The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Research: accounts, teams, enterprise and the platform in three modes, with a 57-package build plan
Claude2507ff67f216
diff --git a/docs/research/README.md b/docs/research/README.mdindex bc7f36e4..6796a5d9 100644--- a/docs/research/README.md+++ b/docs/research/README.md@@ -25,6 +25,7 @@ Everything Fuobe's catalog is built from. JSON files are machine-readable and fe| [`new-models-7.md`](new-models-7.md) / [`.json`](new-models-7.json) | Three new things to place in Fuobe (2026-10-29): **Open-H3-Regenerate-2K** (NVIDIA's refiner LoRA on frozen MiniMax H3: a 384p–768p draft plus a prompt redrawn at 1080p / 2K / 4K in 3 steps; what NVIDIA's merged rank-576 LoRA, Kijai's refiner-only slice and the community repacks contain, incl. the finding that the Sharp curve-branch file is zero in the blocks checked; the rdh9616 and LBH node packs and the graph Fuobe would build; the closed MiniMax regenerate API, Comfy's partner node and fal's 2K / 4K tiers), **WorldCast** (one photo + 1–4 reference views + a camera path → a fly-around on Wan2.1-I2V-14B-720P with a 1B anchor memory; Depth Pro / SAM 3 / VGGT-Omega, not Depth Anything 3; no ComfyUI port; the core Uni3C stand-in, fal's H3 Max camera-controls and the hosted-parts recipe) and **MOSS-Image Layout** (LinXce's box editor, whose node id core ComfyUI already owns; MOSS-Image's layout format with test vectors, the per-model compilers for FLUX.3, Ideogram and Bria, the core-node graph, fal and MOSI routes; `endpointRecords` for `fal-ai/moss-image` and `/lora` in the shape `scripts/gen-cloud-models.py` reads); files with bytes, SHA-256 and pinned revisions, licences as information, hardware, risks, and an 11-package build plan (N7-1 to N7-11) that puts each item into a studio people already use, on both engines where a route exists. Nothing ran on a GPU or a paid API | not yet; see the build plan ([§5](new-models-7.md#5-build-plan)) || [`dbs-separation-7.md`](dbs-separation-7.md) / [`.json`](dbs-separation-7.json) | DBS soundtrack separation (2026-10-29): splitting any soundtrack into dialogue, music and effects with the Dynamic Band Splitting models (DBS-TIGER-DnR, 1.0M parameters, and DBS-BSRNN-DnR, 4.7M; Apache-2.0; 23 MB; CPU or GPU): how they work, quality (SI-SDR on DnR v2) and measured speed, the model files with bytes, SHA-256 and pinned revisions, licences as information; the ComfyUI-DBS pack (MIT, pinned at `f656e53`, two nodes, its only Registry version flagged) node by node, and the three graphs Fuobe would build with core nodes (videos keep a stream-copied picture); running it outside ComfyUI (Python sidecar, ONNX, the browser); hosted routes with prices (no hosted DBS: fal SAM Audio in two passes, Demucs, ElevenLabs isolation, VEED and DeepFilterNet cleaners, Replicate, AudioShake); what Fuobe has today; placements on both engines and a 10-package build plan (D1 to D10). Nothing was installed or run, and no paid API was called | Not yet; see the build plan (§9) || [`work2skill-7.md`](work2skill-7.md) / [`.json`](work2skill-7.json) | Work2Skill (2026-10-29): what the paper, code and dataset actually show against the pitch ("+25 pp" is GPT-5.5's full-credit rate on 64 demonstrated mock-app tasks; +6 to +9 pp on changed versions; the OSWorld subset was chosen after the results; skills are never executed before use), the code's state and licences (MIT, no runners, judge, skills or results released), related work (AWM, ASI) and shipping products, what transfers to Fuobe and what doesn't, the shape-changing pipelines a replay must not freeze, a typed `recipe.json` format inside user skills, and a 7-package build plan (W1 Run a skill with new inputs, W2 Make a skill from what you made, then Assist and MCP, schedules and the CLI, the Canvas, suggestions and upkeep, studio-spanning skills) | not yet; see the build plan |+| [`accounts-8.md`](accounts-8.md) / [`.json`](accounts-8.json) / [`accounts-8-screens.md`](accounts-8-screens.md) | Accounts, teams, enterprise and the platform in three modes (2026-10-29): what Fuobe has today (one install password in `auth.json`, a stateless 30-day cookie, install-wide tokens, 43 tables and 192 routes with no owner, the leaks that follow); Higgsfield's and eight peers' sign-up, teams, enterprise and credits; how Open WebUI, Immich, n8n, Gitea, Jellyfin and Nextcloud do it; libraries (better-auth for authentication only, with versions and OSV re-checked) and the ASVS, NIST and Next 16 rules; the owner's decisions (open sign-up, a library each plus teams, "Just me on this computer" first, both key modes, enterprise); the shared core (identity, sessions, roles, scoping table by table, sharing rules, files, the provider payload guard, settings split, setup wizard and mode switch, tokens and agents, one meter with exact settlement, entitlements, share links, audit, recovery, migration, env vars); Personal, In-house studio (teams, fair GPU queue, approvals, two-step enforcement, verified domains, OIDC and SAML, SCIM, audit, data lifecycle, seats) and Platform (ledger, plans, Stripe, public site, admin panel, trust and safety, legal, scale); every screen as a spec; the threat model; tests; how four reviews changed the plan; 57 packages `acc-1` to `acc-57` in one dependency order | not yet; see the build plan || [`ux-audit-4.md`](ux-audit-4.md) | UX and speed audit of Fuobe at `d781de1` (round 3), measured against Liner's design language and Higgsfield's flows: cold loads, route changes and interactions at 1440 px and 390 px (CPU slowed 4x), JavaScript per route, axe accessibility results, layout shift, what already works, and ranked findings (P0 to P3), each with its route, component, evidence and fix; no code changed | Round 4's onboarding, shell and flow work: Save & test and the Get started card (`src/components/settings-form.tsx`, `src/components/get-started.tsx`, `src/lib/connections.ts`, `tests/connections.test.ts`), the Assist offline planner (`src/server/assist/agent.ts`, `tests/assist-suggestions.test.ts`), Home's Start (`src/components/home-view.tsx`), the skip link, landmarks and ⌘K palette (`src/components/app-sidebar.tsx`, `src/components/command-palette.tsx`) || [`liner-ui.md`](liner-ui.md) | Liner's (liner.com — liner.app itself is a parked domain) design language: tokens, layout, composer, microcopy; the Fuobe theme derived from it | `src/app/globals.css`, `src/components/studio/` |diff --git a/docs/research/accounts-8-screens.md b/docs/research/accounts-8-screens.mdnew file mode 100644index 00000000..a5c43de3--- /dev/null+++ b/docs/research/accounts-8-screens.md@@ -0,0 +1,578 @@+# Fuobe research #8, part 2: every screen as a spec++_As of 2026-10-29. Companion to [`accounts-8.md`](accounts-8.md), whose § numbers this file cites. Each screen gives its route, who sees it, the layout at 1440 px and 390 px, the copy, empty, loading and error states, what each action does, and keyboard and screen-reader behaviour. Light and dark use only the existing tokens. The package that builds each screen is in brackets._++## S0. Conventions (every screen unless its spec says otherwise)++### S0.1 Layout and look++- shadcn/ui with Liner's feel (`liner-ui.md`): `font-heading` H1 (28 px in the auth card, 24 px on pages), 13 px muted lines, `h-7` pill chips, soft shadows, one primary action per screen.+- **Auth card:** a `min-h-svh` grid on `bg-sidebar`; the card is `max-w-sm rounded-2xl border bg-background p-7` (`p-6` under 400 px) with `shadow-soft`; 358 px wide at 390. A 44 px icon tile above the H1.+- **Settings pages:** H1, the sub-nav (S4.0), then `Section` blocks (`settings-form.tsx` L22–48): a 260 px label column on desktop, stacked on phone.+- **Wizard shell** (`/setup/*` after the first screen): `max-w-xl`, "Step N of M" from the step registry, a sticky bottom bar with Back and the primary button (safe-area padding).+- **Status colours** map to existing tokens only: Waiting and Pending → `muted` text with a `StatusDot`; Verified, Active, Paid → `success`; Lapsed, Past due, Blocked → `destructive`; Needs you, Low credits → the `highlight` token. Text on any status chip keeps 4.5:1 contrast in both themes (checked by the axe run in e2e). Charts use the validated data-viz palette with a light and dark pair; QR codes stay dark on white in both themes.++### S0.2 Phone (390 px) and ResponsiveDialog++- 16 px gutters; no sideways page scroll; chip rows and wide tables scroll inside their own container with edge fades (`useEdgeFade`, `library-view.tsx`); tables become card rows; 44 px tap targets.+- **`ResponsiveDialog`** (`src/components/ui/responsive-dialog.tsx`, acc-13): a centred Dialog at 600 px and wider; below 600 px a bottom sheet with `max-h-[85svh]`, `rounded-t-2xl`, a scrolling body, a sticky footer with `pb-[max(16px,env(safe-area-inset-bottom))]`, a visible Close button (aria-label "Close"), and stacked full-width buttons (primary on top). Menus and pickers use the same sheet under 600 px.+- **Destructive confirms** keep Radix `AlertDialog` (`role="alertdialog"`), styled as the same bottom sheet under 600 px; the body states the consequence; the destructive button is last on desktop and first on phone; Esc and Cancel close.++### S0.3 Who sees what (visibility matrix)++| Surface | Just me | Personal with sign-in | Studio member | Studio admin / owner | Studio auditor | Platform customer | Platform staff |+|---|---|---|---|---|---|---|---|+| Settings → General (engine, keys, ComfyUI, LoRAs, demo, StatusStrip) | ✓ | ✓ | — | ✓ | — | — | admin, owner |+| Settings → Models & licences | ✓ | ✓ | read-only card "Your admin manages models, keys and GPUs." | ✓ | — | — | admin, owner |+| Settings → Account | tokens and appearance only | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |+| Settings → Access | ✓ (owner) | ✓ | — | ✓ | — | — | owner |+| Settings → Usage | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ (credits) | ✓ |+| Settings → Plan & billing | — | — | — | — | — | ✓ | — |+| Settings → Data & privacy | — | — | ✓ | ✓ | ✓ | ✓ | ✓ |+| Settings → Backup | ✓ | ✓ | — | owner | — | — | owner |+| Settings → About | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |+| Sidebar footer status block (Cloud models, ComfyUI, Demo) | ✓ | ✓ | — | ✓ | — | — | admin, owner |+| Get started guide on Home | ✓ | ✓ | member welcome (S3.6) | ✓ | member welcome | welcome card (S8.3) | ✓ |+| `/admin` | — | — | — | ✓ | audit, usage, people (read) | — | per staff role |+| ⌘K: Account, Usage, Inbox, Switch workspace, Sign out | partial (no Sign out) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |++Non-admins land on Account when they open `/settings`. A route a person can't see answers 404.++### S0.4 Forms, states and accessibility++- Visible labels; `autocomplete` (`email`, `username webauthn`, `current-password`, `new-password`, `one-time-code`, `name`); `autoFocus` on the first field; Enter submits; show/hide password button with `aria-pressed`.+- Errors are `role="alert"`, linked with `aria-describedby`; focus moves to the first error.+- Loading: skeletons for lists and cards; the primary button shows a spinner and keeps its width.+- Generic copy: "Couldn't load this. Try again." with Retry; "Couldn't save. Try again."; "Can't reach Fuobe. Check your connection and try again."; "Too many tries. Try again in {n} min."+- Toasts are short and past tense ("Invite sent", "Role changed", "Limit updated", "Key added"). Status changes are announced through an `aria-live="polite"` region.+- Tables have captions and `aria-sort`; charts are `role="img"` with a summary and "Show as table".+- Values set by the environment show a lock icon and "Set by the server".++### S0.5 Words++"Personal" (your private space), "Teams" (shared spaces), "space" only as the umbrella word ("Saving to"). Team roles: Owner, Admin, Editor, Viewer. Install roles: Owner, Admin, Member, Auditor; Platform staff: Billing, Moderator, Support. A seat clamp shows as "Editor · view-only seat" with the tooltip "Your account has a view-only seat. Ask for a full seat to make things." Money: "≈ $12.40" for USD estimates, "12 credits" exact, "Up to 18 credits" for open-engine holds.++## S1. Setup [acc-14 unless marked]++### S1.1 `/setup` — the first screen++- **Who:** anyone, on a fresh install only (afterwards `/setup` redirects to `/login` or `/`).+- **Layout:** the auth card, a little wider (`max-w-md`). Fuobe logo tile, H1 "Welcome to Fuobe", line "How do you want to start?". Two stacked option buttons (full width, 72 px, icon left, title and one line):+ - **Just me on this computer** — Laptop icon — "No sign-in. Anyone who can open this address can use Fuobe, so keep it on your own computer or home network."+ - **Create your account** — UserPlus icon — "Sign in with a password from any device. Next, choose whether Fuobe is just for you, for your studio, or a public service."+ - Footer (13 px): "You can change this any time in Settings → Access. Nothing is lost when you do." and (acc-21) "Moving from another computer? Restore a backup".+- **The code.** Arriving through the printed link (`/setup#code=4821-0937`), the code is moved into memory and the fragment removed; nothing is shown. Otherwise, after a choice, an inline region opens under it: label "Setup code", hint "Shown in the terminal where Fuobe is running.", an 8-digit input shown as 4-4 (`one-time-code`, numeric, paste fills it), a "Where do I find it?" collapsible ("In the terminal where you ran pnpm start, in docker logs for a container, or in the file data/setup-code."), and the button (Just me: "Start using Fuobe"; account: "Continue").+- **Actions:** Just me → `POST /api/setup/finish {mode: "personal", signin: "off", code}` → full load of `/` with the toast "Fuobe is ready". Create your account → `POST /api/setup/code` (sets `fuobe_setup`, 2 h, Strict) → `/setup/start`.+- **Errors:** "That code doesn't match. Use the one in the terminal." (role=alert); after 5 misses "Too many tries. Try again in 5 s." (a countdown); 409 "Setup was already finished. Opening Fuobe…" then a full load.+- **Phone:** the same card, option buttons stacked; the code region pushes content down (no modal).+- **Keyboard:** Tab reaches both options; Enter or Space chooses; the code input gets focus when its region opens; Esc collapses it.++### S1.2 `/setup/start` — what will this Fuobe be?++- "Step 1". H1 "What will this Fuobe be?". A radio group of three cards (no buttons inside the cards):+ - **Just me, with sign-in** (Personal): "One person. You set everything up yourself." Bullets: "Your library, your keys, your GPU"; "Passkeys and two-step sign-in"; "Move to a studio or a public service later".+ - **My studio or team** (Studio): "Your company or studio uses Fuobe together." Bullets: "A private library for each person"; "Teams that share their work"; "Limits, company sign-in, audit log".+ - **A public service** (Platform): "Anyone can sign up and use Fuobe with a plan." Bullets: "Open sign-up"; "Plans, credits and payments"; "An admin panel for people, prices and safety". Until acc-57 this card is disabled with "Not ready in this version yet".+- Below the group, an `aria-live="polite"` region with the sticky primary "Continue" → `/setup/account?mode=…`. Arrow keys move between cards (Radix RadioGroup).++### S1.3 `/setup/account` — create the owner account++- H1 "Create your account". Fields: "Your name" (1–80); "Email" (required for Studio and Platform; Personal: "Email (optional)" with "For password reset codes and sign-in alerts, once email is set up. You never type it to sign in."); "Password" (`new-password`, hint "At least 8 characters. Longer is stronger." → at 15+ "Great, that's a strong password.").+- "Create account" → `POST /api/setup/account` (claim-owner intent; `[email protected]` internally when there is no email, never displayed). The email is **not** marked checked: once mail works (S1.8) a 6-digit code is sent and the review step shows "Check your email: we sent a code to {email}" with a code field; until it is checked, owner reset is only through `fuobe recover`.+- Errors: "Use at least 8 characters." / "That password is too common. Try a longer phrase." / "Enter an email like [email protected]." / "Use 128 characters or fewer."++### S1.4 `/setup/address` (Personal)++- H1 "Where will you open Fuobe?". "Site address" prefilled with the current origin. Live checks (`src/lib/site-address.ts`, 300 ms debounce), each a 13 px line with an icon: a path or non-http scheme → error "Use an address like https://fuobe.example.com, with nothing after the name."; plain http to a non-local host → warning "Over plain http, your password can be read on the network. Use https if you open Fuobe from the internet."; `trycloudflare.com` → "Quick tunnel addresses change every time and drop live updates. Use a named tunnel instead."; https or localhost → "Passkeys will work at this address."+- "Finish" → `POST /api/setup/finish {mode: "personal", signin: "on", siteUrl}` → full load with "Fuobe is ready".++### S1.5 `/setup/studio` and `/setup/service`++- **Studio:** "Studio name" (default "Studio"), "Site address" (S1.4 checks), "Time zone" (Intl list, default the browser's; "Monthly spending limits reset on the 1st in this time zone."). A secondary button "Use recommended settings" fills every remaining step and jumps to Review: open sign-up limited to the owner's work domain when mail or Google is set up, otherwise approval; no email; email and password sign-in; two-step required for owner, admins and auditors with 7 days of grace; 30-day sessions; admins create teams, Listed; both key sources at $25 a month; fair GPU share.+- **Platform:** service name; site address (https unless localhost: "A public service needs https."); support email; legal name, address and country; DMCA agent (optional); Terms and Privacy URLs (empty uses Fuobe's templates); minimum age 18 (default) or 16.+- Each Continue saves `PUT /api/setup/draft`.++### S1.6 `/setup/join` — who can join (Studio and Platform)++- H1 "Who can join?". Radio: "Anyone can create an account" ("Open sign-up. Email addresses are checked."; preselected in both modes), "I approve new accounts", "Invite only", "Closed".+- "Only these email domains" chips (Studio: prefilled with the owner's work domain unless it is webmail; empty shows "Anyone who can reach {site} can join and spend up to the monthly limit on the studio's keys."). "People at these domains join without approval" (approval only; disabled without mail or Google: "Needs email or Google sign-in so we can check addresses. Until then, you approve each person."). "Block domains" (collapsible). "Check email addresses with a code" (forced on with open: "Required when anyone can sign up."). Platform: "Block throwaway email addresses" (on) and Turnstile keys with Test (acc-48).+- Without mail and without Google/OIDC, Open is disabled with "Open sign-up needs email or Google sign-in so we can check addresses." and the selection moves to "I approve new accounts" with a `role="status"` line saying so. The server refuses the same.++### S1.7 `/setup/keys` (Studio) and `/setup/allowance` (Platform core)++- **Who pays for runs?** Radio: "Both: people's own keys first, then the studio's within a monthly limit" (default); "The studio's keys, with a monthly limit per person"; "Everyone uses their own keys". "Monthly limit per person" $25 ("Applies to runs paid with the studio's keys."; 0 means no studio-paid runs). Optional studio keys (fal.ai, Replicate, Anthropic) with Save & test.+- **Platform allowance** (until acc-37/acc-40 replace it): "Free monthly allowance per person" $5.++### S1.8 `/setup/email`++- "Don't send email" (default in Studio), with what that means: "Invites are links you copy and send yourself"; "People who forget their password ask you for a reset link"; "Email addresses aren't checked, so open sign-up and domain auto-approve stay off unless Google sign-in is on".+- "Use my SMTP server": host, port (587), security (STARTTLS / SSL/TLS), user, password (encrypted), from name and address. "Send a test email" → "Sent. Check your inbox." or the SMTP error in plain words ("The server refused the password." / "Couldn't reach smtp.example.com on port 587."). A passing test is needed to continue with SMTP.+- Platform with open sign-up disables "Don't send email" ("A public service needs email for codes and receipts.").++### S1.9 `/setup/sign-in` — methods++Rows with switches: "Email and password" (can't be off unless another method is on); "Google" and "GitHub" (client id and secret, plus the read-only callback `<site>/api/identity/callback/<id>` with Copy); "Another provider (OpenID Connect)" (label, issuer, client id and secret, Check → "Found {issuer}. Sign-in will show 'Continue with {label}'." or "We couldn't read {issuer}/.well-known/openid-configuration. Check the issuer URL."; "Add another provider"); Passkeys (acc-19; disabled without https: "Passkeys need an https address."). In Studio, once acc-32 ships, "Another provider" shows "Company identity providers belong in Company sign-in." with a link. Saving bumps the identity config version.++### S1.10 `/setup/teams` and `/setup/invite`++- **Teams:** "Who can create teams": Only admins (Studio default) / Everyone (Platform default). Optional "Create your first team" (name, colour).+- **Invite** (Studio): an emails box that turns addresses into chips (invalid ones red with "Check this address."); role Member or Admin; first team (optional). Primary "Send invites" with mail, or "Create invite links" without: rows of email, link and Copy, "Expires in 72 hours". "Skip".++### S1.11 `/setup/review`++H1 "Ready to go". A description list of every choice with Edit links back to its step. Dependency errors appear in a red box at the top linking to the step to fix ("Open sign-up needs email or Google sign-in. Fix in Who can join."). "Finish setup" → writes the mode and `setup.state=done`, deletes the setup code, audits, full load (Studio: `/admin` Overview; Platform: `/admin` in Preview; Personal: `/`).++### S1.12 `/setup/restore` [acc-21]++"Restore a backup". Four copyable steps: "1 Stop Fuobe." "2 In the Fuobe folder, run: node bin/fuobe.mjs restore <backup file>" "3 Start Fuobe again." "4 Sign in with the account from the backup." Below, a status line polling sign-in options every 5 s: "Waiting for Fuobe to start again…" → "Restored. Opening Fuobe…".++## S2. Sign-in and recovery++### S2.1 `/login` [acc-11; Personal variant acc-1]++- **Studio and Platform:** install chip (name), H1 "Welcome back", "Sign in to {install name}.". Provider buttons first in the admin's order ("Continue with Google", "Continue with GitHub", "Continue with {label}"), the last-used one with a "Last used" pill (`fuobe:last-sign-in-method`); a divider "or"; Email (`username webauthn`), Password, "Forgot password?", primary "Sign in". Footer: open or approval → "New here? Create an account"; invite → "Need access? Ask {contact} for an invite."; closed → nothing. Company sign-in (acc-32) adds "Continue with company sign-in".+- **Personal with sign-in:** lock tile, H1 "Welcome back", "Sign in to {install name}.", one password field, "Sign in", "Forgot password?". With a passkey on this site (acc-19), "Sign in with a passkey" is the primary button and the password a secondary link.+- **Just me:** `/login` redirects to `/`.+- **Actions:** `POST /api/identity/sign-in/email {rememberMe: true}` (Personal: the `/api/auth/login` shim) → full load of `safeNext(next)`; `{twoStep: true}` → the code step (S2.2).+- **Errors:** "That email and password don't match." (Personal: "That password isn't right."); 423 "Too many wrong passwords. Sign in with a passkey, or reset your password." (Personal: "…or run fuobe recover on the computer where Fuobe runs."); unchecked email → `/verify?email=`; "That Google account isn't allowed here."; "Sign-in was cancelled."; registry codes per S2.7; `?reason=idle` → "You were signed out because you were away."; `?reason=expired` → "Your session ended. Sign in again."+- **Forgot password in Personal** (`/login?forgot=1`, in the card): with a checked owner email and mail, "Email me a code" → code, new password, "Set new password" → "Password changed. You've been signed out everywhere." with Sign in. Without: "On the computer where Fuobe runs, open a terminal in the Fuobe folder and run:" with the command box `node bin/fuobe.mjs recover` (Docker installs: `docker exec <container> node bin/fuobe.mjs recover`) and Copy, then "I have a code" → `/recover`.++### S2.2 The two-step step and `/two-step` [acc-19]++- **In the card** after `{twoStep: true}`: ShieldCheck tile, H1 "Enter your code", "Open your authenticator app and type the 6-digit code for {install name}." Code input (6 digits submit automatically). Checkbox "Don't ask again on this device for {n} days" (hidden when the policy is Never). "Verify". Links "Use a backup code instead" (format `xxxxx-xxxxx`) and "Start over".+- **Errors:** "That code isn't right. Check the time on your phone and try again." / "That code was already used. Wait for a new one." / "Too many wrong codes. Try again in 15 min, or use a backup code." / "This sign-in took too long. Enter your password again." After a backup code with 3 or fewer left: toast "{n} backup codes left. Make new ones in Settings → Account."+- **`/two-step?mode=session`:** the same card for a restricted `verify-2fa` session after Google, OIDC or company sign-in; posts to `/api/me/two-step/verify`; footer "Not you? Sign out".++### S2.3 `/register` [acc-11]++- H1 "Create your account", "Join {install name}." Providers ("Sign up with Google"), Name, Email, Password. Platform adds the consent block: an "Agree to all" row that expands to "Terms of Service (required)", "Privacy Policy (required)", "I'm {min age} or older (required)", "Product news by email (optional)", never pre-ticked; consents written through `recordConsent`; Turnstile (acc-48); a plan chip when arriving from `/pricing` ("You picked Pro, yearly. You'll pay after you confirm your email.").+- **Results:** checks on → `/verify`; approval → a card "Thanks, {name}. {contact} will review your request. We'll email you when it's ready." (no mail: "Ask {contact} to approve it."); otherwise a full load with "Welcome to {install name}".+- **States:** closed → "Sign-up is closed. Ask {contact} for an invite."; invite only → "This Fuobe is invite only."; domain refused → "Sign-up here is limited to @studio.com addresses."; throwaway address → "Use a permanent email address."; common password → S1.3 copy; breached password (Platform) → "That password has appeared in a data breach. Choose another one."; an existing email → the same "Check your email" screen as a new one (no enumeration).++### S2.4 `/verify`, `/reset`, `/reset/[token]` [acc-11]++- **`/verify`:** MailCheck tile, H1 "Check your email", "We sent a 6-digit code to {email}." Code input (autosubmit), "Resend in 24 s" (then "Resend code"), "Wrong address? Use a different email" (back to `/register` with fields kept; the unchecked account is discarded). Errors: "That code didn't match. Try again." / "That code expired. Send a new one."+- **`/reset`:** email field, "Send code" → always "If an account uses {email}, we sent a code." → code plus new password → "Password changed. You've been signed out everywhere." with Sign in (no automatic sign-in). Studio or Platform without mail: "Ask {contact} for a reset link." Referrer-Policy no-referrer.+- **`/reset/[token]`** (admin-made link): "Choose a new password" for {email}; expired or used → "This link has expired or was already used. Ask for a new one." Two-step stays on after a reset.++### S2.5 `/invite/[token]` [acc-12]++- Card: inviter avatar, H1 "{inviter} invited you to join", the team or install name and the role line ("You'll join as an Editor: you can create and share in the team.").+- Signed in as the invited email: "Join {team}" (primary) and "Decline". Signed out: "Create account to join" and "I already have an account". Signed in as someone else: "You're signed in as {current}. This invite is for {invited}." with "Switch account".+- States: expired → "This invite expired. Ask {inviter} for a new one."; revoked → "This invite was cancelled."; used → "This invite was already used. Sign in instead."; unknown → "We couldn't find this invite. Check the link."; admin role with an unchecked email → "Check your email first. We sent a code to {email}." Pages are `no-store`.++### S2.6 `/recover` [acc-13; checkboxes acc-19]++- **Step 1:** KeyRound tile, H1 "Recover your account", "Enter the code that fuobe recover printed on the computer where Fuobe runs." Input "Recovery code" `XXXX-XXXX-XXXX` (case-insensitive; O read as 0, I and L as 1). A `#CODE` in the URL fills and submits, and the fragment is cleared.+- **Step 2:** H1 "Choose a new password"; with acc-19, checkboxes "Turn off two-step sign-in (I lost my authenticator)" and "Remove my {n} passkeys"; note "Every device will be signed out."; "Save password".+- **Done:** "Password changed. You've been signed out everywhere." with Sign in; an email and Inbox notice go to the account.+- **Errors:** "That code doesn't match. {n} tries left." / "That code was used up. Run fuobe recover again." / "That code expired. Run fuobe recover again." / "There's no recovery code waiting. Run fuobe recover on the computer where Fuobe runs." / Just me: "Sign-in is off on this Fuobe, so there's nothing to recover."++### S2.7 Copy for every sign-in refusal code++| Code | Copy on `/login` |+|---|---|+| `ACCOUNT_PENDING` | "Your account is waiting for approval. We'll email you when it's ready." (no mail: "Ask {contact} to approve it.") |+| `ACCOUNT_DISABLED` | "This account is turned off. Ask an admin to turn it back on." |+| `ACCOUNT_DORMANT` | "This Fuobe is in personal mode right now, so other accounts can't sign in. Ask {contact} to switch it back." |+| `NETWORK_NOT_ALLOWED` | "You can sign in only from your studio's network. Connect to it or ask an admin." |+| `SEAT_WAIT` | "All seats are taken. An admin has been asked to give you one." |+| `SSO_REQUIRED` | "studio.com uses company sign-in." with "Continue with {provider}" |+| `ACCOUNT_DELETION_PENDING` | sends the person to `/account/restore` (S4.8) |+| `ACCOUNT_SUSPENDED` | "This account is paused while we review it. We'll email you within 48 hours." |+| `ACCOUNT_BANNED` | "This account was closed on {date} for breaking our rules ({policy}). You can appeal until {date}." with "Appeal" (S8.6) |+| `SERVICE_PREVIEW` | "{service} isn't open yet. Join the waitlist." with the waitlist link |+| `PASSWORD_LOCKED` (423) | S2.1 |+| `TWO_STEP_REQUIRED` (tokens) | CLI and API: "Two-step sign-in is required. Set it up in the browser, then create a new token." |++## S3. Shell [acc-13 unless marked]++### S3.1 Account menu and phone sheet++- **Trigger:** the sidebar footer gets a 42 px profile button (24 px avatar, name, chevron) plus a settings icon; icon mode shows the avatar with a tooltip. Just me keeps today's footer. Phone: a 32 px avatar in the PhoneBar opens the same items in the ResponsiveDialog sheet.+- **Menu** (280 px): header with name, email, plan (Platform) and the spend pill ("≈ $12.40 this month" / "≈ $12.40 of $25" / "1,240 credits"; highlight token above 80%). "Workspaces" (S3.3). Then Inbox (count), Approvals (acc-28, approvers), Account, Usage, Plan & billing (Platform), Admin console (admins), Appearance (Light / Dark / System), Sign out.+- **Sign out:** `POST /api/auth/logout`, clear namespaced storage, `location.assign('/login')`.+- **Keyboard:** Radix menu (arrows, Enter, Esc); the trigger has `aria-haspopup="menu"`.++### S3.2 Inbox bell++- A Bell icon button with an unread badge (`aria-label="Inbox, 3 unread"`): desktop in the sidebar header next to Search (icon mode keeps it); phone in the PhoneBar between the wordmark and Search. The avatar also shows a dot when there are unread items.+- **Popover** (360 px; phone: the 85svh sheet): "Inbox" heading with "Mark all read". 56 px rows: icon, title, two-line body, relative time, unread dot. Clicking marks read and navigates. Links are stored as validated relative paths only; bodies render as text. Empty: "You're all caught up." Loading: 3 skeleton rows. Error: S0.4.+- Refetch every 60 s and on focus. Keyboard: arrows move, Enter opens, `m` marks read.+- Approvers see a "Needs you · 2" chip on Home above the composer when requests wait for them.++### S3.3 Workspace switcher++- In the account menu: "Personal" (check mark when active), then the 5 most recently used teams with colour dot and role, "Find a team…" (a cmdk field from 8 teams up), "All teams" → `/teams`, "+ Create team" (when allowed; S5.1). After a Studio → Personal switch the owner sees "Spaces" instead of "Teams".+- Switching sets the tab's space and `fuobe:u:<id>:space`, invalidates workspace-scoped queries and shows "Now in Brand team". ⌘K "Switch workspace…" lists the same.++### S3.4 Banners++All banners sit above the page content, one line plus up to two actions, `role="status"` (alerts use `role="alert"`), dismissible where stated.++| Banner | Copy | Actions |+|---|---|---|+| New sign-in (acc-20) | "New sign-in: Safari on iPhone, 12 min ago. Was this you?" | Yes · Review devices |+| Just me from another device (acc-18) | "You're using Fuobe from another device without sign-in. Anyone who can open {host} can use it and your keys." | Turn on sign-in · Dismiss (7 days) |+| Two-step grace (acc-30) | "Your studio requires two-step sign-in from {date}. Set it up now. It takes a minute." | Set up |+| View-as (acc-35, acc-42) | "Viewing Lee's library as an admin · read-only · logged · ends in 29 min" | Stop |+| Idle warning (acc-30, AlertDialog) | "You'll be signed out in 2 min because you've been away." | Stay signed in |+| Platform Preview (acc-47) | "Preview · only staff and testers can sign in." | Open to the public (owner) |+| Past due (acc-45) | "Your last payment didn't go through. Paid runs continue until {date}." | Update payment |+| Frozen (acc-45) | "Paid runs are paused while a payment is reviewed." | — |+| Development Platform | "Development build: the public service isn't finished. Don't open it to the public." | — |++### S3.5 Confirm it's you++ResponsiveDialog: H1 "Confirm it's you", "For your safety, confirm before changing sign-in settings." Password field with "Confirm" (writes a 10-minute step-up); with a passkey, "Use a passkey" is primary; provider-only people get "Continue with {provider}" (the pending action is restored after the redirect with the toast "Confirmed. Finish {action}."). Errors: "That password isn't right." / "Passkey check was cancelled." The original action continues after success.++### S3.6 Member welcome card (Home)++- **Who:** Studio members and auditors who haven't dismissed it (`guide.dismissed`); replaces the Get started guide.+- Card: H2 "Welcome to {studio}, {name}". Lines: "Things you make are private to you unless you share them or make them in a team."; the money line by mode ("Your limit: ≈ $25 a month on the studio's keys." / "Runs on paid models use your own key here." / "Your own keys pay first; then the studio's, up to $25 a month."); "You're in Brand team (Editor)." when in a team.+- Chips: "Add your key to start" (first when keys.mode is own and no key), "Make an image", "Make a video", "Open Brand team". "Hide" → `guide.dismissed`.++## S4. Settings++### S4.0 The settings sub-nav [acc-15]++A chip row under the H1 from a registry filtered by S0.3: General, Account, Access, Usage, Plan & billing, Data & privacy, Backup, Models & licences, About. The current chip has `aria-current="page"`. The row is not sticky; it scrolls inside its own container on phone. The connection `StatusStrip` shows only on General, and only for admins. `/settings#security` stays as a summary card linking to Account and Access.++### S4.1 `/settings/account` [acc-13; tokens and keys acc-8/13]++Sections in the Section layout:++1. **Profile:** avatar (upload, max 2 MB, cropped square; removing shows initials), name (saved on blur; toast "Saved"). Email row: "No email" / "{email} · Not checked yet" / "{email} · Checked", with Add or Change (step-up; a code to the new address). Members without mail: "Ask an admin to change your email." SSO or SCIM managed: "Managed by your company".+2. **Sign-in:** "Change password" dialog (current, new, "Sign out other devices" ticked by default); `FUOBE_PASSWORD` shows "Set by the server (FUOBE_PASSWORD)". Connected sign-ins (Google, GitHub, OIDC, company) with Connect and Disconnect; the last method can't be removed ("Add another way to sign in first."). "Connect company sign-in" for people at a bound domain (acc-32).+3. **Passkeys and Two-step** (S4.2).+4. **Devices** (`GET /api/me/sessions`, no tokens): rows "{Browser} on {OS}", "This device" badge, "Signed in {rel} · Active {rel}", IP when behind a trusted proxy, "Sign out". Footer "Sign out other devices" → "Signed out of {n} devices". Switch "Email me when a new device signs in" (acc-20).+5. **API tokens:** "Create token" dialog: Name ("Laptop CLI"), Access (Full / Generate only / Read only; Admin for admins), Expires (30 days / 90 days / 1 year (default) / Never), "Only in this workspace" (optional pin). Shown once in a copy box with "You won't see this token again." and the MCP snippet (`claude mcp add --transport http fuobe <origin>/api/mcp --header "Authorization: Bearer …"`). Rows: name, prefix, access, workspace, "Last used {rel}", expiry; expired rows read "Expired on Oct 1" with "Create a new one". Empty: "No tokens yet. Create one for scripts, or run fuobe login to connect the command line."+6. **Your keys** (own or both): fal.ai, Replicate, Anthropic, each with Save & test (`POST /api/me/keys/test`) and Remove; line "Runs use your key first and are billed to your account at the provider." Errors: "fal.ai didn't accept this key."+7. **Notifications:** "Email me about requests and alerts" (needs a checked email and mail).+8. **Appearance:** Light / Dark / System.++**Just me variant:** a card "Sign-in is off, so there's no password, passkey or device list. Turn on sign-in to use Fuobe safely from other devices." with "Turn on sign-in" (→ Access); then API tokens (created by the local actor) and Appearance.++### S4.2 Passkeys and Two-step [acc-19]++- **Passkeys.** Unavailable states: "Passkeys need a secure address. Set an https site address in Settings → Access." / "Passkeys work at {site}. You're on {current}." / "This browser can't make passkeys." Rows: name (inline rename), "Added {date}", authenticator name, "Synced" badge, Remove (AlertDialog "Remove this passkey? You can't use it to sign in any more."). "Add a passkey" (step-up; default name "{Browser} on {OS}"; at most 10). Errors: "Passkey wasn't added." / "This device already has a passkey for {host}." / "You have 10 passkeys. Remove one to add another." Empty: "No passkeys yet. Add one to sign in with your fingerprint, face or device PIN."+- **Two-step.** Off: "Two-step sign-in asks for a code from your phone after your password." and "Turn on". On: "On since {date} · {n} of 10 backup codes left" with "Make new backup codes" and "Turn off" (both step-up).+- **Setup dialog** (ResponsiveDialog, 3 steps): 1 confirm password; 2 a 200 px QR code (`uqr`, dark on white), "Can't scan it? Enter this key:" with the secret grouped in fours and Copy, then a 6-digit code to verify; 3 ten backup codes with "Copy all" and "Download .txt", and the required checkbox "I saved these codes" that enables Done (Esc disabled on step 3). Closing during step 2 discards the half-made factor. Toast "Two-step sign-in is on".++### S4.3 `/settings/usage` [acc-8; Personal labels acc-23; Platform acc-38]++- H1 "Usage", a month picker (last 12 months), "Download CSV".+- Big number: Personal "Spent this month ≈ $12.40" with "Resets on Nov 1 ({zone})."; Studio "≈ $12.40 of $25 this month" with a Progress bar; Platform: credits used, left and refunded cards. A second card shows own-key spend ("Your own keys ≈ $3.10").+- Table (cards on phone): date, what (feature and model), workspace, paid by ("Studio key" / "Your key" / "Team key" / "Studio GPU" / "Demo"; Personal: "fal.ai key", "Replicate key", "Anthropic key", "Your GPU"), cost ("≈ $0.42", "price unknown", "free"; Platform "−12", "Refunded +12"). Infinite scroll; skeleton rows while loading.+- Personal cap row: "Stop paid runs when this month passes [$ ]" (0 blocks paid runs).+- Studio: "Ask for more" (ResponsiveDialog: $10 / $25 / $50 / Custom and a note) → "Asked for $25 more · waiting".+- Empty: Personal "No paid runs this month. Runs on your own GPU are free."; Studio "No paid runs this month. Runs on the studio's GPU don't count toward your limit."+- Footer (USD modes): "Amounts are estimates from each model's list price, not your provider's bill."++### S4.4 `/settings/access` [acc-15; Personal sections acc-18]++1. **Mode** card: "Running as: Just me on this computer" (or Personal with sign-in, Studio, Platform) with "Change mode" (owner). Dialog: three radio cards; below, the consequences in plain words ("8 people will be signed out and can't sign in until you switch back. Their libraries and teams are kept. A backup is saved first."), a checklist from the mode packages (email checked, a non-loopback site address, sign-in on, subscriptions ended) with each unmet row linking to its fix, and "Switch". Studio and Platform targets continue in `/setup/<step>?switch=<mode>`. Toast "Now running as a studio".+2. **Require sign-in** (Personal): switch. On → a dialog for name, optional email, password and site address (`POST /api/access/sign-in`). Off → AlertDialog "Turn off sign-in? Anyone who can open this address will have full access to Fuobe and your keys. Your passkeys and devices are kept for when you turn it back on."+3. **Who can join**, **Sign-in methods**, **Email** (with "Recent problems": the last 5 delivery errors), **Site address and time zone**, **Contact on sign-in pages** (default "the {install name} admin"), **Share links** ("Anyone with the link" / "Only people signed in here" (not in Personal) / "Nobody").+4. **Personal additions (acc-18):** Site address check lines (S1.4 plus "You're using this address right now." and "This address is this computer only. Other devices can't open it."; changing the host warns "Your {n} passkeys were made for {old} and won't work at {new}."); **Other addresses** (chips; env entries locked; refusals "Use a full name like studio.lan, not a pattern." for `*`, wildcards and ranges, and "Quick tunnel addresses can't be added. They're public and change every time."; a public name asks "Anyone who can open {name} will have full access. Turn on sign-in instead?"); **Behind a proxy** (switch, hop count or CIDRs, "Fuobe sees you as 203.0.113.7"); **Remote guide** cards: Same Wi-Fi (LAN addresses with a QR code), Tailscale (Recommended; `tailscale serve --bg 3000`), Cloudflare Tunnel and Caddy (shown only with sign-in on), "Keep the plain port private" (`pnpm start -H 127.0.0.1`).++Non-admins get 404.++### S4.5 `/settings/backup` [acc-21]++H1 "Backup & move", "Backups are saved in {dir} on this computer." 1 "Back up now" (after 10 s "Still working… large libraries take a little longer."; toast "Backup saved"). 2 Automatic: Off / Daily / Weekly, keep 1–30 ("Automatic copies are the database and its key, not your files."), last error shown. 3 List: date, kind chip (Manual, Automatic, Before mode change, Before accounts update), size, key icon, ⋯ Download (a single-use 60 s link) / Delete. Empty: "No backups yet." 4 "Download a full backup": checkboxes for files, trained LoRAs, datasets with sizes; the warning "This file holds your API keys and everything you made. Keep it somewhere safe."; step-up; in Studio and Platform a required reason ("Why are you downloading everything?") and the note "Admins are told." 5 Moving steps. 6 The restore command.++### S4.6 `/settings/account/connect-cli` [acc-22]++Auth card "Connect the command line": "A fuobe login on {client} wants a token for this Fuobe." The code in large mono with "Check that your terminal shows the same code." Request details: "From 203.0.113.7 · fuobe-cli 0.9 on macOS · 2 min ago". Fields: Name ("fuobe CLI on {host}"), Access (default Generate only), Expires (default 1 year). Warning "Only approve if you just ran fuobe login yourself." Buttons "Connect" (step-up) and "Don't connect". States: "Connected. You can close this tab and go back to the terminal." / "This code isn't valid. Run fuobe login again." / "This request expired. Run fuobe login again." Terminal side: `fuobe login` prints the code and URL, polls every 2 s, then "Connected as {name}"; `fuobe status` prints "Fuobe at {url} · Just me on this computer (no sign-in)" or "Signed in as {name} · {workspace}".++### S4.7 Composer refusal lines and the payer hint [acc-8]++One 13 px line under the prompt with AlertCircle; Generate is disabled with `aria-describedby` pointing at it; open-engine models stay runnable. A pre-check from `/api/me/usage` shows the line before submit.++| Case | Line | Action |+|---|---|---|+| Member limit | "You've reached this month's limit (≈ $25)." | Ask for more · (both mode) Use my own key |+| Team limit | "Brand team reached its limit for this month." | Ask a team admin |+| Personal cap | "You reached your $50 limit for this month." | Change limit |+| Own keys required, none set | "Runs on paid models use your own key here. Add your fal.ai key to start." | Add key (inline dialog: field, Save & test, "Your key is encrypted and only used for your runs.") |+| Unknown price | "This model has no listed price, so it can't run on the studio's keys. Ask an admin." | — |+| View-only seat | "Your account is view-only. Ask for a full seat." | Ask for a seat |+| Viewer in a team | "You can view Brand team but not make things in it." | Switch to Personal |+| Cross-space input (409) | "These come from your personal library. Using them copies them into Brand team." | Use them · Cancel |+| Platform credits | S8.4 | |++The payer hint sits next to the price on the Generate button tooltip: "Your key", "Studio key · ≈ $0.42", "Team key", "No key yet"; with a team active, "Saves to Brand team".++### S4.8 `/settings/privacy` and `/account/restore` [acc-35; Platform defaults acc-53]++- H1 "Data & privacy".+- **Download my data:** checkbox "Include trained LoRA files"; "Prepare download" → a progress row "Preparing · 34%" → "Ready · 2 parts · 3.1 GB · until Nov 5" with Download per part. Errors: "Couldn't prepare your export. Try again." / "This download expired. Prepare a new one." Platform: one export a day ("You can prepare another export tomorrow.").+- **Delete my account:** Studio with self-delete off: "To delete your account, ask an admin. Your personal library will be deleted 30 days after they do." with "Ask an admin" (an Inbox request). Owners and last team owners: "Transfer ownership of Brand team first." with a link. Where allowed: step-up, then AlertDialog "Delete your account?" listing "Your personal library ({n} results, {size}) is deleted after 30 days"; "Things you made in teams stay with the teams"; Platform "Your {plan} plan ends now and isn't refunded" (or the operator's rule) and "Your {n} credits are lost"; "Sign back in before {date} to cancel". An optional reason select, a field "Type Delete to confirm", the destructive button "Delete account". Then sign-out with the toast "Your account will be deleted on {date}." During the grace the email can't register again ("This email belongs to an account being deleted. Sign in to restore it.").+- **Platform additions (acc-51):** Notices (date, a blurred thumbnail, decision, rule, "Appeal" for 6 months) and support access requests ("Support wants to view your account for 30 minutes to help with: {reason}." Allow / Decline).+- **`/account/restore`:** "Your account is set to be deleted on Dec 1." with "Restore my account" (self-deleted accounts only) and "Sign out".++### S4.9 Generation and chain card states [acc-9; queue acc-26; safety acc-50]++| State | Card copy | Actions |+|---|---|---|+| Queued | "Queued" | Cancel |+| Waiting for a GPU (acc-26) | "Waiting for a GPU · 3 ahead" (or "· it isn't answering") | Run on cloud instead (confirm "≈ $0.42 · Studio key") · Cancel |+| Waiting for approval (acc-28) | "Waiting for approval" | Withdraw |+| Running | progress | "Stop · it has started, so ≈ $0.42 is still charged" (Platform: "≈ 12 credits") |+| Canceling | "Stopping…" | — |+| Saving results | "Saving results" | Cancel answers "Already finishing. This run will be charged." |+| Stopped (chain) | "Stopped at step 3 of 5 · needs 40 more credits (you have 12)" / "· you reached this month's limit" | Add credits or Ask for more · Continue (re-runs only the stopped steps) · Cancel the rest |+| Held for review (acc-50) | blurred placeholder, "Being checked · usually a few minutes" | — |+| Blocked (acc-50) | "This result was blocked by the safety check. 12 credits refunded." | Appeal |+| Paused owner | "Paused: the account that started this is off." | — |+| Failed | the provider's message in plain words | Retry |++Stopped steps keep 7 days, then cancel and release ("Stopped steps were cancelled after 7 days. Nothing was charged for them."). Assist shows "I stopped before step 3: not enough credits." with the same buttons; scheduled tasks pause with an Inbox notice "Your task "{name}" paused: not enough credits."++## S5. Teams and sharing [acc-17 unless marked]++### S5.1 Create team++ResponsiveDialog "Create a team": Name (1–40; placeholder "Brand team"), Colour (8 dots, radio group), Visibility (Studio: Private / Listed / Open with one-line help, default Listed; Platform: Private only), "Invite people" (optional emails). Primary "Create team". Error "A team with this name already exists." Result: `/teams/[slug]` with the toast "Brand team created". Platform without a Team plan: the line "Runs in this team are paid from each person's own credits. Get the Team plan to share credits." with "See Team plan".++### S5.2 `/teams/[slug]/settings`++Tabs (a Select under 600 px): Members / Keys & limits / Policies (acc-25) / Activity (acc-34) / General.++- **Members:** search; rows (avatar, name, email, role select, source badge, this month's spend); role help "Owner: everything, including deleting the team" / "Admin: manages people, keys and limits" / "Editor: creates and shares in the team" / "Viewer: sees and downloads, uses no budget". "Invite" (Studio: a picker of people plus emails; Platform: emails; with a seat-billed plan: "Adding Lee adds a seat: $25 a month. You pay $13.40 today (prorated)." with "Add and pay"); "Copy invite link (expires in 72 hours)"; pending invites with Resend and Revoke; resend guard "You sent an invite in the last 5 minutes. Try again soon." SCIM members locked ("Your directory manages this."). Remove: AlertDialog "Remove {name} from Brand team? What they made stays with the team. Their queued runs here are cancelled." Waiting to join (acc-24): "Add as Editor ▾" and Decline. Empty (only you): "It's just you so far. Invite people to share work here."+- **Keys & limits:** team keys ("Team runs use these keys before the studio's."), team monthly limit, per-member limit, approvals threshold (acc-28), spend by member.+- **General:** name and colour, description, visibility, "New people join as", who edits brand kits, public links, "Members may copy team content to their personal library" (off by default in Studio), Export team (acc-35), Leave, Delete.++### S5.3 Leave, transfer and delete++- **Leave:** AlertDialog "Leave Brand team? Your work stays with the team. Your scheduled tasks here pause." The last owner sees "Transfer ownership first." with a link.+- **Transfer ownership:** "Make {name} the owner of Brand team? You'll become an admin. Only the owner can delete the team." (install level: "Make {name} the owner of {install}? You'll become an admin. Only the owner can change the mode, roles and billing.") Step-up.+- **Delete:** AlertDialog with a choice: "Move everything to another team" (picker of teams where you are admin) or "Archive for 30 days, then delete"; the note "Characters made from people's faces and cloned voices go back to the people who made them."; "Type Brand team to confirm". Every member gets "Brand team was deleted by {name}. {What happened to the work}."++### S5.4 The Saving-to chip++- An `h-7` chip left of the model picker: "Personal ▾" or "● Brand team ▾" (team colour dot). The menu lists spaces where the person is Editor or more; Viewer spaces are disabled with "View only". Inside a project the chip is read-only: "In Brand team". Shown whenever the person has any team; hidden otherwise.+- **Phone:** its own 32 px row above the prompt, left aligned, team names truncated at 14 characters; the existing chip row is unchanged.+- New tabs start in the last-used space; links with `?space=` set it.++### S5.5 Share, Move, Duplicate and the cross-space confirm++- **Share** (the existing Share dialog gains a "People and teams" section above the public link): a field "Add people or teams" (Studio: picker limited to people who share a team with you; Platform: exact email with the uniform answer "If {email} has an account, they can see it now. Otherwise, they'll see it after they sign up with this email."), level Can view / Can edit (capped at your own), the list of grants with Remove. Viewers see "You can't share this." Public link rows follow the space's policy ("Public links are off in Brand team.").+- **Move:** "Move 3 results to Brand team? Your teammates in Brand team will see and use them. They'll leave your personal library." Face elements: "This character is made from a real person's face. Confirm you have their permission to share it with Brand team." → toast "Moved to Brand team" with Undo (8 s). Moving out of a team without team-admin rights: "Ask a team admin to move this out, or duplicate it if the team allows."+- **Duplicate:** "A copy goes to Brand team. Your original stays here."+- **Cross-space confirm (409):** "These come from your personal library: {names}. Using them copies them into Brand team." with "Use them" and "Cancel".++### S5.6 Library spaces++- **Top row:** a space control styled as a chip Select: "Personal ▾ / Brand team ▾ / Shared with me / All my spaces"; defaults to the active space and follows the Saving-to choice. Hidden for people with no team and no grants.+- **Second row:** the existing kind tabs (All, Images, Videos, Audio, Text, 3D, Favorites, Uploads, Links, Trash): "Shared" is renamed **Links**. Favorites are the viewer's own across the selected space; Trash shows the selected space's trash (team trash visible to members, restorable by the creator or a team admin); Uploads are filtered by space. Filters gain "Made by me".+- Team items show the creator's avatar (16 px) on the tile.+- **Empty states:** Brand team: "Nothing here yet. Make something with Saving to: Brand team, or move results here."; Shared with me: "Nothing shared with you yet. When someone shares a result, folder or project with you, it shows up here."; All my spaces: today's empty state.+- **Phone:** the space chip and the scrollable tab strip fit one 390 px row each with edge fades.++## S6. Admin core [acc-16]++### S6.1 Shell and nav++`/admin` layout with a 220 px nav from a registry, grouped: Overview; People (People, Teams, Seats, Bans); Money (Usage & limits, Approvals, Plans, Credit prices, Codes, Payments); Content (Moderation, Models & features, Announcements); Compute (GPU); Sign-in & security (Access, Security, Company sign-in, Provisioning, Domains); Records (Audit log, Data & retention); System (Settings, Health). Items appear only when their package and the person's permission exist. Under 768 px the nav is a Select at the top. Others get 404. ⌘K adds the admin pages the person can open.++### S6.2 Overview++A checklist card from a registry (Studio "Finish setting up": Connect your GPU, Add the studio's keys, Verify your email domain, Set up company sign-in, Turn on two-step for yourself, Invite your people, Create a team — "3 of 7 done", "Hide this list"; Platform: the launch checklist, S9.1). Stat tiles (People, Spend this month, GPU busy, Security: two-step coverage). "Needs you": waiting sign-ups, join requests, limit and seat requests, approvals, lapsed domains, SSO or SCIM errors, mail failures; each row links to its page. Empty: "Nothing needs you right now." Loading: tile skeletons.++### S6.3 People and the person page++- **`/admin/people`:** tabs Active / Waiting for approval / Invited / Turned off; search (name or email); "Invite people"; "Download CSV". Columns: person (avatar, name, email), role, teams, this month ("≈ $12.40 of $25" and "own keys ≈ $3.10"), last active. Phone: card rows with a ⋯ menu. Empty states: Waiting "No one is waiting. New sign-ups appear here when approval is on."; Invited "No open invites."; Turned off "No one is turned off."+- **`/admin/people/[id]`:** header with avatar, name, email, role chip, seat chip, two-step chip, SSO and provisioned chips; tabs Overview, Usage, Devices, Tokens (Activity from acc-34; Credits, Billing and Safety in Platform). Actions (⋯, each following the target-role matrix in `accounts-8.md` §7.3): Set monthly limit; Send a reset email (or "Create reset link" without mail: "Works once, for 60 minutes. Their other devices will be signed out. Two-step stays on."); Sign out everywhere; Reset two-step (owner); Turn off ("Turn off {name}? They're signed out, their tokens stop working and their scheduled tasks pause. Their work is kept." with a picker for a new owner of teams they solely own); Change role (owner); Transfer ownership (owner); Delete account (acc-35); Open library… (acc-35). Tokens tab: name, access, last used, Revoke. Every action ends with a toast and the person gets a notice.++### S6.4 Teams++`/admin/teams`: columns name (dot), visibility, members, owner, this month's spend, created; search; "Create team"; ⋯ Open, Settings, Reassign owner, Archive. Studio "Team rules" card (acc-24): who creates teams, default visibility, who adds team keys. Empty: "No teams yet. Create one to share work."++### S6.5 Usage & limits (and Studio reports, acc-29)++Totals by payer (studio keys, own keys, team keys, GPU hours); the default monthly limit; "Allow runs with an unknown price on the studio's keys" (off); the limit-request queue (rows "Dana asks for $25 more · 'Client deadline'" with Approve $25 / Approve custom / Decline; toast "Approved $25 for Dana"). With acc-29: a period select (up to 13 months), tabs Overview / People / Teams / Models / GPU / Requests, an SVG day chart with "Show as table", "Alerts" dialog (50/80/100%, monthly report), ⋯ "Pause paid runs" per person. CSV with a byte-order mark; cells starting with `=`, `+`, `-` or `@` are prefixed with `'`. Empty: "No spending yet this month."++## S7. In-house studio++### S7.1 `/teams` — directory [acc-24]++H1 "Teams" with "Create team" (if allowed) and a search field. "Your teams": cards (colour dot, name, role chip, up to 5 avatars, "3 new this week"), ⋯ Work here / Settings / Leave. "Other teams": Listed and Open teams with "Join" (Open) or "Ask to join" (Listed; optional note; toast "Request sent"); a pending request shows "Asked · waiting" with Withdraw. Private teams never appear to non-members. Empty: "You're not in a team yet." (and, for people who may create teams, "Create one to share work with others."). Phone: one column of cards.++### S7.2 `/teams/[slug]` — team home [acc-24]++Header: colour dot, name, description, member avatars, role chip, primary "Work in Brand team" (sets the space and opens Home) or, for Viewers, "Browse". Sections (each with "See all"): This month (spend, runs), Recent (12 tiles), Folders, Projects (chip filter: Cinema, Canvas, Shorts, Swap, Faceless), Characters & styles, Brand kits & products, Presets, palettes & skills. A new team shows one card: "Brand team is ready. Make something with Saving to: Brand team, move results here, or invite people." with "Start making" and "Invite people". Non-members of Listed or Open teams see a preview (name, description, member count, "Ask to join" or "Join"); Private teams answer 404. Removed meanwhile: "You're no longer in Brand team." with "Go to Personal".++### S7.3 `/approvals` [acc-28]++- **Requester:** toast "Sent to Brand team admins for approval · ≈ $14.20" with "Add a note" and "View"; the card state S4.9; outcomes in the Inbox: "Approved by Sam. The runs are starting." / "Declined by Sam: {note}" / "The approval request expired."+- **Approver page:** H1 "Approvals", tabs Waiting (n) / Decided. Admins also see the "Personal spaces" card ("Runs over $[ ] on the studio's keys need an admin's OK"). Request cards: requester, space chip, "Video · Kling 3.0 · 4 runs", "≈ $14.20 (over the $10 limit per run)", payer, note; team requests show the prompt and inputs; personal ones show "Private run: details stay with Dana."; Decline (reason) and Approve. Bulk bar on selection. Toasts "Approved. The runs are starting." / "Sam already decided this." Empty: "No runs are waiting for approval." Decided tab empty: "Nothing decided yet."++### S7.4 `/admin/security` and `/two-step/setup` [acc-30]++- **`/admin/security`:** sections saving after step-up: Two-step ("Require two-step sign-in for": Off / Owner, admins and auditors / Everyone; grace Right away / 3 / 7 / 14 days; "Remember this device" Never / 7 / 30 days; coverage "38 of 42 people have two-step"); Sessions (length 8 hours / 1 day / 7 days / 30 days; "Sign out after inactivity" Never / 30 min / 1 hour / 8 hours / 24 hours; "Devices per person" no limit / 1–10); Allowed networks (CIDR list; needs a trusted proxy; "Your address 203.0.113.7 isn't in this list. Add it first."); API tokens ("Longest token lifetime"); "Sign out everyone" (AlertDialog "Everyone, including you, signs in again."); "Revoke everything" (owner; AlertDialog "Everyone, including you, signs in again. Scripts and the command line need new tokens. Remembered devices are forgotten.").+- **`/two-step/setup`:** the auth card for a restricted `enroll-2fa` session: H1 "Set up two-step sign-in", "Your studio requires it from Nov 5."; "Add a passkey" (primary when available), "Use an authenticator app" (the S4.2 dialog steps inline), "Sign out".++### S7.5 Company sign-in [acc-32]++- **`/login`:** "Continue with company sign-in" → `/login/sso`: "Work email" → redirect to the bound connection. No connection: "No company sign-in is set up for @gmail.com." Enforced domains switch the card to "Continue with Okta" with "studio.com uses company sign-in." After return: toast "Signed in as [email protected]". Errors: not provisioned "Your company account isn't set up here yet. Ask your admin."; `account_exists` "Sign in with your password, then connect company sign-in in Settings → Account."; generic "Company sign-in didn't work. Try again or ask your admin." (details in the audit log).+- **`/admin/sso`:** list (provider, domains, status chip Draft / Tested / Required / Error, last sign-in), "Add connection" (owner), the break-glass card (owner plus up to 2 admins who may still use passwords). Empty: "No company sign-in yet. Connect Okta, Entra ID, Google Workspace or any OIDC or SAML provider." with "Add connection".+- **Editor** (`/admin/sso/[id]`, owner; step-up): 1 Provider preset (Okta, Entra ID, Google Workspace, Keycloak, Authentik, Other OIDC, Other SAML). 2 Values to copy: Redirect URI `<site>/api/identity/sso/callback/<id>`; ACS `<site>/api/identity/sso/saml2/sp/acs/<id>`; Entity ID; SP metadata link. 3 OIDC: issuer, client id, secret, Check; SAML: metadata URL or XML or manual certificate and SSO URL; "Allow a private-network address" (owner). 4 Bound domains (only verified domains not bound elsewhere). 5 Accounts: create accounts on first sign-in (on), default team and role, "Trust this provider's two-step" (on), groups to teams. 6 "Require company sign-in for these domains" (needs a test passed in the last 24 hours). "Test sign-in" → "It works. Fuobe received [email protected] · Dana Ruiz · groups: Design. No account was created." or the plain error ("The response wasn't signed." / "The audience didn't match {entity}." / "The clock on the identity provider is more than 2 minutes off.").+- **`/setup/sso`:** the same editor as an optional wizard step ("Skip for now").++### S7.6 Provisioning, domains and seats++- **`/admin/provisioning`** [acc-33]: Base URL `<site>/api/scim/v2` with Copy; tokens (at most 3; "New token" shows it once; rows with prefix, created, last used, Revoke); Groups → team and role table; "When your directory removes someone": Turn off (default) / Delete after 30 days; safety-brake status ("Paused: the last sync would turn off 14 people. Check your directory, then resume." with "Resume provisioning", owner); Recent activity (time, action, person, result). Empty: "Not connected yet. Paste the base URL and a token into your identity provider."+- **`/admin/domains`** [acc-31]: "Add domain" → a card with the TXT record `_fuobe-challenge.studio.com` and value `fuobe-domain-verification=<token>` (both with Copy) and "Check now" ("We couldn't find the record yet. Checked at 10:42. DNS changes can take up to an hour."). Status chips Waiting / Verified / Lapsed. Owner: "Mark as verified without DNS" with a reason. Per domain: "People with a checked address here can sign up without an invite" and "Bound to company sign-in: Okta". Empty: "No domains yet. Verify studio.com so colleagues can join without approval."+- **`/admin/seats`** [acc-36]: "18 of 25 full seats used" with a bar; "4 view-only accounts (free)"; seat limit and "When seats run out: make new people view-only" (owner); requests ("Lee asks for a full seat" with "Give full seat"); chips for people inactive 30 days; bulk "Make view-only". Empty requests: "No seat requests."++### S7.7 Audit and data++- **`/admin/audit`** [acc-34]: search; chips Who / What / When / Address; rows with time, who, a plain sentence ("Dana changed Lee's role to Admin"), where (admins only); a details sheet (all fields, previous and new values, request id); the chain banner "Records verified up to {time}" or, in red, "The record changed after {time}. Download the export and contact support."; Export CSV or JSONL; Keep for 90 days / 1 / 2 / 7 years; "Send to a log endpoint" (HTTPS URL and secret, Test). Empty: "No activity matches these filters." with "Clear filters".+- **`/admin/data`** [acc-35]: Legal hold (switch with reason; banner "Legal hold is on since Oct 29. Nothing can be deleted."); Delete old results (per install or team: "Delete results older than [90] days", "Preview" → "The next run would move 1,284 results (38 GB) to Trash. The first run is on Nov 5; people get a notice today."); Accounts being deleted (rows with "Deleting on Nov 28" and Restore); Exports (rows, status); "Let admins open anyone's personal library" (owner; off; "Each time needs a reason, the person is told, and it's logged."); "People may delete their own account" (off); link to Backup.+- **Team Activity** (team settings): the same rows without addresses.++### S7.8 `/admin/gpu` [acc-26, acc-27]++Admins edit; auditors read; refresh every 5 s.++1. **Servers:** rows with name, pool, status ("Online · RTX 6000 · 48 GB" / "Not answering since 10:42"), host only, running and "In ComfyUI: 2 of 2", "Take new work" switch, a warning chip "Open to the network" when `/system_stats` answers without a token ("Anyone who can reach this server can see every run. Add a token or keep it on a private network."). "Add GPU server" (ResponsiveDialog): label, address, token, pool, "Only for these teams", LoRA folder, input and output folders (optional; lets Fuobe delete run files), Test ("Connected · RTX 6000 · 48 GB · 412 node types"). Remove: AlertDialog "Runs on it fail with a message and can be run again." Empty: "Using {comfyui.url} from Settings. Add servers here to share work across GPUs."+2. **Waiting:** grouped by team (Platform: by pool and plan); rows with person, model, waiting time; ⋯ Move to front / Cancel run. Empty: "Nothing is waiting for the GPU."+3. **Shares:** team weight Low / Normal / High / Highest with GPU hours this week (Platform shows plan weights and the Free pool cap read-only).+4. **How the GPU is shared:** Fair share / First come, first served; "Waiting runs per person" 50; "Runs per server at once" 2 (1–4); "Longest wait before a run fails" 240 min.++## S8. Platform for customers++### S8.1 `/welcome` (`/` signed out) and `/pricing` [acc-47]++- **`/welcome`:** header (logo, Pricing, Sign in, "Start free"). Hero H1 "Make images and video with the best AI models." line "Start free. Pay with credits for what you make." A composer preview: typing and pressing Generate stores the prompt (sessionStorage) and opens `/register`; after sign-up the prompt is waiting in the composer. Showcase: 12 tiles chosen by staff in Settings → Service ("Pick from published share links"; empty hides the section). Features (4 cards), Free models row, FAQ, footer with legal links and "Report content".+- **`/pricing`:** Monthly / Yearly toggle with "Save 20%" (computed); Individual / Teams chips. Cards (Free, Starter, Pro "Most popular", Ultra): price ("$30 a month, tax included" for consumers), credits chip ("3,300 credits a month"), an example from the price book ("≈ 35 five-second 1080p videos or 730 images"), 6 features, CTA "Start free" / "Get Pro" / "Upgrade" / "Your plan"; for paying customers lower plans read "Switch to Starter" with "from Dec 1, when this period ends". Team: a seat stepper (2–50) with the total. Enterprise: "Talk to us" → a form (name, work email, company, team size, message; "Use your work email." / "Tell us a little about your team."). Packs row (500 for $5, 1,200 for $10, 3,000 for $24). **Cost calculator:** steppers for images, 5 s videos and 10 s videos a month → "You'd use ≈ 1,240 credits a month. Pro fits." Comparison table (scrolls in its own container). FAQ answers: renewal ("Plans renew each month or year on the day you subscribed."), refunds (the operator's rule, default "Within 14 days of your first purchase if you haven't used any of it."), credit expiry and order ("Monthly credits end with the month. Packs don't expire. We always use the credits that expire soonest first."), cancel ("Cancel any time; you keep your plan until the end of the period."), tax ("Prices include tax where we're required to charge it."). No-payments installs: "Request this plan". Test mode: a banner "Test mode: use card 4242 4242 4242 4242". `?checkout=cancelled`: an inline note "Payment cancelled. You're still on Free. Pick a plan when you're ready."+- **Phone:** cards stack; features collapse to "See all features"; the table scrolls inside its container.++### S8.2 `/coming-soon`, `/legal/[slug]`, `/terms-update` [acc-47]++- **`/coming-soon`** (Preview): service name, one line, "Join the waitlist" (email; "You're on the list. We'll email you when we open."), `noindex`.+- **`/legal/[slug]`:** title, "Version {n} · updated {date}", a contents rail (a Select on phone), the text with placeholders filled from settings, a top note on templates "This is a starting point, not legal advice."+- **`/terms-update`** (restricted `accept-terms` session): "We updated our Terms" with a summary of changes, links to the full text, "I agree" and "Sign out".++### S8.3 Register additions and the welcome card [acc-44, acc-47]++Register per S2.3. After email confirmation with a plan picked: "Email confirmed. Taking you to payment…" → Checkout. Welcome card on Home: "Welcome, {name}. You have 50 free credits." (withheld: "Free credits aren't available for this account. Plans start at $10.") with chips Make an image / Make a video / Create a character and the line "Results on Free carry a small {service} badge. See plans".++### S8.4 Billing and credits [acc-37, acc-44, acc-45, acc-46]++- **Credits pill** (account menu and composer header): "1,240 credits" or "1,240 · 60 in use"; a dot when below 10% of the monthly allowance; "On hold" when frozen.+- **Composer credit states:** price label "12 credits" / "Up to 18 credits" / "Unlimited · relaxed" / "Your key". Lines: "This needs 60 credits. You have 24." with "See plans" and "Add credits"; "Kling 3.0 at 1080p is on Pro and up." with the chip "Use 720p"; "Your last run cost 6 credits more than estimated. Add credits to keep going."; "Paid runs are paused while a payment is reviewed."; "Your storage is full. Delete old results or upgrade." Locked studios show an Empty state "Character Swap is on Pro and up." with "See plans". Model picker badges "Pro". A waiting nudge "Pro runs 4 at once." at most once a day.+- **`/settings/billing`:** 1 Plan ("Pro · $30 a month", "Renews on Dec 1" / "Ends on Dec 1" / "Switches to Starter on Dec 1"; Change plan; Cancel → AlertDialog "Cancel auto-renewal? You keep Pro until Dec 1. After that you're on Free." → toast "Your Pro benefits end on Dec 1."; "Keep Pro" when cancelled). 2 Credits: balance, a buckets table (source, left / total, expires; "We always use the credits that expire soonest first."), "Add credits", "Redeem a code". 3 Auto-recharge (Stripe direct): "When I have fewer than [200] credits, add [1,200] for $10" with the line "At most 3 times a day. We'll turn it off if a charge fails." 4 Payment method (card brand and last 4, "Update" → portal). 5 Invoices (date, amount, status, Download). 6 Refund (when eligible: "Refund my purchase from Oct 28. You haven't used any of it." → AlertDialog "Refund $30? Your Pro plan ends now."). Team variant: seats, the pool and member caps. Past due banner (S3.4). Empty invoices: "No invoices yet."+- **Change plan sheet** (ResponsiveDialog): plan cards; the exact charge before confirming ("You pay $26.40 today ($30 minus $3.60 for your 360 unused Starter credits). You get 3,300 credits now, and your plan renews on Nov 29."); downgrades "Switches to Starter on Dec 1. You keep Pro until then."; while unpaid "Pay the open invoice first." 3-D Secure opens a tab and the sheet polls ("Waiting for your bank…").+- **Top-up:** pack picker → "Buy 1,200 credits · $10" → Checkout.+- **`/billing/success`:** "Finishing your purchase…" (polls every 2 s up to 60 s) → "You're on Pro" with "Back to making" / after 60 s "This is taking longer than usual. Your payment went through; your plan will switch in a few minutes. We'll tell you in your Inbox." / unpaid "Your payment didn't go through. Try again."++### S8.5 `/redeem` [acc-42]++Card "Redeem a code", input `XXXX-XXXX-XXXX`, "Redeem" → "Added 500 credits." Errors: "We couldn't find that code." / "This code was already used." / "This code has been used up." / "This code expired." / "This code is for new accounts only." / "Too many tries. Try again in 10 min." No-payments installs link here from "Add credits".++### S8.6 Safety screens for customers [acc-49, acc-50, acc-51]++- **Consent dialog** before a real-face or voice feature: "Is this you, or do you have permission?" with the required box "This is me, or I have written permission from this person, and they're 18 or older." and "Continue".+- **Prompt blocked** (under the composer): "This prompt can't run here: {category in plain words}. Nothing was charged." with "Read the rules". A check that couldn't run: "We couldn't check this prompt. Try again."+- **Held and blocked cards:** S4.9.+- **Report dialog** (share pages, team items) and **`/report`:** category (A minor, Intimate image without consent → `/takedown`, Sexual or violent, Someone's likeness, Copyright (DMCA fields: your contact, the work, the URL, a good-faith statement, signature), Hate, Scam, Other), details, optional email → "Report sent. Thank you."+- **`/takedown`:** NCII form (your name, contact, the URLs, a statement that you didn't consent, signature) → "We'll decide by Nov 3, 14:02 UTC."+- **Notices and appeals:** in Data & privacy (S4.8): "Appeal" opens a form (what you want reconsidered, 1,000 characters) → "Appeal sent. We'll decide within 7 days."; banned people use `/appeal` (email and case id, no sign-in).+- **Ban effects** (per settings): sessions ended; share links show "This link is no longer available."; subscription cancelled with or without a pro-rata refund; credits frozen.++## S9. Platform admin++### S9.1 Overview and the launch checklist [acc-41, acc-57]++Preview: the launch checklist card ("{n} of 12 required steps done"; rows per `accounts-8.md` §10.7, each with its state and a "Fix" link; optional rows below a divider; "Open to the public" disabled until all required rows pass, then AlertDialog "Open {service} to the public? Anyone will be able to sign up." → toast "{service} is open."). Tiles: revenue this month, paying people, credits granted and used, margin (with "Show as table"). "Needs attention": failed webhooks, disputes, moderation over SLA, price changes, spend guard hits. Empty: "Numbers appear after your first day of sign-ups."++### S9.2 `/admin/plans` [acc-40]++List: plan name, price, credits, subscribers, version, status (Live, Draft, Hidden). "New plan". Editor (`/admin/plans/[id]`): Name; Prices per interval (monthly, yearly; "Yearly saves 20%" computed); Monthly credits; Rollover (None / One month); Entitlements (models matrix link, features switches, concurrency cloud and GPU, queue weight, caps: resolution, seconds, outputs, upscale, training photos and steps; storage GB; API tokens and requests a minute; badge on results); Trial (none or N days with an allowance); Visible on pricing. Validation: "Enter a price above $0 or mark the plan Free."; "Credits must be a whole number." Margin check: "At these prices Kling 3.0 1080p runs at a 33% margin." Publish → AlertDialog "Publish version 3? Existing subscribers stay on version 2 unless you move them." with "Also move existing subscribers on renewal". Phone: the editor stacks; the entitlements matrix scrolls inside its container. Empty list: "No plans yet. Start from the recommended template." with "Use template".++### S9.3 People tabs (Platform) [acc-41]++Person page tabs Credits (balance, buckets, ledger with filters, "Adjust credits": amount ±, reason required, caps per role "Support can adjust up to 500 credits at a time."), Billing (plan, subscription status, invoices, refunds, disputes), Safety (reports, strikes, bans, notices). "Request support access" (support role): reason → the customer sees S4.8's request; status "Waiting for Dana to allow" / "Allowed until 14:32". Owner emergency access: reason required, audited, the customer is told.++### S9.4 `/admin/credits` and `/admin/models` [acc-38, acc-40]++- **Credit prices:** value of a credit ($0.01), default markup (50%), GPU price per hour ($2.16), "Unknown prices" (refuse / fixed). Per-model rules table: model, option, provider cost, credits, margin, override; red rows "Below cost: you lose ≈ $0.04 per run"; "Price changed at fal" rows with "Accept new price" / "Keep mine". Live example box ("5 s 1080p Kling = 93 credits"). Empty overrides: "Every model uses the default markup."+- **Models & features:** a plan × model matrix (rows models with licence chips, e.g. "Non-commercial licence"; columns plans; checkboxes) with filters (kind, provider, licence); a banner when a non-commercial model is on a paid plan: "Selling results from models with non-commercial licences may break their terms. Fuobe shows licences as information; the decision is yours."++### S9.5 `/admin/codes` [acc-42, acc-46]++Tabs Credit codes / Promotion codes (Stripe). Credit codes: "New codes": credits, how many, uses per code, expiry, "New accounts only" → shown once ("Download CSV now. You won't see these codes again."). Rows: prefix, credits, used / total, expiry, Disable. Promotion codes: percent or amount off, duration, first-time only, one per card. Empty: "No codes yet."++### S9.6 `/admin/moderation` [acc-51]++Queue with SLA timers ("Due in 47 h" for NCII; red when overdue), filters (category, source: report, classifier, hash match), blurred thumbnails (reveal on click with a warning "This may be disturbing."). Item view: the content, prompt, reporter's note, the uploader's history (strikes), actions Remove / Restrict / Warn / Ban / Restore with a statement of reasons (template per rule, editable). Restricted CSAM tab for the owner only (no thumbnails; report record fields; "Mark reported to NCMEC" with the report id). Keyboard (scoped to the focused queue list, WCAG 2.1.4): j/k next and previous, 1–4 actions, Enter open; announced through `aria-live`. Empty: "Nothing to review. Reports and flagged results appear here."++### S9.7 `/admin/analytics` [acc-56]++Tiles (sign-ups, paying, MRR, churn, credits used, margin), SVG charts per day with "Show as table", tables by model, plan and day, top spenders, abuse signals (accounts sharing a card or network). Period select. Empty: "Numbers appear after your first day of sign-ups."++### S9.8 `/admin/bans` [acc-42]++List (person, reason, until, by, date) with Unban. "Ban someone" dialog: person, reason (select of rules), note, until a date or permanent, "Also refund the current period". Empty: "No one is banned."++### S9.9 `/admin/payments` and `/admin/health` [acc-43, acc-46, acc-56]++- **Payments:** tabs Payments (date, person, amount, status, Refund), Subscriptions (plan, status, renews), Disputes (status, evidence due, Respond in Stripe), Webhooks (event, received, processed, status, Retry; banner "No payment events in 24 hours while 42 subscriptions are active."). Empty: "No payments yet."+- **Health:** queues (waiting by pool, oldest), GPU summary (links `/admin/gpu`), providers (last error, out-of-funds pause with "Resume"), workers and leases, webhooks, backups (last snapshot, Litestream lag), the spend guard ("Paid cloud runs paused: $500 spent in the last hour (limit $400)." with "Raise limit" and "Resume"), tools (reconcile now, re-run price sync).++### S9.10 `/admin/announcements` [acc-57]++Composer: title, body (plain text with links), audience (everyone, a plan, staff), banner on or off, email on or off (sent on the broadcast stream with List-Unsubscribe), start and end time, Preview (light and dark, 390 px). List with status. Customers dismiss banners ("Dismiss" stored per person). Empty: "No announcements."++### S9.11 `/admin/settings` (Platform sections)++Launch (Preview access list: emails or invite links; Open to the public), Service & legal (names, addresses, the legal editor and the operator checklist from `accounts-8.md` §10.9), Payments (provider, keys with Test, tax display, refund window), Credits, Safety (prompt and output checkers with Test, hash matcher, C2PA certificate upload, badge), Abuse (guards and limits), Storage & backups, Email & DNS (SPF, DKIM, DMARC checks per provider with copyable records and "Check").++## S10. Platform setup steps [acc-37, acc-40, acc-44, acc-49, acc-55]++- **`/setup/credits`:** value $0.01, markup 50%, GPU $2.16 an hour, unknown prices off; a live table: FLUX.2 [pro] 1 MP $0.03 → 4.5 credits; Kling 3.0 5 s 1080p $0.62 → 93; 60 s of GPU → 5.4.+- **`/setup/plans`:** Recommended / Free only / Start empty, with the editable table of §10.2.+- **`/setup/payments`:** None / Stripe / Stripe Managed Payments (test mode first); key field with Connect; "Create products and prices" (sync); webhook created automatically or the `stripe listen --forward-to <site>/api/billing/stripe/webhook` command; tax registration note.+- **`/setup/safety`:** prompt checker (Llama Guard on Ollama, HTTP, or off with a red note "Required before opening to the public"), output checker per engine (fal or local HTTP; Test), hash matching (with the line "Recommended. Required by law in some places once you know of a match."), Content Credentials (self-signed until you upload a certificate), badge on Free.+- **`/setup/storage`:** Local / S3-compatible (endpoint, bucket, keys, Test); nightly snapshots (keep 7); a copyable `litestream.yml`.++## S11. Routes added to the layout checks++`tests/e2e/_routes.mjs` gains `AUTH_ROUTES` and per-role lists; `no-horizontal-scroll` runs each list at 1440 and 390 px in light and dark under its role (Just me, Studio owner, Studio member, Platform signed out, Platform customer, Platform admin):++- **Signed out:** `/setup`, `/setup/start`, `/setup/account`, `/setup/address`, `/setup/studio`, `/setup/service`, `/setup/join`, `/setup/keys`, `/setup/email`, `/setup/sign-in`, `/setup/teams`, `/setup/invite`, `/setup/review`, `/setup/restore`, `/login`, `/login/sso`, `/register`, `/verify`, `/reset`, `/recover`, `/invite/<sample>`, `/two-step`, `/welcome`, `/pricing`, `/coming-soon`, `/legal/terms`, `/report`, `/takedown`, `/appeal`.+- **Any signed-in person:** `/settings/account`, `/settings/usage`, `/settings/privacy`, `/settings/account/connect-cli`, `/teams`, `/teams/<slug>`, `/teams/<slug>/settings`, `/approvals`, `/redeem`, `/settings/billing`, `/billing/success`, `/account/restore`, `/two-step/setup`, `/terms-update`.+- **Admins:** `/settings/access`, `/settings/backup`, `/admin`, `/admin/people`, `/admin/people/<id>`, `/admin/teams`, `/admin/usage`, `/admin/gpu`, `/admin/security`, `/admin/sso`, `/admin/sso/<id>`, `/admin/provisioning`, `/admin/domains`, `/admin/seats`, `/admin/audit`, `/admin/data`, `/admin/plans`, `/admin/plans/<id>`, `/admin/credits`, `/admin/models`, `/admin/codes`, `/admin/payments`, `/admin/moderation`, `/admin/bans`, `/admin/announcements`, `/admin/analytics`, `/admin/health`, `/admin/settings`.+- **Overlays checked at 390 px:** the account menu with 10 teams, the Inbox, the two-step setup dialog, the change-plan sheet, the share dialog, the create-team dialog.++## S12. Email templates++Every template has a plain-text part and an HTML part that reads well in light and dark clients; links are built from the site address, never the request `Host`; transactional mail and announcements use separate streams; names are escaped and URLs never come from user input.++| Template | Subject | Body (short) |+|---|---|---|+| Verification code | "Your {service} code: 482193" | "Use this code to finish signing up: 482193. It expires in 10 minutes. If you didn't ask for it, ignore this email." |+| Reset code | "Reset your {service} password" | "Use this code to choose a new password: 482193. It expires in 10 minutes. Your two-step sign-in stays on." |+| Reset link (admin-made) | "{admin} sent you a password reset" | "Open this link to choose a new password: {link}. It works once, for 60 minutes. Your other devices will be signed out." |+| Invite | "{inviter} invited you to {team}" | "Join {team} on {service} as an {role}. The invite expires in 72 hours: {link}" |+| Approved | "Your {service} account is ready" | "{admin} approved your account. Sign in: {link}" |+| Shared with you | "{name} shared {item} with you" | "Open it: {link}" |+| Limit request | "{name} asks for more this month" | "{name} asks for ${amount} more: '{note}'. Decide: {link}" |+| Sign-up on an existing account | "Someone tried to sign up with your email" | "If it was you, sign in instead: {link}. If not, you can ignore this." |+| Notice (admin action) | "Your {service} account was changed" | "{admin} {action} on {date}. If you didn't expect this, contact {contact}." |+| Recovery used | "Your {service} password was changed with a recovery code" | "Someone with access to the server ran fuobe recover and set a new password on {date}. Every device was signed out." |+| Two-step changed | "Two-step sign-in was {turned on/off}" | "This happened on {date} from {device}. If it wasn't you, reset your password." |+| New sign-in | "New sign-in to {service}" | "{device} signed in on {date} from {place or IP}. Not you? Sign out everywhere: {link}" |+| Approval decided | "Your runs were {approved/declined}" | "{approver}: {note}. Open: {link}" |+| Export ready | "Your {service} data is ready" | "Download it before {date}: {link}" |+| Deletion scheduled | "Your {service} account will be deleted on {date}" | "Sign in before then to cancel: {link}" |+| Budget alert | "Brand team has used 80% of this month's limit" | "≈ $400 of $500. See usage: {link}" |+| Monthly report | "{studio} in October: ≈ $1,240 spent" | Totals by team and person, link to the report |+| Receipt and plan change (Platform) | "You're on Pro" / "Your plan changes on {date}" | Amount, credits granted, renewal date, invoice link |+| Payment failed (Platform) | "Your payment didn't go through" | "Update your payment method by {date} to keep Pro: {link}" |+| Moderation decision (Platform) | "We removed something you made" | The item, the rule, the statement of reasons, "Appeal until {date}: {link}" |+| Takedown received (Platform) | "We received your request" | "We'll decide by {deadline}. Case {id}." |+| Announcement (Platform, broadcast) | Operator's subject | Operator's body; `List-Unsubscribe` and `List-Unsubscribe-Post` (RFC 8058) and a visible unsubscribe link |diff --git a/docs/research/accounts-8.json b/docs/research/accounts-8.jsonnew file mode 100644index 00000000..bd10204d--- /dev/null+++ b/docs/research/accounts-8.json@@ -0,0 +1,1925 @@+{+ "meta": {+ "asOf": "2026-10-29",+ "fuobe": "claude/fuobe-parity-4 @ 545ebb5",+ "doc": "accounts-8.md",+ "screens": "accounts-8-screens.md",+ "routeCount": 192,+ "tableCount": 43,+ "migrationsToday": 23,+ "newMigrations": "23 identity, 24 Better Auth frozen SQL, 25 scoping columns, 26 key rebuilds, 27 meter; later packages append"+ },+ "modes": [+ {+ "mode": "personal",+ "subModes": [+ "Just me on this computer (sign-in off)",+ "Personal with sign-in"+ ],+ "whoFor": "One person on their own machine, home server or rented GPU",+ "turnsOn": [+ "local actor on allowed hosts (Just me)",+ "one-field password login, passkeys, optional two-step, devices, alerts (with sign-in)",+ "API tokens with scopes",+ "footer spend line and personal cap",+ "weekly backups, full archives, fuobe backup/restore",+ "browser-approved fuobe login",+ "fuobe recover"+ ],+ "turnsOff": [+ "other accounts",+ "teams",+ "/admin",+ "member limits",+ "own and team keys",+ "credits"+ ],+ "switching": "Just me <-> sign-in in Settings → Access; to Studio or Platform with a snapshot, a checked owner email and a non-loopback address"+ },+ {+ "mode": "studio",+ "whoFor": "A studio or company of 5-500 people on its own server",+ "turnsOn": [+ "accounts (open limited to the owner's work domain by default; approval, invite, closed)",+ "private library each",+ "teams with directory, roles, policies, keys and limits",+ "/admin",+ "fair GPU queue and GPU server pool",+ "approvals",+ "usage reports and alerts",+ "E1 two-step enforcement and session policies",+ "E4 verified domains and auto-join",+ "E2 company sign-in (OIDC, SAML)",+ "E3 SCIM",+ "E5a audit viewer",+ "E5b export, deletion, retention, legal hold, view-as",+ "E6 seats"+ ],+ "turnsOff": [+ "Just me",+ "plans, credits and payments"+ ],+ "switching": "to Platform asks about plans; to Personal makes others dormant"+ },+ {+ "mode": "platform",+ "whoFor": "An operator selling the service to the public",+ "turnsOn": [+ "open sign-up with verification, captcha, breached-password check, farming guards",+ "credits ledger, plans, packs, codes",+ "Stripe or Managed Payments, or none",+ "public site, legal templates, Preview and launch checklist",+ "admin panel with staff roles",+ "trust and safety that withholds on failure, C2PA, badge",+ "worker roles, object storage, observability"+ ],+ "turnsOff": [+ "Just me",+ "own keys unless the plan allows",+ "Studio-only features (SSO, SCIM, seats, approvals)"+ ],+ "switching": "to Studio asks about public accounts and staff roles; refused while subscriptions are active; disabled until acc-57 except FUOBE_DEV_PLATFORM=1"+ }+ ],+ "tables": [+ {+ "table": "generations",+ "scope": "workspace",+ "rule": "Visible to members and grantees; created_by and paid_by are the acting person; chain steps take the root's workspace only with Editor there; favorite and pinned_at move to item_marks",+ "columns": "+workspace_id, created_by, paid_by, hold_id; dispatch_state/dispatch_since/dispatch_priority/lane/gpu_server (acc-9, acc-26); moderation_state (acc-50); last_polled_at (acc-54)",+ "package": "acc-3"+ },+ {+ "table": "assets",+ "scope": "workspace",+ "rule": "Uploads and derived renders belong to the uploader's workspace; outputs follow their generation; /api/files authorizes by rel_path",+ "columns": "+workspace_id, created_by; index rel_path; moderation_state (acc-49)",+ "package": "acc-3"+ },+ {+ "table": "folders",+ "scope": "workspace",+ "rule": "A folder, its subfolders and their results share one workspace",+ "columns": "+workspace_id, created_by",+ "package": "acc-3"+ },+ {+ "table": "folder_items",+ "scope": "derived",+ "rule": "Keyed by generation_id; filing into another workspace's folder opens Move; grantees duplicate",+ "columns": "—",+ "package": "acc-3"+ },+ {+ "table": "generation_trash",+ "scope": "derived",+ "rule": "Trash per workspace; emptying per workspace",+ "columns": "+trashed_by",+ "package": "acc-3"+ },+ {+ "table": "generation_runs",+ "scope": "derived",+ "rule": "Internal; deleted with its generation",+ "columns": "+claimed_by, claimed_at, heartbeat_at (acc-54)",+ "package": "acc-3"+ },+ {+ "table": "characters",+ "scope": "workspace",+ "rule": "@handles unique per workspace; mentions resolve per the sharing rules; consent travels with face elements",+ "columns": "+workspace_id, created_by; UNIQUE(workspace_id, handle)",+ "package": "acc-4"+ },+ {+ "table": "trainings",+ "scope": "derived (element)",+ "rule": "Follow the element; charged to started_by",+ "columns": "+started_by, paid_by",+ "package": "acc-4"+ },+ {+ "table": "cinema_projects / cinema_folders / cinema_items",+ "scope": "workspace / derived",+ "rule": "Co-edited by Editors; takes land in the project's workspace; My Generations lists only visible projects",+ "columns": "+workspace_id, created_by on projects",+ "package": "acc-4"+ },+ {+ "table": "canvases",+ "scope": "workspace",+ "rule": "Co-edited; Duplicate into a chosen workspace",+ "columns": "+workspace_id, created_by, edited_by",+ "package": "acc-4"+ },+ {+ "table": "layer_projects / layer_versions",+ "scope": "workspace / derived",+ "rule": "",+ "columns": "+workspace_id, created_by; versions +created_by",+ "package": "acc-4"+ },+ {+ "table": "shorts_sessions / shorts_presets",+ "scope": "workspace",+ "rule": "Presets can be a team's house looks",+ "columns": "+workspace_id, created_by",+ "package": "acc-4"+ },+ {+ "table": "brand_kits / products / ad_batches / ad_creatives / marketing_runs",+ "scope": "workspace / derived",+ "rule": "Products follow their brand kit; loose products and runs own themselves; team policy decides who edits brand kits",+ "columns": "+workspace_id, created_by",+ "package": "acc-4"+ },+ {+ "table": "palettes",+ "scope": "workspace; built-ins in w_install",+ "rule": "Built-ins read by all, written by none",+ "columns": "+workspace_id, created_by",+ "package": "acc-4"+ },+ {+ "table": "moodboards / photodump_packs",+ "scope": "workspace",+ "rule": "Recraft style ids tied to the key that made them",+ "columns": "+workspace_id, created_by, style_key_ref",+ "package": "acc-4"+ },+ {+ "table": "faceless_channels / faceless_episodes / content_series",+ "scope": "workspace / derived",+ "rule": "Episodes follow their channel; Explainers and draft series own themselves; voices need consent to move",+ "columns": "+workspace_id, created_by",+ "package": "acc-4"+ },+ {+ "table": "dub_sessions / katana_jobs / swap_projects",+ "scope": "workspace",+ "rule": "",+ "columns": "+workspace_id, created_by",+ "package": "acc-4"+ },+ {+ "table": "skills",+ "scope": "workspace",+ "rule": "PK (workspace_id, name); resolution personal, active team, built-in; routes take ?workspace=",+ "columns": "rebuilt",+ "package": "acc-3, acc-5"+ },+ {+ "table": "skill_toggles",+ "scope": "user",+ "rule": "PK (user_id, name)",+ "columns": "rebuilt",+ "package": "acc-3, acc-5"+ },+ {+ "table": "assist_threads / assist_thread_state",+ "scope": "user / derived",+ "rule": "Only the author sees a chat, also inside team projects",+ "columns": "+user_id, workspace_id",+ "package": "acc-5"+ },+ {+ "table": "assist_projects / assist_project_sources",+ "scope": "workspace / derived",+ "rule": "Team projects share instructions and sources; use_personal_memory is each author's own",+ "columns": "+workspace_id, created_by",+ "package": "acc-5"+ },+ {+ "table": "assist_memory",+ "scope": "user (personal) / project",+ "rule": "Personal rows only the owner's; project rows follow the project",+ "columns": "+user_id",+ "package": "acc-5"+ },+ {+ "table": "assist_schedules",+ "scope": "user",+ "rule": "Run as owner, narrowed to a team project's workspace; paused when the owner is off",+ "columns": "+user_id, workspace_id",+ "package": "acc-5"+ },+ {+ "table": "assist_connectors",+ "scope": "user or team",+ "rule": "UNIQUE(owner_id, slug); a chat gets its author's connectors and, in a team chat, the team's",+ "columns": "rebuilt; +workspace_id (acc-25)",+ "package": "acc-3, acc-5, acc-25"+ },+ {+ "table": "shares",+ "scope": "user on workspace content",+ "rule": "Creation needs Editor and policy; re-checked at every serve",+ "columns": "+created_by, workspace_id",+ "package": "acc-6"+ },+ {+ "table": "lora_mirrors",+ "scope": "install cache",+ "rule": "Trained-LoRA rows carry the key that hosted them",+ "columns": "+key_ref",+ "package": "acc-8"+ },+ {+ "table": "settings",+ "scope": "install",+ "rule": "Install defaults and admin policy",+ "columns": "—",+ "package": "—"+ },+ {+ "table": "_migrations",+ "scope": "install",+ "rule": "",+ "columns": "—",+ "package": "—"+ },+ {+ "table": "users / workspaces / workspace_members / invites / grants / item_marks / api_tokens / audit_log / user_settings / workspace_settings / session_step_up",+ "scope": "identity",+ "rule": "Person sees their own; admins see people; team admins manage their team; audit append-only with a hash chain",+ "columns": "new (migration 23)",+ "package": "acc-1, acc-2"+ },+ {+ "table": "auth_user / auth_account / auth_session / auth_verification / auth_rate_limit",+ "scope": "identity (Better Auth)",+ "rule": "Read only through principal.ts, people lists and admin-ops.ts",+ "columns": "frozen SQL (migration 24)",+ "package": "acc-1"+ },+ {+ "table": "auth_two_factor / auth_passkey / totp_seen / session_mfa",+ "scope": "identity",+ "rule": "",+ "columns": "new",+ "package": "acc-19"+ },+ {+ "table": "notifications / consents / mail_outbox",+ "scope": "identity",+ "rule": "Inbox per person; consents append-only",+ "columns": "new",+ "package": "acc-11"+ },+ {+ "table": "request_keys",+ "scope": "user",+ "rule": "Pending, replay, 422; 24 h",+ "columns": "new",+ "package": "acc-10"+ },+ {+ "table": "provider_keys / spend_limits / meter_holds / meter_entries / limit_requests",+ "scope": "money",+ "rule": "Own: the user; team: team admins; all: usage.view_all; secrets never returned",+ "columns": "new (migration 27)",+ "package": "acc-8"+ },+ {+ "table": "cli_connect_requests",+ "scope": "user",+ "rule": "10 minutes; token wiped on delivery",+ "columns": "new",+ "package": "acc-22"+ },+ {+ "table": "team_join_requests / notice_sends",+ "scope": "team",+ "rule": "",+ "columns": "new",+ "package": "acc-24, acc-29"+ },+ {+ "table": "comfy_servers",+ "scope": "install",+ "rule": "Admin only; encrypted token",+ "columns": "new",+ "package": "acc-27"+ },+ {+ "table": "approval_requests",+ "scope": "team / install",+ "rule": "",+ "columns": "new",+ "package": "acc-28"+ },+ {+ "table": "session_activity",+ "scope": "identity",+ "rule": "",+ "columns": "new",+ "package": "acc-30"+ },+ {+ "table": "domains / team_auto_join",+ "scope": "install / team",+ "rule": "Checked addresses only; one connection per domain",+ "columns": "new",+ "package": "acc-31"+ },+ {+ "table": "sso_connections / auth_sso_provider",+ "scope": "install",+ "rule": "Owner-only changes",+ "columns": "new / frozen",+ "package": "acc-32"+ },+ {+ "table": "scim_tokens / scim_groups / scim_group_members",+ "scope": "install",+ "rule": "Scope: SCIM-provisioned people only",+ "columns": "new",+ "package": "acc-33"+ },+ {+ "table": "export_jobs / access_grants / privacy_holds",+ "scope": "user / install",+ "rule": "",+ "columns": "new",+ "package": "acc-35"+ },+ {+ "table": "seat_requests (+users.seat)",+ "scope": "install",+ "rule": "",+ "columns": "new",+ "package": "acc-36"+ },+ {+ "table": "credit_accounts / credit_buckets / credit_ledger / credit_holds",+ "scope": "money (Platform)",+ "rule": "Append-only ledger; buckets never negative; debt on the account",+ "columns": "new",+ "package": "acc-37"+ },+ {+ "table": "price_rules / gpu_run_stats",+ "scope": "install",+ "rule": "",+ "columns": "new",+ "package": "acc-38"+ },+ {+ "table": "plans / plan_versions / account_plans / entitlement_overrides / credit_limits",+ "scope": "install / account",+ "rule": "Versioned and grandfathered",+ "columns": "new",+ "package": "acc-39"+ },+ {+ "table": "credit_codes / credit_code_redemptions / plan_requests / user_bans",+ "scope": "install",+ "rule": "",+ "columns": "new",+ "package": "acc-42"+ },+ {+ "table": "customers / subscriptions / payments / payment_events / checkout_sessions / credit_packs",+ "scope": "billing",+ "rule": "Events deduplicated by id and by object id plus type",+ "columns": "new",+ "package": "acc-43"+ },+ {+ "table": "auto_recharge / promo_codes",+ "scope": "billing",+ "rule": "One pending recharge per account",+ "columns": "new",+ "package": "acc-46"+ },+ {+ "table": "legal_docs / sales_leads",+ "scope": "install",+ "rule": "",+ "columns": "new",+ "package": "acc-47"+ },+ {+ "table": "account_signals / rate_limits",+ "scope": "install",+ "rule": "",+ "columns": "new",+ "package": "acc-48"+ },+ {+ "table": "moderation_checks",+ "scope": "install",+ "rule": "",+ "columns": "new",+ "package": "acc-49"+ },+ {+ "table": "quarantine / csam_reports",+ "scope": "install (restricted)",+ "rule": "Owner only; held 1 year",+ "columns": "new",+ "package": "acc-50"+ },+ {+ "table": "moderation_items / moderation_actions / strikes / content_hash_blocks",+ "scope": "install",+ "rule": "",+ "columns": "new",+ "package": "acc-51"+ },+ {+ "table": "leases / worker_heartbeats / live_events",+ "scope": "install",+ "rule": "",+ "columns": "new",+ "package": "acc-54"+ },+ {+ "table": "platform_daily / provider_costs",+ "scope": "install",+ "rule": "",+ "columns": "new",+ "package": "acc-56"+ },+ {+ "table": "announcements / announcement_dismissals",+ "scope": "install / user",+ "rule": "",+ "columns": "new",+ "package": "acc-57"+ }+ ],+ "fileAreas": [+ {+ "area": "data/files/**",+ "scope": "workspace through assets",+ "rule": "/api/files ACL by rel_path; Move re-homes outputs; refcounted deletes"+ },+ {+ "area": "data/loras/fuobe/**, copies in each GPU server's LoRA folder",+ "scope": "follows the element",+ "rule": "attachLora and loras[] accept only visible elements' files; deleted with the element"+ },+ {+ "area": "data/datasets/**, aitk.datasetDir",+ "scope": "follows the element",+ "rule": "deleted with the element"+ },+ {+ "area": "ComfyUI /history, input and output",+ "scope": "per job",+ "rule": "random prefix in Studio and Platform; history deleted after saving; files deleted where folders are configured"+ },+ {+ "area": "data/fuobe.db, auth.json, secret.key, setup-code, recovery.json, backups/",+ "scope": "install",+ "rule": "never served; snapshots carry secret.key and never sessions"+ }+ ],+ "routes": [+ {+ "group": "Identity (Better Auth)",+ "routes": [+ "/api/identity/[...all]"+ ],+ "access": "public, router-only allowlist",+ "checks": "sign-up routes only from acc-11 with the policy; always-blocked list; /update-user without image",+ "package": "acc-1, acc-11"+ },+ {+ "group": "Auth shims",+ "routes": [+ "POST /api/auth/login",+ "POST /api/auth/logout",+ "GET,POST /api/auth/password",+ "GET,POST,DELETE /api/auth/tokens"+ ],+ "access": "public (login) / session",+ "checks": "tokens listed and revoked per user; admins revoke any; created only from a browser session or the local actor",+ "package": "acc-1, acc-13"+ },+ {+ "group": "Install config",+ "routes": [+ "GET,PUT /api/settings",+ "GET,PUT /api/settings/models",+ "POST /api/providers/test",+ "GET,POST /api/loras",+ "GET /api/status"+ ],+ "access": "perm:install.settings for writes",+ "checks": "members see connected flags only; GET /api/status writes nothing",+ "package": "acc-2, acc-8"+ },+ {+ "group": "Files and assets",+ "routes": [+ "GET /api/files/[...path]",+ "POST /api/uploads",+ "GET /api/assets",+ "GET,DELETE /api/assets/[id]",+ "POST /api/media/probe"+ ],+ "access": "session or token",+ "checks": "asset visible by rel_path; uploads stamped; scoped uses in 409; probe url checked",+ "package": "acc-3, acc-6"+ },+ {+ "group": "Library",+ "routes": [+ "/api/generations/**",+ "/api/folders/**"+ ],+ "access": "session or token",+ "checks": "every id (path, query, body: ids[], folderId, inputs.*, dependsOn, existing) declared and checked; created_by/paid_by = actor; cross-space 409; final-payload price; Idempotency-Key",+ "package": "acc-3, acc-6, acc-7, acc-10"+ },+ {+ "group": "Live stream",+ "routes": [+ "GET /api/generations/stream?workspace="+ ],+ "access": "session or token",+ "checks": "per-event visibility with version counter; 60 s re-validation; close on revoke",+ "package": "acc-6"+ },+ {+ "group": "Shares",+ "routes": [+ "GET,POST /api/shares",+ "GET,PATCH,DELETE /api/shares/[id]",+ "GET /s/[token]",+ "GET /s/[token]/f/[...path]"+ ],+ "access": "session (manage) / public or signed-in per policy (view)",+ "checks": "Editor on every item plus policy at creation; serve-time re-check; owner = creator or target admin",+ "package": "acc-6"+ },+ {+ "group": "Sharing and teams",+ "routes": [+ "POST /api/move",+ "POST /api/grants",+ "POST /api/duplicate",+ "/api/workspaces/**",+ "/api/teams/**"+ ],+ "access": "session or token",+ "checks": "Editor on items; level cap; move out needs team admin; last-owner guard",+ "package": "acc-17, acc-24"+ },+ {+ "group": "Assist and MCP",+ "routes": [+ "/api/assist/**",+ "POST /api/mcp"+ ],+ "access": "session or token (scopes)",+ "checks": "threads/memory/schedules/connectors per user; projects/skills per workspace; skills ?workspace=; tools narrowed in team threads; MCP tools/list by scope and pin",+ "package": "acc-5"+ },+ {+ "group": "Studios",+ "routes": [+ "/api/cinema/**",+ "/api/canvases/**",+ "/api/layers/**",+ "/api/shorts/**",+ "/api/swap-studio/**",+ "/api/brands/**",+ "/api/products/**",+ "/api/ads/**",+ "/api/marketing/**",+ "/api/faceless/**",+ "/api/explainer/**",+ "/api/content-factory/**",+ "/api/dub/**",+ "/api/katana/**",+ "/api/elements/**",+ "/api/palettes/**",+ "/api/moodboards/**",+ "/api/photodump/**",+ "/api/influencer/**",+ "/api/genjutsu/**",+ "/api/evolution/**",+ "/api/remove-object/**",+ "/api/mixed-media/**",+ "/api/storyboards/**",+ "/api/audio-tools",+ "/api/enhance"+ ],+ "access": "session or token",+ "checks": "every id declared and checked; retries and Run again stamp the actor; spend points reserve",+ "package": "acc-4, acc-6, acc-8"+ },+ {+ "group": "Me",+ "routes": [+ "/api/me",+ "/api/me/sessions",+ "/api/me/usage",+ "/api/me/entitlements",+ "/api/me/keys",+ "/api/me/keys/test",+ "/api/me/limit-requests",+ "/api/me/inbox",+ "/api/me/email",+ "/api/me/two-step/verify",+ "/api/users/[id]/avatar"+ ],+ "access": "session (local actor in Just me)",+ "checks": "own data only; avatar to people sharing a workspace",+ "package": "acc-8, acc-11, acc-13, acc-19"+ },+ {+ "group": "Public",+ "routes": [+ "/api/public/sign-in-options",+ "/api/public/price-book",+ "/api/public/sso-route",+ "/api/public/device",+ "/api/auth/forgot*",+ "/api/recover/*",+ "/api/cli/connect",+ "/api/cli/connect/poll"+ ],+ "access": "public, rate-limited",+ "checks": "uniform answers; per-client limits",+ "package": "acc-11, acc-13, acc-22, acc-32, acc-38, acc-48"+ },+ {+ "group": "Setup",+ "routes": [+ "/api/setup/code",+ "/api/setup/account",+ "/api/setup/draft",+ "/api/setup/finish"+ ],+ "access": "public while setup is pending; fuobe_setup cookie",+ "checks": "setup code throttled, never rotated by failures",+ "package": "acc-14"+ },+ {+ "group": "Access and mode",+ "routes": [+ "/api/access/*"+ ],+ "access": "owner and admins",+ "checks": "fresh session for mode changes",+ "package": "acc-15, acc-18"+ },+ {+ "group": "Admin",+ "routes": [+ "/api/admin/**"+ ],+ "access": "per permission registry",+ "checks": "target-role matrix for actions on people",+ "package": "acc-12, acc-16 and later"+ },+ {+ "group": "Approvals",+ "routes": [+ "/api/approvals/**"+ ],+ "access": "approvers",+ "checks": "second decision 409",+ "package": "acc-28"+ },+ {+ "group": "SCIM",+ "routes": [+ "/api/scim/v2/*"+ ],+ "access": "fuobe_scim_ bearer",+ "checks": "only SCIM-provisioned people; never install roles; brake",+ "package": "acc-33"+ },+ {+ "group": "Company sign-in",+ "routes": [+ "/api/identity/sso/*",+ "POST /api/identity/sso/saml2/sp/acs/[id] (cross-site exempt)"+ ],+ "access": "public",+ "checks": "bound domains; RelayState cookie; issuer+subject",+ "package": "acc-32"+ },+ {+ "group": "Billing",+ "routes": [+ "/api/billing/checkout",+ "/api/billing/[provider]/webhook"+ ],+ "access": "session / public signed webhook",+ "checks": "webhook exempt from setup gate, Preview, dormancy, captcha and IP limits; raw body signature; dedupe",+ "package": "acc-43, acc-44"+ }+ ],+ "settingsSplit": [+ {+ "key": "install.mode, install.signin, setup.state, setup.draft",+ "scope": "install",+ "who": "owner; env locks",+ "why": ""+ },+ {+ "key": "install.name, install.site_url, install.timezone, install.contact",+ "scope": "install",+ "who": "owner, admins",+ "why": "links, cookies, passkeys, spend month, public contact"+ },+ {+ "key": "signup.*, signin.*, email.*",+ "scope": "install",+ "who": "admins",+ "why": "who joins and how"+ },+ {+ "key": "teams.create, keys.mode, limits.member_default_usd, limits.unknown_price",+ "scope": "install",+ "who": "admins",+ "why": "money policy"+ },+ {+ "key": "spend_limits workspace/member",+ "scope": "team",+ "who": "team admins",+ "why": ""+ },+ {+ "key": "spend_limits user_self",+ "scope": "user",+ "who": "the person",+ "why": "personal cap"+ },+ {+ "key": "fal/replicate/anthropic keys",+ "scope": "install + team + user",+ "who": "admins / team admins / the person",+ "why": "resolved by keys.mode; encrypted except Personal install keys"+ },+ {+ "key": "civitai.key",+ "scope": "install",+ "who": "admins",+ "why": "downloads land in shared LoRA folders"+ },+ {+ "key": "comfyui.*, aitk.*, ollama.url, demo.mode, models.access, engine.mode, access.*, backup.*",+ "scope": "install",+ "who": "admins (backup: owner)",+ "why": "fetch targets and server paths"+ },+ {+ "key": "ollama.model, enhance.provider, cloud.provider, theme, notify.email",+ "scope": "install default + user",+ "who": "admins / the person",+ "why": "preferences"+ },+ {+ "key": "shares.public",+ "scope": "install; team may narrow",+ "who": "admins / team admins",+ "why": "anyone, signed-in only, nobody"+ },+ {+ "key": "guide.dismissed",+ "scope": "user",+ "who": "the person",+ "why": "replaces the install-wide onboarding write"+ },+ {+ "key": "openai.key, google.key",+ "scope": "removed",+ "who": "—",+ "why": "nothing reads them"+ },+ {+ "key": "browser keys",+ "scope": "user per browser",+ "who": "—",+ "why": "prefixed fuobe:u:<id>: and cleared on sign-out"+ }+ ],+ "plans": {+ "creditValueUsd": 0.01,+ "markupPct": 50,+ "gpuUsdPerHour": 2.16,+ "yearlyDiscountPct": 20,+ "plans": [+ {+ "id": "free",+ "price": 0,+ "credits": 50,+ "concurrency": {+ "cloud": 1,+ "gpu": 1+ },+ "queue": "free pool",+ "notes": "after verification; badge; cheaper models; no Unlimited"+ },+ {+ "id": "starter",+ "price": 10,+ "credits": 1000,+ "concurrency": {+ "cloud": 2,+ "gpu": 1+ },+ "queueWeight": 2+ },+ {+ "id": "pro",+ "price": 30,+ "credits": 3300,+ "concurrency": {+ "cloud": 4,+ "gpu": 2+ },+ "queueWeight": 4,+ "notes": "Unlimited relaxed on selected models"+ },+ {+ "id": "ultra",+ "price": 100,+ "credits": 12000,+ "concurrency": {+ "cloud": 8,+ "gpu": 4+ },+ "queueWeight": 8+ },+ {+ "id": "team",+ "pricePerSeat": 25,+ "creditsPerSeat": 3000,+ "pooled": true,+ "concurrency": "4 a seat up to 32",+ "queueWeight": "4 x seats, capped at 32"+ },+ {+ "id": "enterprise",+ "price": "contact",+ "credits": "custom"+ }+ ],+ "packs": [+ {+ "credits": 500,+ "price": 5+ },+ {+ "credits": 1200,+ "price": 10+ },+ {+ "credits": 3000,+ "price": 24+ }+ ],+ "packExpiry": "none by default (or >= 12 months, operator setting)",+ "rollover": [+ "none (default)",+ "one month"+ ],+ "entitlementFields": [+ "models allow/deny by id, family, kind, engine, provider; price multiplier",+ "features: studios, custom LoRAs, own keys, training (incl. training.open), API, MCP, CLI, public links",+ "concurrency cloud and GPU",+ "queue weight",+ "caps: resolution tier, seconds, outputs and batch, upscale target, training photos and steps, prompt length",+ "storage quota",+ "retention for Free (optional)",+ "badge",+ "API tokens and requests a minute",+ "monthly credits, rollover, top-ups",+ "seats"+ ],+ "queue": {+ "freePool": "all Free accounts form one group (weight 1), per-person fairness inside",+ "unlimitedPool": "low-weight shared pool",+ "freePoolMaxSlotsPct": 25,+ "weights": {+ "starter": 2,+ "pro": 4,+ "ultra": 8,+ "team": "plan weight x active seats, cap 32"+ }+ },+ "changes": {+ "upgrade": "new period now; pay new price minus value of unused plan credits (credits left x old price / old credits, capped at old price); old bucket expires; full new allowance from the paid invoice",+ "downgrade": "at period end",+ "cancel": "at period end",+ "seatsAdd": "prorated charge and prorated seat credits",+ "seatsRemove": "period end, no credit refund",+ "unpaid": "changes refused",+ "managedPayments": "changes at period end only"+ },+ "unlimited": "paid plans only, preferably open engine, one at a time, daily cap, per-plan operator-cost ceiling"+ },+ "ledger": {+ "units": "integer milli-credits (1 credit = 1000)",+ "tables": [+ "credit_accounts (person or team, plan, frozen, debt_mc)",+ "credit_buckets (source plan|topup|promo|admin|refund|trial, granted, remaining >= 0, expires_at, ref, status active|refund_pending|expired)",+ "credit_ledger (append-only; kind grant|hold|capture|release|expire|clawback|adjust|debt; signed amount; bucket_id, hold_id, generation_id, price_version, provider_cost_usd, actor_id, reason, idem_key UNIQUE)",+ "credit_holds (by meter hold)"+ ],+ "order": "credits that expire soonest first, then oldest",+ "reserve": "debit buckets inside the core BEGIN IMMEDIATE admission; 402 NOT_ENOUGH_CREDITS when short",+ "capture": "min(hold, final); rest back to the same buckets or a 7-day refund bucket; overage becomes debt (one step at most); new paid runs refused while debt > 0",+ "release": "every core release path; settle exactly once per hold (settle:<hold>)",+ "idempotencyKeys": [+ "grant:sub:<subscription>:<period_start>",+ "topup:cs:<checkout_session>",+ "capture:<hold>",+ "release:<hold>",+ "clawback:<refund_id>",+ "expire:<bucket>:<date>",+ "admin:<uuid>",+ "code:<redemption>"+ ],+ "sweeps": [+ "expiry every 10 minutes",+ "nightly invariants (buckets = ledger; no hold without a row)"+ ],+ "staffRecordMode": "$50 a day cap per staff account, audited",+ "payer": "team plan pool in a team with a Team plan; otherwise the runner's own credits"+ },+ "libraries": [+ {+ "name": "better-auth (+ @better-auth/passkey, @better-auth/sso)",+ "newest": "1.7.14 (2026-10-26)",+ "ruleToday": "1.7.8 (2026-10-14)",+ "licence": "MIT",+ "use": "authentication only",+ "packages": [+ "acc-1",+ "acc-19",+ "acc-32"+ ],+ "notes": "every OSV advisory fixed at or below 1.7.7; files read at 1.7.14; from 2026-11-09 the rule gives 1.7.14"+ },+ {+ "name": "nodemailer",+ "newest": "10.3.1 (2026-10-29)",+ "ruleToday": "10.1.4 (2026-10-18)",+ "licence": "MIT-0",+ "use": "SMTP",+ "packages": [+ "acc-11"+ ],+ "notes": "releases >= 14 days old are affected by advisories fixed in 10.1.4"+ },+ {+ "name": "stripe",+ "newest": "23.0.1 (2026-10-22)",+ "ruleToday": "23.0.0 (2026-10-01)",+ "licence": "MIT",+ "use": "payments",+ "packages": [+ "acc-46"+ ],+ "notes": "no OSV entries"+ },+ {+ "name": "@simplewebauthn/browser",+ "newest": "14.0.0",+ "ruleToday": "13.3.0",+ "licence": "MIT",+ "use": "passkeys in the browser",+ "packages": [+ "acc-19"+ ],+ "notes": "passkey plugin requires ^13.3.0"+ },+ {+ "name": "uqr",+ "newest": "0.1.3",+ "ruleToday": "0.1.3",+ "licence": "MIT",+ "use": "QR codes",+ "packages": [+ "acc-18",+ "acc-19"+ ]+ },+ {+ "name": "sharp",+ "newest": "0.35.5",+ "ruleToday": "0.35.5",+ "licence": "Apache-2.0",+ "use": "badge",+ "packages": [+ "acc-52"+ ],+ "notes": "already installed transitively"+ },+ {+ "name": "@contentauth/c2pa-node",+ "newest": "0.9.11 (2026-10-27)",+ "ruleToday": "0.9.9 (2026-09-30)",+ "licence": "MIT",+ "use": "C2PA signing",+ "packages": [+ "acc-52"+ ],+ "notes": "Node >= 22, native binary download"+ },+ {+ "name": "@aws-sdk/client-s3, s3-request-presigner",+ "newest": "3.1159.0",+ "ruleToday": "3.1152.0 (2026-10-14)",+ "licence": "Apache-2.0",+ "use": "object storage",+ "packages": [+ "acc-55"+ ]+ },+ {+ "name": "@vercel/otel",+ "newest": "2.1.4 (2026-10-29)",+ "ruleToday": "2.1.3 (2026-06-11)",+ "licence": "MIT",+ "use": "OpenTelemetry",+ "packages": [+ "acc-56"+ ]+ },+ {+ "name": "rejected",+ "items": [+ "extending auth.ts",+ "Auth.js v5 (beta)",+ "Lucia (deprecated)",+ "Arctic and most of Oslo (deprecated)",+ "embedding Ory Polis (optional sidecar only)",+ "iron-session",+ "Better Auth organization/admin/api-key/magic-link/oauth-proxy/one-tap/anonymous/device-authorization/jwt/bearer/multi-session/username plugins",+ "Better Auth SCIM plugin",+ "Better Auth Stripe plugin"+ ]+ }+ ],+ "decisions": [+ {+ "decision": "Deployment modes",+ "choice": "Personal, In-house studio, Platform; one core; reversible switches with a snapshot first",+ "fromOwner": true,+ "section": "§2, §7.9"+ },+ {+ "decision": "Sign-up",+ "choice": "Open by default (Platform; Studio limited to the owner's work domain), with checks; approval, invite and closed as settings",+ "fromOwner": true,+ "section": "§6.1, §9.1, §10.1"+ },+ {+ "decision": "Libraries",+ "choice": "A private library each plus teams; sharing on purpose or by creating in the team space",+ "fromOwner": true,+ "section": "§7.4, §7.5"+ },+ {+ "decision": "Local use",+ "choice": "First screen: Just me on this computer or Create your account; switchable",+ "fromOwner": true,+ "section": "§7.9"+ },+ {+ "decision": "Paid keys",+ "choice": "install keys with a limit, own keys, or both, chosen in setup",+ "fromOwner": true,+ "section": "§7.12"+ },+ {+ "decision": "Enterprise",+ "choice": "All listed features, after the core",+ "fromOwner": true,+ "section": "§9.5, §16"+ },+ {+ "decision": "Setup questions",+ "choice": "Wizard after Create your account with defaults; Just me skips it",+ "fromOwner": true,+ "section": "§7.9"+ },+ {+ "decision": "No Higgsfield models or API; licences are information",+ "choice": "Kept",+ "fromOwner": true,+ "section": "§4, §10.3"+ },+ {+ "decision": "Identity library",+ "choice": "better-auth for authentication only",+ "fromOwner": false,+ "section": "§5.2"+ },+ {+ "decision": "Teams owned by Fuobe; several per person; Editor label",+ "choice": "Fuobe workspaces and members",+ "fromOwner": false,+ "section": "§7.3"+ },+ {+ "decision": "Studio join default",+ "choice": "Open limited to the owner's work domain; approval fallback without checked addresses",+ "fromOwner": false,+ "section": "§9.1"+ },+ {+ "decision": "Member limit",+ "choice": "$25 a month",+ "fromOwner": false,+ "section": "§7.12"+ },+ {+ "decision": "Sessions and passwords",+ "choice": "30 days rolling; 8-128 characters; blocklist; scrypt N=2^15 r=8 p=3",+ "fromOwner": false,+ "section": "§7.2"+ },+ {+ "decision": "Two-step",+ "choice": "For every account; required for owner, admins, auditors and staff with 7 days of grace",+ "fromOwner": false,+ "section": "§8, §9.5"+ },+ {+ "decision": "Recovery",+ "choice": "One mechanism: fuobe recover / FUOBE_RECOVER",+ "fromOwner": false,+ "section": "§7.15"+ },+ {+ "decision": "Setup protection",+ "choice": "Setup code at commit, in the fragment, throttled",+ "fromOwner": false,+ "section": "§7.9"+ },+ {+ "decision": "Platform credit value and markup",+ "choice": "$0.01, 50%",+ "fromOwner": false,+ "section": "§10.5"+ },+ {+ "decision": "Platform plans",+ "choice": "Free 50; Starter $10/1,000; Pro $30/3,300; Ultra $100/12,000; Team $25/seat/3,000; Enterprise contact",+ "fromOwner": false,+ "section": "§10.2"+ },+ {+ "decision": "Platform teams without a Team plan",+ "choice": "Sharing only; runner's credits pay",+ "fromOwner": false,+ "section": "§10.2"+ },+ {+ "decision": "Payments",+ "choice": "Stripe direct, Managed Payments, none; fake for tests only",+ "fromOwner": false,+ "section": "§10.4"+ },+ {+ "decision": "Safety",+ "choice": "Blocks by default; withhold on failure; 18+ default (16 allowed, likeness 18+); C2PA everywhere",+ "fromOwner": false,+ "section": "§10.8"+ },+ {+ "decision": "Database",+ "choice": "SQLite on one host; Postgres deferred",+ "fromOwner": false,+ "section": "§10.10"+ },+ {+ "decision": "Community feed",+ "choice": "Not in this plan",+ "fromOwner": false,+ "section": "§15"+ },+ {+ "decision": "Version rule",+ "choice": "Newest release >= 14 days old and OSV-clean, else oldest fixing all advisories; applied when each package starts",+ "fromOwner": false,+ "section": "§5.2"+ }+ ],+ "reviews": {+ "security": {+ "mustFix": 11,+ "applied": 11,+ "shouldFix": 23,+ "partlyRejected": [+ "private fetch targets for GPU/Ollama/AI-Toolkit stay admin-settable",+ "log streaming is one HTTPS JSONL sink",+ "Personal install keys stay as today"+ ]+ },+ "engineering": {+ "mustFix": 12,+ "applied": 12,+ "shouldFix": 26,+ "partlyRejected": []+ },+ "moneyOps": {+ "mustFix": 10,+ "applied": 10,+ "shouldFix": 13,+ "partlyRejected": [+ "Managed Payments plan changes at period end only (limitation)"+ ]+ },+ "ux": {+ "mustFix": 16,+ "applied": 16,+ "shouldFix": 20,+ "partlyRejected": [+ "setup-code skip on loopback rejected",+ "Inbox kept in the account menu as a second entry"+ ]+ },+ "details": "accounts-8.md §14"+ },+ "packages": [+ {+ "key": "acc-1",+ "title": "Core: identity base (Better Auth behind Fuobe, identity tables, bootstrap, principal, proxy registries, snapshots, security headers)",+ "mode": "core",+ "effort": "large",+ "dependsOn": [],+ "brief": "Sections: §7.1, §7.2 (password format), §7.9 (fresh installs), §7.15 (secret fingerprint), §7.16, §5.2 (version rule).\nFiles: package.json (better-auth exact, per §5.2 rule); new src/server/identity/{auth.ts, password.ts, principal.ts, bootstrap.ts, admin-ops.ts, refusals.ts}; src/server/mode.ts (features registry); src/server/backup/snapshot.ts; scripts/auth-schema.mjs; src/server/db.ts (migration 23 identity tables, 24 frozen Better Auth SQL); src/app/api/identity/[...all]/route.ts; shims src/app/api/auth/{login,logout,password,tokens}/route.ts; src/proxy.ts; src/instrumentation.ts (awaited bootstrap); next.config.ts headers().\nBehaviour: Better Auth configured exactly as §7.1: own better-sqlite3 connection, auth_* table names, HKDF secret from FUOBE_SECRET or data/secret.key, __Host- cookies on https via useSecureCookies:false plus per-cookie names, ipAddressHeaders x-fuobe-client-ip written by the proxy only when a trusted proxy is configured, disableIpTracking otherwise, cookieCache off, telemetry off. The router-only endpoint allowlist excludes /sign-up/*, /sign-in/social and /sign-in/oauth2/*; user.create.before refuses any create other than claim-owner and the bootstrap import unless accounts.multi_user=1 (not set by this package). Bootstrap: wal_checkpoint and a pre-accounts snapshot with session rows stripped; root secret and identity.secret_check (refuse to start on mismatch unless FUOBE_ACCEPT_NEW_SECRET=1); import the auth.json password as u_owner's (legacy salt:hash verifies, upgraded to scrypt$v2 N=2^15 r=8 p=3 on sign-in) and tokens as legacy Full tokens; sync FUOBE_PASSWORD every boot. A fresh data dir boots as personal, sign-in off, setup.state=done; a password install becomes Personal with sign-in. The proxy resolves bearer tokens from api_tokens and the Better Auth cookie, keeps DNS-rebinding, crossSite and share logic, and gains OPEN and CROSS_SITE_EXEMPT registries. The login shim signs u_owner in with one password field and answers with a full reload. Security headers: X-Frame-Options DENY and frame-ancestors 'none' except /s/:path*, no-store on auth pages.\nTests: identity-bootstrap matrix (no password, password, FUOBE_PASSWORD, tokens, fresh dir); schema guard (getMigrations finds nothing to create or add); allowlist (router-only; auth.api passes; POST /api/identity/sign-up/email answers 403 and creates no auth_user row); password formats and upgrade; proxy matrix (Just me, password install, bearer, cookie, share link); security headers; snapshot has no auth_session rows; fingerprint mismatch refuses start; admin-ops reachability pin; Better Auth behaviour pins (cookie names and attributes on http and https, disableIpTracking skips IP rules, request scope inside hooks, returnHeaders); 50 sign-ins during runner writes with busy waits under 1 s.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; every existing Vitest suite (FUOBE_MODE=personal default); the eval harness; the only visible change is one re-sign-in on password installs."+ },+ {+ "key": "acc-2",+ "title": "Core: actor context on every route, role and permission registries, audit writer, runners carry an actor",+ "mode": "core",+ "effort": "large",+ "dependsOn": [+ "acc-1"+ ],+ "brief": "Sections: §7.1 (principal, restricted kinds), §7.3, §7.11, §7.14 (audit chain), §13 (test harness).\nFiles: new src/server/access/{actor.ts (ALS RequestScope, currentActor throws, runAs, asSystem), route.ts (handler({access, scopes}) with the restricted-kind registry and the substituteActor seam), permissions.ts (role and permission registries, effectiveTeamRole), gates.ts (no-op), audit.ts (append-only, prev_hash chain)}; every src/app/**/route.ts (192 at 545ebb5, including the skills recipe run, verify, estimate and recipe routes); src/server/mcp.ts (handleMcp(body, actor)); runner entry points in generations.ts, training.ts, faceless.ts, swap-studio.ts, content-factory.ts, assist/schedules.ts, assist/agent.ts, brand.ts, ads.ts; vitest.config.ts setupFiles += tests/setup/actor.ts; new tests/helpers/actors.ts.\nBehaviour: Every handler resolves an actor through handler(); install-config routes (PUT /api/settings, PUT /api/settings/models, POST /api/providers/test, POST /api/loras) need install.settings (the Personal owner and the local actor pass); typed errors map to 404, 403, 401, 402 and 403 REAUTH; every 403 is audited; runners and after() continuations run inside runAs(row owner) or asSystem. No scoping change yet. tests/setup/actor.ts wraps each test in runAs(local u_owner) unless the test calls asNobody(), so the 101 suites that call server modules directly keep working.\nTests: route-sweep (every route.ts goes through handler(); fails on a new unwrapped route); settings-roles; audit append-only triggers and chain verification; runners carry an actor; mcp receives the actor.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the MCP route's Origin check; every existing suite unchanged in behaviour."+ },+ {+ "key": "acc-3",+ "title": "Core: scoping columns and the data-access layer for the library, files and records",+ "mode": "core",+ "effort": "large",+ "dependsOn": [+ "acc-2"+ ],+ "brief": "Sections: §7.4 (rule, migration 25 and 26, library rows), §7.5 (create rule, created_by and paid_by = actor), §7.6 (recordVisible, denied.hidden).\nFiles: src/server/db.ts (migration 25: workspace_id, created_by, paid_by on every top-level table, backfill to w_owner/u_owner, triggers refusing NULL workspace_id, indexes, w_install rows for built-in palettes, the demo voice and voice previews; migration 26: rebuild skills, skill_toggles, assist_connectors; item_marks with favorites and pins copied); new src/server/access/scope.ts (list({space}), get(kind, id, need), stamp, assertReadable); src/server/generations.ts (createGenerations L691 and recordLocalGeneration L1700 stamp; listGenerations scoped; root-workspace rule), src/server/library.ts (Trash, restore, empty Trash, folders, facets and zips per workspace), src/server/storage.ts, src/server/records.ts (recordVisible), src/proxy.ts; routes under src/app/api/generations/**, folders/**, assets/**.\nBehaviour: Rows are visible per the §7.4 rule and otherwise answer 404 with a rate-limited denied.hidden audit entry; created_by and paid_by are the acting person for any row a request starts; a request that starts rows from a root uses the root's workspace only with Editor or more there; favorites and pins come from item_marks; Trash is per workspace; a token pinned to a workspace sees only that workspace plus grants to it, and an X-Fuobe-Workspace header that differs from the pin answers 403. Personal sees no difference (one workspace).\nTests: table-classification (every table and file area in §7.4, fails on a new one); idor.test.ts ROUTE_FIXTURES for the library, folder, asset and generation routes; favorites per viewer; Trash per workspace; pinned token cannot read or write outside its pin; retry and Run again stamp the actor; ASSET_REFS/ASSET_FREE entries for new columns.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Library, folders and Trash e2e (library-flows); the SSE feed for the owner."+ },+ {+ "key": "acc-4",+ "title": "Core: scoping in every studio module (Cinema, Canvas, Layers, Shorts, brands and ads, Faceless, Content Factory, Dub, Katana, Swap, elements and training)",+ "mode": "core",+ "effort": "large",+ "dependsOn": [+ "acc-3"+ ],+ "brief": "Sections: §7.4 (studio rows, characters, trainings), §7.5 (mentions, cross-workspace inputs are added in acc-6), §3.2.\nFiles: src/server/{cinema.ts, cinema-generate.ts, cinema-director.ts, canvas.ts, layers.ts, shorts.ts, brand.ts, ads.ts, marketing.ts, palettes.ts, moodboards.ts, photodump.ts, faceless.ts, content-factory.ts, dub.ts, katana.ts, swap-studio.ts, elements.ts, training.ts, storyboard.ts, mixed-media.ts, chains.ts, influencer.ts, genjutsu.ts, evolution.ts, remove-object.ts, audio-tools.ts} and their routes under src/app/api/**; src/server/records.ts.\nBehaviour: Every list and get goes through scope.list/get; children follow parents; @handles are unique per workspace and mentions resolve per §7.5; trainings record started_by and paid_by; attachLora accepts only visible elements' files and catalog LoRAs; Cinema My Generations lists only visible projects; storyboard films and retries use the actor; sweeps and runners act as each row's owner.\nTests: IDOR fixtures for every studio dynamic route; handles per workspace; mention resolution order and ambiguity refusal; retries stamp the actor; existing studio suites green.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; every studio e2e (cinema-*, canvas-*, layers, character-swap-studio, mixed-shorts-original)."+ },+ {+ "key": "acc-5",+ "title": "Core: scoping in Assist, skills, recipes and MCP; agents narrowed in shared spaces",+ "mode": "core",+ "effort": "large",+ "dependsOn": [+ "acc-3"+ ],+ "brief": "Sections: §7.4 (Assist rows, skills resolution, assist_memory), §7.10 (MCP, agents in shared spaces), §7.11.\nFiles: src/server/assist/{agent.ts, tools.ts, studio-tools.ts, studio-routes.ts, context.ts, context-tools.ts, memory.ts, projects.ts, schedules.ts, connectors.ts}, src/server/skills.ts, src/server/recipes.ts, src/server/mcp.ts; routes under src/app/api/assist/** and src/app/api/mcp.\nBehaviour: Threads, memory, schedules and connectors belong to their user; projects and skills to workspaces; skills resolve personal, then active team, then built-in, and the skills routes accept ?workspace=; taken() and renameSkillRefs work per workspace; listMemories returns only the actor's personal rows; use_personal_memory means the chat author's memory; activeConnectors returns only the author's connectors; ToolContext carries the actor and, in a team thread, narrows reads and writes to that workspace; schedules run as their owner; recipes run under runAs; MCP tools/list is filtered by token scope.\nTests: memory isolation, connector isolation, skill resolution with ?workspace=, MCP tools/list per scope, schedule runs as owner, agent narrowing in a team thread, IDOR fixtures for every Assist route including skills run/verify/estimate/recipe.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; assist-* suites, the CLI skills commands, the Work2Skill recipe routes."+ },+ {+ "key": "acc-6",+ "title": "Core: leak closures (files ACL, checked reads, declared ids, live-stream isolation, share rules, browser state)",+ "mode": "core",+ "effort": "large",+ "dependsOn": [+ "acc-4",+ "acc-5"+ ],+ "brief": "Sections: §7.6, §7.5 (cross-workspace inputs, move, share and duplicate server rules), §7.13 (creation and serve-time checks), §3.3, §3.8.\nFiles: src/app/api/files/[...path]/route.ts and src/server/file-response.ts (ACL by assets.rel_path, cache headers per mode); src/server/storage.ts (readChecked, assertReadable) and the eight absolutePath call sites (audio-tools.ts, katana.ts, canvas.ts, dub.ts, assist/studio-routes.ts, recipes.ts, library.ts); src/server/request-schema.ts and every route zod schema (ref(kind) annotations); src/server/live.ts and src/app/api/generations/stream/route.ts; src/lib/generation-stream.ts (FeedFilter space), the job notifications component; src/server/shorts-schemas.ts (once by user); brand.ts lock; faceless.ts voice previews in w_install; src/app/api/assets/[id]/route.ts; src/server/shares.ts, share-access.ts, src/proxy.ts (owner rule, signed-in-only policy); new src/lib/local-store.ts; src/app/providers.tsx and src/lib/api.ts (workspace in query keys); src/components/security-settings.tsx (sign-out full reload); new /api/users/[id]/avatar.\nBehaviour: Every file read is checked; every id field in path, query and body is declared and checked; cross-workspace inputs answer 409 CROSS_SPACE_INPUT until confirmed (never for continuations, schedules, approvals, Assist or MCP); the live stream checks each event against current memberships and grants (version counter), re-validates the session every 60 s and closes on revoke; payloads carry per-viewer marks; ?workspace= on the stream and GET downloads; share links need Editor and the policy at creation and are re-checked at every serve; once() and locks per user; storage keys prefixed and cleared on sign-out.\nTests: files-acl; ref-annotation sweep (fails on an undeclared id-like field); IDOR matrix over every declared path, query and body field; absolutePath grep test; live-stream isolation and revocation (removed member gets nothing new and the stream closes within 60 s); leaks (once, brand lock, voice preview, assetUses copy); shares-policy (viewer can't share; serve-time re-check after move, leave and policy change).\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; live updates for the owner's own feed; downloads and zips; the share page and share files route."+ },+ {+ "key": "acc-7",+ "title": "Core: provider payload guard (params.extra allowlist, LoRA rule, final-payload pricing, ComfyUI prefixes and cleanup)",+ "mode": "core",+ "effort": "medium",+ "dependsOn": [+ "acc-6"+ ],+ "brief": "Sections: §7.7, §3.9.\nFiles: src/lib/catalog/types.ts (route extra allowlist), scripts/gen-cloud-models.py (emit allowlists from the research field lists) and the open ModelDefs in src/lib/catalog/models.ts; src/server/request-schema.ts L100 and L109-133; src/server/canvas.ts L121; src/app/api/generations/local/route.ts; src/lib/catalog/payload.ts L418-426 (extra before priced and safety fields); src/server/providers/comfyui.ts L807-811 and L1171; src/server/generations.ts prepare() (final-payload estimate); comfy history delete and per-job prefix.\nBehaviour: Unknown extra keys answer 400 'This setting isn't available for {model}.'; keys naming media, file, LoRA, model or checkpoint bindings and strings with [output], [input], [temp], / or backslash are refused; loras[] accepts catalog LoRAs and visible elements' trained files; the final payload is priced again and a higher price refuses the request ('This would cost more than shown. Refresh the price and try again.'); safety and pricing fields are written after extra; in Studio and Platform each ComfyUI job gets a random filename_prefix and its /history entry is deleted after outputs are saved (files too when the server record has local folders).\nTests: extra.image naming an [output] file refused; unknown extra key refused; another person's trained LoRA refused; extra.num_images above the priced count refused; payload snapshots show safety fields after extra; history delete called; random prefix in Studio; an enumeration test that every extra key used by presets, studios, Canvas and eval cases is on its model's allowlist.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; every payload snapshot test, the eval cases that pass params.extra, the Canvas Table node."+ },+ {+ "key": "acc-8",+ "title": "Core: paid keys, the one meter and the entitlements module, with the usage page",+ "mode": "core",+ "effort": "large",+ "dependsOn": [+ "acc-7"+ ],+ "brief": "Sections: §7.12 (who pays, payer-aware readiness, meter tables, Budget, spend points, hold sizes, entitlements), §7.8 (keys, member key test), screens §S4.3 and §S4.7.\nFiles: src/server/db.ts migration 27 (provider_keys, spend_limits, meter_holds, meter_entries, limit_requests, lora_mirrors.key_ref, moodboards.style_key_ref; sets accounts.multi_user=1); new src/server/keys.ts (payerFor, readyFor, withKey, AES-256-GCM); src/server/providers/{fal.ts, replicate.ts, llm.ts, types.ts (PollResult.gpuMs), comfyui.ts (execution timestamps)}; src/server/enhance.ts; src/server/assist/agent.ts; src/server/faceless.ts askLlm; src/server/training.ts (cloud and AI-Toolkit holds); src/server/loras.ts; src/server/cinema-generate.ts; src/server/generations.ts (chooseRoute and routeReady per payer; reserve at L691, L1700 and dependents); new src/server/meter/{meter.ts, usd-budget.ts}; new src/server/entitlements.ts; routes /api/me/usage, /api/me/entitlements, /api/me/keys, /api/me/keys/test, /api/me/limit-requests; page /settings/usage; composer payer hint and refusal lines.\nBehaviour: keys.mode install, own or both resolves the payer, written to paid_by and used for every poll, cancel and download; readiness and demo auto are decided per payer; every spend point reserves inside BEGIN IMMEDIATE (cloud, open engine with gpuMs capture, AI-Toolkit trainings, Claude calls via meter.llm); UsdBudget with limits for install, team, member and personal cap; offered(), admit(), gate() and summary() in one module; GET /api/me/usage works for the local actor. Settlement stays as today until acc-9.\nTests: meter (every spend point reserves; 20 concurrent creates against a $1 limit give the right refusals; open-engine gpuMs capture; AI-Toolkit hold; FUOBE_DEMO_PRICED demo holds; record mode); keys binding (poll uses paid_by's key); payer-aware readiness (own mode, no install key, member key: real run, not demo); entitlements offered/admit/gate; member key test endpoint accepts only key values.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Personal runs with install keys exactly as today; demo holds are 0 unless FUOBE_DEMO_PRICED=1."+ },+ {+ "key": "acc-9",+ "title": "Core: exact settlement (compare-and-set terminal writes, cancel from the provider's answer, stopped steps, debt-free capture)",+ "mode": "core",+ "effort": "large",+ "dependsOn": [+ "acc-8"+ ],+ "brief": "Sections: §7.12 (settlement, holds over time, re-pricing, provider out of funds, orphans), screens §S4.9.\nFiles: src/server/generations.ts (update() L149 CAS for terminal transitions; cancelGeneration L1641; overdue and timeout branches; submit cancel-on-arrival; launchStored re-reserve; 'canceling' status; 'stopped' dispatch state; orphan entries); src/server/providers/{fal.ts, replicate.ts, comfyui.ts} (cancel returns removed, requested, completed or aborted; insufficient-funds detection); src/server/meter/meter.ts (hold state machine, settle:<hold> key, LLM hold expiry); src/lib/types (status canceling); generation card and chain card components (Stop copy, stopped state with Add credits or Ask for more and Continue); Assist stop message; schedules pause.\nBehaviour: Exactly one settlement per hold; release only when the job provably never ran; otherwise keep polling and capture what ran; Fuobe-side failures after provider success capture; fal or Replicate out of funds pauses that provider and alerts admins; holds on live rows never expire by age; a higher re-price at launch reserves the difference or stops the step (never fails it); Continue re-runs admission for stopped steps only; stopped steps cancel after 7 days.\nTests: per-provider cancel states (queued, in progress, already completed, aborted, interrupted); cancel against success with injected delays in persist and postProcess gives exactly one settle entry and a matching status; re-price above budget stops the step and Continue resumes it; LLM hold expiry captures the maximum; insufficient funds pauses the route; Stop copy on running jobs.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; cancel and retry flows in library-flows and cinema e2e; Personal USD caps."+ },+ {+ "key": "acc-10",+ "title": "Core: runner seams (launch collector, postProcess, live source, idempotency, one price formatter, housekeeping)",+ "mode": "core",+ "effort": "large",+ "dependsOn": [+ "acc-9"+ ],+ "brief": "Sections: §7.18, §7.12 (request idempotency, display), §7.11 (housekeeping registry).\nFiles: src/server/generations.ts (launch() replacing void submit at L777 and L1117; launchStored; postProcess before L1481), src/server/training.ts L221; src/server/access/route.ts (per-request launch collector); src/server/live.ts (pluggable source, typed events); db migration for request_keys; src/lib/api.ts and bin/lib/client.mjs (Idempotency-Key per click); src/server/mcp.ts (key from session and tool-call id); new src/lib/price-display.ts replacing costLabel (composer.ts L971), formatCost (format.ts), formatUsd (cinema/money.ts), the Faceless usd() and the 51 inline sites, plus server strings (assist-schedule.ts L275, assist/context.ts L54, assist/tools.ts L59-65, cinema-generate.ts L130); src/instrumentation.ts housekeeping registry.\nBehaviour: With no gate claiming launches the order and timing are identical to today; postProcess is a no-op by default; request_keys inserted pending in the reserve transaction (409 IN_PROGRESS while pending, replay after, 422 for a different body, 24 h); one formatter for every price label; housekeeping deletes per §7.11.\nTests: collector parity; launchStored equals advanceDependents; postProcess no-op timing; idempotency replay, 409 and 422; price-display sweep with byte-identical USD labels in Personal and Studio; housekeeping retention.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; composer-flows e2e price labels; Assist and MCP price text."+ },+ {+ "key": "acc-11",+ "title": "Core: sign-in pages, sign-up policy, mailer, consents and the notifications store",+ "mode": "core",+ "effort": "large",+ "dependsOn": [+ "acc-10"+ ],+ "brief": "Sections: §7.1 (allowlist adds sign-up with the policy), §7.2 (throttles, 423 rules), §9.1 (policy, domain trust only for checked addresses), §7.14 (notices), screens §S2 and §S12.\nFiles: package.json (nodemailer per §5.2 rule); new src/server/identity/policy.ts, src/lib/webmail-domains.ts, vendored disposable list and password blocklist; new src/server/mail/{mailer.ts, outbox.ts, templates/*}; db migration for consents, notifications, mail_outbox; src/server/identity/auth.ts (emailOTP, socialProviders, genericOAuth from settings); pages src/app/login, /register, /verify, /reset, /reset/[token]; new src/components/auth/*; /api/public/sign-in-options; /api/auth/forgot*; src/proxy.ts OPEN additions; new src/server/inbox.ts (notify(), no UI yet).\nBehaviour: open, approval, invite and closed policies with domain lists; open needs email checks or Google/OIDC only; domain auto-approve only for checked addresses; uniform answers for existing emails; per-account throttle keyed by email hash; password-only 423 with the 24 h and passkey/second-factor/reset lifts; global soft throttle; SMTP, log or none transports with an outbox and retries at 1, 5 and 30 minutes; consents append-only through recordConsent; inbox.notify() writes notifications and email copies for requests, decisions, exports, deadlines and alerts.\nTests: signup-policy matrix; open-without-email refusal; unverified domain address stays pending; uniform sign-up answer; throttle by email hash and 423 lifts; OTP stored hashed; consents append-only; outbox retries; e2e sign-in pages at 390 and 1440 px, light and dark, keyboard and role=alert.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the Personal one-field login; /login redirects to / in Just me."+ },+ {+ "key": "acc-12",+ "title": "Core: install invites, approval queue and admin actions on people (with the target-role matrix and notices)",+ "mode": "core",+ "effort": "medium",+ "dependsOn": [+ "acc-11"+ ],+ "brief": "Sections: §7.3 (who may act on whom), §9.1 (invites, approval, no-email reset links), §7.14 (notices to the person), screens §S2.5 and §S6.3.\nFiles: invites table usage and /api/invites/*; page /invite/[token]; approval queue API; /api/admin/people/[id]/* (approve, disable, enable, reset email or link, sign out everywhere, role, transfer ownership); src/server/identity/admin-ops.ts (target matrix enforced in one place).\nBehaviour: Invites by email or copyable link, 72 h, single use, resend invalidates, 5-minute resend guard, daily limits, roles limited to what the inviter may assign, admin-role invites need a checked email; approvals; admin actions follow the matrix (nothing targets the owner; admins and staff need the owner); reset emails and links never clear two-step or passkeys; Platform staff never get links; the target always gets an Inbox notice and an email when mail works.\nTests: invite lifecycle (expiry, resend, wrong account, used, revoked, unknown); role x action matrix; reset keeps two-step; notices written; audit entries.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the owner's own sign-in; FUOBE_PASSWORD break-glass."+ },+ {+ "key": "acc-13",+ "title": "Core: recovery, Inbox, account menu, Confirm it's you, the account page and the member welcome",+ "mode": "core",+ "effort": "large",+ "dependsOn": [+ "acc-12"+ ],+ "brief": "Sections: §7.15 (recovery), §7.2 (step-up), §7.10 (tokens), screens §S2.6, §S3 and §S4.1.\nFiles: bin/fuobe.mjs and bin/lib (local recover mode reading FUOBE_DATA_DIR), FUOBE_RECOVER at boot; /api/recover/{verify,finish}; page /recover; Inbox bell in the sidebar header and PhoneBar (src/components/app-sidebar.tsx, phone-bar.tsx), /api/me/inbox and /api/me/inbox/read; account menu in the sidebar footer (L386-428) and the phone avatar sheet; new src/components/ui/responsive-dialog.tsx; Confirm it's you dialog with session_step_up; /settings/account (profile, avatar upload, email change, sign-in, devices via /api/me/sessions, tokens with name, scope, expiry and pin, your keys, notifications, appearance) including the Just me variant; Home member welcome card replacing GetStarted for non-admins.\nBehaviour: Recovery file 0600 with a 60-bit code, 30 minutes, 5 tries, printed path; redeem at /recover#CODE with a Strict cookie; the Inbox is reachable from a bell with an unread badge; devices never expose session tokens; tokens are created only from a browser session or the local actor; the welcome card per §S3.6.\nTests: recovery (file mode, tries, expiry, no server call from the CLI); inbox read and mark all; devices list contains no tokens; token scopes and pin; ResponsiveDialog layout at 390 px; keyboard and screen-reader checks.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Settings → Security token list and MCP snippet (reused); fuobe login with a pasted token."+ },+ {+ "key": "acc-14",+ "title": "Core: first-run setup (owner's first screen, setup code at commit, wizard registry) and headless setup",+ "mode": "core",+ "effort": "large",+ "dependsOn": [+ "acc-13"+ ],+ "brief": "Sections: §7.9 (first screen, setup code, steps, headless, Platform availability), §6.3, screens §S1.\nFiles: src/app/setup/** pages; /api/setup/{code,account,draft,finish}; setup code writer and terminal lines in src/instrumentation.ts; step registry; headless env in bootstrap; src/proxy.ts setup gate activated for fresh installs; tests/e2e/_server.mjs, tests/e2e/_routes.mjs (AUTH_ROUTES), README browser-checks section (FUOBE_MODE=personal FUOBE_DEMO_MODE=on).\nBehaviour: Fresh installs open on Just me or Create your account; the code travels in the fragment, is asked only at commit, is throttled after 5 misses and never rotated on failures; the Platform card is disabled until acc-57 (FUOBE_DEV_PLATFORM for development); Studio recommended settings preselect open with the owner's work domain, falling back to approval without mail or Google; Finish deletes the code file and does a full load.\nTests: setup-code throttle and no rotation; fragment carried and removed; Just me finishes in one click from the link; Create account for Personal and Studio; Platform card disabled; recommended settings with and without mail; headless matrix and its one-line errors; e2e setup-wizard at 390 and 1440 px light and dark.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; existing installs (setup.state=done); the e2e harness on a fresh data dir."+ },+ {+ "key": "acc-15",+ "title": "Core: mode switch, Settings → Access and the settings visibility matrix",+ "mode": "core",+ "effort": "medium",+ "dependsOn": [+ "acc-14"+ ],+ "brief": "Sections: §7.9 (switching), §7.8, screens §S0.3 and §S4.4.\nFiles: new src/server/mode-switch.ts (canLeave and onEnter registries, dormancy, snapshot first); /api/access/*; /settings/access core sections (mode card, Require sign-in, who can join, sign-in methods, email, site address, time zone, share links); the settings sub-nav registry driven by the visibility matrix; src/components/settings-form.tsx (StatusStrip only on General for admins; members see Managed by your admin).\nBehaviour: Owner-only switching with a fresh session and a snapshot; Personal to Studio or Platform needs a checked owner email and a non-loopback address; Studio or Platform to Personal makes others dormant and keeps the owner's access to every team space; Require sign-in on and off in Personal with honest copy; env locks show Set by the server.\nTests: mode-switch round trip with snapshots and dormancy; Require sign-in on and off; visibility matrix per mode and role; e2e access page at 390 px.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Just me after turning sign-in off again; the owner's library after a round trip."+ },+ {+ "key": "acc-16",+ "title": "Core: admin console core (/admin shell, Overview, People and the person page, Usage & limits)",+ "mode": "core",+ "effort": "medium",+ "dependsOn": [+ "acc-15"+ ],+ "brief": "Sections: §7.3, §9.1, screens §S6.\nFiles: src/app/admin/** (layout with the nav registry and Select under 768 px, Overview registry, People list with tabs Active, Waiting, Invited, Turned off, /admin/people/[id] with Overview, Usage, Devices and Tokens tabs, Teams read-only list, Usage & limits with CSV, default limit, unknown-price switch and limit requests); ⌘K entries in src/components/command-palette.tsx.\nBehaviour: Admins see people, spend and requests; members get 404; every action uses acc-12's actions; CSV has a byte-order mark and a formula-injection guard.\nTests: admin permissions (404 for members and auditors where not allowed); CSV injection guard; limit request approve and decline; e2e admin pages at 390 and 1440 px.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Settings pages for the Personal owner."+ },+ {+ "key": "acc-17",+ "title": "Core: teams and sharing (team workspaces, switcher, Saving-to chip, Move, Share, Duplicate, Library spaces, team keys and limits)",+ "mode": "core",+ "effort": "large",+ "dependsOn": [+ "acc-16"+ ],+ "brief": "Sections: §7.5 (all rules), §9.3, §7.13 (link re-checks on move and leave), screens §S5.\nFiles: /api/workspaces/* (create, members, invites with the beforeJoin seam, leave, transfer, delete or archive); Create team dialog; /teams/[slug]/settings (Members, Keys & limits, General); full /admin/teams; the switcher in the account menu and ⌘K; the Saving-to chip in src/components/studio composers; /api/move, /api/grants, /api/duplicate; the share dialog section; src/components/library-view.tsx (space control above the tab strip; Shared renamed Links); team keys and limits in the meter; team policies for links, brand kits and copying out; the Editor label.\nBehaviour: Several teams per person; roles with the last-owner guard; Move out of a team needs a team admin; grants need Editor and can't exceed the granter's level; Studio people picker limited to people who share a team; deleting a team moves or archives and returns likeness and voice elements; links re-checked on move and leave; new tabs start in the last-used space.\nTests: teams.test.ts (semantics, last owner, transfer, leave, delete); IDOR with roles; cross-space 409; move-out rule; grant level cap; e2e accounts (invite, isolation, share, team move, limit line, sign-out cache, new tab keeps the space).\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the Library tabs for a person with no team (no space control shown)."+ },+ {+ "key": "acc-18",+ "title": "Personal: access and remote use (address checks, other addresses, trusted proxy, remote guide, Just me honesty)",+ "mode": "personal",+ "effort": "medium",+ "dependsOn": [+ "acc-15"+ ],+ "brief": "Sections: §8 (Just me rules, Access and remote use), §7.2 (trusted proxies), screens §S4.4.\nFiles: new src/server/access.ts (allowedHosts, trustProxy) read by src/server/auth.ts crossSite and hostAllowed, trustedOrigins, the throttles and the client IP; new src/server/net-info.ts; /api/access, /api/access/diagnostics, /api/access/sign-in; src/lib/site-address.ts; /settings/access Personal sections and the remote guide; the other-device banner; uqr 0.1.3; docs/remote-access.md.\nBehaviour: Other addresses refuse *, wildcards, ranges and public suffixes; Just me refuses forwarded requests from non-private addresses unless a trusted proxy is set; /api/identity/* unmounted in Just me except sign-in-options; the detected client IP shown; quick tunnels refused in Just me; Cloudflare Tunnel and Caddy recipes only with sign-in on.\nTests: access-settings; runtime-auth extension (tunnel refusal, private ranges incl. 100.64.0.0/10); e2e personal-access.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; hosts that pass today's hostAllowed; FUOBE_ALLOWED_ORIGINS wins; /s/ framing."+ },+ {+ "key": "acc-19",+ "title": "Personal: two-step sign-in and passkeys for every account in every signed-in mode",+ "mode": "personal",+ "effort": "large",+ "dependsOn": [+ "acc-13",+ "acc-18"+ ],+ "brief": "Sections: §8 (two-step and passkeys), §7.2 (step-up), §7.15 (recovery checkboxes), screens §S2.2, §S2.6 and §S4.2.\nFiles: package.json (@better-auth/passkey matching better-auth, @simplewebauthn/browser 13.3.0); src/server/identity/auth.ts (twoFactor and passkey plugins, allowlist entries, freshness hooks, 10-passkey limit); db (frozen auth_two_factor, auth_passkey; totp_seen; session_mfa); verify-2fa restricted kind; the login shim forwards twoStep; admin-ops resetTwoFactor and removePasskeys; /login code step and passkey button; /two-step?mode=session; Account sections Passkeys and Two-step with the setup dialog; passkey option in Confirm it's you; /recover checkboxes.\nBehaviour: TOTP with replay guard, backup codes, trusted devices 30 days; passkeys with rpID and origin from the site address and user verification required; restricted verify-2fa after OAuth or SSO; recovery may turn off two-step and remove passkeys.\nTests: passkeys-two-step (CDP virtual authenticator); replay guard; verify-2fa after OAuth; recovery checkboxes; e2e personal-signin.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; password-only sign-in for people without two-step."+ },+ {+ "key": "acc-20",+ "title": "Personal: new-sign-in alerts",+ "mode": "personal",+ "effort": "small",+ "dependsOn": [+ "acc-13"+ ],+ "brief": "Sections: §8 (alerts), screens §S3.4.\nFiles: session.create.after alert rule (90-day label memory, security.sign_in_alerts); new-sign-in mail template; banner component in the studio layout; Devices switch and IP display.\nBehaviour: Banner when another session is newer than this browser saw; email only for a label unseen in 90 days and only with a checked email and mail.\nTests: alert decisions; e2e second browser context sees the banner.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; sign-in speed (the rule runs after the session is created)."+ },+ {+ "key": "acc-21",+ "title": "Personal: backup and move (snapshots, full archives, fuobe backup and restore)",+ "mode": "personal",+ "effort": "large",+ "dependsOn": [+ "acc-15"+ ],+ "brief": "Sections: §8 (backup and move), §7.16 (no live credentials in copies), screens §S4.5.\nFiles: new src/server/backup/{schedule.ts, tar.ts, archive.ts}; /api/backups and /api/backup/* (owner); data/server.pid written in register(); /settings/backup and the General summary; /setup/restore; bin/lib/tar.mjs; fuobe backup and fuobe restore commands; docs/moving.md.\nBehaviour: Weekly snapshots keep 4 (Platform daily keep 7, set by acc-55); full archives on demand with single-use 60-second download tickets; in Studio and Platform a full archive needs a reason, is audited and notifies admins; restore only with the server stopped, into .restoring-<UTC>, checksum verified; session and verification rows never included.\nTests: backup schedule and pruning; tar safety (no absolute paths, no links, allowlisted prefixes); checksum; fingerprint carried; restore signs everyone out; e2e personal-backup (TOTP survives the move).\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the core snapshot names; zip downloads."+ },+ {+ "key": "acc-22",+ "title": "Personal: browser-approved fuobe login and token expiry warnings",+ "mode": "personal",+ "effort": "medium",+ "dependsOn": [+ "acc-13"+ ],+ "brief": "Sections: §8 (CLI login), §7.10, screens §S4.6.\nFiles: db cli_connect_requests; /api/cli/connect, /api/cli/connect/poll (public, rate-limited), /api/cli/connect/[code], approve and deny (session only); /settings/account/connect-cli; bin/fuobe.mjs login (--no-browser, --paste); X-Fuobe-Token-Expires header.\nBehaviour: The page shows the code, the requesting IP and user agent and the time; default scope Generate only; approval needs a fresh session; 10-minute requests; tokens delivered once and wiped.\nTests: cli-connect (expiry, single delivery, rate limits, session-only approval); cli login; e2e personal-cli.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; fuobe login with --token and FUOBE_TOKEN."+ },+ {+ "key": "acc-23",+ "title": "Personal: the first minute and everyday spend",+ "mode": "personal",+ "effort": "small",+ "dependsOn": [+ "acc-15"+ ],+ "brief": "Sections: §8 (first minute and spend), §7.12 (display), screens §S1.1 and §S4.3.\nFiles: terminal setup lines; Personal copy on /setup steps; src/components/get-started.tsx autofocus and toast; the footer spend row in app-sidebar.tsx; Personal usage labels and usage.csv; the 402 copy for the personal cap; tests/e2e/_server.mjs timing helper.\nBehaviour: A first demo result in under 60 s from a fresh install; 'Spent ≈ $12.40 this month' in the footer when paid engines are on; the personal cap line with Change limit.\nTests: personal-first-run; e2e personal-setup with the 60 s budget.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the Get started guide for admins."+ },+ {+ "key": "acc-24",+ "title": "Studio: team directory, team home, visibility and join requests",+ "mode": "studio",+ "effort": "large",+ "dependsOn": [+ "acc-17"+ ],+ "brief": "Sections: §9.3 (directory, visibility), screens §S7.1 and §S7.2.\nFiles: db team_join_requests, notice_sends; new src/server/teams/directory.ts; /api/teams/directory, join, join-requests, summary; ?space on list routes; /teams and /teams/[slug]; team settings join and visibility; /admin/teams Team rules; Studio Inbox kinds.\nBehaviour: Private teams answer 404 to non-members; Listed teams take requests that expire after 30 days; Open teams join at once with the join role; the team home shows sections with empty-state copy for a new team.\nTests: teams-directory; space filter; e2e studio-teams.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Personal (inert); core teams."+ },+ {+ "key": "acc-25",+ "title": "Studio: narrow-only team policies and team Assist connectors",+ "mode": "studio",+ "effort": "medium",+ "dependsOn": [+ "acc-24"+ ],+ "brief": "Sections: §9.4 (team policies), §7.10 (team connectors only in team chats).\nFiles: new src/server/teams/policies.ts (resolvePolicy); the team narrower registered in src/server/entitlements.ts; assist_connectors.workspace_id; team policies route; the Policies tab.\nBehaviour: Models, engines, public links, brand-kit editors, connectors, two-step and retention per team, always the narrower of install and team; prepare(), MCP and Assist read offered().\nTests: team-policies (narrowing never widens); connectors offered only in team chats.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; install model switches."+ },+ {+ "key": "acc-26",+ "title": "Studio: one fair queue for Studio and Platform",+ "mode": "studio",+ "effort": "large",+ "dependsOn": [+ "acc-17",+ "acc-10"+ ],+ "brief": "Sections: §9.4 (fair queue), §10.3 (Platform pools, added by acc-39), §7.12 (holds never expire on waiting rows), screens §S7.8 and §S4.9.\nFiles: generations dispatch columns; new src/lib/gpu-fair.ts (pure pick and positions); src/server/gpu/service.ts; src/server/queue/dispatcher.ts as a launch gate; policy hooks for weight and concurrency; /admin/gpu Waiting, Shares and Settings; card lines and Run on cloud instead.\nBehaviour: Weighted fair share over GPU-seconds in 60 minutes by group then person then age; slot rule; 50 waiting per person; max wait; cancel of held rows makes no provider call; AI-Toolkit trainings counted; Personal submits directly.\nTests: gpu-fair (pure); gpu-dispatcher; one open training per person per pool.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Personal submit timing; ComfyUI binding tests."+ },+ {+ "key": "acc-27",+ "title": "Studio: GPU server registry (pools, team pins, probes, sticky routing, drain)",+ "mode": "studio",+ "effort": "large",+ "dependsOn": [+ "acc-26"+ ],+ "brief": "Sections: §9.4 (GPU pool), §7.7 (prefix and cleanup per server), screens §S7.8.\nFiles: db comfy_servers; src/server/providers/comfyui.ts takes the server id for upload, poll, history and cancel; LoRA folders per server; probes and capability matching; /admin/gpu Servers section; team Policies read-only row.\nBehaviour: An empty table means today's comfyui.url and isolatedUrl; least-loaded and warm routing; pins; drain; token warning; removed server fails its rows with a run-again message.\nTests: gpu-pool; existing comfyui binding tests unchanged.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the isolated worker routing."+ },+ {+ "key": "acc-28",+ "title": "Studio: approvals for runs over a threshold",+ "mode": "studio",+ "effort": "large",+ "dependsOn": [+ "acc-25",+ "acc-26"+ ],+ "brief": "Sections: §9.4 (approvals), §7.12 (re-price re-runs approval), screens §S7.3.\nFiles: db approval_requests; src/server/approvals.ts as a launch gate using collector hold ids; /api/approvals and the admin settings route; /approvals; requester toast and card states; menu row; mail templates.\nBehaviour: Off by default; thresholds per team and for personal spaces on studio keys; admins and own-key payers exempt; 72 h expiry; second decision 409; private runs hide the prompt.\nTests: approvals (FUOBE_DEMO_PRICED); e2e studio-approvals.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; runs below the threshold launch exactly as before."+ },+ {+ "key": "acc-29",+ "title": "Studio: usage reports, budget alerts, monthly report, pause paid runs",+ "mode": "studio",+ "effort": "medium",+ "dependsOn": [+ "acc-24",+ "acc-26"+ ],+ "brief": "Sections: §9.4 (reports and alerts), screens §S6.5.\nFiles: new src/server/meter/{reports.ts, alerts.ts, monthly-report.ts}; report routes with CSV streaming; pause-spend route; /admin/usage tabs; /teams/[slug]/usage; SVG day chart with Show as table.\nBehaviour: Reports by person, team, model, feature, engine, day and payer; alerts at 50, 80 and 100% deduplicated; monthly email on the 1st at 09:00; pausing keeps the previous limit in the audit entry.\nTests: usage-reports; budget-alerts; CSV injection guard.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; core /settings/usage."+ },+ {+ "key": "acc-30",+ "title": "Studio: two-step enforcement and session, device, network and token policies (E1)",+ "mode": "studio",+ "effort": "large",+ "dependsOn": [+ "acc-19",+ "acc-25"+ ],+ "brief": "Sections: §9.5 E1, §7.15 (Revoke everything), screens §S7.4.\nFiles: new src/server/identity/two-step.ts (required, deadline) with the enroll-2fa kind; /two-step/setup; session_activity; absolute and idle checks; device cap; networks through trustProxy(); tokens.max_days; Sign out everyone and Revoke everything; admin reset two-step (owner); /admin/security; /setup/security; the team two-step row; the idle warning dialog and draft restore.\nBehaviour: Required for owner, admins and auditors by default with 7 days of grace; tokens refused with TWO_STEP_REQUIRED after the deadline; Platform staff registered under the same rule; networks refuse a list without your own address.\nTests: two-step enforcement; session-policies (absolute, idle, device cap, networks); Revoke everything; e2e studio-security.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; people without a policy requirement."+ },+ {+ "key": "acc-31",+ "title": "Studio: verified domains, domain capture and team auto-join (E4)",+ "mode": "studio",+ "effort": "medium",+ "dependsOn": [+ "acc-24"+ ],+ "brief": "Sections: §9.5 E4, §9.1 (checked addresses only).\nFiles: db domains, team_auto_join; src/server/identity/domains.ts with an injected resolver and the daily recheck; autoJoin on every activation path; /admin/domains; Auto-join card; capture switch.\nBehaviour: TXT verification, lapse after 3 misses, owner manual verification with a reason; capture and auto-join only for checked addresses; each domain bound to at most one connection.\nTests: domains; auto-join (unverified address never joins).\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; invites and approval."+ },+ {+ "key": "acc-32",+ "title": "Studio: company sign-in with OIDC and SAML (E2)",+ "mode": "studio",+ "effort": "large",+ "dependsOn": [+ "acc-30",+ "acc-31"+ ],+ "brief": "Sections: §9.5 E2, §7.1 (cross-site exemption, no issuer origins), screens §S7.5.\nFiles: package.json @better-auth/sso (same version as better-auth); db sso_connections and frozen auth_sso_provider; src/server/identity/sso.ts (defaultSSO, resolveUser, after-hooks, group sync, enforcement, RelayState cookie); CROSS_SITE_EXEMPT registration; /admin/sso and the editor; /login/sso; /api/public/sso-route; /setup/sso; env connection.\nBehaviour: Owner-only connection changes with a test; bound domains; auto-link only to credential-less accounts and never to privileged ones; issuer and subject keys; SAML only with a matching RelayState cookie; require-company-sign-in with break-glass.\nTests: sso-oidc (mock IdP); sso-saml (samlify test IdP, signature wrapping cases); login CSRF refused; proxy cross-site exemption exact; e2e studio-sso.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; password sign-in for break-glass people."+ },+ {+ "key": "acc-33",+ "title": "Studio: SCIM 2.0 provisioning owned by Fuobe (E3)",+ "mode": "studio",+ "effort": "large",+ "dependsOn": [+ "acc-32"+ ],+ "brief": "Sections: §9.5 E3.\nFiles: db scim_tokens, scim_groups, scim_group_members; new src/server/scim/*; /api/scim/v2/{ServiceProviderConfig,ResourceTypes,Schemas,Users,Groups} with access 'scim'; proxy OPEN and bearer skip for fuobe_scim_ tokens; admin routes; /admin/provisioning; Okta and Entra fixtures.\nBehaviour: SCIM touches only people it provisioned and never install roles or the owner; SCIM-managed accounts use company sign-in only; groups map to teams and roles; delete turns off; the safety brake.\nTests: scim-users, scim-groups (filters, PATCH quirks, error format); scope refusals; brake; e2e studio-scim.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; people created by invite or sign-up."+ },+ {+ "key": "acc-34",+ "title": "Studio: audit viewer, export, retention and the Auditor role (E5a, shared by Platform)",+ "mode": "studio",+ "effort": "medium",+ "dependsOn": [+ "acc-24"+ ],+ "brief": "Sections: §9.5 E5a, §7.14 (chain), screens §S7.7.\nFiles: audit indexes; the auditor role registered; src/server/audit-query.ts; audit labels with a group registry; streamed CSV and JSONL export; retention sweep; optional HTTPS sink; /admin/audit; team Activity; person Activity tab.\nBehaviour: Plain sentences, chips, details sheet, chain verification banner, retention 90 days to 7 years, team Activity without IP addresses.\nTests: audit-viewer (filters, export, chain, retention entry).\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; core audit writes."+ },+ {+ "key": "acc-35",+ "title": "Studio: data lifecycle (export, deletion and restore, purge manifest, retention, legal hold, privacy holds, view-as) (E5b)",+ "mode": "studio",+ "effort": "large",+ "dependsOn": [+ "acc-34",+ "acc-25"+ ],+ "brief": "Sections: §9.5 E5b (purge manifest table), §7.3 (view-as rules), screens §S4.8 and §S7.7.\nFiles: db export_jobs, access_grants, privacy_holds; src/server/data/{exports.ts, deletion.ts, retention.ts, legal-hold.ts, view-as.ts}; restore-account and view-as kinds; files read under an active grant; /settings/privacy; /account/restore; /admin/data; person Delete and Open library.\nBehaviour: Exports in parts with a manifest; deletion with 30-day grace and restore; the purge manifest including LoRA files, datasets, GPU server copies, provider copies and ComfyUI history; retention previewed with a 7-day first run; legal hold 423; privacy holds override purges; view-as read-only, reasoned, notified, 30 minutes.\nTests: exports; deletion and restore; purge-manifest coverage (fails on an unclassified table or file area); retention; view-as.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Trash purge timing in Personal."+ },+ {+ "key": "acc-36",+ "title": "Studio: full seats and free view-only accounts (E6)",+ "mode": "studio",+ "effort": "medium",+ "dependsOn": [+ "acc-33"+ ],+ "brief": "Sections: §9.5 E6, screens §S7.6.\nFiles: users.seat, seat_requests; seats.assign in BEGIN IMMEDIATE on every activation path; the view clamp in effectiveTeamRole; /admin/seats; view-only states; FUOBE_SEATS.\nBehaviour: No limit by default; overflow becomes view-only; requests; 'Editor · view-only seat'.\nTests: seats including a 10-way activation race.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; people when no seat limit is set."+ },+ {+ "key": "acc-37",+ "title": "Platform: credit ledger and CreditBudget",+ "mode": "platform",+ "effort": "large",+ "dependsOn": [+ "acc-17"+ ],+ "brief": "Sections: §10.2 (units, tables, lifecycle, keys, sweeps, payer, staff record cap), §7.12 (Budget, debt), screens §S8.4.\nFiles: db credit_accounts, credit_buckets, credit_ledger (append-only triggers), credit_holds; src/server/credits/{accounts.ts, buckets.ts, ledger.ts, budget.ts, sweeps.ts}; features().credits; interim credits.free_monthly; /api/me/credits; admin adjust; the credits live event; /setup/credits (value and markup); the credits pill.\nBehaviour: Reserve by debit in spending order; capture min(hold, final) and debt for overage; release on every core path; idempotency keys; expiry sweep; nightly invariants; staff record mode capped at $50 a day.\nTests: credits-ledger (including two-process concurrency); credit-budget-paths across every release path; debt clears on top-up.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio and Personal UsdBudget."+ },+ {+ "key": "acc-38",+ "title": "Platform: credit price book (per-model rules, GPU-second and AI-Toolkit pricing, credit display)",+ "mode": "platform",+ "effort": "large",+ "dependsOn": [+ "acc-37"+ ],+ "brief": "Sections: §10.5, §7.12 (hold sizes, display).\nFiles: db price_rules, gpu_run_stats; src/lib/credits.ts creditsFor; /api/public/price-book (versioned); the Platform branch of formatPrice; credits in previews; /admin/credits; enhance and Assist credit lines; AI-Toolkit target prices.\nBehaviour: Fixed rules or usd x (1 + markup) / value with minimum and rounding; open-engine holds per §7.12; unknown prices refused unless fixed; below-cost flags.\nTests: credits-price (examples in §10.5); credit labels; unknown price refused.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; USD labels in Personal and Studio."+ },+ {+ "key": "acc-39",+ "title": "Platform: plans and entitlements engine (versions, narrower, admit checks, pools, concurrency, team pools)",+ "mode": "platform",+ "effort": "large",+ "dependsOn": [+ "acc-38",+ "acc-26"+ ],+ "brief": "Sections: §10.2 (plans), §10.3 (fields, queue pools), §7.12 (entitlements module).\nFiles: db plans, plan_versions, account_plans, entitlement_overrides, credit_limits; the plan narrower and admit checks registered in src/server/entitlements.ts; dispatcher weight and concurrency policies (Free pool, Unlimited pool, team weight x seats capped at 32, Free pool at most 25% of slots); staff plan in record mode; team pools and member caps; unlimited relaxed rules with the operator-cost ceiling; teams without a Team plan pay from the runner's credits.\nBehaviour: Plans versioned and grandfathered; every spend entry point checks entitlements after planning; queue weights per §10.3.\nTests: entitlement sweep across every spend entry point; 1,000 Free accounts against one Ultra; unlimited ceiling.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio team weights (same algorithm)."+ },+ {+ "key": "acc-40",+ "title": "Platform: plan editor, model matrix, user locks and /setup/plans",+ "mode": "platform",+ "effort": "medium",+ "dependsOn": [+ "acc-39",+ "acc-16"+ ],+ "brief": "Sections: §10.3, screens §S9.2 and §S9.4.\nFiles: /admin/plans (list and versioned editor with the publish dialog), /admin/models (plan matrix with licence chips), lock badges in pickers and studios, /setup/plans.\nBehaviour: Publishing a version keeps existing subscribers unless moved; margin check before publish; locked items show the plan they need.\nTests: plan editor validation; publish keeps subscribers; e2e admin plans at 390 px.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; model-access switches."+ },+ {+ "key": "acc-41",+ "title": "Platform: admin people with credits, staff roles and the Platform overview",+ "mode": "platform",+ "effort": "large",+ "dependsOn": [+ "acc-40",+ "acc-34"+ ],+ "brief": "Sections: §10.7 (staff roles and caps), screens §S9.1 and §S9.3.\nFiles: billing, moderator and support roles registered; Platform nav groups and Overview tiles; person Credits tab and Adjust credits with role caps; audit groups added to E5a; SVG charts.\nBehaviour: Caps per role (support 500, billing 10,000 credits per action); every adjustment audited with a reason and notified to the customer.\nTests: permissions matrix per staff role; adjustment caps.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio admin console."+ },+ {+ "key": "acc-42",+ "title": "Platform: credit codes and redeem, plan requests, bans, consent-based support access",+ "mode": "platform",+ "effort": "medium",+ "dependsOn": [+ "acc-41",+ "acc-35"+ ],+ "brief": "Sections: §10.1 (code limits), §10.7, §7.3 (view-as by consent), screens §S8.5, §S9.5 and §S9.8.\nFiles: db credit_codes, credit_code_redemptions, plan_requests, user_bans; /redeem; /admin/codes credit tab; /admin/bans; ban refusal codes; support access as an access_grants consent mode with an owner emergency path.\nBehaviour: Codes shown once; first-time and per-card limits; ban effects (sessions, links, subscription and credits per setting); support view-as only after the customer allows.\nTests: codes; ban effects; view-as consent and emergency audit.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio view-as policy."+ },+ {+ "key": "acc-43",+ "title": "Platform: payment core (PaymentProvider, fake provider, webhook route, event store, reconciliation, grants)",+ "mode": "platform",+ "effort": "large",+ "dependsOn": [+ "acc-41"+ ],+ "brief": "Sections: §10.4 (webhooks, grant rules, keys), §10.2 (idempotency keys).\nFiles: db customers, subscriptions, payments, payment_events, checkout_sessions, credit_packs; src/server/billing/{provider.ts, fake.ts, fulfill.ts, grants.ts, webhook.ts, reconcile.ts}; /api/billing/[provider]/webhook registered in the proxy's OPEN and cross-site-exempt registries and exempt from setup gate, Preview, dormancy, captcha and IP limits; Health event-gap alert.\nBehaviour: Raw body, signature, store then 2xx, process from the table, dedupe on event id and on object id plus type, re-fetch the canonical object; grants only for the listed billing reasons keyed by period start; reconciliation every 15 minutes and at boot; fake only with test hooks and demo mode.\nTests: billing-fake; webhook-route (raw body, duplicate events, out-of-order, missing for 4 days then reconciled); grant keys.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; no payments mode (codes and admin grants)."+ },+ {+ "key": "acc-44",+ "title": "Platform: checkout and billing pages (Checkout, success and cancel, /settings/billing, top-ups, redeem, plan requests)",+ "mode": "platform",+ "effort": "large",+ "dependsOn": [+ "acc-43"+ ],+ "brief": "Sections: §10.6, screens §S8.\nFiles: /api/billing/checkout, /billing/success, /pricing?checkout=cancelled, /settings/billing, top-up sheet, post-verification redirect to Checkout, the Request this plan flow, /setup/payments (none and fake).\nBehaviour: Success polls every 2 s for 60 s then the delayed copy; cancel returns to pricing with the note; no-payments installs show Redeem a code and Request this plan.\nTests: billing pages states; e2e platform-billing at 390 px light and dark.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; core /settings/usage."+ },+ {+ "key": "acc-45",+ "title": "Platform: plan changes, seats, dunning, refunds and disputes",+ "mode": "platform",+ "effort": "large",+ "dependsOn": [+ "acc-44"+ ],+ "brief": "Sections: §10.4 (plan changes, seats, unpaid invoice, refunds, disputes).\nFiles: src/server/billing/{changes.ts, seats.ts, refunds.ts, disputes.ts}; the change-plan sheet; team billing tab; freeze state; transactional emails; move subscribers.\nBehaviour: Upgrades start a new period and credit unused plan credits; downgrades and cancels at period end; seat adds prorated with prorated seat credits, removals at period end with no credit refund; changes refused while unpaid; refunds freeze the bucket first; disputes freeze and claw back.\nTests: upgrade on the last day; 10 seats added then removed; change while past due; partial refunds; dispute won and lost; refund racing a spend.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; plan grants from acc-43."+ },+ {+ "key": "acc-46",+ "title": "Platform: Stripe adapter (direct and Managed Payments), tax, portal, promotion codes, auto-recharge",+ "mode": "platform",+ "effort": "large",+ "dependsOn": [+ "acc-45"+ ],+ "brief": "Sections: §10.4 (Stripe direct, Managed Payments, portal, tax display, auto-recharge), §10.1 (card testing).\nFiles: package.json stripe (per §5.2 rule); src/server/billing/stripe.ts (catalog sync by lookup key with AIaaS tax codes, webhook endpoint creation, portal configuration per option, tax inclusive for consumer plans, invoices, promotion codes with first-time and card limits, auto-recharge single-flight); setup and settings UI.\nBehaviour: Every PaymentProvider method; Managed Payments changes at period end only; auto-recharge at most 3 a day and off after a failure.\nTests: billing-stripe against an HTTP double (all event types, idempotency keys, portal changes, $0 invoices).\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the fake provider for e2e."+ },+ {+ "key": "acc-47",+ "title": "Platform: public site, legal documents, re-acceptance, Coming soon and Preview access",+ "mode": "platform",+ "effort": "large",+ "dependsOn": [+ "acc-44"+ ],+ "brief": "Sections: §10 (launch states), §10.9, screens §S8.1 and §S8.2.\nFiles: cached public pages (/welcome as '/' when signed out, /pricing, /coming-soon, /legal/[slug]); registry rewrites; robots and sitemap; db legal_docs, sales_leads; templates with placeholders; the legal editor and operator checklist; accept-terms kind; OAuth consent step; waitlist; Preview access list.\nBehaviour: Pages use 'use cache' with tags and no user data; revalidateTag from route handlers; re-acceptance on new versions.\nTests: public-route matrix; legal versioning; no-horizontal-scroll for public pages.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the signed-in app shell."+ },+ {+ "key": "acc-48",+ "title": "Platform: abuse controls (captcha, breached passwords, signals, free-grant guards, throttles, rate limits)",+ "mode": "platform",+ "effort": "medium",+ "dependsOn": [+ "acc-44"+ ],+ "brief": "Sections: §10.1.\nFiles: captcha and haveibeenpwned plugins in Platform (fake captcha for tests); db account_signals, rate_limits; /api/public/device (consent-gated); free-grant guards with email normalisation and IPv4 /24 or IPv6 /64 networks; checkout throttles; new-account velocity cap; limits on public endpoints; Abuse settings.\nBehaviour: Per-IP rules only with a trusted proxy; server-side signals by default; trials and $0 invoices never grant full allowances.\nTests: abuse (farming, IPv6 networks, normalisation, trusted-proxy off).\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; sign-in for Studio and Personal (plugins load only in Platform)."+ },+ {+ "key": "acc-49",+ "title": "Platform: input safety (word list, prompt classifier, image inputs, provider flags, likeness consent)",+ "mode": "platform",+ "effort": "medium",+ "dependsOn": [+ "acc-37"+ ],+ "brief": "Sections: §10.8 (inputs, provider flags, consent), §7.7 (flags after extra).\nFiles: src/server/safety/{words.ts, prompt-check.ts, image-input-check.ts}; db moderation_checks; the admit word list; the pre-submit classifier as a launch gate; upload checks; generator safety map; payload flags; consent dialog and CONSENT_REQUIRED; /setup/safety prompt row.\nBehaviour: A check that times out or errors blocks; sexual content always blocked; likeness consent recorded in consents.\nTests: safety inputs; payload snapshot (flags after extra); classifier timeout blocks.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio and Personal payloads (flags only in Platform)."+ },+ {+ "key": "acc-50",+ "title": "Platform: output safety via postProcess, withheld results, quarantine, refunds and the CSAM workflow",+ "mode": "platform",+ "effort": "large",+ "dependsOn": [+ "acc-49",+ "acc-35"+ ],+ "brief": "Sections: §10.8 (outputs, withheld, CSAM, refund rule).\nFiles: output checkers (fal x-ailab/nsfw, local HTTP classifier) and frame sampling; db quarantine, csam_reports; holds via privacy_holds; partial re-pricing; re-check sweep; auto pause after 5 blocked in 24 h; generation card states held and blocked.\nBehaviour: Required for every engine that is on; failed or missing checks withhold; blocked results refunded until the pause rule.\nTests: safety outputs; withheld on checker error; csam-flow (quarantine, suspend, hold for 1 year).\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; postProcess no-op in other modes."+ },+ {+ "key": "acc-51",+ "title": "Platform: moderation queue, reports, NCII takedowns, DMCA, strikes, statements of reasons and appeals",+ "mode": "platform",+ "effort": "large",+ "dependsOn": [+ "acc-50",+ "acc-42"+ ],+ "brief": "Sections: §10.8 (reports and takedowns), screens §S9.6 and §S8.6.\nFiles: db moderation_items, moderation_actions, strikes, content_hash_blocks; pHash blocks; /admin/moderation queue; /report; /takedown; notices and appeals in /settings/privacy; banned and suspended sign-in copy.\nBehaviour: 48-hour NCII timers; repeat-infringer rule; statements of reasons; appeals for 6 months; keyboard shortcuts scoped to the queue.\nTests: moderation; e2e platform-safety.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; share pages for unaffected content."+ },+ {+ "key": "acc-52",+ "title": "Platform: provenance (C2PA signing, certificate, C2PA-safe share cleaning in all modes, badge, AI labels)",+ "mode": "platform",+ "effort": "medium",+ "dependsOn": [+ "acc-50"+ ],+ "brief": "Sections: §10.8 (provenance).\nFiles: package.json @contentauth/c2pa-node and sharp (per §5.2 rule); src/server/provenance/{sign.ts, cert.ts, badge.ts} in postProcess; keepC2pa in media-clean (all modes); AI-generated chip on share pages; settings rows; ffmpeg gate.\nBehaviour: Sign last; self-signed until a certificate is uploaded; badge only on Free.\nTests: provenance (manifest present, survives share cleaning).\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; share-file cleaning in Personal and Studio."+ },+ {+ "key": "acc-53",+ "title": "Platform: privacy defaults on the E5b engine",+ "mode": "platform",+ "effort": "small",+ "dependsOn": [+ "acc-45",+ "acc-51"+ ],+ "brief": "Sections: §9.5 E5b, §10.2 (accounting kept), screens §S4.8.\nFiles: Platform defaults: self-delete on, one export a day, subscription cancelled on delete; export extras (credits.csv, consents, notices); consent purge.\nBehaviour: Deleting cancels the subscription per the operator's refund rule; the ledger and invoices are kept pseudonymised.\nTests: privacy-platform.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio defaults."+ },+ {+ "key": "acc-54",+ "title": "Platform: worker roles, leader lease, SQLite claims, partitioned polling and cross-process live events",+ "mode": "platform",+ "effort": "large",+ "dependsOn": [+ "acc-39",+ "acc-27"+ ],+ "brief": "Sections: §10.10 (worker roles, claims, polling).\nFiles: db leases, worker_heartbeats, live_events; generation_runs.claimed_by/claimed_at/heartbeat_at; generations.last_polled_at; FUOBE_ROLE in src/instrumentation.ts; once() and request_keys in SQLite; the live_events source; Health Queues and Workers; docs/PLATFORM.md; scripts/capacity.mjs.\nBehaviour: CAS claims before any upload; sweepInterrupted only on stale heartbeats; polling partitioned by hash(id) mod COUNT and ordered by last_polled_at.\nTests: 2 workers x 50 ready dependents give exactly 50 submissions; a web upload longer than 2 minutes is not swept; crash mid-submit and mid-persist; capacity targets.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; single-process installs (FUOBE_ROLE=all default)."+ },+ {+ "key": "acc-55",+ "title": "Platform: object storage with presigned reads, daily snapshots and the Litestream guide",+ "mode": "platform",+ "effort": "medium",+ "dependsOn": [+ "acc-21"+ ],+ "brief": "Sections: §10.10 (storage, backups, restore runbook), §7.16.\nFiles: package.json @aws-sdk/client-s3 and s3-request-presigner (per §5.2 rule); src/server/storage-driver.ts (local, s3); ensureLocal conversions; presigned 300 s redirects after the ACL; /setup/storage; backup defaults daily keep 7; archive note for bucket files; restore runbook in docs.\nBehaviour: Private reads always pass the ACL first; share files streamed through Fuobe.\nTests: storage-s3 against a local double; presigned expiry.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the local driver everywhere else."+ },+ {+ "key": "acc-56",+ "title": "Platform: analytics, price sync, reconciliation, spend guard and observability",+ "mode": "platform",+ "effort": "large",+ "dependsOn": [+ "acc-46",+ "acc-54",+ "acc-29"+ ],+ "brief": "Sections: §10.5 (price sync, reconciliation, spend guard), §10.10 (observability), screens §S9.7 and §S9.9.\nFiles: package.json @vercel/otel and peers (per §5.2 rule); rollups on acc-29 reports; fal price sync with admin approval; provider cost capture; monthly invoice reconciliation; max provider spend per hour and day; /admin/analytics; /admin/health; /api/admin/metrics; alerts.\nBehaviour: Margin per model including unlimited and blocked runs; drift alert above 5%; spend guard pauses paid cloud routes.\nTests: rollups; price sync; spend guard pause; Prometheus format.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio reports."+ },+ {+ "key": "acc-57",+ "title": "Platform: launch checklist, announcements, Studio and Platform switch hooks, headless Platform and full E2E",+ "mode": "platform",+ "effort": "medium",+ "dependsOn": [+ "acc-30",+ "acc-46",+ "acc-47",+ "acc-48",+ "acc-51",+ "acc-52",+ "acc-53",+ "acc-55",+ "acc-56"+ ],+ "brief": "Sections: §10.7 (launch checklist), §7.9 (Platform availability, switching), §13 (e2e matrix).\nFiles: launch checklist and Open to the public; db announcements, announcement_dismissals; banner and RFC 8058 email; onEnter hooks Studio to Platform and Platform to Studio; headless env (FUOBE_PAYMENTS, STRIPE_*, FUOBE_TURNSTILE_*, FUOBE_CREDIT_VALUE_USD, FUOBE_MARKUP_PCT, FUOBE_PLANS_TEMPLATE, FUOBE_LAUNCH); Email & DNS checks; platformAvailable flag on (the setup card and FUOBE_MODE=platform enabled); e2e suites and docs.\nBehaviour: Open to the public only when the 12 required items pass; Platform to Studio asks about public accounts and staff roles and is refused while subscriptions are active.\nTests: launch gating; mode-switch Platform cases; e2e platform-signup, platform-billing, platform-admin, platform-safety; the full per-role layout matrix.\nMust not break: demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio and Personal setup; FUOBE_DEV_PLATFORM still works for development."+ }+ ],+ "risks": [+ "Better Auth advisory cadence and behaviours read but not yet run",+ "SQLite single writer with two connections",+ "converting ~40 modules and 192 routes",+ "estimates drive limits in Personal and Studio",+ "guessed money defaults",+ "SAML history; defaultSSO documented for testing",+ "unencrypted archives; Personal install keys in plain text",+ "operator legal exposure in Platform",+ "classifier error rates; processor eligibility",+ "c2pa-node native binary",+ "same-day npm releases"+ ],+ "unknowns": [+ "ComfyUI core route to delete input/output files (none found)",+ "Managed Payments immediate plan changes; Stripe mechanism for crediting unused plan credits",+ "Litestream v0.5 replica encryption",+ "route handler seeing the bound address",+ "fal and Replicate billing on every failure kind",+ "cross-account use of lora_mirrors copies"+ ],+ "openQuestions": [+ "Default member limit $25, markup 50%, plan prices?",+ "Studio open limited to the owner's domain, or open to anyone?",+ "Admins see own-key spend totals per person?",+ "Encrypt full backup archives?",+ "Free tier: 50 monthly credits, daily credits, or none?",+ "View-only seats free?",+ "Community feed in Platform?"+ ],+ "sources": [+ "claude/fuobe-parity-4 @ 545ebb5 (files and lines in accounts-8.md Sources)",+ "node_modules/next/dist/docs/01-app (authentication, cache components, proxy, cookies, route, revalidateTag, cli)",+ "/home/user/ext/npm-better-auth-1.7.14, npm-better-auth-sso-1.7.14, npm-better-auth-stripe-1.7.14, npm-saml-jackson-26.2.0, comfyui-v0.43.1, owasp-asvs, owasp-cheatsheets",+ "https://registry.npmjs.org and https://api.osv.dev (2026-10-29)",+ "Higgsfield help centre, pages, Clerk environment and client bundle (parity only)",+ "Krea, Runway, Magnific, Leonardo, Kling, Midjourney, Canva, Figma, Liner pages",+ "Open WebUI, Immich, n8n, Gitea/Forgejo, Jellyfin, Nextcloud docs",+ "Stripe, Paddle, Polar, fal, Replicate docs; LibreChat, Dify, new-api source",+ "NIST SP 800-63B-4, W3C WebAuthn L3, C2PA 2.3, 18 U.S.C. 2258A, TAKE IT DOWN Act summaries, EU AI Act Art. 50 summaries, DSA, GDPR Art. 12, UCPD Art. 7, ePrivacy Art. 5(3), Ofcom letter",+ "/home/user/ext/owner-decisions.json"+ ]+}\ No newline at end of filediff --git a/docs/research/accounts-8.md b/docs/research/accounts-8.mdnew file mode 100644index 00000000..fa83311f--- /dev/null+++ b/docs/research/accounts-8.md@@ -0,0 +1,1797 @@+# Fuobe research #8: Accounts, teams, enterprise and the platform, in three modes++_As of 2026-10-29. Machine-readable twin: [`accounts-8.json`](accounts-8.json) (`modes`, `tables`, `routes`, `settingsSplit`, `plans`, `ledger`, `libraries`, `decisions`, `reviews`, `packages`, `risks`, `sources`). Every screen is specified in [`accounts-8-screens.md`](accounts-8-screens.md). It builds on [`liner-ui.md`](liner-ui.md) (the design language), [`higgsfield-delta-4.md`](higgsfield-delta-4.md) (Higgsfield's plans and credits) and [`ux-audit-4.md`](ux-audit-4.md) (the first-run guide and phone rules)._++**What was asked.** Fuobe has one optional install-wide password and no accounts. The owner said: "we also don't have authentication, register flow either", then "Own library each as well as teams features to share within the same team if users join a team - enterprise level features as well". The owner then decided that Fuobe runs in **three modes**, chosen in the first-run setup, all "done and crafted well":++1. **Personal**: one person who sets up everything (today's Fuobe; "Just me on this computer" is this mode with no sign-in).+2. **In-house studio**: a company hosts Fuobe for its people, with accounts, a private library each, teams that share inside the team, and enterprise features.+3. **Platform**: a public service like Higgsfield, with open sign-up, plans, credits, payments and an admin panel.++One codebase, one core; the mode decides what is on, and the mode can change later without losing data. The owner's answers are in `/home/user/ext/owner-decisions.json` (`accounts`, read again on 2026-10-29 before writing; §6).++**How this was produced.** Read-only. Fuobe at `claude/fuobe-parity-4` (`545ebb5`), read with `git show` and `git grep` in a worktree; line numbers below are at that commit unless marked `76ecd89` (the audit snapshot, same files). Two code audits (data and entry points), a product study of Higgsfield and eight peers, a study of self-hosted apps, auth libraries and standards, and a platform study were combined into one integrated design. Four adversarial reviews (security, engineering, money and operations, UX) then challenged it; every must-fix is applied and every should-fix is applied or rejected with a reason (§14). External pages were read as data, never run. Library tarballs (better-auth 1.7.14 and its plugins, `@boxyhq/saml-jackson` 26.2.0), ComfyUI v0.43.1, OWASP ASVS 5.0 and the OWASP cheat sheets were unpacked under `/home/user/ext/` and read, never installed. Versions and advisories were re-checked on the npm registry and OSV on 2026-10-29 (§5.2). Guesses are marked "guess".++## 1. The short version++- **Fuobe has no identity today.** One scrypt password in `data/auth.json`, a 30-day signed cookie with no user in it (`auth.ts` L107–125), install-wide API tokens, and a proxy that answers "signed in or not" (`proxy.ts` L35). None of the 43 tables has an owner, so every list, file, live event and setting is shared by whoever is signed in (§3).+- **One core, three modes.** Authentication runs on better-auth (exact pin, behind Fuobe's own seams). Fuobe owns everything else: people, workspaces, roles, grants, tokens, the data-access layer, audit, keys, the meter, entitlements and the mode switch (§7). The mode only turns features on or off; it never changes how data is stored, so switching modes moves no data (§7.9).+- **Everything belongs to a workspace.** Each person has a private personal workspace; a team is a workspace people join; sharing is a deliberate Move, Share or Duplicate. Rows nobody may see answer 404 everywhere. Four fail-closed layers stop a missed check: SQLite triggers, an actor-less DAL that throws, a route-sweep test and an IDOR matrix over path, query and body ids (§7.4–7.6).+- **The first screen is the owner's choice.** A fresh install opens on "Just me on this computer" or "Create your account" (the owner's `localUse` answer). Create your account then asks what Fuobe is for (Personal, Studio or Platform) and walks a short wizard with sensible defaults; a setup code printed in the terminal is asked for only when the owner commits (§7.9, screens §S1).+- **Who can sign up follows the owner: open.** Platform and Studio preselect "Anyone can create an account", with email checks required; Studio prefills "Only these email domains" with the owner's work domain. Approval, invite-only and closed are one click away. Domain trust only ever applies to addresses Fuobe has checked (§6, §9.1).+- **Who pays follows the owner: both, configurable.** Studio setup asks "Who pays for runs?": the studio's keys with a monthly limit per person (default $25), people's own keys, or both (own first). Personal pays with the owner's keys. Platform sells credits (§7.12).+- **One meter for every spend point.** Cloud jobs, open-engine GPU time, AI-Toolkit trainings and every Claude call reserve before they start and settle exactly once from the provider's real answer, so Cancel on a running job is charged for what ran. Budgets are dollars in Personal and Studio, credits in Platform (§7.12).+- **Studio gets the enterprise set.** Team directory and policies, a fair GPU queue, a GPU server pool, approvals, reports, enforced two-step and session policies, verified domains, company sign-in (OIDC and SAML), SCIM, an audit viewer, export, deletion, retention, legal hold and seats (§9).+- **Platform is a public service.** An append-only credit ledger, versioned plans, Stripe (direct or Managed Payments), a public site, abuse controls, an admin panel, trust and safety that blocks by default, C2PA on every output, and worker roles. Platform can only be opened to the public once its launch checklist passes (§10).+- **57 packages, one dependency order.** 17 core, 6 Personal, 13 Studio and 21 Platform. Each leaves Fuobe working in every mode with its tests; none breaks demo-mode e2e, API tokens, MCP, share links, `FUOBE_PASSWORD` or "Just me on this computer" (§16).++## 2. The three modes at a glance++| | Personal | In-house studio | Platform |+|---|---|---|---|+| Who it's for | One creator on their own machine, home server or rented GPU | A studio or company of 5–500 people on its own server | An operator selling a creative-AI service to the public |+| First screen | "Just me on this computer" (no sign-in) or "Create your account" | "Create your account" → "My studio or team" | "Create your account" → "A public service" |+| Sign-in | Off (Just me), or one password field plus passkeys and optional two-step | Email and password, Google, GitHub, any OIDC; company sign-in (OIDC, SAML); passkeys; two-step required for admins | Email and password with a code, Google, GitHub; passkeys; two-step optional for customers, required for staff |+| Who can join | Nobody else | Open, limited to the owner's work domain (preselected); approval, invite or closed | Open with abuse controls (preselected); waitlist while in Preview |+| Libraries | One library | A private library each, plus team libraries | A private library each, plus team libraries |+| Teams | No | Yes: directory, roles (Owner, Admin, Editor, Viewer), policies | Yes: team plans with pooled credits; sharing-only teams |+| Who pays | The owner's provider keys | Studio keys with a monthly limit per person, own keys, or both | Credits from plans, top-ups and codes; own keys only if the plan allows |+| Money shown as | "Spent ≈ $12.40 this month" | "≈ $12.40 of $25 this month" | "1,240 credits" |+| GPU queue | First come, first served (today) | Fair share by team weight | Fair share by plan tier; Free shares one pool |+| Admin | Settings, as today | `/admin`: people, teams, usage, GPU, approvals, security, SSO, SCIM, domains, seats, audit, data | `/admin`: plus plans, credit prices, codes, payments, moderation, bans, announcements, analytics, health |+| Safety | Provider defaults | Provider defaults, team policies | Prompt and output checks that block by default, CSAM hash matching (recommended), reports, takedowns, C2PA, AI labels |+| Data rights | Backup and move | Export, deletion with 30-day grace, retention, legal hold, view-as off by default | The same engine with Platform defaults (self-delete on) |+| Switching | Just me ↔ sign-in in Settings → Access; to Studio or Platform with a snapshot first | To Platform (asks about plans) or Personal (others go dormant) | To Studio (asks about public accounts) or Personal; refused while subscriptions are active |++## 3. What Fuobe has today++### 3.1 Sign-in and the perimeter++- **State lives in `data/auth.json`, not SQLite** (`auth.ts` L16–17): an optional scrypt password (`salt:hash`, 16-byte salt, 32-byte key, Node defaults N=16384 r=8 p=1; L80–93), an HMAC secret and API tokens. The file is written with mode 0600 through a temp file and rename (L54–60).+- **Protection is off until a password is set** (Settings → Security or `FUOBE_PASSWORD`; L1–9, L66). `FUOBE_PASSWORD` is compared by SHA-256 and `timingSafeEqual` (L87–89) and can't be changed from the UI (L98).+- **Sessions are stateless.** Cookie `fuobe_session` (L19) = `<expiry>.<HMAC(secret, expiry)>`, valid 30 days (L20, L107–125). There is no user id, no session table and no per-session revocation. Logout only deletes the cookie (`src/app/api/auth/logout/route.ts` L4–7). Changing the password rotates the secret and signs every browser out (L97–102).+- **Login throttle** (`LoginGuard`, L214–265): per client only behind `FUOBE_TRUST_PROXY=1`; otherwise every client shares one "direct" key (one try per 4 s, never locked), plus a global 20 a minute. It throttles but never lets anyone lock the owner out.+- **API tokens** are `fuobe_` + 24 random bytes; only the SHA-256 and a 12-character prefix are stored (L270–278). They have no owner, scope or expiry, and are created only from a signed-in browser (`src/app/api/auth/tokens/route.ts` L5–9).+- **The proxy** (`src/proxy.ts`, Node runtime by default per `proxy.md` L253–255): (a) a DNS-rebinding host check only when no password is set (L88–94, `hostAllowed` L190–200, which accepts `*`, L198); (b) a cross-site write block (`crossSite` L152–166); (c) public share links `/s/<token>` for GET and HEAD (L49–75), where any signed-in session counts as "the owner" (L50); (d) everything open without a password (L103); (e) `OPEN = {"/login", "/api/auth/login"}` (L10); (f) signed in = a valid cookie or bearer token (L35). It also 404s unknown record ids through `recordExists` (L21–28), a primary-key lookup.+- **No route handler checks anything itself.** All 192 `route.ts` files trust the proxy. There are no Server Actions (`git grep "use server"` finds none). The bundled Next 16 guide says the proxy is for optimistic checks only (`authentication.md` L1121) and route handlers are public endpoints (L1507).++### 3.2 Data: 43 tables, none owned++`MIGRATIONS` in `src/server/db.ts` is an append-only array of 23 SQL scripts (indexes 0–22), each applied in its own transaction and recorded in `_migrations` (L573–590). There are no foreign keys. Migrations are SQL only, so importing `auth.json` needs a JS bootstrap step.++| Group | Tables | Scope they need | Notes |+|---|---|---|---|+| The library | `generations`, `assets`, `folders`, `folder_items`, `generation_trash`, `generation_runs` | per workspace, children follow | `folder_items.generation_id` is the primary key, so a result sits in one folder (db.ts L123–128). Trash is emptied install-wide (`library.ts` L160). |+| Studio records | `cinema_*`, `canvases`, `layer_*`, `shorts_*`, `brand_kits`, `products`, `ad_*`, `marketing_runs`, `palettes`, `moodboards`, `photodump_packs`, `faceless_*`, `dub_sessions`, `katana_jobs`, `content_series`, `swap_projects` | per workspace | `palettes` mixes 50 built-ins (install catalog) with user rows. `products` and `faceless_episodes` follow their parent or own themselves. |+| Characters | `characters`, `trainings` | per workspace | @handles are unique across the install (`elements.ts` L42–48) and mentions resolve against everyone's elements (`generations.ts` L528 at 76ecd89). Deleting an element removes only the row (`elements.ts` L102–104). |+| Assist | `assist_threads`, `assist_thread_state`, `assist_projects`, `assist_project_sources`, `assist_memory`, `assist_schedules`, `assist_connectors`, `skills`, `skill_toggles` | per user (chats, memory, schedules, connectors) or per workspace (projects, skills) | `skills.name` and `skill_toggles.name` are primary keys; `assist_connectors.slug` is UNIQUE; every connector and its token goes into every chat (`connectors.ts` L96). |+| Sharing | `shares` | per user on workspace content | Creating a share checks only that the target exists (`shares.ts` L319–327). |+| Install | `settings`, `lora_mirrors`, `_migrations` | install | `settings.key` is the primary key. `lora_mirrors.hosted_url` lives on whichever provider account mirrored it. |++### 3.3 Files++- `data/files/{outputs,uploads}/<day>/<id>.<ext>`, one `assets` row each (`storage.ts` L141–167). `/api/files/[...path]` serves any path under `data/files` to anyone signed in, with `private, max-age=31536000, immutable` (`file-response.ts` L14–22, L38).+- `readRef` and `localHead` accept any asset id or `/api/files` URL (`storage.ts` L231–279), so a request body can pull another person's file into a job. Eight more call sites in seven modules read files directly with `absolutePath()` (`git grep absolutePath( -- src/server`, outside `storage.ts` and `file-response.ts`: `audio-tools.ts`, `katana.ts`, `canvas.ts`, `dub.ts`, `assist/studio-routes.ts`, `recipes.ts`, `library.ts`).+- Trained LoRAs go to `data/loras/fuobe/<handle>-<6>.safetensors` and the ComfyUI LoRA folder; AI-Toolkit datasets to `data/datasets/` (never cleaned). `attachLora` accepts any file name in those folders (`training.ts` L563–599).+- ComfyUI keeps every input (`fuobe_<nanoid8>.<ext>`) and every output (`fuobe/<workflow>_NNNNN_`, e.g. `bg-remove-birefnet.json` L18) readable to anyone who can reach it.++### 3.4 Settings++The `settings` table holds provider keys (fal, Replicate, Anthropic, civitai; `openai.key` and `google.key` are accepted but nothing reads them, `settings.ts` L26–27), ComfyUI, AI-Toolkit and Ollama addresses (server-side fetch targets), server paths (`comfyui.lorasDir`, `aitk.datasetDir`), `engine.mode`, `demo.mode`, `models.access` and `onboarding.done`, which `GET /api/status` writes during a GET (`src/app/api/status/route.ts` L24–27). `PUT /api/settings`, `PUT /api/settings/models`, `POST /api/providers/test` and `POST /api/loras` have no role check; `/api/providers/test` makes the server fetch any candidate URL. Browser state (theme, engine toggle, `fuobe.shareLinks` holding full share tokens, `fuobe:first-name`, drafts) is in unprefixed localStorage.++### 3.5 Money++- Each job stores `cost_usd`, an estimate from `estimateCost` written at creation (`generations.ts` L720 at 76ecd89) and re-priced for dependents and upscale tiers; the provider's bill is never read back. The open engine is priced at $0 (`plan.ts` L648).+- Caps already exist: Cinema `cost_cap_usd` (`cinema-generate.ts` L125–130) and Assist schedule caps (`withinCap`, `assist-schedule.ts` L270, which waits when a price is unknown).+- Unmetered Claude calls: `viaClaude` (`enhance.ts` L37) used by about a dozen call sites, the Assist stream (`agent.ts` L623–642) and Faceless `askLlm` (`faceless.ts` L215).+- The one choke points: `createGenerations` (`generations.ts` L691) and `recordLocalGeneration` (L1700) are the only inserts into `generations`; `submit` is launched with `void submit(...)` at L777 and L1117, and training at `training.ts` L221.++### 3.6 Background work++The generation runner (`ensureRunner`; 1.5 s tick, 0.5 s fast lane, 45-min run and 4-h queue timeouts), `advanceDependents` (L1028), `dropUnused` (L977), `sweepInterrupted` (L1323, 2-minute stale submit), the training poll, the Faceless sweep, the Assist schedule sweeper, Swap Studio's sweep, Content Factory's prune and the daily Trash purge all start from `src/instrumentation.ts` and act for everyone with install keys and no actor. Terminal writes are unconditional: `update()` is `UPDATE generations SET … WHERE id = ?` (L149), and `cancelGeneration` (L1641) writes `canceled` whatever the provider answers.++### 3.7 Machine clients++- **CLI** (`bin/fuobe.mjs`): REST with `Authorization: Bearer`, token from `--token`, `FUOBE_TOKEN` or `~/.config/fuobe/config.json` (0600; `bin/lib/config.mjs` L1–37).+- **MCP** (`/api/mcp`, POST only): refuses a foreign Origin (route L7–13); `handleMcp` builds `ctx() = { engine }` with no user (`mcp.ts` L40) and exposes every Assist tool.+- **Assist** calls server modules in-process with `ToolContext = { engine, thread }` (`agent.ts` L1110–1124).+- **Eval harness** reuses the CLI token and relies on `GET /api/elements/eval-price/trainings` answering for an unknown id (`scripts/eval/lib/run.mjs` L179, errors swallowed).+- No inbound webhooks exist; Fuobe polls fal, Replicate, ComfyUI and AI-Toolkit.++### 3.8 Server state that would leak between people++The live stream sends every generation change to every open stream (`live.ts` L60–82, L85–98 TEMP triggers) and the client inserts them into feeds (`generation-stream.ts` L52–57). `once(scope, id)` dedupe is keyed without the user (`shorts-schemas.ts` L97–118). Faceless voice previews reuse anyone's row (`faceless.ts` L1343–1357). The brand link-read lock is keyed by URL (`brand.ts` L1367). `assetUses` names other people's records in a 409 (`src/app/api/assets/[id]/route.ts` L8–25). React Query keys carry no user or workspace (`providers.tsx` L10–12) and Sign out is a soft navigation (`security-settings.tsx` L215–216).++### 3.9 Provider payloads++`params.extra` is accepted as `z.record(z.string(), z.unknown())` (`src/server/request-schema.ts` L100) and sent as given: the ComfyUI provider writes every extra key over the canonical bindings (`comfyui.ts` L1171) and binds non-media strings raw (L807–811); the cloud payload applies `extra` after the priced fields (`payload.ts` L422–426). ComfyUI resolves a name ending in `[output]` from its output folder (`folder_paths.py` L266–270 in ComfyUI v0.43.1). Request `loras[].file` accepts any file present in the LoRA folders (`request-schema.ts` L109–133).++### 3.10 UI we build on++The sidebar footer holds the connection status, theme and GitHub link (`app-sidebar.tsx` L386–428); `PhoneBar` holds the logo and search (`phone-bar.tsx` L21–30). Settings use a two-column `Section` (`settings-form.tsx` L22–48) and a sticky connection `StatusStrip` (L155, L241). The Library has one tab strip: All, Images, Videos, Audio, Text, 3D, Favorites, Uploads, Shared, Trash (`library-view.tsx` L49–62). The first-run guide asks for a fal.ai key and a ComfyUI address (`get-started.tsx` L114–159). `ui/sheet.tsx` has no max height or safe-area padding for bottom sheets (L65). `components/ui/avatar.tsx` exists but is unused. Cache Components is on (`next.config.ts` L5).++### 3.11 Tests that assume one owner++171 Vitest files; 39 call route handlers with a bare `Request` and about 100 call server modules directly, each with a fresh password-less data dir (`vitest.config.ts` has no setup file). `auth.test.ts`, `runtime-auth.test.ts`, `share-links.test.ts` (L255, L430, L487–583), `mcp.test.ts`, `cli*.test.ts`, `assist-schedules.test.ts`, `cinema-fixes.test.ts` and `eval-*.test.ts` encode one owner. `library.test.ts` L741–746 requires every `_json`/`_url`/`url`/`_file` column to be classified in `ASSET_REFS` or `ASSET_FREE`. The 28 e2e scripts expect a running server in demo mode with no password and call the API with plain `fetch` (README "Browser checks"); `canvas-open-dub` and `marketing-originals` change install settings.+## 4. What Higgsfield and peers do++Higgsfield's help centre (HC = `https://higgsfield.ai/creator-hub/help-center/`, 85 articles, read 2026-10-29), its marketing and team pages, its public Clerk configuration (`https://clerk.higgsfield.ai/v1/environment`, which its sign-in page loads) and its client bundle (read as text, never run) were studied for parity of product and UI only. Fuobe uses no Higgsfield model or API (the owner's standing decision).++### 4.1 Higgsfield: sign-up and recovery++- **Methods:** Google, Apple, Microsoft or email (HC `getting-started/create-an-account-and-sign-in`). The Clerk config also enables GitHub, which no article mentions (guess: hidden or used for developer flows). Email sign-up = email, password, then "a 6-digit verification code".+- **Abuse checks** in the Clerk config: Cloudflare Turnstile "smart" captcha, disposable domains blocked, `+tag` sub-addresses blocked, a blocklist; breached passwords checked (HIBP) at sign-in. The client has `VpnDetectedError`, `IpCheckRateLimitError` and "business domain verification required" errors.+- **Lockout:** 20 failed attempts lock an account for 60 minutes. Enumeration protection is off. No second factor is configured (`second_factor.required` false).+- **No consent step:** `legal_consent_enabled` false, terms URL null. Accounts are 18+ (HC sign-in article).+- **Recovery:** forgot password with a 6-digit code (email accounts only); social accounts recover at the provider; the account email can never change; Support can sign out all sessions.+- **After sign-up:** a welcome quiz path, an `/onboarding` route and timed, personalised offers with countdowns (client bundle; HC `plans/what-are-exclusive-offers`). Free has no credits, one Character generation, a watermark and no commercial use per its pricing table (blog "higgsfield-pricing-explained", 24 Oct 2026).++### 4.2 Higgsfield: account, teams and enterprise++- **Account menu:** username, plan, credits, then Credits, Top-up, Boost speed, Unlimited models, View profile, Manage Account, Increase Concurrent, Join Community, Sign Out (HC `whats-in-my-higgsfield-account`). Manage Account has Profile, Gifts, Subscription, Usage, Promocode; Usage lists every deduction with model, refunds, and MCP/CLI runs tagged.+- **Deletion:** a checklist of what is lost, Delete Account, a 30-day restore by signing back in, then permanent (HC `how-do-i-permanently-delete-my-account`). Data export is by email for GDPR and UK users only.+- **Workspaces:** types `private` and `shared`, roles owner, admin, member (client enum). Characters can be shared to the team workspace or moved. "Other members can't see your assets, but workspace owners and admins can"; Enterprise adds a "View member assets" permission. When a member leaves, their shared assets stay (HC `team-and-business-higgsfield`).+- **Team and Scale:** per-seat, each seat's credits pool into one balance; admins invite, assign roles, pause a member's credit use (Scale and Enterprise) and see usage by member. Seats can't be reduced mid-cycle without Support; only the Owner cancels.+- **Enterprise:** custom seats and credit volume, role-based permissions and user groups with per-group limits, per-user credit caps, CSV member import and usage export, SSO/SAML, "centralized user provisioning", SOC 2, no training on customer data, invoice or PO billing (HC; `https://higgsfield.ai/enterprise`). Its Clerk config has `enterprise_sso` with self-serve SSO and directory sync.++### 4.3 Higgsfield: plans and credits++- **Plans** (official blog, Oct 2026): Free $0 / 0 credits; Starter $15 / 200; Plus $49 / 1,000; Ultra $129 / 3,000; Team $79 a seat / 1,000 a seat (2–9); Scale $215 a seat / 2,500 a seat (5–15); Enterprise by contact. A second price track ($19/270, $59/1,200) is live at the same time (third-party snapshots and both variants in the client bundle; guess: A/B or cohort pricing).+- **Concurrency by plan:** Free 1, Starter 2–4, Plus 6–8, Ultra 8; Team 16 on the standard queue, Scale 32 on the priority queue. Unlimited models run on the standard queue, only on the web, for "personal, human use only".+- **Credit types and order:** subscription credits reset each cycle and don't roll over; packs, auto-refill and boost credits last 90 days; subscription credits are spent first, then whatever expires soonest (HC `credits/how-credits-work`). Failed generations refund automatically.+- **Billing:** Stripe Checkout only, taxes added at checkout, invoices for every payment, VAT IDs in the Stripe portal. Upgrades are immediate and prorated, "unused credits and unused annual months are valued and deducted", and the billing date resets; downgrades apply next cycle (HC `plans/how-do-i-upgrade-or-downgrade-my-plan`). Refunds only within 7 days of an initial purchase with zero credits used, minus up to 6%; EEA and UK buyers get 14 days. Failed renewals go past due and cancel after about 14 days.+- **Credit prices:** the exact cost shows on the Generate button; e.g. Seedance 2.0 5 s at 1080p = 60 credits; about $0.049 a credit on Plus.++### 4.4 Peers++| Product | Sign-up | Teams and enterprise | Plans and credits | Source |+|---|---|---|---|---|+| Krea | Google or email (third-party) | Owner, Admin, Member; one team per user; orgs with private, joinable or auto-join workspaces, DNS-verified domains, SAML enforcement, per-member limits where 0 blocks | Free 100 units a day; Basic $9; Pro $35; Max $105; Business $200 with per-member spend limits and model access control; packs last 90 days | krea.ai/pricing, docs teams.md, organization-management.md |+| Runway | Email code, Google, Apple; SSO on Enterprise forces domain users | Admin, Editor, Billing Admin, Viewer; viewers and billing admins take no seat | Free 125 once; Standard $15; Team $69 a seat pooled with one month of rollover; bought credits never expire | runway.com/pricing, /team-plan |+| Magnific (formerly Freepik) | Email, Google, Apple; 3 devices | Owner, Admin, Member; per-user credit limits; SSO on Enterprise | Credits valid one year | magnific.com/pricing (search snippets; 403 to fetchers) |+| Leonardo | Apple, Google, Microsoft, email; a questionnaire (third-party) | Team feed and personal feed; private generations "planned" | Team $24 or $48 a seat | intercom.help/leonardo-ai teams FAQ |+| Kling | Email, Google | Team Space: Owner, Administrators allocate credits; assets private until moved to Shared Assets | Bought credits last 2 years; failed generations refunded | kling.ai/docs/point-policy |+| Midjourney | Discord or Google | None found | Basic $10 to Mega $120; Relax unlimited from Standard | docs.midjourney.com/docs/plans |+| Canva | Apple, Facebook, Google, email | Org admin, brand designer, team owner, admin, member; SCIM, SSO and audit logs on Enterprise; approvals | Business US$250 a year per person; AI allowances per person | canva.com/help |+| Figma | Google or email with a link | Can view / can edit at file, folder, team and plan level; "Ask to edit"; SAML, SCIM, activity logs, domain capture, idle timeout, seat approval | Full seats $16/$55/$90; viewers free | figma.com/pricing, help.figma.com |+| Liner (UI reference) | 7 methods with a "Last used" badge; email code ("You can receive a one-time code in 30 seconds"); date of birth once; "Agree to all" with required and optional rows | Team $26.99 a seat; invites expire in 72 hours; "You're signed in with a different email"; Transfer ownership; an owner can't delete their account | "My credits" shows subscription credits and packs; "Credits are used in this order"; auto-recharge copy; cancel and delete flows | liner.com i18n strings; `liner-ui.md` L320–335, L579–612 |++### 4.5 What Fuobe takes and what it doesn't++- **Takes:** email code verification, Google and GitHub, a "Last used" badge, a private library by default with deliberate sharing (Kling, Higgsfield), owner/admin/editor/viewer with free viewers (Runway, Figma), per-member limits where 0 blocks (Krea), pooled team credits, credits spent soonest-expiring first, refunds on failure, the price on the Generate button, Stripe Checkout and the customer portal, a 30-day restore after deletion, Liner's invite and ownership microcopy.+- **Improves on:** two-step sign-in for everyone (Higgsfield has none), self-service data export in every mode (Higgsfield's is by email and GDPR-only), visible Downgrade and Cancel (Higgsfield hides Downgrade below the cards), admins can't see members' private work unless a policy allows it and the person is told (Higgsfield's admins can).+- **Leaves out:** countdown offers and "evergreen" timers (they fight "fast and friendly"), a hidden second price track, phone or date-of-birth questions at sign-up (Platform asks one age line), and any community feed, which the owner did not ask for (open question, §15).++## 5. How self-hosted apps do it++### 5.1 Products++| Product | First run | Sign-up and roles | Recovery without email | SSO and provisioning | Lesson for Fuobe |+|---|---|---|---|---|---|+| Open WebUI | First account becomes admin; sign-up then closes automatically | admin, user, pending (pending refused everywhere); additive groups that also act as sharing targets | Admin sets a new password; lost admin = SQL update | OIDC with role and group sync, trusted header, LDAP, SCIM with one static token; `ENABLE_MFA` | Pending state; keep permission groups apart from sharing groups |+| Immich | "The first user to register will be the admin" | Admin creates users; per-user library and quota | `immich-admin reset-admin-password` in the container | OIDC only (auto register, role and quota claims) | A per-person library, a 7-day soft delete, a CLI that reopens a locked install |+| n8n | Owner sign-up screen; owner from env since 2.17 | Invite only; projects with Admin, Editor, Viewer | Copy invite links without SMTP; `user-management:reset` wipes users | SAML, OIDC, LDAP and log streaming on paid plans | Works without email; Fuobe ships SSO in the open |+| Gitea / Forgejo | Web installer locked by `INSTALL_LOCK` | `DISABLE_REGISTRATION`, email confirm, manual confirm, domain allow and block lists, captcha | `admin user change-password`, `must-change-password` | OAuth2/OIDC auto-discovery, LDAP; `TWO_FACTOR_AUTH=enforced` | The best reference for sign-up switches |+| Jellyfin | Setup wizard | Admin-created users | "Forgot password" works only from the local network and writes a PIN file to the config folder, valid 30 minutes | Plugins | Proof of server access replaces email: Fuobe's `fuobe recover` file |+| Nextcloud | Installer or `occ maintenance:install` | Groups, sub-admins, team folders | `occ user:resetpassword` | `user_saml`, `user_oidc`, LDAP; `occ twofactorauth:enforce --group` | Enforced 2FA per group with exclusions |+| ComfyUI `--multi-user` | No accounts | The user is chosen by an unauthenticated `comfy-user` header (`app/user_manager.py` L61–62) | — | — | Outputs and the queue are shared (`server.py` L613): ComfyUI stays a backend only Fuobe talks to |++Sources: docs.openwebui.com (roles, groups, hardening, SSO, SCIM, password reset); docs.immich.app (post-install, user management, server commands, OAuth); docs.n8n.io (user management, RBAC, CLI, SAML, OIDC, LDAP, log streaming); docs.gitea.com and forgejo.org config cheat sheets and CLI; jellyfin.org/docs and `UserController.cs`, `DefaultPasswordResetProvider.cs`; docs.nextcloud.com `occ_users`; ComfyUI v0.43.1 source.++### 5.2 Libraries++**Chosen: better-auth for authentication only.** MIT (still MIT after Vercel's acquisition, announced 2026-07-07), peers `next ^16` and `react ^19`, runs on better-sqlite3 through Kysely and emits SQL Fuobe freezes into `MIGRATIONS`, has fail-closed hooks (`validateUserInfo`, `databaseHooks`, `hooks.before/after`) and a custom password hasher. Fuobe never loads its `organization`, `admin`, `api-key`, `magic-link`, `oauth-proxy`, `one-tap`, `anonymous`, `device-authorization`, `jwt`, `bearer`, `multi-session` or `username` plugins: Fuobe's DAL needs synchronous membership reads, and several of those plugins carried 2026 advisories.++Its advisory list is long (OSV, 26 entries on 2026-10-29; critical ones include GHSA-965c-763c-88jm OAuth state used as a magic link, GHSA-rjg6-39jm-rgg4 SCIM provider collision, GHSA-5rr4-8452-hf4v SSO SSRF and GHSA-xg6x-h9c9-2m83 a 2FA bypass with the cookie cache). Conditions: every `@better-auth/*` package at the same exact version, an OSV watch that blocks releases, a router-only endpoint allowlist (§7.1), `cookieCache` off, its own database connection and a schema-guard test.++**Version rule (applied when each package starts, not today):** pin the newest release that is at least 14 days old and OSV-clean; if every release that old has an open advisory, pin the oldest release that fixes all of them. Re-checked on 2026-10-29:++| Package | Newest | Rule today | Notes |+|---|---|---|---|+| better-auth (+ `@better-auth/passkey`, `@better-auth/sso`) | 1.7.14 (2026-10-26) | 1.7.8 (2026-10-14) | Every OSV advisory is fixed at or below 1.7.7. This research read the 1.7.14 files; from 2026-11-09 the rule gives 1.7.14. A package that starts earlier pins 1.7.8 and re-runs the behaviour-pin tests. |+| nodemailer | 10.3.1 (2026-10-29) | 10.1.4 (2026-10-18) | Every release at least 14 days old is affected by GHSA-85x2-q946-cp5h, -8c8m-p3m8-cjg8 and -m943-m63m-w62w (fixed 10.1.4). |+| stripe | 23.0.1 (2026-10-22) | 23.0.0 (2026-10-01) | No OSV entries. |+| @simplewebauthn/browser | 14.0.0 | 13.3.0 | The passkey plugin requires `^13.3.0`. |+| uqr | 0.1.3 | 0.1.3 | QR codes. |+| sharp | 0.35.5 | 0.35.5 | Already installed transitively; becomes direct (Apache-2.0). |+| @contentauth/c2pa-node | 0.9.11 (2026-10-27) | 0.9.9 (2026-09-30) | Needs Node ≥22 (this machine runs 22.22) and downloads a native binary. |+| @aws-sdk/client-s3, s3-request-presigner | 3.1159.0 | 3.1152.0 (2026-10-14) | |+| @vercel/otel | 2.1.4 (2026-10-29) | 2.1.3 (2026-06-11) | Plus its `@opentelemetry` peers. |++Unchanged: next 16.4.2, react 19.3.0, better-sqlite3 ^13.0.3, zod ^4.6.7, nanoid ^6.0.2 (`package.json` L38–57).++**Rejected:** extending `auth.ts` (single-password design that fails ASVS 7.4.1/7.4.2 once there are several people, and would mean hand-rolling SAML); Auth.js (v5 still `5.0.0-beta.32`, no sign-up, reset, 2FA, orgs or SAML; its maintainers now point new projects to Better Auth); Lucia (deprecated March 2025); Arctic and most of Oslo (deprecated 2026-07-29); embedding Ory Polis (about 267 packages and 161 MB, pins better-sqlite3 12.8.0 against Fuobe's 13.x, `dist/db/sql/sql.js` L78; documented as an optional sidecar instead); iron-session (stateless cookies can't be revoked); Better Auth's SCIM plugin (it can't write Fuobe's tables, so Fuobe owns `/api/scim/v2`) and its Stripe plugin (no event dedupe, no `invoice.paid`, and GHSA-h3rm-78g3-j7cp).++### 5.3 Standards that set the rules++- **OWASP ASVS 5.0** (`/home/user/ext/owasp-asvs`, `9ccce0e`): passwords of 8+ characters with 64+ allowed and no composition rules (6.2.1, 6.2.5, 6.2.9), a blocklist of at least the top 3,000 passwords (6.2.4), every authentication path equally strong (6.3.4), reset must not bypass MFA (6.4.3), admins initiate a reset but never know the password (6.4.6), lookup codes single-use (6.5.1), accounts keyed by issuer and subject (6.8.1); sessions revoked on the backend at logout, disable and delete (7.4.1, 7.4.2), people see and end their sessions (7.5.2); data-specific authorization against IDOR (8.2.2), authorization on the originating user (8.3.3), cross-tenant controls (8.4.1); every authentication attempt and failed authorization logged without secrets (16.3.1, 16.3.2, 16.2.5); scrypt N ≥ 2^17 with r=8 p=1, or the OWASP table's N=2^15 r=8 p=3 (Appendix C).+- **NIST SP 800-63B-4** (final, 31 July 2025): 15+ characters for single-factor passwords or 8+ with MFA, no composition rules, a blocklist, no periodic changes, paste allowed, at most 100 consecutive failures per account; synced passkeys acceptable at AAL2 when user verification is set.+- **OWASP cheat sheets** (Forgot Password, Session Management, Authorization, IDOR, Credential Stuffing, MFA, SAML): uniform answers and timing, hashed single-use reset tokens built from a configured base URL, `__Host-` cookies, deny by default, scoped lookups, and never hand-rolled SAML.+- **WebAuthn Level 3** (W3C Recommendation, 25 August 2026): passkey autofill with `autocomplete="username webauthn"` and conditional mediation; the RP ID must be a real domain, so passkeys need an https site address or localhost.++### 5.4 Next 16 rules (bundled docs at `node_modules/next/dist/docs/`)++- Proxy runs on the Node.js runtime and can't be configured otherwise (`proxy.md` L253–255); it is for optimistic checks, "not … your only line of defense" (`authentication.md` L1121). Route handlers are public endpoints and must authorize themselves (L1507). Fuobe keeps the proxy optimistic and authorizes in every handler.+- `cookies()` is async and can set cookies only in a Route Handler or Server Function (`cookies.md` L74).+- With `cacheComponents` on, a session read can't sit inside plain `'use cache'` (`authentication-with-cache-components.md` L309–313). Account data is read client-side or under Suspense.+- A webhook reads its raw body with `await request.text()` (`route.md` L566–590).+- `updateTag` is Server-Action-only; a route handler revalidates with `revalidateTag` (`revalidateTag.md` L142).+- `next start` binds `0.0.0.0` by default (`cli/next.md` L123), and `Host` and `X-Forwarded-For` are client-controlled. That is why setup needs a code (§7.9).++## 6. The owner's decisions++### 6.1 What the owner decided (binding, `owner-decisions.json` → `accounts`, answered 2026-10-29)++| Topic | The owner's answer | Where the plan applies it |+|---|---|---|+| Deployment modes | Three modes chosen in first-run setup, all crafted well; one codebase, one core; the mode can change later without losing data | §2, §7.9, §8–§10 |+| Sign-up | **Open public sign-up** (email check, Google sign-in), as a first-class path with verification, abuse controls and per-person limits; invite-only, owner-approved and closed stay as settings | §6.3, §9.1, §10.1 |+| Libraries | Own library each **and** teams; people may join several teams and share inside them, on purpose or by creating in the team space, on top of sharing with a person or a public link | §7.4–§7.5, §9.3 |+| Local use | The first screen offers "Create your account" or "Just me on this computer" (no sign-in, local addresses only, as today); switchable later in Settings | §7.9, screens §S1.1 |+| Paid keys | Both, configurable from setup: the owner's keys with a per-person monthly limit and spend shown to the owner, people's own keys, or both (own first, then the owner's within the limit) | §7.12, screens §S1.7 |+| Enterprise | Roles and permissions, admin console, SSO (OIDC and SAML), SCIM, verified domains and auto-join, enforced 2FA and session policies, audit log, per-team and per-member limits and reports, team keys, seats, export, deletion, retention; core first, enterprise after | §9.5, §16 order |+| Setup | After "Create your account" the wizard asks who can sign up, email verification and transport, sign-in methods with client ids, allowed or blocked domains, whether people may create teams, the paid-keys mode and default limit, and the public site address; sensible defaults; all changeable later; "Just me" skips it | §7.9, screens §S1 |+| Standing | No Higgsfield models or API; licences are information, not gates | §4, §10.3 |++### 6.2 Decisions this plan assumed (the owner can change any of them)++| Decision | Choice | Why |+|---|---|---|+| Identity library | better-auth for authentication only, behind Fuobe's seams | §5.2 |+| Teams | Fuobe-owned workspaces and members; several teams per person | Synchronous DAL reads; owner wants "a team (or several)" |+| Team role names | Stored `owner/admin/member/viewer`; a team `member` is shown as **Editor** everywhere | Avoids a clash with the install role "Member" |+| Studio join default | **Anyone can create an account**, with "Only these email domains" prefilled with the owner's work domain (empty for webmail); needs email checks or Google/OIDC; without either, setup falls back to "I approve new accounts" and says why | The owner's "open", made safe for company keys (§9.1) |+| Default member limit | $25 a month on the studio's keys, in the install time zone | Bounded company money; open question §15 |+| Sessions and passwords | 30 days rolling; 8–128 characters; a top-10,000 blocklist; scrypt N=2^15 r=8 p=3 | ASVS 6.2, OWASP table |+| Two-step | TOTP with 10 backup codes and passkeys (user-verified) for every account; required for owner, admins, auditors and Platform staff in Studio and Platform, with 7 days of grace | ASVS 6.3.3 |+| Recovery | One mechanism: `fuobe recover` (or `FUOBE_RECOVER`) writes a code to the data folder | Works without email (Jellyfin's idea) |+| Setup protection | An 8-digit setup code, asked only when the owner commits; the printed link carries it in the URL fragment | `next start` binds `0.0.0.0` |+| Platform money | 1 credit = $0.01, 50% markup over provider cost, rounded up | Guess; open question |+| Platform plans | Free 50 credits a month; Starter $10 / 1,000; Pro $30 / 3,300; Ultra $100 / 12,000; Team $25 a seat / 3,000 a seat pooled; Enterprise by contact | Higgsfield's shape; amounts are guesses |+| Platform teams without a Team plan | Allowed for sharing only; runs in them are paid from the runner's own credits | Simple and fair |+| Payments | Stripe direct, or Stripe Managed Payments as a switch, or none (codes and admin grants); a fake provider only for tests | §10.4 |+| Safety | Sexual content always blocked; 18+ by default (16 allowed; likeness features always 18+); prompt and output checks required before Platform opens; failed or unavailable checks withhold the result | §10.8 |+| Database | SQLite on one host with WAL, snapshots and Litestream; Postgres deferred with explicit triggers | §10.10 |+| Community feed | Not in this plan | Not asked for; open question |++### 6.3 Where this plan departs from the integrated design because of the owner's answers++- **Sign-up default.** The integrated design preselected "I approve new accounts" for Studio and left it as an open question. The owner's answer is open, so Studio now preselects open with the owner's work domain filled in (§9.1). Platform was already open.+- **First screen.** The design opened on a setup-code gate, then a three-card mode page. The owner's `localUse` answer says the first screen offers "Create your account" or "Just me on this computer", so that is the first screen now, and the code is asked for only when the owner commits (§7.9).+## 7. The shared core++Everything in this section exists in every mode. The mode only switches features on (§7.9).++### 7.1 Identity++**Who answers what.** Better Auth answers "who is this". Fuobe answers "what may they do, and with whose money". Fuobe code touches Better Auth's tables in three places only: `principal.ts` (through `auth.api.getSession`), people lists (a read-only join for name, email and image) and `src/server/identity/admin-ops.ts`, which writes through `(await auth.$context).internalAdapter` (`setPasswordFor`, `revokeAllSessions`, `revokeSessionById`, `setEmail`, `updateName`, `deleteAuthUser`; two-step adds `resetTwoFactor` and `removePasskeys`). Every call is audited. A test pins that `$context.internalAdapter` is reachable in the pinned version (guess until that test runs).++**Better Auth configuration** (`src/server/identity/auth.ts`):++- Mounted at `/api/identity/[...all]` with `toNextJsHandler`. Fuobe's `/api/auth/login`, `logout`, `password` and `tokens` stay as Fuobe shims, so the CLI and today's UI keep their paths.+- Its own better-sqlite3 connection to `data/fuobe.db` (WAL, `busy_timeout` 5000), cached on `globalThis.__fuobeAuthDb`. Tables are named `auth_*` (`modelName`); no `additionalFields`. `telemetry.enabled: false`.+- `secret = HKDF-SHA256(rootSecret, "fuobe", "better-auth/v1")`, where the root secret is `FUOBE_SECRET` or `data/secret.key` (32 bytes, 0600). `baseURL` = `install.site_url`, else the request origin.+- `trustedOrigins` is a registry function: `install.site_url`, `access.allowed_hosts`, `FUOBE_ALLOWED_ORIGINS`, and the request origin when `hostAllowed()` is true **in Personal only**. SSO issuer origins are never added (the SSO plugin already skips origin checks on SAML paths, `@better-auth/sso` `dist/index.mjs` L4540–4542; trusted origins also govern `callbackURL` redirects).+- **Client IP.** The proxy deletes any incoming `x-fuobe-client-ip` and writes one only when a trusted proxy is configured (§7.2); `advanced.ipAddressHeaders: ["x-fuobe-client-ip"]`. With no trusted proxy the header is absent and `advanced.ipAddress.disableIpTracking: true`, so Better Auth's limiter has no key and skips its IP rules (`dist/api/rate-limiter/index.mjs` L243). The integrated design wrote `0.0.0.0`, which makes Better Auth's rules (3 tries per 10 s on `/sign-in*` and `/sign-up*`, L305–318) one install-wide bucket that any client can fill (reviews 1 and 2).+- **Cookies.** Prefix `fuobe`. On an https site address the session cookie is `__Host-fuobe.session_token`: `advanced.useSecureCookies: false` plus `advanced.cookies.session_token = { name: "__Host-fuobe.session_token", attributes: { secure: true, path: "/" } }`, with no `Domain` (Better Auth otherwise prepends `__Secure-` to any name, `dist/cookies/index.mjs` L23–31). The same is done for every Better Auth cookie and for Fuobe's `fuobe_setup` and `fuobe_recover`. On plain http (LAN, localhost) the names have no prefix and `Secure` is off. A core test pins the names and attributes.+- **Sessions:** `expiresIn` 2,592,000 s (30 days), `updateAge` 86,400 s, `deferSessionRefresh: true` (refresh only on POST), `freshAge` 600 s, `cookieCache` off.+- **Email and password:** hash and verify from `password.ts` (§7.2); `revokeSessionsOnPasswordReset: true`. **Email OTP:** 6 digits, 600 s, 3 attempts, `storeOTP: "hashed"`, `disableSignUp: true`. `verification.storeIdentifier: "hashed"`.+- **Social and OIDC:** Google and GitHub through `socialProviders`, other OpenID providers through `genericOAuth` (PKCE on), secrets stored `enc:v1:` (§7.12). `accountLinking: { trustedProviders: [], allowDifferentEmails: false }`; Better Auth's own `requireLocalEmailVerified` defaults to true (`dist/oauth2/link-account.mjs` L140–141) and stays so. `genericOAuth` is for consumer-style buttons; company identity providers with domains, provisioning and groups go only through company sign-in (§9.5 E2), and in Studio the "Another provider" row offers to move into it once E2 ships.+- **Hooks.** `validateUserInfo` runs the sign-up policy (§9.1). `user.create.before` refuses every create whose intent is not "claim-owner", the bootstrap import, an invite, SSO, SCIM or an admin create, **unless** the install flag `accounts.multi_user` is `1`; that flag is set only by the migration of the meter package (acc-8), after isolation and limits exist. `user.create.after` links or creates the Fuobe person. `session.create.before` is a registry of `(userRow, session, path)` checks returning `{code, message, restricted?}` (core codes `ACCOUNT_PENDING`, `ACCOUNT_DISABLED`, `ACCOUNT_DORMANT`; packages add theirs). `session.create.after` is a registry too (audit, alerts, two-step marks).+- **Endpoint allowlist** in `hooks.before`, built from the loaded plugins and applied only when `ctx.request` exists (router traffic), so Fuobe's own `auth.api` calls pass. `/sign-up/*`, `/sign-in/social` and `/sign-in/oauth2/*` are **not** on the list until the sign-in package (acc-11) adds them together with the policy. Always blocked: `/delete-user`, `/update-session`, `/get-access-token`, `/refresh-token`, `/account-info`, `/change-email`, `/send-verification-email`, `/sign-in/email-otp`, `/list-sessions`, `/revoke-session`, `/revoke-sessions`, `/two-factor/send-otp`, `/two-factor/verify-otp` and the SSO provider-management routes. `/update-user` is allowed with `image` stripped (Fuobe's avatar upload is the only way to set a picture) and `name` limited to 80 characters.+- **Rate limiter** on with `storage: "database"`; IP rules apply only when a trusted proxy exists (above).+- `getAuth()` is memoised by `identity.config_version`, bumped whenever sign-in settings change.++**Fuobe's identity tables** (migration 23; Better Auth's frozen SQL is migration 24):++| Table | Columns that matter |+|---|---|+| `users` | `id` (`u_owner` or `u_` + nanoid(12)), `auth_user_id` UNIQUE, `role` (checked against the role registry; UNIQUE where `role='owner'`), `status` active, pending, disabled, deleted; `pending_reason`, `dormant`, `personal_workspace_id`, `source` legacy, env, setup, signup, invite, admin, sso, scim, unknown; `external_id`, `provisioned_email` (UNIQUE lower where no `auth_user_id`), `provisioned_name`, `invited_by`, `approved_by`, `avatar_asset_id`, times in ms |+| `workspaces` | `kind` personal, team, install; `name`, `slug` UNIQUE, `color`, `created_by`, `archived_at`, `delete_after` |+| `workspace_members` | `workspace_id`, `user_id`, `role` owner, admin, member, viewer; `source` manual, invite, join, domain, sso, scim; `added_by` |+| `invites` | token `fuobe_inv_` + 24 bytes, SHA-256 stored, 72 h, single use, `role`, `workspace_id`, `inviter_id`, `email` |+| `grants` | `resource_kind`, `resource_id`, `grantee_kind` user, workspace, email (pending); `grantee_id`, `level` view, edit; `granted_by` |+| `item_marks` | per viewer: `user_id`, `item_kind`, `item_id`, `favorite`, `pinned_at` |+| `api_tokens` | `user_id`, `workspace_id` pin, `name`, `prefix`, `hash`, `scopes` full, read, generate, admin; `expires_at`, `last_used_at`, `revoked_at`, `legacy` |+| `audit_log` | append-only (§7.14) |+| `user_settings`, `workspace_settings`, `session_step_up` | key/value per scope; step-up marks with expiry |++Seeds: `w_owner` (personal), `w_install` (install catalog), `u_owner` (unclaimed) and its membership. Better Auth plugin tables (`auth_two_factor` and `auth_passkey` in acc-19, `auth_sso_provider` in acc-32) are appended as frozen SQL by the package that loads the plugin (`scripts/auth-schema.mjs`). A schema-guard test asserts that `getMigrations(auth.options)` has nothing to create or add with the full plugin set, so a library upgrade that needs schema changes fails CI instead of changing the database at run time.++**The principal.** `resolvePrincipal(request) → Actor { userId, role, via: session|token|local|system|runner|scim, sessionId, tokenId, scopes, workspacePin, restricted?, impersonatorId? }`, memoised per request:++1. `Authorization: Bearer fuobe_…` → `api_tokens`. An invalid bearer is 401, except in Just me, where it is ignored. `fuobe_scim_…` tokens are never API tokens.+2. Session cookie → `getSession` → `users`. A missing link is created idempotently **as pending**, with no memberships and `source: unknown`, and audited; it is never created active (review 1). Inactive or dormant people get null plus the registry code.+3. Just me (Personal, sign-in off, `hostAllowed`, §8) → `u_owner` via `local`.+4. Otherwise null.++Seams: `substituteActor(actor, request)` (used by view-as, §9.5 E5b) and a registry of restricted session kinds, each with its own route allowlist: `enroll-2fa`, `verify-2fa`, `view-as`, `restore-account`, `accept-terms`.++### 7.2 Sessions, passwords and throttles++- **Passwords:** 8–128 characters, no composition rules, a vendored top-10,000 blocklist ("That password is too common. Try a longer phrase."), paste allowed. Hash: scrypt N=2^15, r=8, p=3, 64-byte key, stored `scrypt$v2$N$r$p$salt$hash`; the legacy `salt:hash` from `auth.json` (N=2^14, r=8, p=1, 32 bytes) verifies and is upgraded in place on the next sign-in. Platform adds the breached-password check (§10.1).+- **Per-account throttle** keyed by SHA-256 of the lower-cased submitted email (so unknown emails behave like known ones): 5 failures in 15 minutes → one try per 60 s. 100 consecutive failures lock **the password only** (423 `PASSWORD_LOCKED`): passkeys, recovery and an email reset still work. The lock lifts after 24 hours (the throttle stays), on a passkey sign-in, a second-factor proof or a completed reset. The answer is the same whether or not the account exists.+- **Global soft throttle:** above 60 failed sign-ins a minute install-wide, each sign-in request waits 1 s before it is answered. It never refuses (today's `LoginGuard` principle, `auth.ts` L205–213).+- **Trusted proxies.** `FUOBE_TRUSTED_PROXIES` (or Settings → Access → Behind a proxy) is a hop count (`1`, `2`) or a list of CIDRs. The client IP is the first `X-Forwarded-For` entry counting from the right past the trusted hops, or past the trusted CIDRs. `FUOBE_TRUST_PROXY=1` keeps meaning one hop. The Access page shows the IP it detects for the current request ("Fuobe sees you as 203.0.113.7").+- **Step-up:** sensitive actions (passwords, two-step, passkeys, tokens, keys, roles, mode, backups, SSO, SCIM, deletion) need a session confirmed in the last 10 minutes ("Confirm it's you", screens §S3.5). For people who sign in only with a provider, step-up re-runs the provider sign-in; the pending action (route and a non-secret draft of the form) is kept in sessionStorage under a step-up id and the dialog reopens filled after the redirect (`?stepup=<id>`).++### 7.3 Roles and permissions++**Install roles** come from a registry: `owner` (exactly one), `admin` and `member` in core; `auditor` added by the audit viewer; `billing`, `moderator` and `support` added by the Platform admin package. **Team roles:** `owner`, `admin`, `member` (shown as **Editor**), `viewer`. `effectiveTeamRole(actor, workspace)` is the only function that answers a team role: it clamps view-only seats to Viewer (§9.5 E6) and makes view-as read-only.++**Permissions** (registry; each route declares what it needs): `install.settings`, `install.mode`, `people.view`, `people.manage`, `people.roles` (owner), `usage.view_all`, `limits.manage`, `keys.install`, `teams.create`, `teams.manage_all`, `audit.view`, `data.manage`, `gpu.manage`, `approvals.decide`, `billing.*`, `moderation.*`, `support.view_as`, `credits.adjust`.++**Who may act on whom.** No admin action may target the owner. Actions on admins, auditors and Platform staff need the owner. The target always gets an Inbox notice and, when mail works, an email ("Your password was reset by {admin} on {date}.").++| Action | On a member | On an admin, auditor or staff | On the owner |+|---|---|---|---|+| Send a reset email (mail works) | admin | owner | no one |+| Create a reset link (no mail; Studio only) | admin | owner | no one (`fuobe recover`) |+| Reset two-step or remove passkeys | owner | owner | no one (`fuobe recover`) |+| Sign out everywhere | admin | owner | the owner, for themselves |+| Turn off, delete | admin | owner | no one |+| Set a monthly limit | admin | owner | — |+| Change install role | owner | owner | transfer only |+| Open a personal library (view-as, §9.5 E5b) | per policy | owner | no one |++Admin reset links and reset emails never clear two-step or passkeys (ASVS 6.4.3). Platform staff never get a reset link, only "Send a reset email". Invites may grant only roles the inviter may assign directly, and an invite for an admin role needs the invited email to be checked before it can be accepted.++### 7.4 Data scoping, table by table++Every row belongs to one workspace. A row is **visible** to an actor when any of these holds: the actor is a member of its workspace; a grant names the row or its container for the actor, for one of the actor's teams, or for the workspace the row is being used in; its workspace is `w_install`; or a live share serves it (§7.13). Otherwise the answer is 404, never 403, and the denial is audited as `denied.hidden` (at most one entry per actor and route a minute). Writes need the team role the action requires (§7.5).++Migration 25 adds `workspace_id` and `created_by` (no defaults), backfills them to `w_owner`/`u_owner`, adds triggers that refuse a NULL `workspace_id` on insert and update, and indexes `(workspace_id, created_at DESC)` and `assets(rel_path)`. Migration 26 rebuilds the tables whose keys assume one owner.++| Table | Scope | Rule | Changes |+|---|---|---|---|+| `generations` | workspace | Members and grantees see it. `created_by` and `paid_by` are always the acting person (§7.5). Chain, batch and helper steps take the root's workspace only when the actor holds Editor or more there. `favorite` and `pinned_at` move to `item_marks`; review status stays on the row. | +`workspace_id`, `created_by`, `paid_by`, `hold_id`, `dispatch_*` (Studio), `moderation_state` (Platform) |+| `assets` | workspace | Uploads and derived renders belong to the uploader in the workspace they were uploaded to; outputs follow their generation. `/api/files` authorizes through `rel_path` (§7.6). | +`workspace_id`, `created_by`; index `rel_path` |+| `folders`, `folder_items` | workspace, child | A folder, its subfolders and their results share one workspace. `folder_items` stays keyed by `generation_id`: filing an item into a folder of another workspace opens Move; grantees can't file granted items (they Duplicate). | +`workspace_id`, `created_by` on folders |+| `generation_trash` | child | Trash is per workspace; trashing a team item puts it in the team's Trash; emptying is per workspace. | +`trashed_by` |+| `generation_runs` | child | Internal. Deleted with its generation. | +`claimed_by`, `claimed_at`, `heartbeat_at` (Platform scale) |+| `characters` | workspace | @handles unique per workspace; mentions resolve per §7.5. Face elements carry their consent record. | +`workspace_id`, `created_by`; UNIQUE(`workspace_id`, `handle`) |+| `trainings` | child (element) | Follow the element; charged to `started_by`. | +`started_by`, `paid_by` |+| `cinema_projects`, `cinema_folders`, `cinema_items` | workspace, children | Co-edited by Editors. Takes made by anyone are created in the project's workspace. "My Generations" lists only visible projects (`cinema.ts` L448–461 at 76ecd89). | +`workspace_id`, `created_by` |+| `canvases` | workspace | Co-edited (last write wins, as today). Duplicate creates the copy in the chosen workspace. | +`workspace_id`, `created_by`, `edited_by` |+| `layer_projects`, `layer_versions` | workspace, child | | +`workspace_id`, `created_by`; versions +`created_by` |+| `shorts_sessions`, `shorts_presets` | workspace | Presets can be a team's house looks. | +`workspace_id`, `created_by` |+| `brand_kits`, `products`, `ad_batches`, `ad_creatives`, `marketing_runs` | workspace, children | Products follow their brand kit; loose products and runs own themselves. A team policy decides who edits brand kits (Admins only, or Editors). | +`workspace_id`, `created_by` (batches +`created_by`) |+| `palettes` | workspace; built-ins in `w_install` | Built-ins are read by all and written by no one. | +`workspace_id`, `created_by` |+| `moodboards`, `photodump_packs` | workspace | A moodboard's Recraft style id is tied to the key that made it (`style_key_ref`). | +`workspace_id`, `created_by`, `style_key_ref` |+| `faceless_channels`, `faceless_episodes`, `content_series` | workspace, children | Episodes follow their channel; Explainers and draft series own themselves. Voice samples need consent to move. | +`workspace_id`, `created_by` |+| `dub_sessions`, `katana_jobs`, `swap_projects` | workspace | Swap's `revision` already detects concurrent saves. | +`workspace_id`, `created_by` |+| `skills` | workspace | Rebuilt with PK (`workspace_id`, `name`). Resolution: personal, then the active team, then built-in. `/api/assist/skills/[name]/*` (including `run`, `verify`, `estimate`, `recipe`, `download`, `duplicate`) take `?workspace=`; `taken()` and `renameSkillRefs` (`skills.ts` L191–256) work per workspace. | rebuilt |+| `skill_toggles` | user | Rebuilt with PK (`user_id`, `name`). | rebuilt |+| `assist_threads`, `assist_thread_state` | user, child | Only the author sees a chat. A chat inside a team project stays the author's. | +`user_id`, `workspace_id` |+| `assist_projects`, `assist_project_sources` | workspace, child | Team projects share instructions and sources. `use_personal_memory` means each member's own memory, never the creator's. | +`workspace_id`, `created_by` |+| `assist_memory` | user (personal rows), project (project rows) | Personal rows are only ever the owner's (`listMemories`, `memory.ts` L48–67, is filtered by `user_id`); project rows follow the project's workspace. | +`user_id` |+| `assist_schedules` | user | Run as their owner (§7.11); paused when the owner is off. | +`user_id`, `workspace_id` |+| `assist_connectors` | user, or team (Studio) | Rebuilt with UNIQUE(`owner_id`, `slug`). A chat gets only its author's connectors, plus team connectors when the chat is in that team (§7.10). | rebuilt; +`workspace_id` |+| `shares` | user on workspace content | §7.13 | +`created_by`, `workspace_id` |+| `lora_mirrors` | install cache | Library LoRAs stay install-wide; rows for trained LoRAs carry the key that hosted them. | +`key_ref` |+| `settings` | install | Install defaults and admin policy (§7.8). | — |+| `_migrations` | install | | — |+| New core tables | identity, money | `users` … `session_step_up` (§7.1), `notifications`, `consents`, `request_keys`, `mail_outbox`, `provider_keys`, `spend_limits`, `meter_holds`, `meter_entries`, `limit_requests` | new |++| File area | Scope | Rule |+|---|---|---|+| `data/files/**` | workspace through `assets` | `/api/files` ACL; Move re-homes output assets and gives inputs a new asset row; files are refcounted by `rel_path` |+| `data/loras/fuobe/**`, copies in each ComfyUI LoRA folder | follows the element | `attachLora` and request `loras[]` accept only visible elements' files and catalog LoRAs (§7.7); deletion follows the element (§9.5 E5b manifest) |+| `data/datasets/**`, `aitk.datasetDir` | follows the element | Deleted with the element |+| `data/fuobe.db`, `auth.json`, `secret.key`, `setup-code`, `recovery.json`, `backups/` | install | Never served |++A table-classification test fails when a table or file area is not in this list. Every new `_json`/`_url` column goes into `ASSET_REFS` (tables that reference files: `export_jobs`, `quarantine`, `moderation_items`, `announcements`, `legal_docs`, `csam_reports`) or `ASSET_FREE` with a reason (`library.test.ts` L741–746).++### 7.5 Sharing rules++- **Create.** New things land in the **active workspace** (Editor or more). `created_by` and `paid_by` are always the acting person for any row a request starts, including retries, "Run again", storyboard films, Cinema retries, Katana retries, canvas runs and Mixed Media retries. A request that starts rows from an existing root uses the root's workspace only if the actor holds Editor or more there; otherwise it answers 403, or, for derived outputs a viewer may make (a download, a zip), uses the actor's active workspace. Only runner continuations of rows that already exist (waiting chain steps) keep their stored creator. The audit entry names both the actor and the root.+- **Active workspace.** Each tab sends `X-Fuobe-Workspace`. A new tab starts in the person's last-used workspace (`fuobe:u:<id>:space` in localStorage, checked by the server); links from the Inbox, email and team pages carry `?space=<slug>`. Once a person has any team, the "Saving to" chip is always visible (screens §S5.4).+- **Move** (`POST /api/move`): the creator or a source-workspace admin may move into a workspace where the actor is Editor or more. Moving **out of a team** into a personal library needs a team admin. Derived rows and output assets move too; input assets get a new asset row in the target. Face elements and cloned voices ask for consent again. An item that other team rows reference is copied instead of moved. Undo for 8 s.+- **Share** (`POST /api/grants`): only the creator or a workspace admin creates or revokes grants, and only with Editor on the item. The level granted can't exceed the granter's own; viewers and grantees can't re-share. Studio offers a picker of people who share a team with the actor (the full directory needs Editor or more). Platform asks for an exact email and always answers "If {email} has an account, they can see it now. Otherwise, they'll see it after they sign up with this email." (a pending grant by email, attached at sign-up).+- **Duplicate** (`POST /api/duplicate`): new rows and new asset rows pointing at the same files. Copying team content into a personal library follows the team policy "Members may copy team content to their personal library" (off by default in Studio, on in Platform).+- **Cross-workspace inputs.** A job in workspace W may use inputs and elements only from W, `w_install` or grants to W. Using a personal item in a team job needs an explicit confirmation: the request answers 409 `CROSS_SPACE_INPUT` listing the items ("These come from your personal library. Using them copies them into Brand team."), and the asset rows are created only after the person confirms. It is never allowed for runner continuations, schedules, approvals, Assist and MCP tool calls, or runs of a document last edited by someone else.+- **Mentions.** In a personal job `@handle` resolves personal, then grants. In a team job it resolves W, then grants to W, then `w_install`; never the runner's personal elements. Ambiguity is refused with the list. To use a personal character in a team, the person moves or duplicates it there (with consent).+- **Edit grants on projects.** Takes made by a grantee land in the project's workspace with `created_by` = the grantee, paid by the grantee's payer chain.+- **Leaving a team.** The person's work stays with the team; their schedules there pause; their queued jobs in the team are cancelled and released; their share links to team content stop serving (§7.13).+- **Deleting a team.** The team owner chooses "Move everything to another team" (a picker of teams where they are admin) or "Archive for 30 days, then delete". In both cases likeness and voice elements go back to their creators' personal libraries, every member gets an Inbox notice, and the archive can be exported by the owner.++### 7.6 Files and leak closures++- **`/api/files`** authorizes when a visible `assets` row has that `rel_path`. Cache headers: Personal keeps `immutable`; Studio and Platform send `private, no-cache` with an ETag, so revoked access isn't served from cache.+- **Every file read is checked.** `readRef`, `localHead` and a new `readChecked()` (replacing the eight direct `absolutePath()` reads) call `assertReadable(actor, ref)` first. A grep test fails on `absolutePath(` outside `storage.ts` and `file-response.ts`.+- **Every id is declared.** Each route's zod schema marks id fields with `ref(kind)` (path, query, body and nested, e.g. `targetId`, `items[]`, `cover.generationId`, `ids[]`, `folderId`, `projectId`, `brandId`, `items[].productId`, `packId`, `elementId`, `dependsOn`, `existing`, palette-lock `signature`, canvas graph refs, `?brand=`, `?id=`). A sweep test fails on any schema field matching `/(^id$|Id$|ids$|Ref$|url$|urls$)/` that isn't declared. The IDOR matrix runs every declared field as person B against person A's records and expects 404.+- **Live stream.** Each event is checked against the subscriber's current memberships and grants, cached by a version counter that bumps on any membership, grant, role or status change. Delete events carry the workspace. The session is re-validated at least every 60 s and at once on revoke events, then the stream closes. Payloads carry the subscriber's own `favorite` and `pinned_at`. `EventSource` can't send headers, so the stream and GET downloads accept `?workspace=`. The client's `FeedFilter` gains `space` and `matchesFilter` checks it (`generation-stream.ts`); job notifications fire only for rows with `created_by = me`.+- **Other leaks:** `once()` and the brand link-read lock are keyed by user; voice previews and the demo voice live in `w_install` (the requester is `created_by` and pays; reuse is free for others); `assetUses` counts only visible uses ("This file is still used in 3 places you can't see."); `recordVisible` replaces `recordExists`.+- **Browser state.** Sign-in and sign-out are full page loads. React Query keys for workspace data include the workspace id; per-user and install queries stay; `queryClient.clear()` runs only on sign-in and sign-out. localStorage keys go through `src/lib/local-store.ts` with the prefix `fuobe:u:<id>:`; `fuobe.shareLinks` and `fuobe:first-name` are cleared on sign-out.+- **Avatars** are `w_install` assets served at `/api/users/[id]/avatar` to anyone who shares a workspace with that person (404 otherwise).++### 7.7 Provider payload guard++Review 1 found that untrusted `params.extra` and `loras[]` reach the providers unchanged (§3.9): on a shared ComfyUI a request could name `fuobe/bg-remove-birefnet_00042_.png [output]` and read another person's output, attach someone else's trained face LoRA, or on cloud models raise `num_images` or `duration` after the price was computed and, in Platform, switch off safety flags. The guard, in every mode:++- **An allowlist of `params.extra` per model.** Each catalog route gains `extra: { key: { type, min?, max?, enum? } }`. Keys not listed are refused (400 "This setting isn't available for {model}."). Keys that name a media, file, LoRA, model or checkpoint binding are never allowed, nor any string containing `[output]`, `[input]`, `[temp]`, `/` or `\`. The canvas schema's free-form `extra` (`canvas.ts` L121) and `/api/generations/local` follow the same allowlist.+- **`loras[]`** accepts catalog LoRAs and the trained files of elements the actor can see (the `attachLora` rule). In Platform only admin-approved LoRA URLs are downloaded.+- **Price the final payload.** After the provider payload is built, `estimateCost` runs again on the final values (outputs, duration, resolution, steps). If it is higher than the priced request, the request is refused ("This would cost more than shown. Refresh the price and try again."). Safety and pricing fields are written after `extra`, so `extra` can't override them.+- **ComfyUI.** In Studio and Platform each job gets a random `filename_prefix` (`fuobe/<16 random base32 chars>/<workflow>_`), so output names can't be guessed. After outputs are saved, Fuobe deletes the job's `/history` entry (`POST /history {"delete":[id]}`, ComfyUI `server.py` L1305–1316). ComfyUI has no core route to delete input or output files (guess, from reading `server.py`); when the GPU server record has local input and output folders configured (admin-only paths), Fuobe deletes the files; otherwise `/admin/gpu` shows "Files from runs stay on this server. Restrict who can reach it." (§9.4).++### 7.8 Settings split++Resolution order: user, then workspace, then install, then environment, then default. Admin-only keys are never read from user or team settings.++| Key | Scope | Who writes | Why |+|---|---|---|---|+| `install.mode`, `install.signin`, `setup.state`, `setup.draft` | install | owner; env locks them | |+| `install.name`, `install.site_url`, `install.timezone`, `install.contact` | install | owner, admins | Links, cookies, passkeys, the spend month; the contact shown on public sign-in pages (default "the {install name} admin") |+| `signup.*`, `signin.*`, `email.*` | install | admins | Who joins and how |+| `teams.create`, `keys.mode`, `limits.member_default_usd`, `limits.unknown_price` | install | admins | Money policy |+| `spend_limits` (workspace, member in team) | team | team admins | |+| `spend_limits` (user_self) | user | the person | A personal cap |+| fal, Replicate, Anthropic keys | install, team, user | admins, team admins, the person | Resolved by `keys.mode` (§7.12); install keys encrypted in Studio and Platform |+| `civitai.key` | install | admins | Downloads land in shared LoRA folders. Members see "Some LoRAs need the admin to add a civitai key." |+| `comfyui.*`, `aitk.*`, `ollama.url`, `demo.mode`, `models.access`, `engine.mode`, `access.*`, `backup.*` | install | admins (backup: owner) | Server-side fetch targets and server paths |+| `ollama.model`, `enhance.provider`, `cloud.provider`, `theme`, `notify.email` | install default + user | admins, the person | Preferences |+| `shares.public` | install; a team may narrow | admins, team admins | anyone, signed-in only, nobody |+| `guide.dismissed` | user | the person | The first-run guide, per person (replaces the install-wide `onboarding.done` write in `GET /api/status`) |+| `openai.key`, `google.key` | removed | — | Nothing reads them (`settings.ts` L26–27); removed from the UI and API |+| Browser keys | user, per browser | — | Prefixed and cleared on sign-out (§7.6) |++`PUT /api/settings`, `PUT /api/settings/models`, `POST /api/providers/test` and `POST /api/loras` need `install.settings`. Members get `POST /api/me/keys/test`, which accepts only fal, Replicate or Anthropic key values (never URLs), 10 a minute. Members see install settings as "Managed by your admin" with connected flags only.++**Server-side fetch targets.** Link-local and metadata addresses (169.254.0.0/16, fe80::/10, `fd00:ec2::254`, `metadata.google.internal`) are always refused for every target. GPU servers, AI-Toolkit and Ollama may be private addresses (that is their purpose) and are admin-only. OIDC discovery, SAML metadata and classifier URLs at private addresses need the owner. `FUOBE_ALLOW_PRIVATE_URLS` is refused in Platform.+### 7.9 Modes, the setup wizard and the mode switch++**Features, not mode strings.** `src/server/mode.ts` holds a `features()` registry. Each package registers flags as functions of `(mode, signin, settings)`; UI and API gates read flags, never the mode string. Core flags: `signInRequired`, `signUp`, `teams`, `invites`, `admin`, `limits`, `ownKeys`, `teamKeys`, `credits`, `enterprise`. Flags added by mode packages: `passkeys`, `twoStep`, `backups` (Personal packages); `teamsDirectory`, `teamPolicies`, `gpuFairShare`, `gpuPool`, `approvals`, `usageReports`, `sessionPolicies`, `sso`, `scim`, `domains`, `auditViewer`, `dataLifecycle`, `seats` (Studio); `plans`, `payments`, `publicSite`, `launch`, `moderation`, `provenance`, `staffRoles`, `platformAvailable` (Platform).++**Fresh installs before the setup package lands.** From acc-1 until acc-14, a fresh data folder boots as `mode=personal`, `signin=off`, `setup.state=done` (today's behaviour), and the proxy's setup gate stays inert. That keeps the 28 e2e scripts working on every intermediate build.++**The first screen** (owner's `localUse`; screens §S1.1). On a fresh install every page redirects to `/setup`, which shows two choices:++- **Just me on this computer** — "No sign-in. Anyone who can open this address can use Fuobe, so keep it on your own computer or home network."+- **Create your account** — "Sign in with a password from any device. Next, choose whether Fuobe is just for you, for your studio, or a public service."++Choosing Create your account leads to `/setup/start` ("What will this Fuobe be?": Just me, with sign-in / My studio or team / A public service), then the wizard for that mode. Choosing Just me finishes setup.++**The setup code.** `next start` binds every address by default and `Host` is client-controlled, so whoever reaches a fresh install first could claim it. At start the server writes an 8-digit code to `data/setup-code` (0600) and prints, right after Next's banner:++```+Fuobe isn't set up yet. Open this link to set it up:+ http://localhost:3000/setup#code=4821-0937+Only you on this computer? Restart with: pnpm start -H 127.0.0.1+```++The code travels in the URL **fragment**, so it never reaches server or proxy logs; the page moves it into memory and removes it with `history.replaceState`. It is asked for only when the owner commits (the Just me button, or the account form): a person who arrived through the link never sees a field; anyone else sees one inline field under the chosen action ("Enter the setup code from the terminal to finish."). Wrong codes are throttled (after 5 misses, one try per 5 s) and the code is never rotated on failures, so nobody on the network can invalidate the owner's printed code; it rotates only on restart or after setup finishes, when the file is deleted. The integrated design's "rotate after 10 failures" and `?code=` query string were dropped (review 1). Skipping the code when the server binds to loopback only was considered and rejected: a route handler can't reliably see which address the server bound to (guess), and the cost of the code is one paste.++**Wizard steps** come from a step registry, so packages insert their own. Core steps (screens §S1): account → address (Personal) or studio/service details → who can join → email → sign-in methods → teams → who pays (`/setup/keys`, Studio) or free allowance (Platform core) → invite (Studio) → review. Packages insert: restore (Personal backup), sso (company sign-in), security (two-step policy), credits, plans, payments, safety, storage (Platform). "Use recommended settings" fills every remaining step. Each Continue saves `PUT /api/setup/draft`; "Finish setup" writes the mode and `setup.state=done`, deletes `data/setup-code`, audits `install.setup_finished` and does a full page load.++**Headless setup.** `FUOBE_MODE` completes setup at boot from environment variables, or stops with one line naming what is missing ("FUOBE_MODE=studio needs FUOBE_OWNER_EMAIL."). `FUOBE_MODE=personal` with no `FUOBE_SIGNIN` means Just me. The e2e harness and the README's "Browser checks" start the server with `FUOBE_MODE=personal FUOBE_DEMO_MODE=on`, so every existing script keeps working; signed-in suites use their own harness (§13).++**Platform availability.** Until the Platform launch package (acc-57) lands, the "A public service" card is disabled ("Not ready in this version yet") and `FUOBE_MODE=platform` stops the server, unless `FUOBE_DEV_PLATFORM=1` is set for development and tests. That flag forces Preview (sign-up closed except invites) and shows a red banner: "Development build: the public service isn't finished. Don't open it to the public." This stops an operator from running a half-built public service (review 2).++**Switching modes** (Settings → Access → Change mode; owner only, fresh session):++- `snapshotDatabase({ kind: "before-<mode>" })` writes `data/backups/fuobe-<UTC>-before-<mode>.{db,secret.key,json}` first (session rows stripped, §7.16), then the audit row `install.mode_changed`.+- `canLeave(mode)` and `onEnter(mode, from, answers)` registries let packages refuse or ask:+ - **Personal → Studio or Platform** needs a real owner email (checked with a code when mail works) and a site address that isn't loopback.+ - **Studio → Platform** asks which plan existing people get (default Free) and whether Studio limits become credit caps.+ - **Platform → Studio** asks "What happens to the {n} people who signed up here?" with "Turn them off" (default; they become dormant) or "Keep them with a $0 monthly limit"; maps staff roles (billing, moderator, support → member, each confirmed); lists the teams that become Studio teams. It is refused while subscriptions are active ("End the {n} active subscriptions first, or let them run out on {date}.").+ - **Studio or Platform → Personal** makes every non-owner **dormant**: sessions deleted, tokens rejected, schedules paused, queued jobs cancelled and released. Their libraries and teams are kept. The owner keeps full access to every team workspace, listed as "Spaces" in the switcher. Switching back clears dormancy.+ - **Leaving Studio** suspends SSO, SCIM, approvals and seats and keeps their settings.+- `FUOBE_MODE` and `FUOBE_SIGNIN` lock the switch ("Set by the server").++### 7.10 Tokens, MCP, CLI and agents in shared spaces++- **API tokens** are created only from a browser session or the local actor, never from a token. Scopes: Full, Generate only, Read only, Admin; expiry 30, 90 or 365 days or Never (default 365); an optional workspace pin. Each person lists their own; admins can see and revoke anyone's on the person page. `auth.json` tokens are imported as `legacy` Full tokens owned by `u_owner`, keeping their hashes and prefixes, so today's CLI and MCP keep working.+- **A pinned token** sees only the pinned workspace plus grants to it. An `X-Fuobe-Workspace` header that differs from the pin answers 403; MCP `tools/list`, CLI listings and `?space=all` all honour the pin.+- **MCP:** `handleMcp(body, actor)`; tools filtered by scope (Read only gets the read tools, `mcp.ts` L42); prompts are the actor's enabled skills.+- **CLI:** the protocol is unchanged. `--workspace` sends the header; `fuobe status` names the person and workspace. `fuobe login` gains a browser approval flow (§8). The eval harness moves to `GET /api/trainings/targets` (unknown element ids will answer 404) and runs with a scoped token.+- **Agents in shared spaces** (review 1). Assist, MCP and scheduled tasks act as the person who owns the chat, token or task (ASVS 8.3.3), and in a team thread or team project they are **narrowed to that workspace**: tools list and read only W, `w_install` and grants to W; they write only into W; cross-workspace inputs are refused (§7.5); personal memory is used only for the chat's own author. Team connectors (Studio) are offered only in chats inside that team; personal connectors only in the author's chats. Instructions, sources and skills written by teammates are data in the model's context, never authority: every tool call that spends money still goes through the meter, approvals and the person's limits, and Assist shows the plan before running unless the author turned on auto-approve for that chat. A scheduled task in a team project runs as its owner, narrowed to the team, within `min(task cap, remaining limit)`.++### 7.11 Background jobs++- Runners wrap each row's work in `runAs(row owner)` and `withKey(paid_by)`: generations and chains, training polls, the Faceless sweep, Content Factory, the Swap sweep, brand research, ads and Assist turns continued with `after()`. The nine routes that use `after()` today (assist, its messages and approval, schedule run, brands, research, chat confirm, ads batches, Cinema director) keep it, with the actor captured explicitly through `runAs`; with worker roles (§10.10) the continuation runs in the web process that received the request, and its spend still goes through the meter. Long new work runs on instrumentation timers.+- A row whose owner is disabled or dormant fails with "Paused: the account that started this is off."+- **Housekeeping registry** in `instrumentation.ts` (led by the leader lease once worker roles exist): `request_keys` 24 h, `totp_seen` 90 s, `cli_connect_requests` 10 min, expired `auth_verification` and `auth_session`, `auth_rate_limit`, `session_step_up`, `session_activity`, expired invites and join requests, sent `mail_outbox` after 30 days, `notifications` after 90 days, `live_events`, `rate_limits`.++### 7.12 Keys, the one meter, settlement and entitlements++**Who pays.** `keys.mode` (Studio setup "Who pays for runs?"): `install` (team key, else the studio's key), `own` (the person's key; team key first for team jobs; no studio fallback) or `both` (own, then team, then studio within the limit). Personal pays with install keys; Platform with install keys unless the plan allows own keys. The payer is written to `paid_by` at submit and `withKey(paid_by)` is used for every poll, cancel and download of that job (adapters read keys at call time, `fal.ts` L20, `replicate.ts` L18). Install keys stay in `settings` in Personal and are encrypted (AES-256-GCM under HKDF(root, "keys/v1")) in Studio and Platform; team and own keys are in `provider_keys`, always encrypted, never returned.++**Payer-aware readiness** (review 2). `keys.ts` exports `payerFor(actor, provider, workspace)` and `readyFor(actor, route)`. `chooseRoute` and `routeReady` (`generations.ts` L420–441), `isConfigured`, `llmBackends`, training blockers (`training.ts` L149), the Assist and enhance backend choice (`agent.ts` L385, L393, L441, L611; `enhance.ts` L38, L88), `llm.ts` (L107, L131, L467, L482), `cinema-generate.ts` L28 and `loras.ts` L108 all call them. Demo "auto" is decided per payer, so a member with their own fal key and no studio key runs for real. Refusal for `own` mode without a key: "Runs on paid models use your own key here. Add your fal.ai key to start." with "Add key" (screens §S4.7).++**Meter tables** (migration 27): `meter_holds` (`id`, `generation_id` or `kind`, payer, workspace, `budget` usd or credit, `est`, `final`, `gpu_ms`, `status` held, captured, released, `settled_at`), `meter_entries` (append-only), `spend_limits` (install, workspace, member, user_self), `limit_requests`.++**The Budget interface:** `{ admit, reserve, capture, release, adjust, unknownPrice(model) → allow | refuse, mode: charge | record }`. `UsdBudget` serves Personal and Studio; `CreditBudget` serves Platform (§10.2). `record` mode is for Platform staff (capped, §10.2).++**Admission.** Inside `db().transaction().immediate()`: `Budget.admit(ctx)` (entitlements, §below), limits (`LimitReached` → 402 with the refusal line), then the hold. SQLite has one writer, so two requests can't both pass the check.++**Every spend point** reserves first: `createGenerations` (`generations.ts` L691), `recordLocalGeneration` (L1700), dependents at launch (L1028), `startTraining` (`training.ts` L176) including **AI-Toolkit trainings on the open engine** (§10.5), `meter.llm` around `viaClaude` (`enhance.ts` L37), the Assist stream (`agent.ts` L623) and `askLlm` (`faceless.ts` L215). Skills recipes go through `createPipeline`, `createGenerations` and `llmText`, so they are covered. The open engine is metered too: payer `open`, held from the workflow's run statistics and captured from measured GPU time (`PollResult` gains `gpuMs`, from ComfyUI's `execution_start` and `execution_success` timestamps).++**Hold sizes.** Cloud: the price of the final payload (§7.7). LLM: input token estimate × input price + `max_tokens` × output price, captured from `usage`; if a hold is refused mid-turn, the Assist turn ends with the refusal line. Open engine: 1.5 × p75 of `gpu_run_stats` for the workflow; with fewer than 5 samples, the manifest's default seconds or an admin-set maximum per workflow; with neither, a fixed per-run price from the price book, else refused in Platform.++**Settlement: exactly once, from the provider's answer** (review 3):++- Every terminal transition is a compare-and-set inside the same `BEGIN IMMEDIATE` as its ledger entry: `UPDATE generations SET status=? WHERE id=? AND status IN ('queued','running','canceling') RETURNING id`. Only the winner settles. `meter_holds` moves `held → captured | released` once, guarded by the unique key `settle:<hold_id>`.+- **Cancel** releases only when the job provably never ran: no `external_id` and `adapter.submit` not reached; fal answered 200 (removed from the queue); Replicate status `aborted`; ComfyUI removed the prompt from `/queue` before `execution_start`. Otherwise the row becomes `canceling` and keeps polling: if the job completes (or fal answers `ALREADY_COMPLETED`), outputs are kept and captured; if it was stopped after starting, the elapsed cost is captured (Replicate `metrics.predict_time` × rate for time-billed models; the full hold for fal per-output models, since fal may still complete it — fal queue docs: an in-progress cancel returns `CANCELLATION_REQUESTED` and "the request may still complete"; measured `gpuMs` up to `execution_interrupted` for ComfyUI). The same rules apply to the 45-minute and 4-hour timeouts and to cancel-on-arrival in `submit`.+- **Fuobe-side failures after a provider success** (persist, mosaic, post-processing) capture; an operator can refund them as an `adjust` entry with a reason, so margin reports show the cost.+- **Cancel UI:** on a queued job "Cancel"; on a running job "Stop · it has started, so ≈ $0.42 (or ≈ 12 credits) is still charged"; once a row is saving results, cancel answers 409 "Already finishing. This run will be charged."+- **Provider out of funds:** an "insufficient balance" error from fal or Replicate pauses that provider's routes install-wide, alerts admins ("fal.ai says the account is out of funds. Paid fal runs are paused.") and fails the job with a release.+- **Orphans:** if a row is no longer queued or running when `adapter.submit` returns (swept, cancelled), Fuobe cancels at the provider and writes an `orphan` meter entry (operator cost, reason, external id) instead of attaching silently.++**Holds over time and re-pricing** (reviews 3 and 4):++- Holds on non-terminal rows never expire by age (a pipeline behind the GPU queue can wait hours). Only holds whose row is terminal (settled at once) or that have no row (LLM holds: max stream time + 5 minutes, then the reserved maximum is captured) expire.+- When a waiting step launches (`launchStored`), it asserts an active hold. If the re-priced cost is higher, the difference is reserved in the same transaction; if that fails, the step does not fail: it moves to **stopped** (`dispatch_state = 'stopped'`, message "Needs 40 more credits" or "You reached this month's limit"). Finished steps are untouched. The chain card shows "Stopped at step 3 of 5" with "Add credits" (or "Ask for more") and "Continue", which re-runs admission for the stopped steps only. Stopped steps keep 7 days, then cancel and release. Assist shows "I stopped before step 3: not enough credits." with the same buttons; a scheduled task pauses with an Inbox notice. A re-price that crosses an approval threshold re-runs the approval gate (§9.4).+- At capture, a final cost above the hold is never a reason to discard a finished, paid output. Studio records the overage (limits are hard at admission, soft at capture). Platform captures the overage as account **debt** (one step's overage at most), and new paid runs are refused until a top-up or the next grant clears it ("Your last run cost 6 credits more than estimated. Add credits to keep going.").+- Each hold stores its budget kind, so a later mode switch settles it with the budget that created it.++**Request idempotency.** The browser and CLI send an `Idempotency-Key` (a UUID per click) on generation, studio create and retry routes; MCP derives one from the session and tool-call id. `request_keys(user_id, key, route, body_sha256, state, response_json)` is inserted as `pending` in the same `BEGIN IMMEDIATE` as the reserve. A second request with the same key while pending gets 409 `IN_PROGRESS` (clients retry after 1 s); after completion the stored response is replayed; a different body answers 422; a pending key older than 10 minutes is released. Kept 24 hours.++**Entitlements** (`src/server/entitlements.ts`), one module:++- `offered(actor, workspace)` → allowed routes and engines: install switches (`model-access.ts` `requireOffered` L143), then registered narrowers in order: plan (Platform), then team policy (Studio). Used by `prepare()` (replacing `offeredFor`, `generations.ts` L517), listings, pickers, MCP `tools/list`, Assist and the CLI.+- `admit(ctx)` runs inside the reserve for every spend point: re-checks `offered()`, then registered checks (plan caps, storage, unlimited caps, member caps, concurrency). Refusals: 403 `PLAN_REQUIRED`, `STORAGE_FULL`, `VIEW_ONLY`; 402 `NOT_ENOUGH_CREDITS`, `MEMBER_CAP`.+- `gate(kind, actor)` for non-spend actions: token creation, share creation, uploads, team creation, own keys.+- `summary(actor)` feeds `GET /api/me/entitlements` for UI badges.++**Display.** One formatter, `src/lib/price-display.ts` (`formatPrice({usd, credits, modelId, op, engine, payer})`), replaces `costLabel` (`composer.ts` L971), `formatCost`, `formatUsd` and the Faceless `usd()`, and the 51 inline `$${…toFixed}` and `≈ $` sites in components; server strings (`assist-schedule.ts` L275, `assist/context.ts` L54, `assist/tools.ts` L59–65 prices told to Claude and MCP, `cinema-generate.ts` L130) use it too. USD estimates always carry `≈`; credits are exact ("12 credits") or "Up to 18 credits" for open-engine holds. Payer labels: Personal "Your GPU", "fal.ai key"; Studio "Studio GPU", "Studio key", "Team key", "Your key"; Platform shows credits, not payers. Cinema cost caps, Assist auto-run caps and schedule caps are shown and stored in credits in Platform. A sweep test fails any other money formatting.++### 7.13 Share links++- **Creating** a link needs Editor on every item it shows, plus the item workspace's `shares.public` policy (install `anyone`, `signed-in only` or `nobody`, narrowed by teams; Personal offers anyone or nobody). Viewers and grantees can't create links.+- **Serving** re-checks every time: the creator is active (not disabled, dormant or banned), the creator can still view every item, and each item's current workspace still allows public links. Moving an item, leaving a team, revoking a grant or tightening a policy disables affected links and lists them to team admins ("3 links stopped working because Brand team turned off public links.").+- **Proxy:** `/s/<token>` passes without a session only when the share's policy is `anyone`; `signed-in only` requires a session and a person who can view it. "Owner" (no view counted, guard skipped) means the share's creator or an admin of the target workspace, computed only when credentials are present (today any signed-in session counts, `proxy.ts` L50). Unavailable links show the existing "gone" page.+- **Limits:** link creation is rate-limited per person (Platform Free: 20 a day; others 200 a day).++### 7.14 Audit log and notices to the person++- `audit(action, target, meta)` takes actor, IP and user agent from the request scope and never records secrets (ASVS 16.2.5). Core events: `auth.*`, `token.*`, `people.*`, `team.*`, `install.*`, `keys.*` (setting names and masked prefixes only), `limits.*`, `content.share|move|grant`, `denied` (every 403) and `denied.hidden` (rate-limited 404s for invisible records).+- **Tamper evidence:** each row stores `prev_hash` and `hash = SHA-256(prev_hash ‖ row)`; the viewer verifies the chain and shows "Records verified up to {time}" or "The record changed after {time}". Deletes happen only inside the retention purge, which writes its own entry.+- **Notices to the person** when an admin acts on their account: reset email or link, two-step reset, role change, sessions revoked, limit change, view-as, SSO link added. Inbox always; email when mail works.++### 7.15 Recovery, incidents and secret rotation++- **Recovery (one mechanism).** `fuobe recover [--email <address>]` is a local command that opens `data/fuobe.db` directly (never the server), and `FUOBE_RECOVER=<email|owner>` at boot does the same. Both write `data/recovery.json` atomically with mode 0600: the SHA-256 of a 12-character Crockford code (60 bits), valid 30 minutes, 5 attempts. The command prints "Wrote a recovery code for the Fuobe data in {path}: 7KQF-2M9X-HD4P" and refuses to run where it finds no `fuobe.db`. The person redeems it at `/recover#CODE` (screens §S2.6): `POST /api/recover/verify` sets `fuobe_recover` (15 minutes, SameSite=Strict, HMAC under HKDF(root, "recover/v1")) and deletes the file; `POST /api/recover/finish` sets a new password, optionally turns off two-step and removes passkeys, revokes every session, audits and mails. Copy names the exact command for the install: `node bin/fuobe.mjs recover` in the Fuobe folder, or `docker exec <container> node bin/fuobe.mjs recover`.+- **Incident: "Revoke everything"** (owner, `/admin/security`): deletes every session, revokes every API, SCIM and pending CLI token, rotates the trusted-device secret (so "remember this device" cookies stop working), and audits. Copy: "Everyone, including you, signs in again. Scripts and the command line need new tokens."+- **Root secret rotation** (`fuobe secret rotate`, server stopped): generates a new `secret.key`, re-encrypts `provider_keys`, install keys, OIDC and SCIM secrets, TOTP secrets and backup codes, deletes all sessions and recovery cookies (they were signed with the old secret), updates `identity.secret_check`, and keeps the old key as `secret.key.old-<UTC>` until the owner deletes it. The server refuses to start when `identity.secret_check` doesn't match the key it finds, unless `FUOBE_ACCEPT_NEW_SECRET=1`.++### 7.16 Migrating existing installs++First boot of the new build:++1. `wal_checkpoint`, then `snapshotDatabase({ kind: "pre-accounts" })` → `data/backups/fuobe-<UTC>-pre-accounts.{db,secret.key,json}`.+2. Migrations 23–27: identity tables, Better Auth's frozen tables, scoping columns backfilled to `w_owner`/`u_owner` (never by a column default, so a forgotten owner on a new insert fails instead of silently belonging to the owner), the key rebuilds of `skills`, `skill_toggles` and `assist_connectors`, and the meter.+3. A bootstrap awaited in `register()`: root secret and fingerprint; `setup.state`; the legacy password hash imported into `auth_account` for `u_owner`; `auth.json` tokens imported as legacy tokens; `FUOBE_PASSWORD` synced at every boot (it stays the owner's break-glass password).+4. An install with a password becomes Personal with sign-in on; one without becomes Just me. Everyone signs in once more (old cookies are not accepted); tokens keep working.+5. `auth.json` stays in place, unread, for one release as a rollback aid. Files don't move.++**Snapshots and archives never carry live credentials.** `auth_session`, `auth_verification`, `session_step_up`, `cli_connect_requests` and `request_keys` rows are removed from every snapshot copy and archive; restoring signs everyone out. A Litestream replica holds live sessions: the docs say to treat its bucket as credentials (restricted access, server-side encryption). Whether Litestream v0.5 encrypts replicas itself is unverified (guess).++### 7.17 Environment variables++Core: `FUOBE_MODE`, `FUOBE_SIGNIN`, `FUOBE_SITE_URL`, `FUOBE_INSTALL_NAME`, `FUOBE_TIMEZONE`, `FUOBE_SECRET`, `FUOBE_ACCEPT_NEW_SECRET`, `FUOBE_OWNER_EMAIL`, `FUOBE_OWNER_NAME`, `FUOBE_OWNER_PASSWORD` (`FUOBE_PASSWORD` is an alias), `FUOBE_SIGNUP` and `FUOBE_SIGNUP_ALLOWED_DOMAINS` / `_BLOCKED_DOMAINS` / `_AUTO_APPROVE_DOMAINS`, `FUOBE_EMAIL_VERIFY`, `FUOBE_SMTP_URL`, `FUOBE_MAIL_FROM`, `FUOBE_MAIL=log`, `FUOBE_GOOGLE_*`, `FUOBE_GITHUB_*`, `FUOBE_OIDC_*`, `FUOBE_TEAMS_CREATE`, `FUOBE_KEYS_MODE`, `FUOBE_MEMBER_LIMIT_USD`, `FUOBE_SHARES_PUBLIC`, `FUOBE_RECOVER`, `FUOBE_DEMO_PRICED` (honoured only with `FUOBE_DEMO_MODE=on`: demo holds carry the catalog estimate), `FUOBE_TRUSTED_PROXIES`, `FUOBE_DEV_PLATFORM`.++Mode packages add: `FUOBE_BACKUP_*`, `FUOBE_REQUIRE_2FA`, `FUOBE_SSO_*`, `FUOBE_SCIM_TOKEN_SHA256`, `FUOBE_SEATS`, `FUOBE_GPU_FAIRNESS`, `FUOBE_PAYMENTS`, `STRIPE_*`, `FUOBE_TURNSTILE_*`, `FUOBE_CAPTCHA`, `FUOBE_CREDIT_VALUE_USD`, `FUOBE_MARKUP_PCT`, `FUOBE_PLANS_TEMPLATE`, `FUOBE_LAUNCH`, `FUOBE_ROLE`, `FUOBE_WORKER_INDEX`, `FUOBE_WORKER_COUNT`, `FUOBE_TEST_HOOKS`.++Existing variables keep their meaning (`FUOBE_PASSWORD`, `FUOBE_ALLOWED_ORIGINS`, `FUOBE_TRUST_PROXY`, `FUOBE_DATA_DIR`, `FUOBE_DEMO_MODE`, `FUOBE_ENGINE_MODE` and the provider keys). Values set by the environment show as "Set by the server". A missing required value stops the server with one line naming it.++### 7.18 Runner seams and Next 16 rules++- **Launch.** `launch(id, args)` replaces every `void submit(...)` (`generations.ts` L777, L1117; `training.ts` L221). `launchStored(row)` is the re-planning half of `advanceDependents`. A launch-gate registry runs in order (approvals, then the queue hold); the default submits now. `handler()` opens a per-request launch collector for POST/PUT/PATCH and flushes after the handler; with no gate claiming launches, behaviour is identical to today.+- **Post-process.** `postProcess(row, outputs) → { outputs, blocked[] }` runs between saving outputs and the `succeeded` write and capture (`generations.ts` L1481); the row stays `running` with a message. The default is a no-op; Platform adds safety checks, the badge, metadata cleaning and C2PA there.+- **Live source** is pluggable (SQLite TEMP triggers by default; a `live_events` tail with worker roles), with typed events: generation, credits, inbox.+- **Next 16:** authorization re-checked in every route handler; no Server Actions; cookies set only by route handlers; no user data inside `'use cache'`; public cached pages revalidated with `revalidateTag(tag, { expire: 0 })` from route handlers; the proxy stays optimistic.+## 8. Mode 1: Personal++**Who it's for.** One creator, freelancer or developer on their own machine, home server or rented GPU, paying providers with their own keys or running ComfyUI, who wants every setting in their own hands. A second person is Studio.++**Two sub-modes, switchable in Settings → Access:**++- **Just me on this computer** (sign-in off). Anyone who reaches an allowed host is the owner through the `local` actor, exactly as today. Allowed hosts: today's `hostAllowed` (IP literals, localhost, single-label and `.local`/`.lan`/`.home.arpa`/`.internal`/`.localdomain` names, this machine's hostname, `FUOBE_ALLOWED_ORIGINS`) plus "Other addresses" from Settings. `*`, wildcards, IP ranges and public-suffix entries are refused in the UI and API; only `FUOBE_ALLOWED_ORIGINS` may hold `*`. Tunnels that rewrite `Host` (ngrok `--host-header=rewrite`, Codespaces, cloudflared `httpHostHeader`) would make internet visitors look local, so in Just me a request carrying `Forwarded`, `X-Forwarded-For`, `X-Real-IP` or `CF-Connecting-IP` with a non-private address is refused unless a trusted proxy is configured and the host is allowed: "This request came through a tunnel. Turn on sign-in to use Fuobe remotely." Private here means RFC 1918, loopback, link-local, 100.64.0.0/10 (Tailscale's range) and fc00::/7. `/api/identity/*` is unmounted except `sign-in-options`; `/login` redirects to `/`; an invalid bearer token is ignored, a valid one names `u_owner`.+- **Personal with sign-in.** The login card has one password field and never asks for an email (`POST /api/auth/login` shim). A password is always required; passkeys and two-step are extras. Devices, alerts and recovery come from the core and the Personal packages.++**What Personal adds** (6 packages):++1. **Access and remote use** (acc-18): `access.ts` (`allowedHosts()`, `trustProxy()`), read by `crossSite`, `hostAllowed`, `trustedOrigins`, the throttles and the client IP. Settings → Access: site-address checks with plain warnings ("Over plain http, your password can be read on the network. Use https if you open Fuobe from the internet."; "Passkeys work only at an https address or localhost."; quick tunnels refused), Other addresses, Behind a proxy (with the detected IP), and a remote guide: same Wi-Fi with LAN addresses and a QR code, Tailscale Serve (recommended: `tailscale serve --bg 3000`), Cloudflare Tunnel and Caddy (both only with sign-in on), and "Keep the plain port private" (`pnpm start -H 127.0.0.1`). A banner when Just me is used from another device: "You're using Fuobe from another device without sign-in. Anyone who can open {host} can use it and your keys."+2. **Two-step sign-in and passkeys for every account** (acc-19, all signed-in modes): TOTP (6 digits, 30 s, issuer = install name) with 10 single-use backup codes (stored encrypted), a replay guard (`totp_seen` for 90 s), trusted devices for 30 days, passkeys through `@better-auth/passkey` with `rpID` and `origin` set from the site address and `residentKey` and `userVerification` "required" (so a passkey sign-in counts as two steps), at most 10 passkeys, freshness on removing a passkey, turning off two-step or making new codes. After an OAuth or SSO sign-in by someone with two-step on, the session is a restricted `verify-2fa` session until the code is entered (`/two-step`).+3. **New-sign-in alerts** (acc-20): a banner on Home and Settings when another session is newer than this browser last saw ("New sign-in: Safari on iPhone, 12 min ago. Was this you?"), and an email for a device label not seen in 90 days.+4. **Backup and move** (acc-21; owner in every mode): weekly database snapshots (keep 4; Platform daily, keep 7), "Back up now", full `.tar` archives on demand (database snapshot, `secret.key`, `auth.json`, files, trained LoRAs, optional datasets; never `tmp`, backups, mail, setup code, recovery file, the library LoRA cache or `-wal`), `fuobe backup` and `fuobe restore` (server stopped; refuses a live `server.pid` or a non-empty folder; extracts to `.restoring-<UTC>`, checks the SHA-256, then renames), `/setup/restore`. In Studio and Platform a full archive needs a reason, is audited and notifies admins. Archives are not encrypted in v1 (open question).+5. **Browser-approved CLI login** (acc-22): `fuobe login` opens `/settings/account/connect-cli`, which shows the code, the requesting IP and user agent and the time; the default scope is "Generate only"; approval needs a fresh session; requests live 10 minutes; start and poll are rate-limited (10 a minute per client, 30 overall). Tokens near expiry carry `X-Fuobe-Token-Expires` and the CLI warns once a day.+6. **First minute and everyday spend** (acc-23): the terminal lines (§7.9), autofocus in the Get started guide, a footer row "Spent ≈ $12.40 this month" when the engine mode isn't open-only, a personal cap ("Stop paid runs when this month passes $50"), and an e2e check that the first result arrives within 60 s in demo mode.++**Recovery in Personal:** a passkey or backup code; an email code when an owner email is checked and mail works (`/login?forgot=1`); `fuobe recover`; or `FUOBE_PASSWORD`. Without email the forgot-password card shows the exact command to run.++**Personal settings:** `install.signin` (off after Just me, on after Create an account or `FUOBE_PASSWORD`), `install.site_url`, `access.allowed_hosts`, `access.trust_proxy`, `security.sign_in_alerts` (on), `security.trust_device_days` (30), `backup.schedule` / `keep` / `dir` (weekly, 4, `data/backups`), `shares.public` (anyone or nobody).++**Personal threats and answers:** Just me reached by others (honest copy, the banner, the bind hint, the tunnel refusal); password guessing (throttles, the password-only lock, passkeys, recovery); passkey origin confusion (explicit origin and RP ID); two-step bypass (no cookie cache, restricted sessions after OAuth, email resets keep two-step); a lost root secret (fingerprint check, key carried in snapshots); recovery abuse (60-bit code, 5 tries, fragment only, Strict cookie); backup leakage (step-up, single-use download tickets, no sessions inside); CLI phishing (code, IP and user agent shown, fresh session, 10 minutes).++## 9. Mode 2: In-house studio++**Who it's for.** Studios and in-house creative teams of 5–500 people on their own server and GPUs: an owner, admins, auditors, team leads, editors, viewers and clients.++### 9.1 Accounts and joining++- **Sign-up policy** (`policy.ts`): `open`, `approval`, `invite`, `closed`; allowed, blocked and auto-approve domain lists; a vendored disposable-domain list (CC0, `disposable-email-domains`) and a webmail list (`src/lib/webmail-domains.ts`).+- **The Studio default follows the owner: open.** `/setup/join` preselects "Anyone can create an account" with "Only these email domains" prefilled with the owner's work domain (empty when the owner's email is webmail, with the line "Anyone who can reach {site} can join and spend up to the monthly limit on the studio's keys."). Open requires checked addresses: an email code (needs a working mail transport) or Google/OIDC as the only methods. Without either, Open is disabled with "Open sign-up needs email or Google sign-in so we can check addresses. Until then, you approve each person." and the step preselects "I approve new accounts". The server enforces the same rule.+- **Domain trust applies only to checked addresses** (reviews 1 and 4). Domain auto-approve, domain capture and team auto-join apply only to emails Fuobe verified with a code, or asserted (with `email_verified`) by the company sign-in connection bound to that domain. Without a mail transport, "People at these domains join without approval" is disabled, and "Use recommended settings" never turns it on.+- **Approval:** waiting people see "Your account is waiting for approval. We'll email you when it's ready." (without email: "Ask {contact} to approve it."); admins approve in `/admin/people` → Waiting.+- **Invites:** by email (with mail) or as copyable links ("Expires in 72 hours"); single use; a resend invalidates the old link; a resend within 5 minutes is refused ("You sent an invite in the last 5 minutes. Try again soon."); daily limits per inviter (200; Platform Free 20). Invites bypass the policy except blocked domains.+- **Without email:** invites are links; "Forgot password?" says "Ask {contact} for a reset link."; admins create single-use reset links (60 minutes, shown once, audited, the person's other devices signed out, two-step kept).++### 9.2 Own libraries++Every person has a personal workspace created at activation. Everything they make lands there unless they choose a team in the "Saving to" chip. Nobody else sees it — not teammates, not admins — unless the person shares, moves or duplicates it, or the owner turns on the view-as policy (off by default; reason required; the person is told; read-only; 30 minutes; audited; §9.5 E5b). Favorites and pins are per viewer. The Library opens on the active space (screens §S5.6).++### 9.3 Teams and sharing++- **Teams** are workspaces. A person can be in several. Roles: Owner, Admin ("manages people, keys and limits"), Editor ("creates and shares in the team"), Viewer ("sees and downloads, uses no budget"). The last owner can't leave or be demoted; "Transfer ownership" makes the old owner an admin.+- **Who creates teams:** admins only by default in Studio (`teams.create`), everyone in Platform.+- **Directory** (acc-24): `/teams` lists "Your teams" and "Other teams". Visibility per team: Private (only members know it exists; 404 to others), Listed (others see it and "Ask to join", with an optional note; requests expire after 30 days), Open (others "Join" at once as the team's join role, default Editor). New teams start Listed. `/teams/[slug]` is the team home: recent work, folders, projects, characters and styles, brand kits and products, presets, palettes and skills, with "Work in Brand team".+- **Sharing inside a team:** make it there (the chip), Move it there, or Share it (grants to the team or a person, view or edit). The rules are §7.5. Team folders are the team library. Brand kits are editable by Admins only or by Editors (a team policy).+- **Team keys and limits:** team admins add team keys ("Team runs use these keys before the studio's.") and set a team limit and a per-member limit; spend by member is listed.++### 9.4 Team policies, the fair queue, the GPU pool, approvals and reports++- **Team policies** (acc-25) narrow and never widen the install: models and engines (a team narrower in `offered()`), public links, who edits brand kits, team Assist connectors ("Everyone in the team can use these in Assist. Nobody sees the token."), two-step (§9.5 E1), retention (§9.5 E5b) and pinned GPU servers. `resolvePolicy` returns the narrower of the install and team values.+- **One fair queue** (acc-26; Studio and Platform). Rows wait in `generations.dispatch_state` (`queue`, `approval`, `stopped`) with `dispatch_since`, `dispatch_priority`, `lane` (`cloud` or `gpu:<pool>`) and `gpu_server`. The launch gate holds every ComfyUI row when fair share is on, and cloud rows only when an account reaches a concurrency policy (Platform). Nothing is uploaded before dispatch. Pick, on every tick and completion: move-to-front rows first; then the group with the least `GPU-seconds in the last 60 minutes ÷ weight` (Studio: the workspace, weights Low 1 / Normal 2 / High 4 / Highest 8, default Normal; Platform: §10.3); within the group, the person with the least service, and nobody holds two slots on a pool while others wait; then oldest first (chain steps keep their pipeline's age). "First come, first served" skips the fair steps. At most 50 waiting per person (429 "You have 50 runs waiting. Wait for some to finish."); maximum wait 240 minutes (Platform 120), then the row fails and its hold is released. AI-Toolkit trainings count in group service with their measured job time, and each person runs at most one open-engine training per pool at a time. Cards show "Waiting for a GPU · 3 ahead" (refreshed every 10 s) and offer "Run on cloud instead" with the price and payer. Personal submits directly.+- **GPU server pool** (acc-27): `comfy_servers` (label, address, encrypted token, pool `main`/`isolated`/named, `max_outstanding` 2, enabled, draining, pinned teams, LoRA folder, local input and output folders, status, GPU label, VRAM, capabilities). An empty table means `comfyui.url` and `comfyui.isolatedUrl` as today. Probes: `/system_stats` every 30 s; `/object_info` and model lists every 10 minutes; a workflow is runnable on a server when every node class and manifest model is present. Routing: teams with pins use only their servers; otherwise the least loaded unpinned server, preferring one with the models warm. Every call for a job (upload, poll, history, cancel) goes to the server recorded on the row. A server that answers `/system_stats` without a token is flagged: "Anyone who can reach this server can see every run. Add a token or keep it on a private network." AI-Toolkit servers are registered in the same table with pool `trainer`.+- **Approvals** (acc-28; off by default): per team ("Runs over $[ ] need an admin's OK") and for personal spaces on studio keys. Per request the launch collector groups holds by workspace; over the threshold, an `approval_requests` row holds the launches (`dispatch_state = approval`) and the response carries `X-Fuobe-Approval`. Approvers: team admins, or the owner and admins for personal spaces; with no approver the request is automatic. Approve launches; decline and withdraw cancel and release; a second decision answers 409; requests expire after 72 hours. Admins and own-key payers are exempt. Personal-space requests don't show the prompt to approvers ("Private run: details stay with Dana.").+- **Usage reports and alerts** (acc-29): reports by person, team, model, feature, engine, day and payer from `meter_holds`, GPU hours from `generation_runs`, average wait; CSV with a byte-order mark and a formula-injection guard; an SVG day chart with a table behind "Show as table"; 50/80/100% Inbox alerts deduplicated through `notice_sends`; a monthly report email on the 1st at 09:00 (install time zone); "Pause paid runs" for a person (limit 0, previous value kept in the audit entry).++### 9.5 Enterprise++**E1 · Two-step enforcement and session policies** (acc-30). Required for: Off / Owner, admins and auditors (default) / Everyone, with grace Right away / 3 / 7 (default) / 14 days, and per team. After the deadline a person without a second factor gets a restricted `enroll-2fa` session (`/two-step/setup`), and their tokens are refused with `TWO_STEP_REQUIRED`. Sessions: absolute length 8 h / 1 d / 7 d / 30 d (default), idle timeout Never (default) / 30 min / 1 h / 8 h / 24 h tracked in `session_activity` (written at most once a minute), a device cap per person, allowed networks (CIDRs, needs a trusted proxy, refuses a list that excludes your own address), a maximum token lifetime. Two minutes before an idle sign-out a dialog warns "You'll be signed out in 2 min because you've been away." with "Stay signed in"; composer and editor drafts are kept in namespaced localStorage and restored after sign-in ("Restored your draft"). "Sign out everyone" and the owner's "Revoke everything" (§7.15). Platform registers billing, moderator and support under the same requirement.++**E4 · Verified domains and auto-join** (acc-31). Add a domain → a DNS TXT record `_fuobe-challenge.<domain>` with `fuobe-domain-verification=<token>`, checked on demand and daily at 03:00 (resolver timeout 5,000 ms, 2 tries), lapsed after 3 daily misses. The owner may mark a domain verified without DNS (air-gapped installs) with a reason. A verified domain enables domain capture (people with a checked address at that domain can sign up without an invite) and team auto-join (default role Viewer). Each verified domain is bound to at most one company sign-in connection.++**E2 · Company sign-in, OIDC and SAML** (acc-32). `@better-auth/sso` fed from Fuobe's `sso_connections` through `defaultSSO` (`providersLimit: 0`, so nobody registers providers through the API), with InResponseTo checks on, IdP-initiated SAML off, timestamps required, 120 s clock skew, deprecated algorithms rejected and signed assertions required. Rules from review 1:++- A connection may assert identities only in its own bound domains. Creating or editing a connection or a domain binding needs the owner (or the owner's approval from the Inbox), a fresh session and a passing test ("It works. Fuobe received [email protected] · Dana Ruiz · groups: Design. No account was created."). "Require company sign-in for studio.com" needs a test passed in the last 24 hours, and keeps a break-glass list (the owner plus up to 2 admins) who may still use passwords.+- `resolveUser` keys accounts by issuer and subject. It links an IdP identity automatically only to an account that has no other credential (provisioned by SCIM or an admin and never signed in) at a bound domain, never to an owner, admin or auditor account. Accounts with a password or passkey link only by the person's own action in Settings → Account ("Connect company sign-in"); otherwise the answer is `account_exists` ("Sign in with your password, then connect company sign-in in Settings → Account."). New people are created just in time at bound domains (on by default), into a default team and role.+- **SAML login CSRF:** at SSO start Fuobe sets a `SameSite=None; Secure; HttpOnly` cookie holding the AuthnRequest id, and the ACS refuses posts without a matching cookie (the plugin parses RelayState with `skipStateCookieCheck: true`, `@better-auth/sso` `dist/index.mjs` L2690). After company sign-in the toast says "Signed in as {email}".+- The ACS path `^/api/identity/sso/saml2/sp/acs/sso-[a-z0-9-]{1,48}$` is the only cross-site POST the proxy exempts. Group claims sync memberships that came from SSO only. `trust MFA` per connection (on by default) skips Fuobe's two-step for that connection's sign-ins.++**E3 · SCIM 2.0** (acc-33). Fuobe's own `/api/scim/v2` (Better Auth's plugin can't write Fuobe's tables): `ServiceProviderConfig`, `ResourceTypes`, `Schemas`, `Users` and `Groups` with `eq` filters and PATCH, mapping `userName`, `emails[primary]`, `name.givenName`/`familyName`, `externalId`, `active`, `groups`; errors in the SCIM error format. Up to 3 tokens (`fuobe_scim_…`, shown once, SHA-256 stored), 600 requests a minute each, 503 outside Studio. **Scope (review 1):** SCIM reads and modifies only people it provisioned (`source = scim` with that connection's `external_id`), never holders of install roles, and never the owner. SCIM-managed accounts sign in only with company sign-in: password sign-in and password reset are off for them, so changing their email can't open a reset path. Groups map to teams with Viewer, Editor or Admin. Delete turns the account off (or deletes after 30 days, a setting). A safety brake stops provisioning when more than 20% of people or 10 accounts an hour would be turned off; the owner resumes it.++**E5a · Audit viewer** (acc-34). The Auditor role (read-only access to audit, usage and people). `/admin/audit`: search; chips Who / What / When / Address; plain sentences ("Dana changed Lee's role to Admin"); a details sheet; chain verification (§7.14); CSV or JSONL export streamed; retention 90 days to 7 years (default 365); an optional HTTPS sink that receives JSONL batches every 60 s. Team Activity shows the team's events without IP addresses.++**E5b · Data lifecycle** (acc-35). Export (zip parts of at most 2 GiB or 20,000 entries with a manifest; scope: the person's personal workspace, plus items they created in teams only with a team admin's consent; optional trained LoRA files), deletion with a 30-day grace and restore (self-delete off by default in Studio: "To delete your account, ask an admin."), purge, retention (per install or team: "Delete results older than N days", previewed, the first run 7 days out with notices, through Trash), legal hold (423 on deletes while on), privacy holds that override purges (CSAM evidence, §10.8), and **view-as** (`access_grants`: Studio policy, off by default, scope = the person's personal library, reason required, person told, read-only, 30 minutes, audited). The **purge manifest** lists what deleting a person, a workspace or an element removes, and a coverage test fails when a table or file area isn't classified:++| Area | On person deletion | On workspace deletion | On element deletion |+|---|---|---|---|+| Rows in workspace tables | personal workspace's rows | all rows | the element and its trainings |+| `assets` and `data/files` | files no longer referenced by visible rows elsewhere (refcount) | same | reference photos not used elsewhere |+| `data/loras/fuobe/*`, each GPU server's LoRA folder copy | the person's elements' files | the workspace's | the element's files |+| `data/datasets/*`, `aitk.datasetDir` | same | same | same |+| Provider copies (`lora_mirrors.hosted_url`, Recraft style ids, uploads to fal/Replicate storage) | deleted where the provider API allows; otherwise listed in the deletion receipt | same | same |+| ComfyUI `/history`, input and output files | history entries deleted; files deleted where folders are configured | same | — |+| `generation_runs`, `item_marks`, `grants`, `notifications`, sessions, tokens | deleted | deleted for that workspace | grants on the element |+| `consents`, `audit_log`, `meter_entries`, Platform ledger and invoices | kept, pseudonymised (accounting and evidence) | kept | kept |++**E6 · Seats** (acc-36). Full seats (make things, spend) and free view-only accounts. "18 of 25 full seats used". Overflow becomes view-only ("Your account is view-only. Ask for a full seat."), with a request queue. `seats.assign` runs inside `BEGIN IMMEDIATE` on every activation path; `effectiveTeamRole` clamps view-only seats to Viewer ("Editor · view-only seat").++**Studio threats and answers:** SSO takeover by email (bound domains, issuer and subject, no auto-link to accounts with credentials or privileged roles); SAML parser bugs (pinned libraries, strict options); cross-site ACS (one exact pattern, RelayState cookie); a rogue connection (owner-only, test before enforce, audit, Inbox); SCIM token theft (scope to SCIM-provisioned people, brake); two-step bypass via OAuth (restricted session); approval splitting (limits stay the hard cap); queue starvation (weights, slot rule, caps); shared ComfyUI exposure (pins, token warning, history cleanup, random prefixes); inspection abuse (view-as off by default, reason, notice, audit); retention mistakes (preview, 7-day notice, Trash, legal hold).+## 10. Mode 3: Platform++**Who it's for.** An operator selling a creative-AI service to the public, with staff (owner, admin, billing, moderator, support) and customers on Free, paid and team plans. Platform reuses the core and the Studio pieces that are mode-neutral (fair queue, GPU pool, audit viewer, data lifecycle, view-as, Inbox, two-step).++**Launch states.** A new Platform starts in **Preview**: `/` shows "Coming soon" with a waitlist; only staff and listed testers (Settings → Launch → Preview access: emails or invite links) can sign in, with a banner "Preview · only staff and testers can sign in · Open to the public". "Open to the public" unlocks only when the launch checklist's required items pass (§10.7). Until acc-57 lands, Platform is a development mode only (§7.9).++**Demo mode in Platform** (review 3): `demo.mode` is forced off unless `FUOBE_DEMO_MODE=on`; the request field `demo: true` is ignored except for staff and server-made skill dry runs. A model whose route isn't ready answers 503 "This model is unavailable right now." and reserves nothing, instead of silently returning placeholder results.++### 10.1 Sign-up and abuse++- **Open by default** (the owner's answer), with: email verification before any free credits; Cloudflare Turnstile through Better Auth's `captcha` plugin on `/sign-up/email`, `/sign-in/email` and `/request-password-reset` (server-side `siteverify`, tokens single-use and 300 s, hostname and action checked; fails closed after a 10 s timeout); disposable domains blocked; emails normalised before checking free-grant uniqueness (lower case, Gmail dots and `+tags`); the `haveibeenpwned` check ("That password has appeared in a data breach. Choose another one."), with an offline top-N list as the fallback when the API is unreachable.+- **Free-credit farming:** one free grant per normalised email; at most 2 grants per device per 30 days and 5 per network per 24 hours, where a network is an IPv4 /24 or an IPv6 /64 (Better Auth had an IPv6 rate-limit bypass, GHSA-p6v2-xcpg-h6xw); a velocity cap of 5,000 credits a day for accounts younger than 72 hours; free runs on the Free pool and cheaper models; per-IP rules only when a trusted proxy is detected (otherwise they are off rather than install-wide, §7.2), and Platform can't open to the public without one.+- **Signals without consent banners** (review 3): the default signals are server-side (IP, card fingerprint, verified email). A device cookie is an option that is consent-gated for visitors from the EU and UK (ePrivacy 2002/58/EC Art. 5(3)); the privacy template states the legal basis for counsel to review.+- **Card testing:** Stripe Checkout only (Stripe's own limiters and Radar); a signed-in account is required to start Checkout; at most 5 Checkout sessions an hour per account and 20 per network; never retry cards from accounts frozen for fraud.+- **Trials and $0 invoices** (a 100%-off first invoice) grant a trial allowance or nothing, never a full plan allowance; promotion codes are limited to first-time transactions and one per card fingerprint.+- **Limits on public endpoints:** `/report` and `/takedown` 10 an hour per network, the waitlist and sales forms 5 an hour, CLI-connect start 10 a minute, invites 20 a day on Free (§9.1), share links 20 a day on Free (§7.13). Counters live in `rate_limits` (SQLite; Postgres or Redis with several hosts).+- **Age:** 18 or older by default (a declared line at sign-up); 16 may be chosen, but likeness, face-swap and training features stay 18+. 13 is not offered (UK Online Safety Act children's duties, the UK Children's Code and DSA Art. 28 apply to under-18s; review 3).++### 10.2 Plans and the credits ledger++**Units.** Integer milli-credits (1 credit = 1,000 units); 1 credit = $0.01 of list price by default (`credits.value_usd`). No floats in the ledger.++**Tables** (acc-37): `credit_accounts` (person or team, plan, frozen, `debt_mc`), `credit_buckets` (`source` plan, topup, promo, admin, refund, trial; `granted`, `remaining` CHECK ≥ 0, `expires_at`, `ref`, `status` active, refund_pending, expired), `credit_ledger` (append-only through triggers; `kind` grant, hold, capture, release, expire, clawback, adjust, debt; signed amount; `bucket_id`, `hold_id`, `generation_id`, `price_version`, `provider_cost_usd`, `actor_id`, `reason`, `idem_key` UNIQUE), `credit_holds` keyed by meter hold.++**Lifecycle** (inside the core admission transaction, §7.12):++- **Reserve** debits buckets in the spending order: the credits that expire soonest first (the plan's monthly credits usually expire first; packs with no expiry last), then the oldest. Short → 402 `NOT_ENOUGH_CREDITS` ("This needs 60 credits. You have 24.").+- **Capture** `min(hold, final)` and return the rest to the same buckets, or to a 7-day refund bucket if those expired. A final above the hold becomes debt (§7.12). **Release** on every core release path.+- **Idempotency keys:** `grant:sub:<subscription>:<period_start>`, `topup:cs:<checkout_session>`, `capture:<hold>`, `release:<hold>`, `clawback:<refund_id>`, `expire:<bucket>:<date>`, `admin:<uuid>`, `code:<redemption>`.+- **Sweeps:** expiry every 10 minutes; a nightly invariant check (sum of buckets = sum of ledger per account; no hold without a row) that alerts on drift.+- **Payer:** the team plan pool for runs in a team with a Team plan; otherwise the runner's own credits ("Paid from your credits" in team workspaces without a Team plan). Staff use `record` mode with a $50-a-day cap per staff account (audited, alert above it).++**Plans** (acc-39; versioned and grandfathered; amounts are guesses):++| Plan | Price | Credits | Concurrency (cloud / GPU) | Queue | Notable |+|---|---|---|---|---|---|+| Free | $0 | 50 a month, after verification | 1 / 1 | Free pool | Badge on results; cheaper models; Unlimited off |+| Starter | $10 a month | 1,000 | 2 / 1 | Normal (2) | |+| Pro | $30 | 3,300 | 4 / 2 | High (4) | Unlimited relaxed on selected models |+| Ultra | $100 | 12,000 | 8 / 4 | Highest (8) | |+| Team | $25 a seat | 3,000 a seat, pooled | 4 a seat, up to 32 | High (4) × seats, capped at 32 | Member caps, seats, team billing |+| Enterprise | By contact | Custom | Custom | Custom | Invoice billing |++Yearly billing is 20% off ("Save 20%" is computed from the prices) with 12 monthly grants. Rollover: none (default) or one month, per plan. Credit packs: 500 credits for $5, 1,200 for $10 and 3,000 for $24 (guesses); no expiry by default (or at least 12 months, an operator setting with a legal note); `topups.require_plan` off. A monthly export of outstanding paid credits supports deferred-revenue accounting.++**Unlimited relaxed** (review 3): only on paid plans and preferably on the open engine; 0 credits, one at a time, a daily cap, a shared low-weight pool, and a per-plan ceiling on the operator's monthly cost, after which the model shows its credit price again. Margin reports include unlimited runs.++### 10.3 Entitlements++The plan narrower and admit checks are registered in the core module (§7.12). Fields, each checked against the request after planning: models (allow and deny by id, family, kind, engine, provider; a price multiplier), features (studios, custom LoRAs, own keys, training, API, MCP, CLI, public links), concurrency (cloud and GPU), queue weight, caps (resolution tier, seconds, outputs and batch, upscale target, training photos and steps, prompt length), storage quota (over quota blocks new runs and offers cleanup; nothing is deleted automatically), optional retention for Free, the badge, API tokens and requests a minute, monthly credits, rollover, top-ups, seats. The owner's rule stands: licences are information, not gates; the plan matrix in `/admin/models` shows non-commercial licence chips prominently, because selling outputs of non-commercial weights is the operator's legal exposure.++**Queue weights in Platform** (review 3): all Free accounts form **one** "Free pool" group (weight 1), and Unlimited relaxed runs form another low-weight pool; inside a pool fairness is per person. Paid accounts keep their own groups (Starter 2, Pro 4, Ultra 8). A Team plan's weight is the plan weight × active seats, capped at 32. While paid work waits, the Free pool may hold at most 25% of GPU slots (shown on `/admin/gpu` → Shares). A test runs 1,000 Free accounts against one Ultra account.++### 10.4 Payments++`PaymentProvider` (`createCheckout`, `createPortal`, `verifyWebhook`, `mapEvent`, `refund`, `changePlan`) with four implementations:++- **None:** credit codes, admin grants and plan requests ("Request this plan" → "Requested · waiting for {service}").+- **Stripe direct** (`stripe` 23.0.x): Checkout `mode=subscription` per plan and interval (prices found by `lookup_key`), `mode=payment` for packs; Stripe Tax on (`automatic_tax`), products with the AIaaS tax codes `txcd_10105001` (personal) and `txcd_10105002` (business); the Customer Portal for payment methods, tax IDs, invoices and cancel-at-period-end only (plan switching happens in Fuobe); `consent_collection` with custom text for the EU 14-day withdrawal waiver.+- **Stripe Managed Payments** (Stripe as merchant of record, 3.5% on top): the same Checkout code with `managed_payments[enabled]=true` and no tax parameters; subscriptions are created only through Checkout and plan changes take effect at the end of the period through the portal (immediate upgrades are not offered; guess about the API limits, checked when the package starts).+- **Fake:** only with `FUOBE_TEST_HOOKS=1` and `FUOBE_DEMO_MODE=on`, never with `launch=public`, and always with a red banner.++**Webhooks** (review 3): `/api/billing/<provider>/webhook` is registered in the proxy's OPEN and cross-site-exempt registries and exempt from the setup gate, Preview rewrites, dormancy, captcha and per-IP limits. The handler reads the raw body (`await request.text()`), verifies the signature (1 MB limit), inserts the event into `payment_events` (deduplicated on `event.id` **and** on `(data.object.id, type)`, because Stripe can send two Event objects for one change) and answers 2xx at once; a worker processes it from the table, re-fetching the canonical object. A **reconciliation sweep** every 15 minutes and at boot lists `/v1/events` since the last cursor (Stripe resends for up to 30 days) and each active subscription's latest invoice, through the same idempotent handler. Health alerts when subscriptions are active and no event arrived in 24 hours. Grants happen only for `invoice.paid` with `billing_reason` `subscription_create`, `subscription_cycle` or a cycle-resetting `subscription_update`.++**Plan changes** (review 3; Higgsfield's rule, which values unused credits rather than unused time):++- **Upgrade:** the new period starts now (`billing_cycle_anchor: "now"`, `proration_behavior: "none"`); the customer pays the new plan's full price minus the value of their unused plan credits (credits left × old price ÷ old plan credits, capped at the old price), applied as a one-off credit on that invoice (mechanism checked against Stripe's docs when the package starts; guess: a customer balance transaction). The old plan bucket expires and the new allowance is granted from the paid invoice. Copy: "You pay $26.40 today ($30 minus $3.60 for your 360 unused Starter credits). You get 3,300 credits now, and your plan renews on Nov 29."+- **Downgrade and cancel:** at the end of the period ("Switches to Starter on Dec 1"; "Cancel auto-renewal? You keep Pro until Dec 1."). Downgrade and Cancel are always visible.+- **Seats:** adding seats charges the prorated amount now and grants seat credits × the remaining fraction of the period; removing seats takes effect at period end, and pooled credits are never refunded.+- **Unpaid invoice:** plan and seat changes are refused while the latest invoice is unpaid or past due ("Pay the open invoice first."). Past due: a top banner with "Update payment"; paid runs continue within remaining credits for 7 days; then the subscription cancels at Stripe's retry end.+- **Refund** (self-serve within 14 days of an initial purchase with nothing spent from that purchase's bucket): in one transaction the bucket becomes `refund_pending` (excluded from available credits), then `stripe.refunds.create` with idempotency key `refund:<bucket>`; success expires the bucket and cancels the plan, failure unfreezes it. **Disputes** freeze the account ("Paid runs are paused while a payment is reviewed.") and claw back credits; a refund of spent credits becomes debt and admin review.+- **Auto-recharge** (Stripe direct only): one charge in flight per account (`UNIQUE(account) WHERE status='pending'`), idempotency key `recharge:<account>:<seq>`, at most 3 a day, turned off after any failure or `authentication_required` with an Inbox notice.+- **Tax display** (review 3): consumer plans show prices including tax by default (Stripe Tax inclusive, estimated by locale; EU UCPD Art. 7(4)(c) and Directive 98/6/EC); Team and Enterprise show "plus tax". Setup warns: "Stripe calculates zero tax where you haven't registered."++### 10.5 Credit prices++`creditsFor` in `src/lib/credits.ts`, shared by client and server: a fixed rule if set, else `usd × (1 + markup) ÷ value`; then a minimum; then rounding up (to 0.1 below 10 credits, else whole). Defaults: markup 50%, GPU $2.16 an hour ($0.0006 a second). Examples: FLUX.2 [pro] 1 MP at $0.03 → 4.5 credits; Kling 3.0 5 s 1080p at $0.62 → 93 credits; 60 s of GPU → 5.4 credits. Open-engine holds and captures follow §7.12 (with no statistics, a fixed per-run price or refusal). AI-Toolkit trainings on the open engine are priced per target (fixed) or from the measured job time × the GPU rate, and need the `training.open` entitlement. Claude calls (enhance, Assist, Faceless writing) are charged by tokens. Unknown prices are refused unless an admin sets a fixed price. A nightly sync reads fal's pricing API (`GET https://api.fal.ai/v1/models/pricing?endpoint_id=`) and flags changes for admin approval ("Price changed at fal: Kling 3.0 now costs $0.70. You charge 93 credits ($0.93); your margin falls to 33%."). Rules below cost show "Below cost: you lose ≈ $0.04 per run".++**Reconciliation and the spend guard** (review 3): store provider-reported cost when available (Replicate `metrics.predict_time` × the hardware rate; fal per-output units); compare each provider's monthly invoice total with the summed `provider_cost_usd` and alert above 5% drift; an operator "maximum provider spend per hour and per day" pauses paid cloud routes and alerts; the launch checklist asks the operator to set provider-side spend caps too.++### 10.6 Account and billing pages++`/settings/billing` (plan, credits by bucket, auto-recharge, payment method, invoices, refund when eligible), the change-plan sheet with the exact charge before confirming, top-up, `/billing/success` (polls every 2 s for up to 60 s, then "This is taking longer than usual. Your payment went through; your plan will switch in a few minutes. We'll tell you in your Inbox."), cancel → `/pricing?checkout=cancelled` ("Payment cancelled. You're still on Free."), `/redeem`, the credits pill, composer credit states, `/settings/usage` in credits, the welcome card, and after email verification with a plan picked on `/pricing`, straight to Checkout ("Email confirmed. Taking you to payment…"). Specs: screens §S8.++### 10.7 Admin panel++`/admin` with Platform sections (screens §S9): Overview (launch checklist, revenue, paying people, credits, margin, "Needs you"), People (with Credits, Billing and Safety tabs; adjust credits with role caps; support access by consent), Teams, Plans (versioned editor), Credit prices, Codes, Payments (payments, subscriptions, disputes, webhooks with Retry), Models & features (plan matrix with licence chips), Moderation, Bans, Announcements (banner and RFC 8058 email), Analytics, Audit (the shared viewer), Settings (Launch, Service & legal, Payments, Credits, Safety, Abuse, Storage & backups, Email & DNS) and Health. Staff roles: billing (payments, refunds, codes), moderator (moderation, bans), support (people, view-as by consent), each with caps on credit adjustments (support 500 credits per action, billing 10,000, admin unlimited).++**Launch checklist** (required items gate "Open to the public"; "{n} of 12 required steps done"):++| Required | Optional |+|---|---|+| Payments connected, or "No payments" chosen | C2PA signing certificate (otherwise self-signed) |+| Legal pages set (Terms, Privacy, AUP) | Hash matching (PhotoDNA or Safer), with the NCMEC registration status recorded |+| Email transport passing a test | DMCA agent registered |+| Captcha keys passing a test | Litestream or another off-host backup |+| Site address on https | Announcements email stream |+| A trusted proxy detected | |+| Prompt checker chosen and passing | |+| Output checker for every engine that is on | |+| Two-step on for every staff account | |+| Every GPU server has a token or is private | |+| A provider spend cap set (Fuobe and provider side) | |+| A backup taken in the last 24 hours | |++### 10.8 Trust and safety++**Blocks by default; a check that can't run withholds** (review 3):++- **Inputs:** a normalised word list in `admit` (minors combined with sexual terms; known abuse phrases); a prompt classifier before submit (Llama Guard 3 on Ollama, or an HTTP endpoint; 3 s; a timeout or error **blocks** with "We couldn't check this prompt. Try again."); image inputs (uploads, references, training photos) pass the image classifier before submit.+- **Provider flags:** `enable_safety_checker: true`, `safety_tolerance: 2` (written after `extra`, §7.7), never `disable_safety_checker`; `has_nsfw_concepts` kept in meta instead of being dropped (`payload.ts` L449 at 76ecd89).+- **Outputs** in the `postProcess` stage, required for every engine that is on: fal `x-ailab/nsfw` ($0.001 an image) or a local classifier on the operator's GPU (ShieldGemma 2 or the Falconsai ViT behind an HTTP worker), so open-engine-only operators aren't forced onto fal; video: 5 frames. Without an output checker for an engine, that engine's custom LoRAs, face swap and training stay off. A result whose check failed or didn't run is **withheld** ("Being checked · usually a few minutes"), not shown to the requester. Blocked: "This result was blocked by the safety check. 12 credits refunded." with "Appeal".+- **Refunding blocked results:** `charge_blocked` is off (blocked results are refunded), but after 5 blocked results in 24 hours refunds stop and generation pauses pending review.+- **Sexual content** is always blocked in Platform. **Likeness and voices:** a consent dialog before any real-face or voice feature ("This is me, or I have written permission from this person, and they're 18 or older."), recorded in `consents` with the asset ids.+- **CSAM:** a hash-matching hook (PhotoDNA or Thorn Safer; recommended, not required, with the owner's choice and NCMEC status recorded); on a match: block, quarantine to restricted storage, suspend, draft a report record with the fields NCMEC needs, keep for 1 year through `privacy_holds` overriding deletion (18 U.S.C. §2258A; Pub. L. 118-59).+- **Reports and takedowns:** a Report button on share pages, posts and team items; `/report` (categories) and `/takedown` (NCII, 48-hour removal under the TAKE IT DOWN Act from 2026-05-19, with perceptual-hash blocks of copies); a DMCA notice and counter-notice flow with a repeat-infringer policy; strikes; statements of reasons (DSA Art. 17) and appeals for 6 months; a moderation queue with SLA timers.+- **Provenance:** a C2PA manifest on every image and video output (`@contentauth/c2pa-node`; self-signed until the operator uploads a certificate; signed last), the provider watermark kept, a visible "AI-generated" chip on share pages, a small badge on Free results; share-file cleaning keeps APP11 C2PA segments in every mode.++### 10.9 Legal (templates, not legal advice)++Fuobe ships editable templates under `/legal/*` (Terms, Privacy, Acceptable Use, Cookies) with placeholders from settings, versioned, with re-acceptance when they change (a restricted `accept-terms` session). The operator's checklist (Settings → Service & legal) lists, with a short plain explanation each: tax registrations or a merchant of record; NCMEC registration and hash-service applications; a DMCA agent ($6, renewed every 3 years); DSA points of contact (Art. 11 and 12) and an EU legal representative for non-EU operators (Art. 13); a GDPR Art. 27 representative, Art. 28 processing agreements and a public sub-processor list (fal, Replicate, Anthropic, Stripe, Cloudflare, the storage host) and Art. 30 records; UK Online Safety Act illegal-content and children's-access risk assessments; an Illinois BIPA written release and a public retention schedule for face training data; the EU AI Act Art. 50 marking (from 2 August 2026, with a grace period to 2 December 2026 for systems already on the market); the EU 14-day withdrawal waiver at checkout. Each template says at the top: "This is a starting point, not legal advice. Have a lawyer review it."++### 10.10 Scale++- **One host by default:** SQLite with WAL, short synchronous transactions, `.immediate()` for admission, daily snapshots (keep 7) and a Litestream guide. Postgres is deferred until 2 hosts are needed, p95 write wait passes 50 ms, or the database passes 200 GB.+- **Worker roles** (acc-54): `FUOBE_ROLE` all, web or worker; `FUOBE_WORKER_INDEX` and `COUNT`. A leader lease runs the dispatcher and the housekeeping sweeps. **Submit and launch claims live in SQLite** (review 3): `generation_runs.claimed_by`, `claimed_at`, `heartbeat_at` joined to `worker_heartbeats`; `READY_DEPENDENTS` and `launchStored` claim a row with a compare-and-set before any upload; `sweepInterrupted` fails only rows whose claim heartbeat is stale; `once()` and `request_keys` are in SQLite. Polling is partitioned by `hash(id) mod FUOBE_WORKER_COUNT` and ordered by `last_polled_at` (today the tick polls the 50 oldest rows, `generations.ts`, so new jobs can starve behind long videos). Live events go through a `live_events` table tail.+- **Object storage:** a storage driver (local, or S3/R2/MinIO); private reads redirect to presigned GET URLs valid 300 s after the ACL check; share files are streamed through Fuobe.+- **Restore runbook:** restore the snapshot or Litestream copy, start in maintenance, replay Stripe events from the snapshot time through the idempotent handler, reconcile holds against provider jobs, then open.+- **Observability:** OpenTelemetry through `@vercel/otel`, `/api/admin/metrics` (Prometheus format), structured logs with generation, account and provider request ids. `scripts/capacity.mjs` targets 500 active jobs with a p95 collection delay under 10 s.+## 11. Every screen as a spec++The screen specs are long, so they live in [`accounts-8-screens.md`](accounts-8-screens.md). Every screen there has its route, who sees it, layout at 1440 px and 390 px, the copy, empty, loading and error states, what each action does, and keyboard and screen-reader behaviour; light and dark use only the existing tokens. Index:++| § | Screens |+|---|---|+| S0 | Conventions: layout and look, phone rules and the `ResponsiveDialog` primitive, the visibility matrix (who sees which Settings section, menu item and admin page in each mode), forms, states, accessibility, terms |+| S1 | Setup: the first screen, mode choice, account, address, studio or service details, who can join, who pays, email, sign-in methods, teams and invites, review, restore |+| S2 | Sign-in and recovery: `/login` in every variant, the two-step step and `/two-step`, `/register`, `/verify`, `/reset`, `/invite/[token]`, `/recover`, the copy for every sign-in refusal code |+| S3 | Shell: account menu and phone sheet, Inbox bell, workspace switcher, banners, Confirm it's you, the member welcome card |+| S4 | Settings: sub-nav, Account, Passkeys and Two-step, Usage, Access, Backup, Connect the command line, composer refusal lines and payer hint, Data & privacy and restore, generation and chain card states |+| S5 | Teams and sharing: Create team, team settings, leave, transfer and delete, the Saving-to chip, Share, Move, Duplicate and the cross-space confirm, Library spaces |+| S6 | Admin core: shell and nav, Overview, People and the person page, Teams, Usage & limits |+| S7 | Studio: team directory and home, approvals, security and two-step setup, company sign-in, provisioning, domains, seats, audit and data, GPU |+| S8 | Platform for customers: welcome and pricing, Coming soon and legal, register and welcome card, billing and credits, redeem, safety screens |+| S9 | Platform admin: Overview and launch checklist, plans, people tabs, credit prices and models, codes, moderation, analytics, bans, payments and health, announcements, settings |+| S10 | Platform setup steps: credits, plans, payments, safety, storage |+| S11 | Routes added to the layout checks |+| S12 | Email templates: subject and body for each |++## 12. Threat model++| Threat | How it is handled | § |+|---|---|---|+| IDOR on about 120 id-taking routes (path, query, body) | DAL `scope.get`, uniform 404, declared `ref(kind)` ids, route sweep, IDOR matrix over every declared field | 7.4, 7.6 |+| A missed check in new code | Four fail-closed layers: NULL-workspace triggers, actor-less DAL throws, route sweep, IDOR matrix; table and file-area classification test | 7.4 |+| Reading another person's files (`/api/files`, `readRef`, direct `absolutePath`) | ACL by `rel_path`, `assertReadable` on every read, grep test | 7.6 |+| Reading other people's ComfyUI outputs or using their LoRA through `params.extra` | Per-model allowlist, refused annotations and paths, `loras[]` rule, random prefixes, history deletion | 7.7 |+| Running more than was priced (extra outputs, longer duration) | Final payload priced again; safety and price fields written after `extra` | 7.7 |+| Live stream leaks and stale access after revocation | Per-event visibility with a version counter, session re-check every 60 s, close on revoke | 7.6 |+| Existence oracles (record pages, handles, `assetUses`) | `recordVisible`, per-workspace handles, scoped uses, `denied.hidden` audit | 7.4, 7.6 |+| Publishing someone else's work; stale links | Editor plus policy at creation; re-check at every serve; links stop on move, leave, revoke | 7.13 |+| Re-sharing beyond one's level; viewers sharing | Grants need Editor, can't exceed the granter's level; only creator or admin grants | 7.5 |+| Personal data entering team spaces (inputs, mentions, agents) | 409 `CROSS_SPACE_INPUT`; team mentions never resolve personal elements; agents narrowed to the thread's workspace | 7.5, 7.10 |+| Wrong person billed or audited | `created_by` and `paid_by` always the actor; jobs polled with the key that submitted them | 7.5, 7.12 |+| Spend races and double charges | `BEGIN IMMEDIATE` admission; one settlement per hold (CAS); pending idempotency keys | 7.12 |+| Free compute by cancelling a running job | Settlement from the provider's answer; `canceling` keeps polling | 7.12 |+| Second accounts before isolation exists | Sign-up off the allowlist and `user.create.before` refusing until the meter package | 7.1 |+| Setup takeover on a fresh, exposed install | Setup code asked at commit, carried in the fragment, throttled, never rotated by failures | 7.9 |+| Just me reached from the internet | Honest copy, bind hint, other-device banner, tunnel refusal, no `*` in Other addresses | 8 |+| Session theft and fixation | Server sessions, no cookie cache, `__Host-` cookies on https, tokens never in page scripts, revocation, step-up | 7.1, 7.2 |+| Install-wide sign-in lockout through the limiter | No IP rules without a trusted proxy; per-account throttle by email hash; soft global throttle | 7.1, 7.2 |+| Password guessing | Per-account throttle, password-only lock that lifts, blocklist, breached-password check (Platform), passkeys | 7.2, 10.1 |+| Account enumeration | Uniform answers and timing for sign-up, reset, sharing by email; picker limited to shared teams | 7.2, 7.5 |+| OAuth or SSO account takeover | No trusted providers; Better Auth's local-verification rule; bound domains; auto-link only to credential-less, non-privileged accounts; issuer and subject keys | 7.1, 9.5 |+| Domain squatting (registering [email protected] unchecked) | Domain trust only for checked addresses; disabled without mail | 9.1 |+| SAML parser and signature bugs; SAML login CSRF | Pinned versions, strict options, signed assertions, InResponseTo, RelayState cookie, exact ACS exemption | 9.5 |+| SCIM token theft | Tokens hashed and scoped to SCIM-provisioned people; no install roles; company sign-in only; brake | 9.5 |+| Admin abuse (taking over the owner, silent impersonation) | Target-role matrix; reset never clears two-step; view-as off by default, reasoned, notified, audited; notices to the person | 7.3, 7.14 |+| Better Auth plugin bugs | Minimal plugins, router-only allowlist, exact pins, OSV watch, behaviour-pin tests | 5.2, 7.1 |+| SSRF through settings or connections | Admin-only targets; metadata and link-local always refused; private OIDC/SAML/classifier targets need the owner | 7.8 |+| Secrets at rest and in backups | AES-GCM for new and (Studio, Platform) install keys; no sessions in snapshots or archives; fingerprint check; rotation procedure | 7.12, 7.15, 7.16 |+| Lost or stolen recovery codes | 60-bit code, 0600 file, 5 tries, 30 minutes, fragment only, Strict cookie, mailed notice | 7.15 |+| Audit tampering | Hash chain, purge writes its own entry, export | 7.14 |+| Payment replays, forged or lost webhooks | Signature on raw body, event and object dedupe, reconciliation sweep, restore replay | 10.4, 10.10 |+| Credit gaming (upgrade timing, seats, refunds racing spends, auto-recharge loops) | Unused-credit valuation, seat rules, refund freeze first, single-flight recharge | 10.4 |+| Credit farming and card testing | Verification, captcha, normalisation, device and network limits, velocity cap, Checkout throttles, Radar | 10.1 |+| Selling below cost; runaway provider spend | Price sync, margin alerts, reconciliation, spend guard, provider out-of-funds pause | 10.5, 7.12 |+| CSAM, NCII, likeness abuse | Layered checks that withhold on failure, hash matching, quarantine and holds, consent, 48-hour takedowns | 10.8 |+| Staff abuse | Role caps, consent-based view-as, record-mode cap, two-step required, audit | 10.7, 9.5 |+| Multi-process double launches | SQLite claims with heartbeats, CAS before upload | 10.10 |+| Browser leaks on shared computers | Full reloads on sign-in and out, namespaced storage, no-cache files in Studio and Platform | 7.6 |++## 13. Tests++**Harness.** `tests/setup/actor.ts` (Vitest `setupFiles`) runs each test as the local owner unless it calls `asNobody()`, and the default `FUOBE_MODE` in tests is `personal`, so the 171 existing files keep passing (acc-2). `tests/helpers/actors.ts` seeds people, teams and roles and wraps a `Request` with a session cookie or bearer token. Suites that encode one owner are rewritten in the package that changes the behaviour: `auth.test.ts` and `runtime-auth.test.ts` (acc-1), `share-links.test.ts` L255, L430, L487–583, L534 (acc-6), `mcp.test.ts` (acc-5), `cli*.test.ts` (acc-1, acc-22), `assist-schedules.test.ts` (acc-5), `cinema-fixes.test.ts` "My Generations" (acc-4), `eval-api.test.ts` and `eval-harness.test.ts` (acc-4, the new targets route), and the `ASSET_REFS`/`ASSET_FREE` coverage in `library.test.ts` (every package adding columns).++**Sweeps that stop forgetting:** route sweep (every `route.ts` through `handler()`); table and file-area classification; `ref(kind)` declaration sweep; the IDOR matrix driven from declarations; the `absolutePath(` grep; the price-display sweep; the `extra` allowlist enumeration; the schema guard; the purge-manifest coverage.++**Money and settlement:** every spend point reserves; 20 concurrent creates against a $1 limit; every release path; per-provider cancel states (queued, in progress, already completed, aborted, interrupted); cancel racing success with injected delays (exactly one settlement); re-price above budget stops and Continue resumes; LLM hold expiry; open-engine `gpuMs`; idempotency pending, replay and 422; Platform ledger with two processes; payment changes (upgrade on the last day, seats added then removed, change while past due, partial refunds, dispute won and lost, duplicate Event objects, an event missing for 4 days then reconciled, a portal change, a $0 invoice); refund racing a spend; auto-recharge with 20 parallel reserves (one charge).++**Multi-process (acc-54):** two workers with 50 ready dependents give 50 submissions; a web upload longer than 2 minutes isn't swept; crash mid-submit and mid-persist; web plus leader.++**Security:** proxy matrix (mode × path × credential × host, setup gate, public registry, tunnel refusal, headers); live stream after revocation; cross-space 409; agent narrowing; role × action matrix; SSO (mock OIDC IdP, samlify test IdP with signature-wrapping cases, login CSRF refused); SCIM scope and brake; payload guard cases; limiter without a trusted proxy (10 different emails in 10 s all succeed; failures for one account never cause a 429 for another).++**End to end.** Existing scripts run unchanged against `FUOBE_MODE=personal FUOBE_DEMO_MODE=on` (Just me). New suites: `setup-wizard`, `personal-setup` (first result under 60 s), `personal-signin` (CDP virtual authenticator, TOTP), `personal-recovery`, `personal-backup`, `personal-access`, `personal-cli`, `accounts`, `studio-teams`, `studio-approvals`, `studio-security`, `studio-sso`, `studio-scim`, `studio-admin`, `platform-signup`, `platform-billing` (fake payments, `FUOBE_DEV_PLATFORM=1` until acc-57), `platform-admin`, `platform-safety`. **Layout matrix:** `no-horizontal-scroll` runs for six seeded roles — Just me, Studio owner, Studio member, Platform signed out, Platform customer, Platform admin — each with a saved Playwright `storageState`, at 1440 and 390 px in light and dark, with route lists from the registries (screens §S11), including the account menu with 10 teams and the two-step setup sheet at 390 px.++## 14. How the four reviews changed the plan++All must-fixes are applied. Should-fixes are applied unless the last column says otherwise.++### 14.1 Security review++| Finding | What changed | § / package |+|---|---|---|+| **Must:** `params.extra` and `loras[]` reach providers unchanged | Payload guard: allowlists, LoRA rule, final-payload pricing, prefixes, cleanup | 7.7 / acc-7 |+| **Must:** domain trust on unchecked emails | Only checked addresses; disabled without mail | 9.1, 9.5 E4 / acc-11, acc-14, acc-31 |+| **Must:** SSO and SCIM can take over accounts | Bound domains, owner-only connections, no auto-link to credentialed or privileged accounts, SCIM scope, SCIM accounts company-sign-in only | 9.5 E2, E3 / acc-32, acc-33 |+| **Must:** admin actions have no target rule | Target-role matrix; resets keep two-step; notices | 7.3, 7.14 / acc-12 |+| **Must:** constant client IP makes one limiter bucket | No IP rules without a trusted proxy; per-account throttle | 7.1, 7.2 / acc-1 |+| **Must:** `created_by` inherited from roots | Always the actor; root workspace only with Editor | 7.5 / acc-3, acc-4 |+| **Must:** sharing rules missing | Editor to share, level cap, no re-share, serve-time re-checks | 7.5, 7.13 / acc-6, acc-17 |+| **Must:** personal data enters teams via inputs, mentions, agents | 409 confirm, mention rule, agent narrowing | 7.5, 7.10 / acc-5, acc-6 |+| **Must:** token pin overridable | Pin limits reads and writes; header mismatch 403 | 7.10 / acc-3, acc-5 |+| **Must:** open SSE streams ignore revocation | Per-event checks, 60 s re-validation, close on revoke | 7.6 / acc-6 |+| **Must:** second accounts before isolation | Sign-up off the allowlist; create hook until the meter package | 7.1 / acc-1, acc-8 |+| Setup code rotates on failures, travels in the query | Throttle, never rotate; fragment | 7.9 / acc-14 |+| Permanent 423 lock | Lifts after 24 h and on passkey, second factor or reset; keyed by email hash | 7.2 / acc-11 |+| Backups carry live sessions | Sessions stripped; restore signs out; Litestream bucket treated as credentials | 7.16 / acc-1, acc-21 |+| `*` in Other addresses; identity routes in Just me | Refused; unmounted | 8 / acc-18 |+| Host-rewriting tunnels expose Just me | Forwarded non-private requests refused | 8 / acc-18 |+| SAML login CSRF | RelayState cookie | 9.5 E2 / acc-32 |+| SSO issuer origins in `trustedOrigins` | Dropped; request origin only in Personal | 7.1 / acc-1 |+| `/update-user` image and names | Image stripped; names limited and escaped | 7.1 / acc-1, acc-11 |+| No `__Host-` cookies | `__Host-` on https (mechanism pinned by a test) | 7.1 / acc-1 |+| Owner email marked verified without a code | Checked with a code once mail works; until then reset only via `fuobe recover` | 7.9, S1.3 / acc-14 |+| Invites grant privileged roles too freely | Inviter's own assignable roles; admin invites need a checked email; daily limits | 7.3, 9.1 / acc-12 |+| Enumeration through sharing and the picker | Uniform email answer; picker limited | 7.5 / acc-17 |+| Server-side fetch targets set by admins | Metadata and link-local always refused; private OIDC, SAML and classifier targets need the owner; `FUOBE_ALLOW_PRIVATE_URLS` refused in Platform. **Partly rejected:** GPU servers, AI-Toolkit and Ollama stay settable by admins at private addresses, because that is what they are for | 7.8 / acc-2, acc-27 |+| ComfyUI keeps everyone's files and history | Token warning, history deletion, random prefixes, folder cleanup where configured | 7.7, 9.4 / acc-7, acc-27 |+| No audit tamper evidence; 404s unlogged | Hash chain, purge entry, `denied.hidden`; **partly rejected:** log streaming is one HTTPS JSONL sink, not syslog (one format covers common log tools; guess) | 7.14, 9.5 E5a / acc-2, acc-34 |+| Lazily created links fail open | Created pending | 7.1 / acc-1 |+| IDOR matrix misses body and query ids | `ref(kind)` declarations and sweep | 7.6 / acc-6 |+| Creators can move team work out | Moving out needs a team admin; copying out is a team policy | 7.5 / acc-17 |+| Deleting a team re-homes others' likeness | Archive or move; likeness and voice back to creators | 7.5 / acc-17 |+| Install keys in plain text | Encrypted in Studio and Platform. **Partly rejected for Personal:** the owner's keys stay as today, because the root secret would sit on the same disk; Personal gains nothing but complexity | 7.12 / acc-8 |+| CLI device flow phishing | IP, user agent and time shown; Generate-only default; rate limits | 8 / acc-22 |+| Last-hop client IP wrong behind CDN + nginx | Configurable hops or CIDRs; detected IP shown | 7.2 / acc-1, acc-18 |+| Inbox links and notes user-influenced | Links stored as validated relative paths; bodies rendered as text | S3.2 / acc-11, acc-13 |+| Missing: agent authorization in shared spaces; admin-action notices; revoke everything; secret rotation; public endpoint limits; ComfyUI and AI-Toolkit hardening; body-id and stream tests | All added | 7.10, 7.14, 7.15, 10.1, 9.4, 13 |++### 14.2 Engineering review++| Finding | What changed | § / package |+|---|---|---|+| **Must:** sign-up open from core-1 to core-7 | Hard close in acc-1 | 7.1 / acc-1 |+| **Must:** fresh installs and e2e break between packages | Fresh dirs boot as Just me until acc-14; e2e with `FUOBE_MODE=personal` | 7.9 / acc-1, acc-14 |+| **Must:** actor-less DAL breaks ~100 suites | Default-actor setup file; list of suites to rewrite | 13 / acc-2 |+| **Must:** readiness and demo read install keys | `payerFor` and `readyFor` everywhere; demo auto per payer; own-key refusal copy | 7.12 / acc-8 |+| **Must:** limiter shares one bucket | Same as the security finding | 7.1 / acc-1 |+| **Must:** Platform selectable before its safety and money exist | Disabled until acc-57; `FUOBE_DEV_PLATFORM` forces Preview | 7.9 / acc-14, acc-57 |+| **Must:** Platform → Studio has no step for public accounts | `onEnter(studio, from=platform)` with dormancy default and staff mapping | 7.9 / acc-57 |+| **Must:** AI-Toolkit trainings not priced, metered or queued | Held and captured; priced in Platform; counted in fair share; one per person per pool | 7.12, 9.4, 10.5 / acc-8, acc-26, acc-38 |+| **Must:** IDOR only on path ids; direct `absolutePath` reads | Declarations, sweep, `readChecked`, grep test | 7.6 / acc-6 |+| **Must:** E5b doesn't list what is deleted or exported | Purge manifest and export scope; coverage test | 9.5 E5b / acc-35 |+| **Must:** Studio default departs from the owner's answer | Open preselected with the owner's work domain; approval only as a fallback without checked addresses | 6.3, 9.1 / acc-14 |+| **Must:** admin and Platform screens too thin | Full specs | screens S6–S10 |+| Packages too big | core-3 → acc-3/4/5; core-7 → acc-11/12/13; core-8 → acc-14/15/16; pl-03 → acc-39/40; pl-06 → acc-43/44 | 16 |+| Platform staff not required to use two-step; Platform could ship without E1 | Staff registered under E1; acc-57 depends on acc-30 | 9.5 E1 / acc-30, acc-57 |+| `civitai.key` scope | Install, admin only, member copy | 7.8 |+| Members hit the install first-run guide | Member welcome card; per-person `guide.dismissed`; footer status for admins only | S3.6, 7.8 / acc-13 |+| Members can't test own keys | `POST /api/me/keys/test` (keys only) | 7.8 / acc-8 |+| Live feed and notifications per workspace | `FeedFilter.space`, per-viewer marks, own-job notifications, `?workspace=` | 7.6 / acc-6 |+| Folder semantics with grants | Move dialog across workspaces; grantees duplicate | 7.4 |+| Grant authority and enumeration | Creator or admin; level cap; uniform email answer | 7.5 |+| Skill name resolution | Personal, active team, built-in; `?workspace=` | 7.4 / acc-5 |+| `assist_memory` project rows | Follow the project; personal memory only the author's | 7.4 / acc-5 |+| Avatars | `w_install` assets with a shared-workspace ACL | 7.6 / acc-6, acc-13 |+| `ASSET_REFS`/`ASSET_FREE` | Rule per package | 7.4 |+| No housekeeping for TTL tables | Registry | 7.11 / acc-10 |+| Eval harness relies on unknown-id answers | `GET /api/trainings/targets` | 7.10 / acc-4 |+| USD outside the formatter in Platform | Server strings and caps converted; sweep extended to inline formatting | 7.12 / acc-10 |+| Hold sizes for Claude and cold GPU stats | Defined | 7.12 / acc-8 |+| `after()` contradiction | Kept with explicit `runAs` in every package of this plan; with worker roles it runs in the receiving web process | 7.11 |+| Owner loses team content in Personal | Owner keeps team spaces | 7.9 / acc-15 |+| Full archive bypasses privacy | Reason, audit, admin notice in Studio and Platform | 8 / acc-21 |+| Thin briefs (SCIM mapping, Stripe events, partition rule, `dispatch_state` timing) | Written; holds on live rows never expire, so no package depends on `dispatch_state` for expiry | 9.5 E3, 10.4, 10.10, 7.12 |+| Pins break the 14-day rule | Rule re-checked; table of what it gives today | 5.2 |+| Two OIDC mechanisms | `genericOAuth` for buttons; company IdPs only through E2 | 7.1 |+| "Signed-in only" share policy not in the proxy | Proxy rule | 7.13 / acc-6 |+| Voice previews payer | Requester pays; reuse free | 7.6 |+| Hidden-row denials not audited | `denied.hidden` | 7.4 |+| Smaller gaps (`/login` in Just me; Platform team without a plan; docs) | `/login` → `/`; runner's credits pay; each package updates `docs/STATUS.md`, README and ARCHITECTURE where behaviour changes | 8, 10.2, 16 |++### 14.3 Money and operations review++| Finding | What changed | § / package |+|---|---|---|+| **Must:** cancel and timeout release after the provider started | Settle from the provider's answer; `canceling`; Stop copy | 7.12 / acc-9 |+| **Must:** unconditional terminal writes | CAS in the ledger transaction; one settlement per hold | 7.12 / acc-9 |+| **Must:** worker roles keep in-memory guards | SQLite claims with heartbeats; orphan entries | 10.10, 7.12 / acc-54, acc-9 |+| **Must:** plan and seat changes can be gamed | Unused-credit valuation, seat rules, no changes while unpaid, portal limited | 10.4 / acc-45, acc-46 |+| **Must:** lost, late, duplicated events | Store-then-process, double dedupe, reconciliation, exemptions, grant keys by period start, refund keys | 10.4 / acc-43 |+| **Must:** refund and auto-recharge races | Freeze first; single-flight recharge | 10.4 / acc-45, acc-46 |+| **Must:** holds expire or settle at the wrong time | No age expiry on live rows; launch re-reserve; LLM hold rule; budget kind on holds | 7.12 / acc-9 |+| **Must:** idempotency misses in-flight duplicates | Pending state and 409 | 7.12 / acc-10 |+| **Must:** Platform fair share can be gamed | Free pool, Unlimited pool, team weight × seats, 25% cap | 10.3 / acc-39 |+| **Must:** safety depends on add-ons; failures undefined | Required per engine; withhold on failure; launch checklist | 10.8, 10.7 / acc-49, acc-50, acc-57 |+| Demo mode in Platform | Forced off; `demo: true` ignored; 503 for missing routes | 10 / acc-49 |+| Open-engine holds without statistics | Manifest default, admin maximum or fixed price | 7.12 / acc-8, acc-38 |+| Reconciliation and a spend kill switch | Provider cost capture, invoice reconciliation, spend guard | 10.5 / acc-56 |+| Tax-exclusive consumer prices | Inclusive for consumers, exclusive for B2B | 10.4 / acc-46 |+| Farming gaps (IPv6, normalisation, $0 invoices) | Fixed | 10.1 / acc-48 |+| Fake payments in production | Test hooks and demo only; never public; banner | 10.4 / acc-43 |+| Unlimited relaxed costs real money | Paid plans, open engine preferred, cost ceiling | 10.2 / acc-39 |+| Blocked results refunded forever | Stop refunds and pause after 5 in 24 h | 10.8 / acc-50 |+| Runner throughput | `last_polled_at` polling, partitioning, capacity targets | 10.10 / acc-54 |+| Device cookie needs consent in the EU | Server-side signals by default; cookie consent-gated | 10.1 / acc-48 |+| Minimum age 13 | 18 default, 16 allowed, likeness 18+ | 10.1 / acc-48 |+| Staff record mode unbounded | $50 a day cap | 10.2 / acc-37 |+| Pack expiry and breakage | No expiry by default; deferred-revenue export | 10.2 / acc-37 |+| Missing: provider spend kill switch and balance exhaustion; restore runbook; orphan report; legal checklist; portal configuration; payment-change and multi-process tests | All added. Managed Payments plan changes happen at period end only (immediate upgrades not offered; a limitation, not a rejection) | 7.12, 10.4, 10.5, 10.9, 10.10, 13 |++### 14.4 UX review++| Finding | What changed | § / package |+|---|---|---|+| **Must:** first screen is a code gate | Owner's two-choice first screen; code at commit | 7.9, S1.1 / acc-14. **Rejected part:** skipping the code on loopback-bound servers (a route handler can't reliably see the bind address; guess) |+| **Must:** auto-approve without email | Disabled without mail; preset falls back | 9.1 / acc-14 |+| **Must:** Inbox has no trigger | Bell with a badge in the sidebar header and PhoneBar; "Needs you" chip on Home for approvers. **Partly rejected:** Inbox stays in the account menu as a second entry | S3.2 / acc-13 |+| **Must:** Library IA undefined | One space control above the kind tabs; Shared renamed Links; Favorites, Trash and Uploads per space; "Made by me" filter | S5.6 / acc-17 |+| **Must:** new tabs fall back to Personal | Last-used space; `?space=` links; chip always shown | 7.5 / acc-17 |+| **Must:** members see admin and setup surfaces | Visibility matrix; member welcome card | S0.3, S3.6 / acc-13, acc-15 |+| **Must:** own-keys path not designed | Refusal line with Add key; "Use my own key"; welcome chip | 7.12, S4.7 / acc-8 |+| **Must:** out of money mid-chain | Stopped steps, Continue, debt instead of discarding | 7.12, S4.9 / acc-9 |+| **Must:** checkout states | Cancel page, success timeout, post-verify routing, request state | 10.6, S8.4 / acc-44 |+| **Must:** moderation from the person's side | Sign-in copy, appeals, card states, notices, ban effects | S8.6, S2.7 / acc-51 |+| **Must:** Platform admin as one-liners | Full specs and the enumerated checklist | S9, 10.7 / acc-40, acc-41, acc-57 |+| **Must:** no Create team screen; Platform team payer unclear | Dialog; teams without a plan pay from the runner's credits; seat-charge copy | S5.1, 10.2 / acc-17, acc-45 |+| **Must:** deletion and export dialogs | Specified incl. Studio "ask an admin" | S4.8 / acc-35 |+| **Must:** bottom sheets break at 390 px | `ResponsiveDialog` with max height, scroll, safe area; AlertDialog kept for destructive confirms | S0.2 / acc-13 |+| **Must:** missing copy | Written (setup bullets, refusal codes, invite states, banners, Transfer ownership, email templates) | S1.2, S2.5, S2.7, S3.4, S5.3, S12 |+| **Must:** empty states | Written for every list | S6–S9 |+| Settings rows stacking | Sub-nav not sticky; StatusStrip on General for admins | S4.0 |+| Switching clears every query | Workspace in keys; `clear()` only on sign-in and out | 7.6 |+| Many teams in the menu | 5 recent, search from 8, All teams | S3.3 |+| Terminology drift | Personal and Teams; "space" only as umbrella | S0.5 |+| Owner's name on public pages; `.invalid` placeholder | `install.contact`; placeholder never shown | 7.8 |+| Recovery command copy | Exact command per install | 7.15 |+| Step-up for SSO-only people loses the form | Pending action restored | 7.2 |+| Team deletion removes others' access | Move or archive, notices | 7.5 |+| Idle timeouts lose work | Warning and draft restore | 9.5 E1 |+| Buttons nested in radio cards | Actions below the group | S1.2 |+| `/verify` wrong address | "Use a different email" | S2.4 |+| Share by email copy | Written, uniform | 7.5 |+| Pricing details | Calculator, FAQ, Enterprise form, lower-plan CTAs | S8.1 |+| Price label conflicts | `≈` for USD only; payer labels per mode | 7.12 |+| Preview testers | Preview access list and staff banner | 10 |+| Saving-to chip on phone | Own 32 px row | S5.4 |+| Layout e2e can't reach new screens | Six-role matrix with saved sessions | 13 |+| Token rows thin | Name field, expired rows, admin revoke | S4.1, S6.3 |+| Dark-mode status colours | Mapped to existing tokens; contrast checked | S0.1 |++## 15. Risks and unknowns++**Risks**++- **Better Auth's advisory cadence.** An urgent fix may need a reviewed migration (the schema guard forces it) and re-running the behaviour pins. Several behaviours this plan relies on were read from the 1.7.14 files, not run: `$context.internalAdapter`, cookie overrides, `disableIpTracking`, hook order and request scope inside hooks (guesses until acc-1's pin tests pass).+- **SQLite with two connections and many timers.** Better Auth's connection and Fuobe's share one writer; busy waits are possible during long writes. acc-1 has a stress test; the fallback is `transaction: false` on Better Auth's adapter. Platform past one host needs Postgres (§10.10).+- **Converting about 40 modules and 192 routes.** The sweeps make forgetting fail CI, but the IDOR fixtures must keep pace with new routes and tool paths.+- **Estimates drive limits in Personal and Studio.** `cost_usd` is the list price, not the provider's bill; the copy says "≈" and "Amounts are estimates from each model's list price, not your provider's bill."+- **Guessed money defaults:** the $25 member limit, the 50% markup, plan prices and credits, pack prices, the $2.16 GPU hour.+- **SAML's history** (ruby-saml, samlify, node-saml and xml-crypto bypasses) and `defaultSSO` being documented for testing in Better Auth.+- **Unencrypted backup archives** and plain install keys in Personal.+- **Operator legal exposure** in Platform (CSAM reporting, TAKE IT DOWN, DSA, AI Act, GDPR, tax). The templates are not legal advice.+- **Classifier error rates** (ShieldGemma 2's numbers are from an internal benchmark; Llama Guard is text-first) and processor eligibility for face and likeness tools.+- **`@contentauth/c2pa-node`** downloads a native binary and needs Node 22 or newer.+- **Same-day npm releases:** pins are re-resolved by the §5.2 rule when each package starts.++**Unknowns (guesses to confirm when building)**++- Whether ComfyUI has any core route to delete input and output files (none found in `server.py` v0.43.1).+- Whether Stripe Managed Payments allows immediate plan changes through the API, and the exact mechanism for crediting unused plan credits on an upgrade.+- Whether Litestream v0.5 encrypts replicas itself.+- Whether a route handler can see the bound address (for a loopback setup shortcut).+- Whether fal and Replicate bill failed jobs in every case (the plan follows fal's "you pay only for successful outputs" and Replicate's lifecycle page).+- Whether `lora_mirrors` copies hosted on one provider account can be used by another account's key.++**Open questions for the owner**++1. Default member limit $25 a month, Platform markup 50%, and the plan prices in §10.2?+2. Studio sign-up: open limited to the owner's work domain (assumed), or open to anyone with an email check?+3. Should admins see each person's own-key spend totals (assumed yes, totals only)?+4. Encrypt full backup archives with a passphrase?+5. Free tier: 50 monthly credits (assumed), daily credits, or none?+6. View-only seats free (assumed yes)?+7. A community feed: in scope for Platform?+## 16. Build plan++All 57 packages in one dependency order. Keys run `acc-1` to `acc-57`; each title starts with the mode it serves or "Core". The core lands first (accounts, own libraries, teams, sharing), then Personal, then the Studio enterprise set, then Platform, as the owner asked.++**Rules for every package.**++- **Leaves Fuobe working in every mode.** Mode packages are inert in other modes (their `features()` flags are off). Until acc-14, fresh installs boot as Just me; until acc-57, Platform is a development mode only (`FUOBE_DEV_PLATFORM=1`, forced Preview).+- **Never breaks** demo-mode e2e (the server started with `FUOBE_MODE=personal FUOBE_DEMO_MODE=on`), API tokens (legacy imported tokens and new scoped ones), MCP (`/api/mcp` with a bearer token and its Origin check), share links (`/s/<token>` and `/s/<token>/f/…`), `FUOBE_PASSWORD` (break-glass owner password, synced every boot) and "Just me on this computer". Each brief names what else it must not break.+- **Checks:** `pnpm typecheck`, `pnpm lint`, the targeted tests, the full Vitest run, the e2e scripts the package touches, and a browser check at 1440 and 390 px in light and dark with no horizontal scroll for every new screen (screens §S11 lists the routes).+- **Versions:** each new dependency is pinned by the §5.2 rule on the day the package starts.+- **Docs:** each package updates `docs/STATUS.md`, `README.md` and `docs/ARCHITECTURE.md` where it changes behaviour; acc-17 changes STATUS's "Accounts" row from not done to partly done.+- **Owner decisions** in §6 are not reopened by a package; a package that finds one impossible stops and asks.++| # | Package | Depends on | Effort |+|---|---|---|---|+| acc-1 | Core: identity base (Better Auth behind Fuobe, identity tables, bootstrap, principal, proxy registries, snapshots, security headers) | — | large |+| acc-2 | Core: actor context on every route, role and permission registries, audit writer, runners carry an actor | acc-1 | large |+| acc-3 | Core: scoping columns and the data-access layer for the library, files and records | acc-2 | large |+| acc-4 | Core: scoping in every studio module (Cinema, Canvas, Layers, Shorts, brands and ads, Faceless, Content Factory, Dub, Katana, Swap, elements and training) | acc-3 | large |+| acc-5 | Core: scoping in Assist, skills, recipes and MCP; agents narrowed in shared spaces | acc-3 | large |+| acc-6 | Core: leak closures (files ACL, checked reads, declared ids, live-stream isolation, share rules, browser state) | acc-4, acc-5 | large |+| acc-7 | Core: provider payload guard (params.extra allowlist, LoRA rule, final-payload pricing, ComfyUI prefixes and cleanup) | acc-6 | medium |+| acc-8 | Core: paid keys, the one meter and the entitlements module, with the usage page | acc-7 | large |+| acc-9 | Core: exact settlement (compare-and-set terminal writes, cancel from the provider's answer, stopped steps, debt-free capture) | acc-8 | large |+| acc-10 | Core: runner seams (launch collector, postProcess, live source, idempotency, one price formatter, housekeeping) | acc-9 | large |+| acc-11 | Core: sign-in pages, sign-up policy, mailer, consents and the notifications store | acc-10 | large |+| acc-12 | Core: install invites, approval queue and admin actions on people (with the target-role matrix and notices) | acc-11 | medium |+| acc-13 | Core: recovery, Inbox, account menu, Confirm it's you, the account page and the member welcome | acc-12 | large |+| acc-14 | Core: first-run setup (owner's first screen, setup code at commit, wizard registry) and headless setup | acc-13 | large |+| acc-15 | Core: mode switch, Settings → Access and the settings visibility matrix | acc-14 | medium |+| acc-16 | Core: admin console core (/admin shell, Overview, People and the person page, Usage & limits) | acc-15 | medium |+| acc-17 | Core: teams and sharing (team workspaces, switcher, Saving-to chip, Move, Share, Duplicate, Library spaces, team keys and limits) | acc-16 | large |+| acc-18 | Personal: access and remote use (address checks, other addresses, trusted proxy, remote guide, Just me honesty) | acc-15 | medium |+| acc-19 | Personal: two-step sign-in and passkeys for every account in every signed-in mode | acc-13, acc-18 | large |+| acc-20 | Personal: new-sign-in alerts | acc-13 | small |+| acc-21 | Personal: backup and move (snapshots, full archives, fuobe backup and restore) | acc-15 | large |+| acc-22 | Personal: browser-approved fuobe login and token expiry warnings | acc-13 | medium |+| acc-23 | Personal: the first minute and everyday spend | acc-15 | small |+| acc-24 | Studio: team directory, team home, visibility and join requests | acc-17 | large |+| acc-25 | Studio: narrow-only team policies and team Assist connectors | acc-24 | medium |+| acc-26 | Studio: one fair queue for Studio and Platform | acc-17, acc-10 | large |+| acc-27 | Studio: GPU server registry (pools, team pins, probes, sticky routing, drain) | acc-26 | large |+| acc-28 | Studio: approvals for runs over a threshold | acc-25, acc-26 | large |+| acc-29 | Studio: usage reports, budget alerts, monthly report, pause paid runs | acc-24, acc-26 | medium |+| acc-30 | Studio: two-step enforcement and session, device, network and token policies (E1) | acc-19, acc-25 | large |+| acc-31 | Studio: verified domains, domain capture and team auto-join (E4) | acc-24 | medium |+| acc-32 | Studio: company sign-in with OIDC and SAML (E2) | acc-30, acc-31 | large |+| acc-33 | Studio: SCIM 2.0 provisioning owned by Fuobe (E3) | acc-32 | large |+| acc-34 | Studio: audit viewer, export, retention and the Auditor role (E5a, shared by Platform) | acc-24 | medium |+| acc-35 | Studio: data lifecycle (export, deletion and restore, purge manifest, retention, legal hold, privacy holds, view-as) (E5b) | acc-34, acc-25 | large |+| acc-36 | Studio: full seats and free view-only accounts (E6) | acc-33 | medium |+| acc-37 | Platform: credit ledger and CreditBudget | acc-17 | large |+| acc-38 | Platform: credit price book (per-model rules, GPU-second and AI-Toolkit pricing, credit display) | acc-37 | large |+| acc-39 | Platform: plans and entitlements engine (versions, narrower, admit checks, pools, concurrency, team pools) | acc-38, acc-26 | large |+| acc-40 | Platform: plan editor, model matrix, user locks and /setup/plans | acc-39, acc-16 | medium |+| acc-41 | Platform: admin people with credits, staff roles and the Platform overview | acc-40, acc-34 | large |+| acc-42 | Platform: credit codes and redeem, plan requests, bans, consent-based support access | acc-41, acc-35 | medium |+| acc-43 | Platform: payment core (PaymentProvider, fake provider, webhook route, event store, reconciliation, grants) | acc-41 | large |+| acc-44 | Platform: checkout and billing pages (Checkout, success and cancel, /settings/billing, top-ups, redeem, plan requests) | acc-43 | large |+| acc-45 | Platform: plan changes, seats, dunning, refunds and disputes | acc-44 | large |+| acc-46 | Platform: Stripe adapter (direct and Managed Payments), tax, portal, promotion codes, auto-recharge | acc-45 | large |+| acc-47 | Platform: public site, legal documents, re-acceptance, Coming soon and Preview access | acc-44 | large |+| acc-48 | Platform: abuse controls (captcha, breached passwords, signals, free-grant guards, throttles, rate limits) | acc-44 | medium |+| acc-49 | Platform: input safety (word list, prompt classifier, image inputs, provider flags, likeness consent) | acc-37 | medium |+| acc-50 | Platform: output safety via postProcess, withheld results, quarantine, refunds and the CSAM workflow | acc-49, acc-35 | large |+| acc-51 | Platform: moderation queue, reports, NCII takedowns, DMCA, strikes, statements of reasons and appeals | acc-50, acc-42 | large |+| acc-52 | Platform: provenance (C2PA signing, certificate, C2PA-safe share cleaning in all modes, badge, AI labels) | acc-50 | medium |+| acc-53 | Platform: privacy defaults on the E5b engine | acc-45, acc-51 | small |+| acc-54 | Platform: worker roles, leader lease, SQLite claims, partitioned polling and cross-process live events | acc-39, acc-27 | large |+| acc-55 | Platform: object storage with presigned reads, daily snapshots and the Litestream guide | acc-21 | medium |+| acc-56 | Platform: analytics, price sync, reconciliation, spend guard and observability | acc-46, acc-54, acc-29 | large |+| acc-57 | Platform: launch checklist, announcements, Studio and Platform switch hooks, headless Platform and full E2E | acc-30, acc-46, acc-47, acc-48, acc-51, acc-52, acc-53, acc-55, acc-56 | medium |++### 16.1 Core++#### acc-1 · Core: identity base (Better Auth behind Fuobe, identity tables, bootstrap, principal, proxy registries, snapshots, security headers)++_Effort: large. Depends on: none._++- **Sections:** §7.1, §7.2 (password format), §7.9 (fresh installs), §7.15 (secret fingerprint), §7.16, §5.2 (version rule).+- **Files:** package.json (better-auth exact, per §5.2 rule); new src/server/identity/{auth.ts, password.ts, principal.ts, bootstrap.ts, admin-ops.ts, refusals.ts}; src/server/mode.ts (features registry); src/server/backup/snapshot.ts; scripts/auth-schema.mjs; src/server/db.ts (migration 23 identity tables, 24 frozen Better Auth SQL); src/app/api/identity/[...all]/route.ts; shims src/app/api/auth/{login,logout,password,tokens}/route.ts; src/proxy.ts; src/instrumentation.ts (awaited bootstrap); next.config.ts headers().+- **Behaviour:** Better Auth configured exactly as §7.1: own better-sqlite3 connection, auth_* table names, HKDF secret from FUOBE_SECRET or data/secret.key, __Host- cookies on https via useSecureCookies:false plus per-cookie names, ipAddressHeaders x-fuobe-client-ip written by the proxy only when a trusted proxy is configured, disableIpTracking otherwise, cookieCache off, telemetry off. The router-only endpoint allowlist excludes /sign-up/*, /sign-in/social and /sign-in/oauth2/*; user.create.before refuses any create other than claim-owner and the bootstrap import unless accounts.multi_user=1 (not set by this package). Bootstrap: wal_checkpoint and a pre-accounts snapshot with session rows stripped; root secret and identity.secret_check (refuse to start on mismatch unless FUOBE_ACCEPT_NEW_SECRET=1); import the auth.json password as u_owner's (legacy salt:hash verifies, upgraded to scrypt$v2 N=2^15 r=8 p=3 on sign-in) and tokens as legacy Full tokens; sync FUOBE_PASSWORD every boot. A fresh data dir boots as personal, sign-in off, setup.state=done; a password install becomes Personal with sign-in. The proxy resolves bearer tokens from api_tokens and the Better Auth cookie, keeps DNS-rebinding, crossSite and share logic, and gains OPEN and CROSS_SITE_EXEMPT registries. The login shim signs u_owner in with one password field and answers with a full reload. Security headers: X-Frame-Options DENY and frame-ancestors 'none' except /s/:path*, no-store on auth pages.+- **Tests:** identity-bootstrap matrix (no password, password, FUOBE_PASSWORD, tokens, fresh dir); schema guard (getMigrations finds nothing to create or add); allowlist (router-only; auth.api passes; POST /api/identity/sign-up/email answers 403 and creates no auth_user row); password formats and upgrade; proxy matrix (Just me, password install, bearer, cookie, share link); security headers; snapshot has no auth_session rows; fingerprint mismatch refuses start; admin-ops reachability pin; Better Auth behaviour pins (cookie names and attributes on http and https, disableIpTracking skips IP rules, request scope inside hooks, returnHeaders); 50 sign-ins during runner writes with busy waits under 1 s.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; every existing Vitest suite (FUOBE_MODE=personal default); the eval harness; the only visible change is one re-sign-in on password installs.+++#### acc-2 · Core: actor context on every route, role and permission registries, audit writer, runners carry an actor++_Effort: large. Depends on: acc-1._++- **Sections:** §7.1 (principal, restricted kinds), §7.3, §7.11, §7.14 (audit chain), §13 (test harness).+- **Files:** new src/server/access/{actor.ts (ALS RequestScope, currentActor throws, runAs, asSystem), route.ts (handler({access, scopes}) with the restricted-kind registry and the substituteActor seam), permissions.ts (role and permission registries, effectiveTeamRole), gates.ts (no-op), audit.ts (append-only, prev_hash chain)}; every src/app/**/route.ts (192 at 545ebb5, including the skills recipe run, verify, estimate and recipe routes); src/server/mcp.ts (handleMcp(body, actor)); runner entry points in generations.ts, training.ts, faceless.ts, swap-studio.ts, content-factory.ts, assist/schedules.ts, assist/agent.ts, brand.ts, ads.ts; vitest.config.ts setupFiles += tests/setup/actor.ts; new tests/helpers/actors.ts.+- **Behaviour:** Every handler resolves an actor through handler(); install-config routes (PUT /api/settings, PUT /api/settings/models, POST /api/providers/test, POST /api/loras) need install.settings (the Personal owner and the local actor pass); typed errors map to 404, 403, 401, 402 and 403 REAUTH; every 403 is audited; runners and after() continuations run inside runAs(row owner) or asSystem. No scoping change yet. tests/setup/actor.ts wraps each test in runAs(local u_owner) unless the test calls asNobody(), so the 101 suites that call server modules directly keep working.+- **Tests:** route-sweep (every route.ts goes through handler(); fails on a new unwrapped route); settings-roles; audit append-only triggers and chain verification; runners carry an actor; mcp receives the actor.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the MCP route's Origin check; every existing suite unchanged in behaviour.+++#### acc-3 · Core: scoping columns and the data-access layer for the library, files and records++_Effort: large. Depends on: acc-2._++- **Sections:** §7.4 (rule, migration 25 and 26, library rows), §7.5 (create rule, created_by and paid_by = actor), §7.6 (recordVisible, denied.hidden).+- **Files:** src/server/db.ts (migration 25: workspace_id, created_by, paid_by on every top-level table, backfill to w_owner/u_owner, triggers refusing NULL workspace_id, indexes, w_install rows for built-in palettes, the demo voice and voice previews; migration 26: rebuild skills, skill_toggles, assist_connectors; item_marks with favorites and pins copied); new src/server/access/scope.ts (list({space}), get(kind, id, need), stamp, assertReadable); src/server/generations.ts (createGenerations L691 and recordLocalGeneration L1700 stamp; listGenerations scoped; root-workspace rule), src/server/library.ts (Trash, restore, empty Trash, folders, facets and zips per workspace), src/server/storage.ts, src/server/records.ts (recordVisible), src/proxy.ts; routes under src/app/api/generations/**, folders/**, assets/**.+- **Behaviour:** Rows are visible per the §7.4 rule and otherwise answer 404 with a rate-limited denied.hidden audit entry; created_by and paid_by are the acting person for any row a request starts; a request that starts rows from a root uses the root's workspace only with Editor or more there; favorites and pins come from item_marks; Trash is per workspace; a token pinned to a workspace sees only that workspace plus grants to it, and an X-Fuobe-Workspace header that differs from the pin answers 403. Personal sees no difference (one workspace).+- **Tests:** table-classification (every table and file area in §7.4, fails on a new one); idor.test.ts ROUTE_FIXTURES for the library, folder, asset and generation routes; favorites per viewer; Trash per workspace; pinned token cannot read or write outside its pin; retry and Run again stamp the actor; ASSET_REFS/ASSET_FREE entries for new columns.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Library, folders and Trash e2e (library-flows); the SSE feed for the owner.+++#### acc-4 · Core: scoping in every studio module (Cinema, Canvas, Layers, Shorts, brands and ads, Faceless, Content Factory, Dub, Katana, Swap, elements and training)++_Effort: large. Depends on: acc-3._++- **Sections:** §7.4 (studio rows, characters, trainings), §7.5 (mentions, cross-workspace inputs are added in acc-6), §3.2.+- **Files:** src/server/{cinema.ts, cinema-generate.ts, cinema-director.ts, canvas.ts, layers.ts, shorts.ts, brand.ts, ads.ts, marketing.ts, palettes.ts, moodboards.ts, photodump.ts, faceless.ts, content-factory.ts, dub.ts, katana.ts, swap-studio.ts, elements.ts, training.ts, storyboard.ts, mixed-media.ts, chains.ts, influencer.ts, genjutsu.ts, evolution.ts, remove-object.ts, audio-tools.ts} and their routes under src/app/api/**; src/server/records.ts.+- **Behaviour:** Every list and get goes through scope.list/get; children follow parents; @handles are unique per workspace and mentions resolve per §7.5; trainings record started_by and paid_by; attachLora accepts only visible elements' files and catalog LoRAs; Cinema My Generations lists only visible projects; storyboard films and retries use the actor; sweeps and runners act as each row's owner.+- **Tests:** IDOR fixtures for every studio dynamic route; handles per workspace; mention resolution order and ambiguity refusal; retries stamp the actor; existing studio suites green.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; every studio e2e (cinema-*, canvas-*, layers, character-swap-studio, mixed-shorts-original).+++#### acc-5 · Core: scoping in Assist, skills, recipes and MCP; agents narrowed in shared spaces++_Effort: large. Depends on: acc-3._++- **Sections:** §7.4 (Assist rows, skills resolution, assist_memory), §7.10 (MCP, agents in shared spaces), §7.11.+- **Files:** src/server/assist/{agent.ts, tools.ts, studio-tools.ts, studio-routes.ts, context.ts, context-tools.ts, memory.ts, projects.ts, schedules.ts, connectors.ts}, src/server/skills.ts, src/server/recipes.ts, src/server/mcp.ts; routes under src/app/api/assist/** and src/app/api/mcp.+- **Behaviour:** Threads, memory, schedules and connectors belong to their user; projects and skills to workspaces; skills resolve personal, then active team, then built-in, and the skills routes accept ?workspace=; taken() and renameSkillRefs work per workspace; listMemories returns only the actor's personal rows; use_personal_memory means the chat author's memory; activeConnectors returns only the author's connectors; ToolContext carries the actor and, in a team thread, narrows reads and writes to that workspace; schedules run as their owner; recipes run under runAs; MCP tools/list is filtered by token scope.+- **Tests:** memory isolation, connector isolation, skill resolution with ?workspace=, MCP tools/list per scope, schedule runs as owner, agent narrowing in a team thread, IDOR fixtures for every Assist route including skills run/verify/estimate/recipe.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; assist-* suites, the CLI skills commands, the Work2Skill recipe routes.+++#### acc-6 · Core: leak closures (files ACL, checked reads, declared ids, live-stream isolation, share rules, browser state)++_Effort: large. Depends on: acc-4, acc-5._++- **Sections:** §7.6, §7.5 (cross-workspace inputs, move, share and duplicate server rules), §7.13 (creation and serve-time checks), §3.3, §3.8.+- **Files:** src/app/api/files/[...path]/route.ts and src/server/file-response.ts (ACL by assets.rel_path, cache headers per mode); src/server/storage.ts (readChecked, assertReadable) and the eight absolutePath call sites (audio-tools.ts, katana.ts, canvas.ts, dub.ts, assist/studio-routes.ts, recipes.ts, library.ts); src/server/request-schema.ts and every route zod schema (ref(kind) annotations); src/server/live.ts and src/app/api/generations/stream/route.ts; src/lib/generation-stream.ts (FeedFilter space), the job notifications component; src/server/shorts-schemas.ts (once by user); brand.ts lock; faceless.ts voice previews in w_install; src/app/api/assets/[id]/route.ts; src/server/shares.ts, share-access.ts, src/proxy.ts (owner rule, signed-in-only policy); new src/lib/local-store.ts; src/app/providers.tsx and src/lib/api.ts (workspace in query keys); src/components/security-settings.tsx (sign-out full reload); new /api/users/[id]/avatar.+- **Behaviour:** Every file read is checked; every id field in path, query and body is declared and checked; cross-workspace inputs answer 409 CROSS_SPACE_INPUT until confirmed (never for continuations, schedules, approvals, Assist or MCP); the live stream checks each event against current memberships and grants (version counter), re-validates the session every 60 s and closes on revoke; payloads carry per-viewer marks; ?workspace= on the stream and GET downloads; share links need Editor and the policy at creation and are re-checked at every serve; once() and locks per user; storage keys prefixed and cleared on sign-out.+- **Tests:** files-acl; ref-annotation sweep (fails on an undeclared id-like field); IDOR matrix over every declared path, query and body field; absolutePath grep test; live-stream isolation and revocation (removed member gets nothing new and the stream closes within 60 s); leaks (once, brand lock, voice preview, assetUses copy); shares-policy (viewer can't share; serve-time re-check after move, leave and policy change).+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; live updates for the owner's own feed; downloads and zips; the share page and share files route.+++#### acc-7 · Core: provider payload guard (params.extra allowlist, LoRA rule, final-payload pricing, ComfyUI prefixes and cleanup)++_Effort: medium. Depends on: acc-6._++- **Sections:** §7.7, §3.9.+- **Files:** src/lib/catalog/types.ts (route extra allowlist), scripts/gen-cloud-models.py (emit allowlists from the research field lists) and the open ModelDefs in src/lib/catalog/models.ts; src/server/request-schema.ts L100 and L109-133; src/server/canvas.ts L121; src/app/api/generations/local/route.ts; src/lib/catalog/payload.ts L418-426 (extra before priced and safety fields); src/server/providers/comfyui.ts L807-811 and L1171; src/server/generations.ts prepare() (final-payload estimate); comfy history delete and per-job prefix.+- **Behaviour:** Unknown extra keys answer 400 'This setting isn't available for {model}.'; keys naming media, file, LoRA, model or checkpoint bindings and strings with [output], [input], [temp], / or backslash are refused; loras[] accepts catalog LoRAs and visible elements' trained files; the final payload is priced again and a higher price refuses the request ('This would cost more than shown. Refresh the price and try again.'); safety and pricing fields are written after extra; in Studio and Platform each ComfyUI job gets a random filename_prefix and its /history entry is deleted after outputs are saved (files too when the server record has local folders).+- **Tests:** extra.image naming an [output] file refused; unknown extra key refused; another person's trained LoRA refused; extra.num_images above the priced count refused; payload snapshots show safety fields after extra; history delete called; random prefix in Studio; an enumeration test that every extra key used by presets, studios, Canvas and eval cases is on its model's allowlist.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; every payload snapshot test, the eval cases that pass params.extra, the Canvas Table node.+++#### acc-8 · Core: paid keys, the one meter and the entitlements module, with the usage page++_Effort: large. Depends on: acc-7._++- **Sections:** §7.12 (who pays, payer-aware readiness, meter tables, Budget, spend points, hold sizes, entitlements), §7.8 (keys, member key test), screens §S4.3 and §S4.7.+- **Files:** src/server/db.ts migration 27 (provider_keys, spend_limits, meter_holds, meter_entries, limit_requests, lora_mirrors.key_ref, moodboards.style_key_ref; sets accounts.multi_user=1); new src/server/keys.ts (payerFor, readyFor, withKey, AES-256-GCM); src/server/providers/{fal.ts, replicate.ts, llm.ts, types.ts (PollResult.gpuMs), comfyui.ts (execution timestamps)}; src/server/enhance.ts; src/server/assist/agent.ts; src/server/faceless.ts askLlm; src/server/training.ts (cloud and AI-Toolkit holds); src/server/loras.ts; src/server/cinema-generate.ts; src/server/generations.ts (chooseRoute and routeReady per payer; reserve at L691, L1700 and dependents); new src/server/meter/{meter.ts, usd-budget.ts}; new src/server/entitlements.ts; routes /api/me/usage, /api/me/entitlements, /api/me/keys, /api/me/keys/test, /api/me/limit-requests; page /settings/usage; composer payer hint and refusal lines.+- **Behaviour:** keys.mode install, own or both resolves the payer, written to paid_by and used for every poll, cancel and download; readiness and demo auto are decided per payer; every spend point reserves inside BEGIN IMMEDIATE (cloud, open engine with gpuMs capture, AI-Toolkit trainings, Claude calls via meter.llm); UsdBudget with limits for install, team, member and personal cap; offered(), admit(), gate() and summary() in one module; GET /api/me/usage works for the local actor. Settlement stays as today until acc-9.+- **Tests:** meter (every spend point reserves; 20 concurrent creates against a $1 limit give the right refusals; open-engine gpuMs capture; AI-Toolkit hold; FUOBE_DEMO_PRICED demo holds; record mode); keys binding (poll uses paid_by's key); payer-aware readiness (own mode, no install key, member key: real run, not demo); entitlements offered/admit/gate; member key test endpoint accepts only key values.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Personal runs with install keys exactly as today; demo holds are 0 unless FUOBE_DEMO_PRICED=1.+++#### acc-9 · Core: exact settlement (compare-and-set terminal writes, cancel from the provider's answer, stopped steps, debt-free capture)++_Effort: large. Depends on: acc-8._++- **Sections:** §7.12 (settlement, holds over time, re-pricing, provider out of funds, orphans), screens §S4.9.+- **Files:** src/server/generations.ts (update() L149 CAS for terminal transitions; cancelGeneration L1641; overdue and timeout branches; submit cancel-on-arrival; launchStored re-reserve; 'canceling' status; 'stopped' dispatch state; orphan entries); src/server/providers/{fal.ts, replicate.ts, comfyui.ts} (cancel returns removed, requested, completed or aborted; insufficient-funds detection); src/server/meter/meter.ts (hold state machine, settle:<hold> key, LLM hold expiry); src/lib/types (status canceling); generation card and chain card components (Stop copy, stopped state with Add credits or Ask for more and Continue); Assist stop message; schedules pause.+- **Behaviour:** Exactly one settlement per hold; release only when the job provably never ran; otherwise keep polling and capture what ran; Fuobe-side failures after provider success capture; fal or Replicate out of funds pauses that provider and alerts admins; holds on live rows never expire by age; a higher re-price at launch reserves the difference or stops the step (never fails it); Continue re-runs admission for stopped steps only; stopped steps cancel after 7 days.+- **Tests:** per-provider cancel states (queued, in progress, already completed, aborted, interrupted); cancel against success with injected delays in persist and postProcess gives exactly one settle entry and a matching status; re-price above budget stops the step and Continue resumes it; LLM hold expiry captures the maximum; insufficient funds pauses the route; Stop copy on running jobs.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; cancel and retry flows in library-flows and cinema e2e; Personal USD caps.+++#### acc-10 · Core: runner seams (launch collector, postProcess, live source, idempotency, one price formatter, housekeeping)++_Effort: large. Depends on: acc-9._++- **Sections:** §7.18, §7.12 (request idempotency, display), §7.11 (housekeeping registry).+- **Files:** src/server/generations.ts (launch() replacing void submit at L777 and L1117; launchStored; postProcess before L1481), src/server/training.ts L221; src/server/access/route.ts (per-request launch collector); src/server/live.ts (pluggable source, typed events); db migration for request_keys; src/lib/api.ts and bin/lib/client.mjs (Idempotency-Key per click); src/server/mcp.ts (key from session and tool-call id); new src/lib/price-display.ts replacing costLabel (composer.ts L971), formatCost (format.ts), formatUsd (cinema/money.ts), the Faceless usd() and the 51 inline sites, plus server strings (assist-schedule.ts L275, assist/context.ts L54, assist/tools.ts L59-65, cinema-generate.ts L130); src/instrumentation.ts housekeeping registry.+- **Behaviour:** With no gate claiming launches the order and timing are identical to today; postProcess is a no-op by default; request_keys inserted pending in the reserve transaction (409 IN_PROGRESS while pending, replay after, 422 for a different body, 24 h); one formatter for every price label; housekeeping deletes per §7.11.+- **Tests:** collector parity; launchStored equals advanceDependents; postProcess no-op timing; idempotency replay, 409 and 422; price-display sweep with byte-identical USD labels in Personal and Studio; housekeeping retention.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; composer-flows e2e price labels; Assist and MCP price text.+++#### acc-11 · Core: sign-in pages, sign-up policy, mailer, consents and the notifications store++_Effort: large. Depends on: acc-10._++- **Sections:** §7.1 (allowlist adds sign-up with the policy), §7.2 (throttles, 423 rules), §9.1 (policy, domain trust only for checked addresses), §7.14 (notices), screens §S2 and §S12.+- **Files:** package.json (nodemailer per §5.2 rule); new src/server/identity/policy.ts, src/lib/webmail-domains.ts, vendored disposable list and password blocklist; new src/server/mail/{mailer.ts, outbox.ts, templates/*}; db migration for consents, notifications, mail_outbox; src/server/identity/auth.ts (emailOTP, socialProviders, genericOAuth from settings); pages src/app/login, /register, /verify, /reset, /reset/[token]; new src/components/auth/*; /api/public/sign-in-options; /api/auth/forgot*; src/proxy.ts OPEN additions; new src/server/inbox.ts (notify(), no UI yet).+- **Behaviour:** open, approval, invite and closed policies with domain lists; open needs email checks or Google/OIDC only; domain auto-approve only for checked addresses; uniform answers for existing emails; per-account throttle keyed by email hash; password-only 423 with the 24 h and passkey/second-factor/reset lifts; global soft throttle; SMTP, log or none transports with an outbox and retries at 1, 5 and 30 minutes; consents append-only through recordConsent; inbox.notify() writes notifications and email copies for requests, decisions, exports, deadlines and alerts.+- **Tests:** signup-policy matrix; open-without-email refusal; unverified domain address stays pending; uniform sign-up answer; throttle by email hash and 423 lifts; OTP stored hashed; consents append-only; outbox retries; e2e sign-in pages at 390 and 1440 px, light and dark, keyboard and role=alert.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the Personal one-field login; /login redirects to / in Just me.+++#### acc-12 · Core: install invites, approval queue and admin actions on people (with the target-role matrix and notices)++_Effort: medium. Depends on: acc-11._++- **Sections:** §7.3 (who may act on whom), §9.1 (invites, approval, no-email reset links), §7.14 (notices to the person), screens §S2.5 and §S6.3.+- **Files:** invites table usage and /api/invites/*; page /invite/[token]; approval queue API; /api/admin/people/[id]/* (approve, disable, enable, reset email or link, sign out everywhere, role, transfer ownership); src/server/identity/admin-ops.ts (target matrix enforced in one place).+- **Behaviour:** Invites by email or copyable link, 72 h, single use, resend invalidates, 5-minute resend guard, daily limits, roles limited to what the inviter may assign, admin-role invites need a checked email; approvals; admin actions follow the matrix (nothing targets the owner; admins and staff need the owner); reset emails and links never clear two-step or passkeys; Platform staff never get links; the target always gets an Inbox notice and an email when mail works.+- **Tests:** invite lifecycle (expiry, resend, wrong account, used, revoked, unknown); role x action matrix; reset keeps two-step; notices written; audit entries.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the owner's own sign-in; FUOBE_PASSWORD break-glass.+++#### acc-13 · Core: recovery, Inbox, account menu, Confirm it's you, the account page and the member welcome++_Effort: large. Depends on: acc-12._++- **Sections:** §7.15 (recovery), §7.2 (step-up), §7.10 (tokens), screens §S2.6, §S3 and §S4.1.+- **Files:** bin/fuobe.mjs and bin/lib (local recover mode reading FUOBE_DATA_DIR), FUOBE_RECOVER at boot; /api/recover/{verify,finish}; page /recover; Inbox bell in the sidebar header and PhoneBar (src/components/app-sidebar.tsx, phone-bar.tsx), /api/me/inbox and /api/me/inbox/read; account menu in the sidebar footer (L386-428) and the phone avatar sheet; new src/components/ui/responsive-dialog.tsx; Confirm it's you dialog with session_step_up; /settings/account (profile, avatar upload, email change, sign-in, devices via /api/me/sessions, tokens with name, scope, expiry and pin, your keys, notifications, appearance) including the Just me variant; Home member welcome card replacing GetStarted for non-admins.+- **Behaviour:** Recovery file 0600 with a 60-bit code, 30 minutes, 5 tries, printed path; redeem at /recover#CODE with a Strict cookie; the Inbox is reachable from a bell with an unread badge; devices never expose session tokens; tokens are created only from a browser session or the local actor; the welcome card per §S3.6.+- **Tests:** recovery (file mode, tries, expiry, no server call from the CLI); inbox read and mark all; devices list contains no tokens; token scopes and pin; ResponsiveDialog layout at 390 px; keyboard and screen-reader checks.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Settings → Security token list and MCP snippet (reused); fuobe login with a pasted token.+++#### acc-14 · Core: first-run setup (owner's first screen, setup code at commit, wizard registry) and headless setup++_Effort: large. Depends on: acc-13._++- **Sections:** §7.9 (first screen, setup code, steps, headless, Platform availability), §6.3, screens §S1.+- **Files:** src/app/setup/** pages; /api/setup/{code,account,draft,finish}; setup code writer and terminal lines in src/instrumentation.ts; step registry; headless env in bootstrap; src/proxy.ts setup gate activated for fresh installs; tests/e2e/_server.mjs, tests/e2e/_routes.mjs (AUTH_ROUTES), README browser-checks section (FUOBE_MODE=personal FUOBE_DEMO_MODE=on).+- **Behaviour:** Fresh installs open on Just me or Create your account; the code travels in the fragment, is asked only at commit, is throttled after 5 misses and never rotated on failures; the Platform card is disabled until acc-57 (FUOBE_DEV_PLATFORM for development); Studio recommended settings preselect open with the owner's work domain, falling back to approval without mail or Google; Finish deletes the code file and does a full load.+- **Tests:** setup-code throttle and no rotation; fragment carried and removed; Just me finishes in one click from the link; Create account for Personal and Studio; Platform card disabled; recommended settings with and without mail; headless matrix and its one-line errors; e2e setup-wizard at 390 and 1440 px light and dark.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; existing installs (setup.state=done); the e2e harness on a fresh data dir.+++#### acc-15 · Core: mode switch, Settings → Access and the settings visibility matrix++_Effort: medium. Depends on: acc-14._++- **Sections:** §7.9 (switching), §7.8, screens §S0.3 and §S4.4.+- **Files:** new src/server/mode-switch.ts (canLeave and onEnter registries, dormancy, snapshot first); /api/access/*; /settings/access core sections (mode card, Require sign-in, who can join, sign-in methods, email, site address, time zone, share links); the settings sub-nav registry driven by the visibility matrix; src/components/settings-form.tsx (StatusStrip only on General for admins; members see Managed by your admin).+- **Behaviour:** Owner-only switching with a fresh session and a snapshot; Personal to Studio or Platform needs a checked owner email and a non-loopback address; Studio or Platform to Personal makes others dormant and keeps the owner's access to every team space; Require sign-in on and off in Personal with honest copy; env locks show Set by the server.+- **Tests:** mode-switch round trip with snapshots and dormancy; Require sign-in on and off; visibility matrix per mode and role; e2e access page at 390 px.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Just me after turning sign-in off again; the owner's library after a round trip.+++#### acc-16 · Core: admin console core (/admin shell, Overview, People and the person page, Usage & limits)++_Effort: medium. Depends on: acc-15._++- **Sections:** §7.3, §9.1, screens §S6.+- **Files:** src/app/admin/** (layout with the nav registry and Select under 768 px, Overview registry, People list with tabs Active, Waiting, Invited, Turned off, /admin/people/[id] with Overview, Usage, Devices and Tokens tabs, Teams read-only list, Usage & limits with CSV, default limit, unknown-price switch and limit requests); ⌘K entries in src/components/command-palette.tsx.+- **Behaviour:** Admins see people, spend and requests; members get 404; every action uses acc-12's actions; CSV has a byte-order mark and a formula-injection guard.+- **Tests:** admin permissions (404 for members and auditors where not allowed); CSV injection guard; limit request approve and decline; e2e admin pages at 390 and 1440 px.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Settings pages for the Personal owner.+++#### acc-17 · Core: teams and sharing (team workspaces, switcher, Saving-to chip, Move, Share, Duplicate, Library spaces, team keys and limits)++_Effort: large. Depends on: acc-16._++- **Sections:** §7.5 (all rules), §9.3, §7.13 (link re-checks on move and leave), screens §S5.+- **Files:** /api/workspaces/* (create, members, invites with the beforeJoin seam, leave, transfer, delete or archive); Create team dialog; /teams/[slug]/settings (Members, Keys & limits, General); full /admin/teams; the switcher in the account menu and ⌘K; the Saving-to chip in src/components/studio composers; /api/move, /api/grants, /api/duplicate; the share dialog section; src/components/library-view.tsx (space control above the tab strip; Shared renamed Links); team keys and limits in the meter; team policies for links, brand kits and copying out; the Editor label.+- **Behaviour:** Several teams per person; roles with the last-owner guard; Move out of a team needs a team admin; grants need Editor and can't exceed the granter's level; Studio people picker limited to people who share a team; deleting a team moves or archives and returns likeness and voice elements; links re-checked on move and leave; new tabs start in the last-used space.+- **Tests:** teams.test.ts (semantics, last owner, transfer, leave, delete); IDOR with roles; cross-space 409; move-out rule; grant level cap; e2e accounts (invite, isolation, share, team move, limit line, sign-out cache, new tab keeps the space).+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the Library tabs for a person with no team (no space control shown).+++### 16.2 Personal++#### acc-18 · Personal: access and remote use (address checks, other addresses, trusted proxy, remote guide, Just me honesty)++_Effort: medium. Depends on: acc-15._++- **Sections:** §8 (Just me rules, Access and remote use), §7.2 (trusted proxies), screens §S4.4.+- **Files:** new src/server/access.ts (allowedHosts, trustProxy) read by src/server/auth.ts crossSite and hostAllowed, trustedOrigins, the throttles and the client IP; new src/server/net-info.ts; /api/access, /api/access/diagnostics, /api/access/sign-in; src/lib/site-address.ts; /settings/access Personal sections and the remote guide; the other-device banner; uqr 0.1.3; docs/remote-access.md.+- **Behaviour:** Other addresses refuse *, wildcards, ranges and public suffixes; Just me refuses forwarded requests from non-private addresses unless a trusted proxy is set; /api/identity/* unmounted in Just me except sign-in-options; the detected client IP shown; quick tunnels refused in Just me; Cloudflare Tunnel and Caddy recipes only with sign-in on.+- **Tests:** access-settings; runtime-auth extension (tunnel refusal, private ranges incl. 100.64.0.0/10); e2e personal-access.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; hosts that pass today's hostAllowed; FUOBE_ALLOWED_ORIGINS wins; /s/ framing.+++#### acc-19 · Personal: two-step sign-in and passkeys for every account in every signed-in mode++_Effort: large. Depends on: acc-13, acc-18._++- **Sections:** §8 (two-step and passkeys), §7.2 (step-up), §7.15 (recovery checkboxes), screens §S2.2, §S2.6 and §S4.2.+- **Files:** package.json (@better-auth/passkey matching better-auth, @simplewebauthn/browser 13.3.0); src/server/identity/auth.ts (twoFactor and passkey plugins, allowlist entries, freshness hooks, 10-passkey limit); db (frozen auth_two_factor, auth_passkey; totp_seen; session_mfa); verify-2fa restricted kind; the login shim forwards twoStep; admin-ops resetTwoFactor and removePasskeys; /login code step and passkey button; /two-step?mode=session; Account sections Passkeys and Two-step with the setup dialog; passkey option in Confirm it's you; /recover checkboxes.+- **Behaviour:** TOTP with replay guard, backup codes, trusted devices 30 days; passkeys with rpID and origin from the site address and user verification required; restricted verify-2fa after OAuth or SSO; recovery may turn off two-step and remove passkeys.+- **Tests:** passkeys-two-step (CDP virtual authenticator); replay guard; verify-2fa after OAuth; recovery checkboxes; e2e personal-signin.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; password-only sign-in for people without two-step.+++#### acc-20 · Personal: new-sign-in alerts++_Effort: small. Depends on: acc-13._++- **Sections:** §8 (alerts), screens §S3.4.+- **Files:** session.create.after alert rule (90-day label memory, security.sign_in_alerts); new-sign-in mail template; banner component in the studio layout; Devices switch and IP display.+- **Behaviour:** Banner when another session is newer than this browser saw; email only for a label unseen in 90 days and only with a checked email and mail.+- **Tests:** alert decisions; e2e second browser context sees the banner.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; sign-in speed (the rule runs after the session is created).+++#### acc-21 · Personal: backup and move (snapshots, full archives, fuobe backup and restore)++_Effort: large. Depends on: acc-15._++- **Sections:** §8 (backup and move), §7.16 (no live credentials in copies), screens §S4.5.+- **Files:** new src/server/backup/{schedule.ts, tar.ts, archive.ts}; /api/backups and /api/backup/* (owner); data/server.pid written in register(); /settings/backup and the General summary; /setup/restore; bin/lib/tar.mjs; fuobe backup and fuobe restore commands; docs/moving.md.+- **Behaviour:** Weekly snapshots keep 4 (Platform daily keep 7, set by acc-55); full archives on demand with single-use 60-second download tickets; in Studio and Platform a full archive needs a reason, is audited and notifies admins; restore only with the server stopped, into .restoring-<UTC>, checksum verified; session and verification rows never included.+- **Tests:** backup schedule and pruning; tar safety (no absolute paths, no links, allowlisted prefixes); checksum; fingerprint carried; restore signs everyone out; e2e personal-backup (TOTP survives the move).+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the core snapshot names; zip downloads.+++#### acc-22 · Personal: browser-approved fuobe login and token expiry warnings++_Effort: medium. Depends on: acc-13._++- **Sections:** §8 (CLI login), §7.10, screens §S4.6.+- **Files:** db cli_connect_requests; /api/cli/connect, /api/cli/connect/poll (public, rate-limited), /api/cli/connect/[code], approve and deny (session only); /settings/account/connect-cli; bin/fuobe.mjs login (--no-browser, --paste); X-Fuobe-Token-Expires header.+- **Behaviour:** The page shows the code, the requesting IP and user agent and the time; default scope Generate only; approval needs a fresh session; 10-minute requests; tokens delivered once and wiped.+- **Tests:** cli-connect (expiry, single delivery, rate limits, session-only approval); cli login; e2e personal-cli.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; fuobe login with --token and FUOBE_TOKEN.+++#### acc-23 · Personal: the first minute and everyday spend++_Effort: small. Depends on: acc-15._++- **Sections:** §8 (first minute and spend), §7.12 (display), screens §S1.1 and §S4.3.+- **Files:** terminal setup lines; Personal copy on /setup steps; src/components/get-started.tsx autofocus and toast; the footer spend row in app-sidebar.tsx; Personal usage labels and usage.csv; the 402 copy for the personal cap; tests/e2e/_server.mjs timing helper.+- **Behaviour:** A first demo result in under 60 s from a fresh install; 'Spent ≈ $12.40 this month' in the footer when paid engines are on; the personal cap line with Change limit.+- **Tests:** personal-first-run; e2e personal-setup with the 60 s budget.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the Get started guide for admins.+++### 16.3 In-house studio++#### acc-24 · Studio: team directory, team home, visibility and join requests++_Effort: large. Depends on: acc-17._++- **Sections:** §9.3 (directory, visibility), screens §S7.1 and §S7.2.+- **Files:** db team_join_requests, notice_sends; new src/server/teams/directory.ts; /api/teams/directory, join, join-requests, summary; ?space on list routes; /teams and /teams/[slug]; team settings join and visibility; /admin/teams Team rules; Studio Inbox kinds.+- **Behaviour:** Private teams answer 404 to non-members; Listed teams take requests that expire after 30 days; Open teams join at once with the join role; the team home shows sections with empty-state copy for a new team.+- **Tests:** teams-directory; space filter; e2e studio-teams.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Personal (inert); core teams.+++#### acc-25 · Studio: narrow-only team policies and team Assist connectors++_Effort: medium. Depends on: acc-24._++- **Sections:** §9.4 (team policies), §7.10 (team connectors only in team chats).+- **Files:** new src/server/teams/policies.ts (resolvePolicy); the team narrower registered in src/server/entitlements.ts; assist_connectors.workspace_id; team policies route; the Policies tab.+- **Behaviour:** Models, engines, public links, brand-kit editors, connectors, two-step and retention per team, always the narrower of install and team; prepare(), MCP and Assist read offered().+- **Tests:** team-policies (narrowing never widens); connectors offered only in team chats.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; install model switches.+++#### acc-26 · Studio: one fair queue for Studio and Platform++_Effort: large. Depends on: acc-17, acc-10._++- **Sections:** §9.4 (fair queue), §10.3 (Platform pools, added by acc-39), §7.12 (holds never expire on waiting rows), screens §S7.8 and §S4.9.+- **Files:** generations dispatch columns; new src/lib/gpu-fair.ts (pure pick and positions); src/server/gpu/service.ts; src/server/queue/dispatcher.ts as a launch gate; policy hooks for weight and concurrency; /admin/gpu Waiting, Shares and Settings; card lines and Run on cloud instead.+- **Behaviour:** Weighted fair share over GPU-seconds in 60 minutes by group then person then age; slot rule; 50 waiting per person; max wait; cancel of held rows makes no provider call; AI-Toolkit trainings counted; Personal submits directly.+- **Tests:** gpu-fair (pure); gpu-dispatcher; one open training per person per pool.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Personal submit timing; ComfyUI binding tests.+++#### acc-27 · Studio: GPU server registry (pools, team pins, probes, sticky routing, drain)++_Effort: large. Depends on: acc-26._++- **Sections:** §9.4 (GPU pool), §7.7 (prefix and cleanup per server), screens §S7.8.+- **Files:** db comfy_servers; src/server/providers/comfyui.ts takes the server id for upload, poll, history and cancel; LoRA folders per server; probes and capability matching; /admin/gpu Servers section; team Policies read-only row.+- **Behaviour:** An empty table means today's comfyui.url and isolatedUrl; least-loaded and warm routing; pins; drain; token warning; removed server fails its rows with a run-again message.+- **Tests:** gpu-pool; existing comfyui binding tests unchanged.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the isolated worker routing.+++#### acc-28 · Studio: approvals for runs over a threshold++_Effort: large. Depends on: acc-25, acc-26._++- **Sections:** §9.4 (approvals), §7.12 (re-price re-runs approval), screens §S7.3.+- **Files:** db approval_requests; src/server/approvals.ts as a launch gate using collector hold ids; /api/approvals and the admin settings route; /approvals; requester toast and card states; menu row; mail templates.+- **Behaviour:** Off by default; thresholds per team and for personal spaces on studio keys; admins and own-key payers exempt; 72 h expiry; second decision 409; private runs hide the prompt.+- **Tests:** approvals (FUOBE_DEMO_PRICED); e2e studio-approvals.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; runs below the threshold launch exactly as before.+++#### acc-29 · Studio: usage reports, budget alerts, monthly report, pause paid runs++_Effort: medium. Depends on: acc-24, acc-26._++- **Sections:** §9.4 (reports and alerts), screens §S6.5.+- **Files:** new src/server/meter/{reports.ts, alerts.ts, monthly-report.ts}; report routes with CSV streaming; pause-spend route; /admin/usage tabs; /teams/[slug]/usage; SVG day chart with Show as table.+- **Behaviour:** Reports by person, team, model, feature, engine, day and payer; alerts at 50, 80 and 100% deduplicated; monthly email on the 1st at 09:00; pausing keeps the previous limit in the audit entry.+- **Tests:** usage-reports; budget-alerts; CSV injection guard.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; core /settings/usage.+++#### acc-30 · Studio: two-step enforcement and session, device, network and token policies (E1)++_Effort: large. Depends on: acc-19, acc-25._++- **Sections:** §9.5 E1, §7.15 (Revoke everything), screens §S7.4.+- **Files:** new src/server/identity/two-step.ts (required, deadline) with the enroll-2fa kind; /two-step/setup; session_activity; absolute and idle checks; device cap; networks through trustProxy(); tokens.max_days; Sign out everyone and Revoke everything; admin reset two-step (owner); /admin/security; /setup/security; the team two-step row; the idle warning dialog and draft restore.+- **Behaviour:** Required for owner, admins and auditors by default with 7 days of grace; tokens refused with TWO_STEP_REQUIRED after the deadline; Platform staff registered under the same rule; networks refuse a list without your own address.+- **Tests:** two-step enforcement; session-policies (absolute, idle, device cap, networks); Revoke everything; e2e studio-security.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; people without a policy requirement.+++#### acc-31 · Studio: verified domains, domain capture and team auto-join (E4)++_Effort: medium. Depends on: acc-24._++- **Sections:** §9.5 E4, §9.1 (checked addresses only).+- **Files:** db domains, team_auto_join; src/server/identity/domains.ts with an injected resolver and the daily recheck; autoJoin on every activation path; /admin/domains; Auto-join card; capture switch.+- **Behaviour:** TXT verification, lapse after 3 misses, owner manual verification with a reason; capture and auto-join only for checked addresses; each domain bound to at most one connection.+- **Tests:** domains; auto-join (unverified address never joins).+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; invites and approval.+++#### acc-32 · Studio: company sign-in with OIDC and SAML (E2)++_Effort: large. Depends on: acc-30, acc-31._++- **Sections:** §9.5 E2, §7.1 (cross-site exemption, no issuer origins), screens §S7.5.+- **Files:** package.json @better-auth/sso (same version as better-auth); db sso_connections and frozen auth_sso_provider; src/server/identity/sso.ts (defaultSSO, resolveUser, after-hooks, group sync, enforcement, RelayState cookie); CROSS_SITE_EXEMPT registration; /admin/sso and the editor; /login/sso; /api/public/sso-route; /setup/sso; env connection.+- **Behaviour:** Owner-only connection changes with a test; bound domains; auto-link only to credential-less accounts and never to privileged ones; issuer and subject keys; SAML only with a matching RelayState cookie; require-company-sign-in with break-glass.+- **Tests:** sso-oidc (mock IdP); sso-saml (samlify test IdP, signature wrapping cases); login CSRF refused; proxy cross-site exemption exact; e2e studio-sso.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; password sign-in for break-glass people.+++#### acc-33 · Studio: SCIM 2.0 provisioning owned by Fuobe (E3)++_Effort: large. Depends on: acc-32._++- **Sections:** §9.5 E3.+- **Files:** db scim_tokens, scim_groups, scim_group_members; new src/server/scim/*; /api/scim/v2/{ServiceProviderConfig,ResourceTypes,Schemas,Users,Groups} with access 'scim'; proxy OPEN and bearer skip for fuobe_scim_ tokens; admin routes; /admin/provisioning; Okta and Entra fixtures.+- **Behaviour:** SCIM touches only people it provisioned and never install roles or the owner; SCIM-managed accounts use company sign-in only; groups map to teams and roles; delete turns off; the safety brake.+- **Tests:** scim-users, scim-groups (filters, PATCH quirks, error format); scope refusals; brake; e2e studio-scim.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; people created by invite or sign-up.+++#### acc-34 · Studio: audit viewer, export, retention and the Auditor role (E5a, shared by Platform)++_Effort: medium. Depends on: acc-24._++- **Sections:** §9.5 E5a, §7.14 (chain), screens §S7.7.+- **Files:** audit indexes; the auditor role registered; src/server/audit-query.ts; audit labels with a group registry; streamed CSV and JSONL export; retention sweep; optional HTTPS sink; /admin/audit; team Activity; person Activity tab.+- **Behaviour:** Plain sentences, chips, details sheet, chain verification banner, retention 90 days to 7 years, team Activity without IP addresses.+- **Tests:** audit-viewer (filters, export, chain, retention entry).+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; core audit writes.+++#### acc-35 · Studio: data lifecycle (export, deletion and restore, purge manifest, retention, legal hold, privacy holds, view-as) (E5b)++_Effort: large. Depends on: acc-34, acc-25._++- **Sections:** §9.5 E5b (purge manifest table), §7.3 (view-as rules), screens §S4.8 and §S7.7.+- **Files:** db export_jobs, access_grants, privacy_holds; src/server/data/{exports.ts, deletion.ts, retention.ts, legal-hold.ts, view-as.ts}; restore-account and view-as kinds; files read under an active grant; /settings/privacy; /account/restore; /admin/data; person Delete and Open library.+- **Behaviour:** Exports in parts with a manifest; deletion with 30-day grace and restore; the purge manifest including LoRA files, datasets, GPU server copies, provider copies and ComfyUI history; retention previewed with a 7-day first run; legal hold 423; privacy holds override purges; view-as read-only, reasoned, notified, 30 minutes.+- **Tests:** exports; deletion and restore; purge-manifest coverage (fails on an unclassified table or file area); retention; view-as.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Trash purge timing in Personal.+++#### acc-36 · Studio: full seats and free view-only accounts (E6)++_Effort: medium. Depends on: acc-33._++- **Sections:** §9.5 E6, screens §S7.6.+- **Files:** users.seat, seat_requests; seats.assign in BEGIN IMMEDIATE on every activation path; the view clamp in effectiveTeamRole; /admin/seats; view-only states; FUOBE_SEATS.+- **Behaviour:** No limit by default; overflow becomes view-only; requests; 'Editor · view-only seat'.+- **Tests:** seats including a 10-way activation race.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; people when no seat limit is set.+++### 16.4 Platform++#### acc-37 · Platform: credit ledger and CreditBudget++_Effort: large. Depends on: acc-17._++- **Sections:** §10.2 (units, tables, lifecycle, keys, sweeps, payer, staff record cap), §7.12 (Budget, debt), screens §S8.4.+- **Files:** db credit_accounts, credit_buckets, credit_ledger (append-only triggers), credit_holds; src/server/credits/{accounts.ts, buckets.ts, ledger.ts, budget.ts, sweeps.ts}; features().credits; interim credits.free_monthly; /api/me/credits; admin adjust; the credits live event; /setup/credits (value and markup); the credits pill.+- **Behaviour:** Reserve by debit in spending order; capture min(hold, final) and debt for overage; release on every core path; idempotency keys; expiry sweep; nightly invariants; staff record mode capped at $50 a day.+- **Tests:** credits-ledger (including two-process concurrency); credit-budget-paths across every release path; debt clears on top-up.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio and Personal UsdBudget.+++#### acc-38 · Platform: credit price book (per-model rules, GPU-second and AI-Toolkit pricing, credit display)++_Effort: large. Depends on: acc-37._++- **Sections:** §10.5, §7.12 (hold sizes, display).+- **Files:** db price_rules, gpu_run_stats; src/lib/credits.ts creditsFor; /api/public/price-book (versioned); the Platform branch of formatPrice; credits in previews; /admin/credits; enhance and Assist credit lines; AI-Toolkit target prices.+- **Behaviour:** Fixed rules or usd x (1 + markup) / value with minimum and rounding; open-engine holds per §7.12; unknown prices refused unless fixed; below-cost flags.+- **Tests:** credits-price (examples in §10.5); credit labels; unknown price refused.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; USD labels in Personal and Studio.+++#### acc-39 · Platform: plans and entitlements engine (versions, narrower, admit checks, pools, concurrency, team pools)++_Effort: large. Depends on: acc-38, acc-26._++- **Sections:** §10.2 (plans), §10.3 (fields, queue pools), §7.12 (entitlements module).+- **Files:** db plans, plan_versions, account_plans, entitlement_overrides, credit_limits; the plan narrower and admit checks registered in src/server/entitlements.ts; dispatcher weight and concurrency policies (Free pool, Unlimited pool, team weight x seats capped at 32, Free pool at most 25% of slots); staff plan in record mode; team pools and member caps; unlimited relaxed rules with the operator-cost ceiling; teams without a Team plan pay from the runner's credits.+- **Behaviour:** Plans versioned and grandfathered; every spend entry point checks entitlements after planning; queue weights per §10.3.+- **Tests:** entitlement sweep across every spend entry point; 1,000 Free accounts against one Ultra; unlimited ceiling.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio team weights (same algorithm).+++#### acc-40 · Platform: plan editor, model matrix, user locks and /setup/plans++_Effort: medium. Depends on: acc-39, acc-16._++- **Sections:** §10.3, screens §S9.2 and §S9.4.+- **Files:** /admin/plans (list and versioned editor with the publish dialog), /admin/models (plan matrix with licence chips), lock badges in pickers and studios, /setup/plans.+- **Behaviour:** Publishing a version keeps existing subscribers unless moved; margin check before publish; locked items show the plan they need.+- **Tests:** plan editor validation; publish keeps subscribers; e2e admin plans at 390 px.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; model-access switches.+++#### acc-41 · Platform: admin people with credits, staff roles and the Platform overview++_Effort: large. Depends on: acc-40, acc-34._++- **Sections:** §10.7 (staff roles and caps), screens §S9.1 and §S9.3.+- **Files:** billing, moderator and support roles registered; Platform nav groups and Overview tiles; person Credits tab and Adjust credits with role caps; audit groups added to E5a; SVG charts.+- **Behaviour:** Caps per role (support 500, billing 10,000 credits per action); every adjustment audited with a reason and notified to the customer.+- **Tests:** permissions matrix per staff role; adjustment caps.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio admin console.+++#### acc-42 · Platform: credit codes and redeem, plan requests, bans, consent-based support access++_Effort: medium. Depends on: acc-41, acc-35._++- **Sections:** §10.1 (code limits), §10.7, §7.3 (view-as by consent), screens §S8.5, §S9.5 and §S9.8.+- **Files:** db credit_codes, credit_code_redemptions, plan_requests, user_bans; /redeem; /admin/codes credit tab; /admin/bans; ban refusal codes; support access as an access_grants consent mode with an owner emergency path.+- **Behaviour:** Codes shown once; first-time and per-card limits; ban effects (sessions, links, subscription and credits per setting); support view-as only after the customer allows.+- **Tests:** codes; ban effects; view-as consent and emergency audit.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio view-as policy.+++#### acc-43 · Platform: payment core (PaymentProvider, fake provider, webhook route, event store, reconciliation, grants)++_Effort: large. Depends on: acc-41._++- **Sections:** §10.4 (webhooks, grant rules, keys), §10.2 (idempotency keys).+- **Files:** db customers, subscriptions, payments, payment_events, checkout_sessions, credit_packs; src/server/billing/{provider.ts, fake.ts, fulfill.ts, grants.ts, webhook.ts, reconcile.ts}; /api/billing/[provider]/webhook registered in the proxy's OPEN and cross-site-exempt registries and exempt from setup gate, Preview, dormancy, captcha and IP limits; Health event-gap alert.+- **Behaviour:** Raw body, signature, store then 2xx, process from the table, dedupe on event id and on object id plus type, re-fetch the canonical object; grants only for the listed billing reasons keyed by period start; reconciliation every 15 minutes and at boot; fake only with test hooks and demo mode.+- **Tests:** billing-fake; webhook-route (raw body, duplicate events, out-of-order, missing for 4 days then reconciled); grant keys.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; no payments mode (codes and admin grants).+++#### acc-44 · Platform: checkout and billing pages (Checkout, success and cancel, /settings/billing, top-ups, redeem, plan requests)++_Effort: large. Depends on: acc-43._++- **Sections:** §10.6, screens §S8.+- **Files:** /api/billing/checkout, /billing/success, /pricing?checkout=cancelled, /settings/billing, top-up sheet, post-verification redirect to Checkout, the Request this plan flow, /setup/payments (none and fake).+- **Behaviour:** Success polls every 2 s for 60 s then the delayed copy; cancel returns to pricing with the note; no-payments installs show Redeem a code and Request this plan.+- **Tests:** billing pages states; e2e platform-billing at 390 px light and dark.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; core /settings/usage.+++#### acc-45 · Platform: plan changes, seats, dunning, refunds and disputes++_Effort: large. Depends on: acc-44._++- **Sections:** §10.4 (plan changes, seats, unpaid invoice, refunds, disputes).+- **Files:** src/server/billing/{changes.ts, seats.ts, refunds.ts, disputes.ts}; the change-plan sheet; team billing tab; freeze state; transactional emails; move subscribers.+- **Behaviour:** Upgrades start a new period and credit unused plan credits; downgrades and cancels at period end; seat adds prorated with prorated seat credits, removals at period end with no credit refund; changes refused while unpaid; refunds freeze the bucket first; disputes freeze and claw back.+- **Tests:** upgrade on the last day; 10 seats added then removed; change while past due; partial refunds; dispute won and lost; refund racing a spend.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; plan grants from acc-43.+++#### acc-46 · Platform: Stripe adapter (direct and Managed Payments), tax, portal, promotion codes, auto-recharge++_Effort: large. Depends on: acc-45._++- **Sections:** §10.4 (Stripe direct, Managed Payments, portal, tax display, auto-recharge), §10.1 (card testing).+- **Files:** package.json stripe (per §5.2 rule); src/server/billing/stripe.ts (catalog sync by lookup key with AIaaS tax codes, webhook endpoint creation, portal configuration per option, tax inclusive for consumer plans, invoices, promotion codes with first-time and card limits, auto-recharge single-flight); setup and settings UI.+- **Behaviour:** Every PaymentProvider method; Managed Payments changes at period end only; auto-recharge at most 3 a day and off after a failure.+- **Tests:** billing-stripe against an HTTP double (all event types, idempotency keys, portal changes, $0 invoices).+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the fake provider for e2e.+++#### acc-47 · Platform: public site, legal documents, re-acceptance, Coming soon and Preview access++_Effort: large. Depends on: acc-44._++- **Sections:** §10 (launch states), §10.9, screens §S8.1 and §S8.2.+- **Files:** cached public pages (/welcome as '/' when signed out, /pricing, /coming-soon, /legal/[slug]); registry rewrites; robots and sitemap; db legal_docs, sales_leads; templates with placeholders; the legal editor and operator checklist; accept-terms kind; OAuth consent step; waitlist; Preview access list.+- **Behaviour:** Pages use 'use cache' with tags and no user data; revalidateTag from route handlers; re-acceptance on new versions.+- **Tests:** public-route matrix; legal versioning; no-horizontal-scroll for public pages.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the signed-in app shell.+++#### acc-48 · Platform: abuse controls (captcha, breached passwords, signals, free-grant guards, throttles, rate limits)++_Effort: medium. Depends on: acc-44._++- **Sections:** §10.1.+- **Files:** captcha and haveibeenpwned plugins in Platform (fake captcha for tests); db account_signals, rate_limits; /api/public/device (consent-gated); free-grant guards with email normalisation and IPv4 /24 or IPv6 /64 networks; checkout throttles; new-account velocity cap; limits on public endpoints; Abuse settings.+- **Behaviour:** Per-IP rules only with a trusted proxy; server-side signals by default; trials and $0 invoices never grant full allowances.+- **Tests:** abuse (farming, IPv6 networks, normalisation, trusted-proxy off).+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; sign-in for Studio and Personal (plugins load only in Platform).+++#### acc-49 · Platform: input safety (word list, prompt classifier, image inputs, provider flags, likeness consent)++_Effort: medium. Depends on: acc-37._++- **Sections:** §10.8 (inputs, provider flags, consent), §7.7 (flags after extra).+- **Files:** src/server/safety/{words.ts, prompt-check.ts, image-input-check.ts}; db moderation_checks; the admit word list; the pre-submit classifier as a launch gate; upload checks; generator safety map; payload flags; consent dialog and CONSENT_REQUIRED; /setup/safety prompt row.+- **Behaviour:** A check that times out or errors blocks; sexual content always blocked; likeness consent recorded in consents.+- **Tests:** safety inputs; payload snapshot (flags after extra); classifier timeout blocks.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio and Personal payloads (flags only in Platform).+++#### acc-50 · Platform: output safety via postProcess, withheld results, quarantine, refunds and the CSAM workflow++_Effort: large. Depends on: acc-49, acc-35._++- **Sections:** §10.8 (outputs, withheld, CSAM, refund rule).+- **Files:** output checkers (fal x-ailab/nsfw, local HTTP classifier) and frame sampling; db quarantine, csam_reports; holds via privacy_holds; partial re-pricing; re-check sweep; auto pause after 5 blocked in 24 h; generation card states held and blocked.+- **Behaviour:** Required for every engine that is on; failed or missing checks withhold; blocked results refunded until the pause rule.+- **Tests:** safety outputs; withheld on checker error; csam-flow (quarantine, suspend, hold for 1 year).+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; postProcess no-op in other modes.+++#### acc-51 · Platform: moderation queue, reports, NCII takedowns, DMCA, strikes, statements of reasons and appeals++_Effort: large. Depends on: acc-50, acc-42._++- **Sections:** §10.8 (reports and takedowns), screens §S9.6 and §S8.6.+- **Files:** db moderation_items, moderation_actions, strikes, content_hash_blocks; pHash blocks; /admin/moderation queue; /report; /takedown; notices and appeals in /settings/privacy; banned and suspended sign-in copy.+- **Behaviour:** 48-hour NCII timers; repeat-infringer rule; statements of reasons; appeals for 6 months; keyboard shortcuts scoped to the queue.+- **Tests:** moderation; e2e platform-safety.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; share pages for unaffected content.+++#### acc-52 · Platform: provenance (C2PA signing, certificate, C2PA-safe share cleaning in all modes, badge, AI labels)++_Effort: medium. Depends on: acc-50._++- **Sections:** §10.8 (provenance).+- **Files:** package.json @contentauth/c2pa-node and sharp (per §5.2 rule); src/server/provenance/{sign.ts, cert.ts, badge.ts} in postProcess; keepC2pa in media-clean (all modes); AI-generated chip on share pages; settings rows; ffmpeg gate.+- **Behaviour:** Sign last; self-signed until a certificate is uploaded; badge only on Free.+- **Tests:** provenance (manifest present, survives share cleaning).+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; share-file cleaning in Personal and Studio.+++#### acc-53 · Platform: privacy defaults on the E5b engine++_Effort: small. Depends on: acc-45, acc-51._++- **Sections:** §9.5 E5b, §10.2 (accounting kept), screens §S4.8.+- **Files:** Platform defaults: self-delete on, one export a day, subscription cancelled on delete; export extras (credits.csv, consents, notices); consent purge.+- **Behaviour:** Deleting cancels the subscription per the operator's refund rule; the ledger and invoices are kept pseudonymised.+- **Tests:** privacy-platform.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio defaults.+++#### acc-54 · Platform: worker roles, leader lease, SQLite claims, partitioned polling and cross-process live events++_Effort: large. Depends on: acc-39, acc-27._++- **Sections:** §10.10 (worker roles, claims, polling).+- **Files:** db leases, worker_heartbeats, live_events; generation_runs.claimed_by/claimed_at/heartbeat_at; generations.last_polled_at; FUOBE_ROLE in src/instrumentation.ts; once() and request_keys in SQLite; the live_events source; Health Queues and Workers; docs/PLATFORM.md; scripts/capacity.mjs.+- **Behaviour:** CAS claims before any upload; sweepInterrupted only on stale heartbeats; polling partitioned by hash(id) mod COUNT and ordered by last_polled_at.+- **Tests:** 2 workers x 50 ready dependents give exactly 50 submissions; a web upload longer than 2 minutes is not swept; crash mid-submit and mid-persist; capacity targets.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; single-process installs (FUOBE_ROLE=all default).+++#### acc-55 · Platform: object storage with presigned reads, daily snapshots and the Litestream guide++_Effort: medium. Depends on: acc-21._++- **Sections:** §10.10 (storage, backups, restore runbook), §7.16.+- **Files:** package.json @aws-sdk/client-s3 and s3-request-presigner (per §5.2 rule); src/server/storage-driver.ts (local, s3); ensureLocal conversions; presigned 300 s redirects after the ACL; /setup/storage; backup defaults daily keep 7; archive note for bucket files; restore runbook in docs.+- **Behaviour:** Private reads always pass the ACL first; share files streamed through Fuobe.+- **Tests:** storage-s3 against a local double; presigned expiry.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; the local driver everywhere else.+++#### acc-56 · Platform: analytics, price sync, reconciliation, spend guard and observability++_Effort: large. Depends on: acc-46, acc-54, acc-29._++- **Sections:** §10.5 (price sync, reconciliation, spend guard), §10.10 (observability), screens §S9.7 and §S9.9.+- **Files:** package.json @vercel/otel and peers (per §5.2 rule); rollups on acc-29 reports; fal price sync with admin approval; provider cost capture; monthly invoice reconciliation; max provider spend per hour and day; /admin/analytics; /admin/health; /api/admin/metrics; alerts.+- **Behaviour:** Margin per model including unlimited and blocked runs; drift alert above 5%; spend guard pauses paid cloud routes.+- **Tests:** rollups; price sync; spend guard pause; Prometheus format.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio reports.+++#### acc-57 · Platform: launch checklist, announcements, Studio and Platform switch hooks, headless Platform and full E2E++_Effort: medium. Depends on: acc-30, acc-46, acc-47, acc-48, acc-51, acc-52, acc-53, acc-55, acc-56._++- **Sections:** §10.7 (launch checklist), §7.9 (Platform availability, switching), §13 (e2e matrix).+- **Files:** launch checklist and Open to the public; db announcements, announcement_dismissals; banner and RFC 8058 email; onEnter hooks Studio to Platform and Platform to Studio; headless env (FUOBE_PAYMENTS, STRIPE_*, FUOBE_TURNSTILE_*, FUOBE_CREDIT_VALUE_USD, FUOBE_MARKUP_PCT, FUOBE_PLANS_TEMPLATE, FUOBE_LAUNCH); Email & DNS checks; platformAvailable flag on (the setup card and FUOBE_MODE=platform enabled); e2e suites and docs.+- **Behaviour:** Open to the public only when the 12 required items pass; Platform to Studio asks about public accounts and staff roles and is refused while subscriptions are active.+- **Tests:** launch gating; mode-switch Platform cases; e2e platform-signup, platform-billing, platform-admin, platform-safety; the full per-role layout matrix.+- **Must not break:** demo-mode e2e (FUOBE_MODE=personal FUOBE_DEMO_MODE=on), API tokens (legacy and new), MCP, share links (/s/<token> and its files), FUOBE_PASSWORD, and Just me on this computer; Studio and Personal setup; FUOBE_DEV_PLATFORM still works for development.+++## Sources (read 2026-10-29)++**Fuobe** at `claude/fuobe-parity-4` (`545ebb5`; the audits also cite `76ecd89` for the same files): `src/server/auth.ts` L1–300; `src/proxy.ts` L10–118; `src/app/api/auth/{login,logout,password,tokens}/route.ts`; `src/server/db.ts` L6–595 (23 migrations, 43 tables); `src/server/generations.ts` L149, L420–441, L517, L540, L691, L777, L977, L1028, L1117, L1323, L1481, L1641, L1700; `src/server/training.ts` L149, L176, L221, L563–599, catalog targets in `src/lib/catalog/training.ts` L261–372; `src/server/enhance.ts` L37; `src/server/assist/agent.ts` L385–643, L1110–1124; `src/server/faceless.ts` L215, L1343–1357; `src/server/storage.ts` L141–279; `src/server/file-response.ts` L14–38; `src/server/live.ts` L36–153; `src/server/shares.ts` L319–327; `src/server/share-access.ts` L64–182; `src/server/settings.ts` L19–75; `src/server/model-access.ts` L135–153; `src/server/request-schema.ts` L100, L109–133; `src/lib/catalog/payload.ts` L418–426; `src/server/providers/comfyui.ts` L96–112, L807–811, L1171; `src/server/canvas.ts` L121; `src/server/elements.ts` L30–104; `src/server/shorts-schemas.ts` L94–118; `src/app/api/status/route.ts` L24–34; `src/components/{app-sidebar.tsx L386–428, phone-bar.tsx L11–30, settings-form.tsx L22–48 L155 L241, get-started.tsx L114–159, library-view.tsx L49–62, ui/sheet.tsx L60–70, security-settings.tsx}`; `next.config.ts` L5; `package.json` L38–62; `bin/lib/config.mjs`; `scripts/eval/lib/run.mjs` L179; `workflows/comfyui/bg-remove-birefnet.json` L18; `tests/library.test.ts` L741–746; `vitest.config.ts`; `README.md` (browser checks); `docs/STATUS.md` L192, L289; `docs/research/liner-ui.md` L320–335, L579–612. Counts: 192 `route.ts` files; 171 Vitest files (39 import route handlers, 101 import server modules); 28 e2e scripts; no `"use server"`.++**Next 16** (bundled at `node_modules/next/dist/docs/01-app/`): `02-guides/authentication.md` L25, L519–528, L1011–1033, L1121–1137, L1507; `02-guides/authentication-with-cache-components.md` L47–60, L309–313; `02-guides/data-security.md` L56–75, L279–299, L603–611; `03-api-reference/03-file-conventions/proxy.md` L11, L19, L236–255; `01-getting-started/16-proxy.md`; `03-api-reference/04-functions/cookies.md` L6, L74; `03-api-reference/03-file-conventions/route.md` L559–590; `03-api-reference/04-functions/revalidateTag.md` L142; `03-api-reference/06-cli/next.md` L71, L123; `02-guides/self-hosting.md` L155–177.++**Libraries** (tarballs unpacked under `/home/user/ext/`, read, never run): better-auth 1.7.14 `dist/cookies/index.mjs` L20–45, `dist/api/rate-limiter/index.mjs` L190, L236–262, L305–318, `dist/oauth2/link-account.mjs` L140–141, `dist/db/internal-adapter.mjs` L285, `dist/context/create-context.mjs` L170–176, `dist/plugins/captcha/constants.mjs`, `dist/plugins/admin/*`; `@better-auth/utils` `password.node.mjs` L3–30; `@better-auth/sso` 1.7.14 `dist/index.mjs` L2690, L4540–4542; `@better-auth/stripe` 1.7.14 `dist/index.mjs` L1551–1600; `@boxyhq/saml-jackson` 26.2.0 `dist/db/sql/sql.js` L78. ComfyUI v0.43.1: `server.py` L600–615, L1170–1177, L1305–1316; `folder_paths.py` L262–272; `app/user_manager.py` L36–70; `comfy/cli_args.py` L225; `execution.py` L680–686, L1306–1330. npm registry (`https://registry.npmjs.org/<package>`, publish dates) and OSV (`https://api.osv.dev/v1/query`) for better-auth, `@better-auth/*`, nodemailer, stripe, `@simplewebauthn/*`, uqr, sharp, `@contentauth/c2pa-node`, `@aws-sdk/client-s3`, `@vercel/otel`, next-auth, `@auth/core`, lucia, arctic, oslo, otplib, openid-client, jose, `@node-saml/node-saml`, samlify, scimmy, ldapts, argon2, iron-session, resend, postmark, bullmq, pg-boss, graphile-worker; `https://www.better-auth.com/docs/` (sqlite adapter, database, CLI, Next integration, security, organization, admin, 2fa, sso, scim); `https://vercel.com/blog/vercel-acquires-better-auth`; `https://www.better-auth.com/blog/authjs-joins-better-auth`; `https://lucia-auth.com/`; `https://pilcrowonpaper.com/blog/18`; `https://github.com/ory/polis`.++**Standards:** OWASP ASVS 5.0 (`OWASP/ASVS` at `9ccce0e`: `0x15-V6-Authentication.md`, `0x16-V7-Session-Management.md`, `0x17-V8-Authorization.md`, `0x25-V16-Security-Logging-and-Error-Handling.md`, `0x92-Appendix-C_Cryptography.md`, `0x12-V3-Web-Frontend-Security.md`); OWASP Cheat Sheets (Password Storage, Forgot Password, Session Management, Authorization, IDOR Prevention, Credential Stuffing, Multifactor Authentication, SAML Security); NIST SP 800-63B-4 (`https://pages.nist.gov/800-63-4/sp800-63b/authenticators/`, `/syncable/`, `https://csrc.nist.gov/pubs/sp/800/63/b/4/final`); W3C WebAuthn Level 3 (`https://www.w3.org/TR/webauthn-3/`); `https://passkeys.dev/docs/use-cases/bootstrapping/`; SQLite `https://www.sqlite.org/lang_altertable.html`, `https://www.sqlite.org/wal.html`.++**Higgsfield** (product and UI parity only): help centre `https://higgsfield.ai/creator-hub/help-center/` (getting-started/create-an-account-and-sign-in, getting-started/whats-in-my-higgsfield-account, account/how-do-i-recover-access-to-my-account, account/how-do-i-permanently-delete-my-account, account/how-do-i-submit-a-gdpr-ccpa-or-privacy-request, account/who-owns-my-generations-and-can-i-use-them-commercially, business/team-and-business-higgsfield, plans/*, credits/*, refunds/*, billing/*, community/*, troubleshooting/*, integrations/what-is-the-higgsfield-api); `https://higgsfield.ai/enterprise`; `https://higgsfield.ai/team-plan`; `https://higgsfield.ai/creator-hub/changelog`; `https://higgsfield.ai/blog/higgsfield-pricing-explained`; `https://higgsfield.ai/blog/ai-video-team-plans-compared`; `https://clerk.higgsfield.ai/v1/environment`; client bundle files under `https://assets.higgsfield.ai/tanstack/assets/` (`01bd19df-ij0FP3MXG0GkVG4Z.js`, `-yMDX0zfZICQ9H7Zy.js`, `-3LcKjRnXWlxEkBJA.js`, `-IPfz1JFFFl3cZkaM.js`, `-jeilZTqCBqXiuAZ9.js`, `-5n2JXIZLGM4DCryM.js`), read as text; third-party snapshots `https://www.krea.ai/blog/higgsfield-pricing-explained-2026-unlimited-credits-and-real-monthly-costs`, `https://www.krea.ai/blog/what-is-higgsfield-ai-pricing-free-plan-and-alternatives-in-2026`, `https://www.blotato.com/blog/higgsfield-pricing`, `https://krater.ai/blog/higgsfield-pricing`.++**Peers:** `https://www.krea.ai/pricing`, Krea docs `features/teams.md`, `help-and-support/organization-management.md`, `login-and-account.md`; `https://runway.com/pricing`, `https://runway.com/team-plan`, `https://help.runwayml.com/hc/en-us/articles/24297557468563-Creating-a-Runway-Account`, `https://docs.runway.com/guides/sharing/sso`; `https://www.magnific.com/pricing`, `/business`, `/ai/docs/business-and-enterprise`; `https://intercom.help/leonardo-ai/en/articles/9393396-teams-faq`, `https://eesel.ai/blog/leonardo-ai-pricing`; `https://kling.ai/docs/point-policy`, `https://eesel.ai/blog/kling-ai-pricing`; `https://docs.midjourney.com/docs/plans`, `/your-midjourney-account`; `https://www.canva.com/help/roles-and-permissions/`, `/sign-up-log-in/`, `/enterprise-manage-teams-organization-structure/`, `https://www.canva.com/pricing/`; `https://www.figma.com/pricing/`, `https://help.figma.com/hc/en-us/articles/1500007609322-Guide-to-sharing-and-permissions`; `https://liner.com/pricing`, `https://liner.com/` (UI strings in the page JSON), `https://pricingsaas.com/companies/liner`.++**Self-hosted apps:** `https://docs.openwebui.com/` (rbac/roles, rbac/groups, hardening, auth/sso, auth/scim, troubleshooting/password-reset); `https://docs.immich.app/` (post-install, user-management, server-commands, oauth, sharing, partner-sharing); `https://docs.n8n.io/` (user-management-self-hosted, rbac, cli-commands, saml, oidc, ldap, log-streaming); `https://docs.gitea.com/administration/config-cheat-sheet`, `/command-line`; `https://forgejo.org/docs/latest/admin/config-cheat-sheet/`, `/command-line/`; `https://jellyfin.org/docs/general/server/users/` and `Jellyfin.Api/Controllers/UserController.cs`, `DefaultPasswordResetProvider.cs`; `https://docs.nextcloud.com/server/latest/admin_manual/occ_users.html`, `https://github.com/nextcloud/user_oidc`, `/user_saml`; `https://docs.gitlab.com/user/permissions/`; `https://grafana.com/docs/grafana/latest/administration/roles-and-permissions/`; `https://docs.mattermost.com/administration-guide/onboard/sso-saml.html`; `https://develop.sentry.dev/self-hosted/sso/`; `https://github.com/liusida/ComfyUI-Login`.++**Platform money and operations:** `https://docs.stripe.com/webhooks`, `/checkout/fulfillment`, `/billing/subscriptions/prorations`, `/billing/subscriptions/usage-based/billing-credits`, `/billing/subscriptions/usage-based/recording-usage-api`, `/billing/entitlements`, `/customer-management`, `/tax/set-up`, `/api/idempotent_requests`, `/disputes/prevention/card-testing`, `/payments/managed-payments`, `/payments/managed-payments/eligibility`; `https://stripe.com/pricing`; `https://www.paddle.com/pricing`, `https://developer.paddle.com/webhooks/respond-to-webhooks`; `https://polar.sh/docs/merchant-of-record/fees`, `/features/usage-based-billing/introduction`; `https://fal.ai/docs/documentation/model-apis/pricing.md`, `https://fal.ai/docs/model-apis/model-endpoints/queue`, `https://fal.ai/models/fal-ai/x-ailab/nsfw/llms.txt`; `https://replicate.com/docs/topics/predictions/lifecycle.md`, `/safety-checking.md`; LibreChat (`8d3da9bb`: `packages/data-schemas/src/schema/balance.ts`, `methods/transaction.ts` L242–300, L470–590), Dify (`fd5c3696`: `api/services/quota_service.py` L14–130, `feature_service.py` L26), new-api (`e449cc70`: `service/billing_session.go`, `model/redemption.go`, `setting/ratio_setting/group_ratio.go`); `https://www.librechat.ai/docs/configuration/token_usage`; `https://litestream.io/how-it-works/`; `https://developers.cloudflare.com/r2/api/s3/presigned-urls/`; `https://developers.cloudflare.com/turnstile/get-started/server-side-validation/`; `https://github.com/disposable-email-domains/disposable-email-domains`; `https://support.google.com/a/answer/81126`; `https://resend.com/pricing`; `https://postmarkapp.com/pricing`.++**Trust, safety and law:** `https://huggingface.co/meta-llama/Llama-Guard-4-12B`; `https://huggingface.co/google/shieldgemma-2-4b-it`; `https://huggingface.co/Falconsai/nsfw_image_detection`; `https://www.law.cornell.edu/uscode/text/18/2258A`; `https://www.microsoft.com/en-us/photodna`; `https://developers.cloudflare.com/cache/reference/csam-scanning/`; Thorn Safer Predict press release; `https://wilmerhale.com/en/insights/client-alerts/20260615-the-take-it-down-act-goes-live`; `https://www.insideprivacy.com/united-states/federal-trade-commission/the-take-it-down-acts-notice-and-removal-requirements-enter-into-effect/`; `https://www.copyright.gov/dmca-directory/faq.html`; `https://www.addleshawgoddard.com/en/insights/insights-briefings/2026/technology/eu-ai-act-code-practice-marking-labelling-ai-generated-content/`; `https://www.reedsmith.com/our-insights/blogs/viewpoints/102nbz0/transparency-obligations-for-ai-generated-content-the-code-of-practice-adequacy/`; C2PA specification 2.3 (`https://spec.c2pa.org/specifications/specifications/2.3/specs/_attachments/C2PA_Specification.pdf`); `https://www.ofcom.org.uk/online-safety/protecting-children/letter-to-part-3-services-that-allow-pornography-outlining-heaa-requirements`; `https://gdpr-info.eu/art-12-gdpr/`; `https://interface-eu.org/storage/pdf/dsa_article_overview.pdf`; `https://www.legislation.gov.uk/eudr/2005/29/article/7` (UCPD Art. 7); Directive 98/6/EC; Directive 2002/58/EC Art. 5(3).++**Owner:** `/home/user/ext/owner-decisions.json` (`accounts`, answered 2026-10-29: `signUp`, `libraries`, `localUse`, `paidKeys`, `enterprise`, `setup`, `deploymentModes`).