Public: anyone can read this; the crew can change it.
Access 1: one Principal for who is asking, an anonymous visitor included #18060
Merged 10h 45m ago, live in production
mason/forge:mason/18047-access-1-one-principal-for-who-is-asking → main 0 commits fork 3 threads · 3 unresolved
93 files
changed +398
−145
- docs/APPS.md
- docs/ARCHITECTURE.md
- docs/CREW.md
- docs/MCP.md
- docs/ON-YOUR-MACHINE.md
- docs/OPERATING.md
- docs/PULLS.md
- docs/REFERENCE.md
- docs/ROLES.md
- docs/TOUR.md
- docs/features/agents-md.md
- docs/features/bugs.md
- docs/features/changelog.md
- docs/features/claim-own-name.md
- docs/features/claimed-forge-door.md
- docs/features/client-last-activity.md
- docs/features/clog-watch.md
- docs/features/code-scanning.md
- docs/features/data-browser.md
- docs/features/events.md
- docs/features/explore.md
- docs/features/first-wrong.md
- docs/features/flow-declines.md
- docs/features/flows.md
- docs/features/forge-link-states.md
- docs/features/growth.md
- docs/features/home-plans.md
- docs/features/issue-cost.md
- docs/features/keeper.md
- docs/features/made-from.md
- docs/features/map-held.md
- docs/features/new-forge-template.md
- docs/features/origin-ahead.md
- docs/features/report-status.md
- docs/features/space.md
- docs/features/spawner-claim-link.md
- docs/features/start-my-forge.md
- docs/features/subtitle-shift.md
- docs/features/traffic-sources.md
- docs/features/week-pace.md
- src/core/principal.ts
- src/http/server.ts
- src/http/usage_tag.ts
- src/tui/forge_parts.ts
- src/tui/main.ts
- src/tui/screens/api.ts
- src/tui/screens/bets.ts
- src/tui/screens/bugs.ts
- src/tui/screens/changelog.ts
- src/tui/screens/dashboard.ts
- src/tui/screens/data.ts
- src/tui/screens/decider.ts
- src/tui/screens/deploys.ts
- src/tui/screens/docs.ts
- src/tui/screens/family.ts
- src/tui/screens/featurefeed.ts
- src/tui/screens/findings.ts
- src/tui/screens/fleet.ts
- src/tui/screens/forge_usage.ts
- src/tui/screens/forgename.ts
- src/tui/screens/forges.ts
- src/tui/screens/frontms.ts
- src/tui/screens/getforge.ts
- src/tui/screens/health_voice.ts
- src/tui/screens/iterations.ts
- src/tui/screens/limbs.ts
- src/tui/screens/madefrom.ts
- src/tui/screens/mesh_edit.ts
- src/tui/screens/next.ts
- src/tui/screens/notes.ts
- src/tui/screens/oauthgrants.ts
- src/tui/screens/originahead.ts
- src/tui/screens/payments.ts
- src/tui/screens/pricing.ts
- src/tui/screens/roadmap.ts
- src/tui/screens/signin.ts
- src/tui/screens/signins.ts
- src/tui/screens/space.ts
- src/tui/screens/startforge.ts
- src/tui/screens/subtitle_shift.ts
- src/tui/screens/templates.ts
- src/tui/screens/thoughtnotes.ts
- src/tui/session.ts
- src/tui/ssh-guest-rate.ts
- src/tui/ssh-tell.ts
- src/tui/ssh.ts
- src/tui/ui/image.ts
- src/web/pages/milestones_near.ts
- test/principal.test.ts
- test/ssh-app.test.ts
- test/tui-changelog-waves.test.ts
- test/tui-screens.test.ts
- test/turnstile.test.ts
docs/APPS.md +5 −5
| @@ -105,7 +105,7 @@ Under the box, four starter sentences are plain links (no script): | ||
| 105 | 105 | (`:`): *Tell the builders* sends a note as you, and *Notes from the app* |
| 106 | 106 | lists yours with their status; the repository's admin sees every sender's and |
| 107 | 107 | may hide a note, ban its sender, list the banned senders (*Banned senders*) |
| 108 | and unban one. The gating is the page's: a guest or a | |
| 108 | and unban one. The gating is the page's: a visitor or a | |
| 109 | 109 | non-reader sees nothing, and a repository that is not an app has no rows. |
| 110 | 110 | Who may write: anyone on a public app, but a private app, and any sealed |
| 111 | 111 | pull's preview, take notes only from a person the app admits (the condition |
| @@ -204,7 +204,7 @@ Under the box, four starter sentences are plain links (no script): | ||
| 204 | 204 | (each with what it carries), `enter` for the log, `r` to refresh. A signed-in |
| 205 | 205 | reader also sees `Production: <url>` and, when a pull's preview is up or |
| 206 | 206 | asleep, `Newest preview: #N <title> <url>` — the pill's other side, same |
| 207 | gate; a guest sees neither. Under the deploys, anyone who may read the | |
| 207 | gate; a visitor sees neither. Under the deploys, anyone who may read the | |
| 208 | 208 | repository sees a **Previews** group: one row per open pull with a preview, |
| 209 | 209 | `#N <title> · <state> · <url>`, the state in the studio's words (`live`, |
| 210 | 210 | `not up`, `starting`…) from the one runtime read the studio's list makes. |
| @@ -842,8 +842,8 @@ will make a locally-run forge refuse browser form posts as cross-site; see | ||
| 842 | 842 | `README.md`'s "Run it". |
| 843 | 843 | |
| 844 | 844 | A terminal session (`tty`) gets the same variables plus `FORGE_APP_TTY=1` |
| 845 | and `FORGE_APP_USER`, the forge account at the keyboard or empty for a guest | |
| 846 | — but no `FORGE_TOKEN`: a guest at the keyboard is not the owner. | |
| 845 | and `FORGE_APP_USER`, the forge account at the keyboard or empty for a visitor | |
| 846 | — but no `FORGE_TOKEN`: a visitor at the keyboard is not the owner. | |
| 847 | 847 | |
| 848 | 848 | ### Live UI into the forge |
| 849 | 849 | |
| @@ -1241,7 +1241,7 @@ any name opens the forge's terminal UI, and an app's slug opens **that | ||
| 1241 | 1241 | app's terminal** — `ssh -p 2222 notes@forge` runs the app's `tty` command |
| 1242 | 1242 | on a real pty, in the deployed checkout, with the environment's own |
| 1243 | 1243 | variables (`FORGE_APP_DATA` and the rest, plus `FORGE_APP_TTY=1` and |
| 1244 | `FORGE_APP_USER`, the forge account at the keyboard or empty for a guest). | |
| 1244 | `FORGE_APP_USER`, the forge account at the keyboard or empty for a visitor). | |
| 1245 | 1245 | `notes--12@forge` is the preview of pull 12's. The key still decides who |
| 1246 | 1246 | you are: a private app's terminal answers only to a key the forge knows |
| 1247 | 1247 | that can write the repository, or the crew's; a public app's answers to |
docs/ARCHITECTURE.md +4 −4
| @@ -283,10 +283,10 @@ key, and what the key _is_ decides what the session can do: | ||
| 283 | 283 | |
| 284 | 284 | - a key registered to an account (`user_key.fingerprint`) → that user, with |
| 285 | 285 | `last_used_at` touched; |
| 286 | - any other key → a **guest**, who browses public repos exactly as an | |
| 286 | - any other key → a **visitor**, who browses public repos exactly as an | |
| 287 | 287 | anonymous web visitor does. |
| 288 | 288 | |
| 289 | A guest becomes someone by signing in: username and password verified with the | |
| 289 | A visitor becomes someone by signing in: username and password verified with the | |
| 290 | 290 | same `verifyPassword` the web uses, then the presenting key is registered to |
| 291 | 291 | that account through the `addSshKey` action. The connection is that user from |
| 292 | 292 | that moment on — no reconnect — and the next connection needs no password. On a |
| @@ -299,7 +299,7 @@ runner (`tui/main.ts --user alice`) is the one place an account can be chosen | ||
| 299 | 299 | by name, it runs over stdio, and it is not reachable over SSH. |
| 300 | 300 | |
| 301 | 301 | Git over SSH enforces the HTTP matrix, function for function: `canRead` for |
| 302 | upload-pack (guests included), a signed-in `canWrite` for receive-pack, | |
| 302 | upload-pack (visitors included), a signed-in `canWrite` for receive-pack, | |
| 303 | 303 | push-to-create for a writer pushing to a repo that does not exist yet, and |
| 304 | 304 | `hookEnv` carrying the actor so pre-receive protection and post-receive events |
| 305 | 305 | fire identically to a push over HTTPS. A repo you cannot see is "not found" — |
| @@ -423,7 +423,7 @@ Paid-for lessons from open-platform-ts, designed in structurally: | ||
| 423 | 423 | most 4 in flight per address and half the transfer pool for all, killed |
| 424 | 424 | after 300 s, and a negotiation that goes 30 s without a byte ends), code |
| 425 | 425 | search (10 a minute, one stranger's at a time, so half the plumbing pool |
| 426 | stays the forge's — the page, the API and the terminal's guest palette, | |
| 426 | stays the forge's — the page, the API and the terminal's visitor palette, | |
| 427 | 427 | which is counted under its SSH peer address, alike), event streams (8 open per address, 256 for all |
| 428 | 428 | strangers, 4096 for anyone) and spawn plans (10 a minute). Past a limit |
| 429 | 429 | the answer is a 429 with `Retry-After`. The audit card and the sitemap, |
docs/CREW.md +2 −2
Diff not shown — a line 2,381 characters wide (limit 2,000). +2 −2
View filedocs/MCP.md +1 −1
| @@ -528,7 +528,7 @@ answers | ||
| 528 | 528 | becomes the "Told from" link on the issue; a bad one is refused. It differs |
| 529 | 529 | from `context.page`, which is any http(s) address appended as context, not |
| 530 | 530 | linked as the origin. |
| 531 | - **`map` with `view: "space"`** answers the same `spaceOf` as the space page and `space.json`, for the viewer's own scope (a guest sees what the page shows a guest); a junk `view` is an error naming `plan` and `space`; answers past 300 issues or 100 runs an actor are cut and say `truncated: true` with `total`; no tool was added and no ceiling moved. | |
| 531 | - **`map` with `view: "space"`** answers the same `spaceOf` as the space page and `space.json`, for the viewer's own scope (a visitor sees what the page shows a visitor); a junk `view` is an error naming `plan` and `space`; answers past 300 issues or 100 runs an actor are cut and say `truncated: true` with `total`; no tool was added and no ceiling moved. | |
| 532 | 532 | - **`ready` and `startable`.** `map` (and `GET …/map`) carries both. `ready` is |
| 533 | 533 | every open issue with nothing open in front, held or working ones included, |
| 534 | 534 | and the page's Ready now section reads it. `startable` is the numbers from |
docs/ON-YOUR-MACHINE.md +1 −1
| @@ -106,7 +106,7 @@ owner/name` names another, `--json` prints the API's answer). Each row of | ||
| 106 | 106 | username, null for a check or deploy), `number` and `title` (its pull or |
| 107 | 107 | issue, null for none), so no client reads them out of a branch name. The SSH |
| 108 | 108 | terminal's door is `H` on a repository: the runs screen |
| 109 | (`src/tui/screens/runs.ts`), read through the same `listRepoRuns`, so a guest | |
| 109 | (`src/tui/screens/runs.ts`), read through the same `listRepoRuns`, so a visitor | |
| 110 | 110 | sees only what the page shows them and a stranger sees no cost or session. |
| 111 | 111 | |
| 112 | 112 | In the SSH terminal, `enter` on a run opens its log (the last 200 lines, following new ones while it runs; "Not found" where the web would say so), and `o` there prints the web address (`src/tui/screens/runlog.ts`). |
docs/OPERATING.md +1 −1
| @@ -110,7 +110,7 @@ home page shows the fingerprint beside the ssh command, to compare with what `ss | ||
| 110 | 110 | a first connection. The SSH door refuses, before any key work, past 256 open connections, 32 from one address |
| 111 | 111 | or 20 new handshakes from one address (120 overall) per 10 s (`src/ssh/limits.ts`); the address is the |
| 112 | 112 | TCP peer's, a proxy's when one fronts the port, since SSH has no header to carry a client address. A |
| 113 | guest's `tell`/`talk` are 5 a minute per key or address (`src/tui/ssh-guest-rate.ts`), and the server | |
| 113 | visitor's `tell`/`talk` are 5 a minute per key or address (`src/tui/ssh-guest-rate.ts`), and the server | |
| 114 | 114 | starts a rekey itself after 1 GiB or an hour. |
| 115 | 115 | |
| 116 | 116 | ## What the forge stands on |
docs/PULLS.md +1 −1
Diff not shown — a line 2,395 characters wide (limit 2,000). +1 −1
View filedocs/REFERENCE.md +8 −8
| @@ -39,7 +39,7 @@ child's own data, and `/forges` says how many are running and why any is not. Ea | ||
| 39 | 39 | with why (also in the terminal and the MCP `forges`): "Not reporting" (no word |
| 40 | 40 | in 24 hours), "App down", or "Unclaimed" three days after it was sent; the rest |
| 41 | 41 | follow by last activity. |
| 42 | A signed-out visitor's command palette (Cmd-K) lists only places they can reach (Home, Apps, Explore, Front page, Search, public repositories) plus **Sign in**, which goes where the topbar's button does (`signInHref` in `src/web/layout.ts`: `/signin`, `/signup` for an edge stranger, the edge's login when an edge token is active); no Create or Settings rows. After signing in from the palette the visitor lands on the default page, not the one they were on. The terminal's guest palette already hides the signed-in verbs (New repository, Migrate, New forge and the rest) and offers Sign in. | |
| 42 | A signed-out visitor's command palette (Cmd-K) lists only places they can reach (Home, Apps, Explore, Front page, Search, public repositories) plus **Sign in**, which goes where the topbar's button does (`signInHref` in `src/web/layout.ts`: `/signin`, `/signup` for an edge stranger, the edge's login when an edge token is active); no Create or Settings rows. After signing in from the palette the visitor lands on the default page, not the one they were on. The terminal's visitor palette already hides the signed-in verbs (New repository, Migrate, New forge and the rest) and offers Sign in. | |
| 43 | 43 | |
| 44 | 44 | In the terminal an admin's palette offers "Forges you sent": each forge with its |
| 45 | 45 | claim state and the same apps-running note, never a claim link. Both carry the |
| @@ -85,7 +85,7 @@ A forge admin's terminal home ends its forge strip with `Builders idle: <word> ( | ||
| 85 | 85 | |
| 86 | 86 | A hold an agent placed does not stand forever: the tick releases one still standing after 24 h, in one transaction, with a comment on the pull, "Hold expired after 24 h: <why>. Back to @builder.", which shows in the pull's timeline like any comment, and the pull goes back to its builder (`expireCrewHolds` in `src/actions/holds.ts`). A person's hold is never expired. The window is fixed; a pull held again and expiring again leaves one such comment per round in its timeline. |
| 87 | 87 | |
| 88 | In the terminal, `T` on a shipped pull's screen takes it back, as the pull page's button does: a one-line confirm names the pull, Yes opens the pull that undoes it (`revertPull`, `src/actions/revert.ts`) and shows it, No changes nothing. The key appears only to a person who can write a local repository (never an agent, a reader, a guest or a mirror), and refusals read as the page's do (`takeBackWords`). `T` also opens an app preview's terminal on an open pull; a shipped pull has no live preview, so the two never meet. | |
| 88 | In the terminal, `T` on a shipped pull's screen takes it back, as the pull page's button does: a one-line confirm names the pull, Yes opens the pull that undoes it (`revertPull`, `src/actions/revert.ts`) and shows it, No changes nothing. The key appears only to a person who can write a local repository (never an agent, a reader, a visitor or a mirror), and refusals read as the page's do (`takeBackWords`). `T` also opens an app preview's terminal on an open pull; a shipped pull has no live preview, so the two never meet. | |
| 89 | 89 | |
| 90 | 90 | In the terminal, `m` on a local repository's issue list opens the plan screen (`src/tui/screens/plan.ts`): Working, Ready now, Waiting and Parked twice, each headed with its count. It reads what MCP `map` reads (`repoGraph` under the reader's sealed scope, `pillarView`, `mapHeldFor`, the runs in flight), so a sealed issue the reader may not see is left out. Enter opens the issue, `r` reads again, and the headings are skipped over. It is not offered on the pulls list or on a live browse of another forge. |
| 91 | 91 | |
| @@ -395,7 +395,7 @@ snapshot, which the forge keeps for 60 seconds: scores that change between | ||
| 395 | 395 | pages can move a row across the position, so a client that must see a stable |
| 396 | 396 | list reads the pages in one minute. |
| 397 | 397 | |
| 398 | A signed-out visitor to `/explore` sees **Make it yours** on every public app (not on a private one, nor one only its writers may enter); it leads to sign-in and back to the plan of their copy, and nothing is copied until they confirm. Behind a platform edge the sign-in is the edge's; a newcomer it vouched for is sent to `/signup` and may need to come back. API and MCP rows say `copyable: true` for a guest too; making the copy needs a signed-in caller, and the terminal is always signed in and offers `Y` on the repository screen. | |
| 398 | A signed-out visitor to `/explore` sees **Make it yours** on every public app (not on a private one, nor one only its writers may enter); it leads to sign-in and back to the plan of their copy, and nothing is copied until they confirm. Behind a platform edge the sign-in is the edge's; a newcomer it vouched for is sent to `/signup` and may need to come back. API and MCP rows say `copyable: true` for a visitor too; making the copy needs a signed-in caller, and the terminal is always signed in and offers `Y` on the repository screen. | |
| 399 | 399 | |
| 400 | 400 | ## On your machine |
| 401 | 401 | |
| @@ -561,8 +561,8 @@ This page is the front door. Everything else is a file of its own under | ||
| 561 | 561 | - Visibility at the terminal: on the About card (`I`) a repository admin who is a person sees `V make private` on a public repository and `V make public` on a private one. `V` opens a confirm that names who will see it (public: anyone with the link, signed in or not; private: only its members and the crew, while forks and clones already made keep what they have), with Cancel selected first, so enter alone changes nothing. Confirming calls `updateRepoSettings`, as the web About form and MCP do, and toasts `now public`, `now private` or the refusal (a sealed report stays private until it merges). A writer who is not an admin and an agent are not offered `V`; an agent that administers its own repository changes visibility on the web or through MCP, not here. |
| 562 | 562 | - Description at the terminal: on the About card (`I`) a repository admin who is a person sees `w write description`. `w` opens a one-line prompt filled with the current description; enter saves it through `updateRepoSettings` (as the web form and MCP `repo_settings` do, so it is audited the same way) and toasts `description saved`, esc changes nothing, and an empty line clears it. Control characters and more than 2000 characters are refused in a toast and nothing is written. That cap and the control-character rule live in the terminal only: the web form and the API accept any text. A reader and an agent are not offered `w`, and pressing it does nothing. |
| 563 | 563 | - Default branch at the terminal: on the About card (`I`) a repository admin who is a person sees `b default branch`; a writer who is not an admin and an agent are not offered it, and pressing it does nothing. `b` opens a picker of the repository's branches with the current default marked `default`; enter on another branch asks `make <branch> the default? y/n` with Cancel selected first, so enter alone changes nothing, and `n` or esc leaves it. `y` saves through `updateRepoSettings` (git HEAD moves first, audited as from Settings), toasts `<branch> is the default branch`, and the card's row shows it. If the branch vanished meanwhile the toast says `<branch> is no longer a branch here` and nothing changes. |
| 564 | - Prompt source at the terminal: `i` on the Deploys screen opens the app's Instagram prompt source, as Settings › Prompts does, and is offered only to the repository's admin who is a person (an agent, a reader or a guest sees no `i` and it does nothing). It lists the account, when it last ran and what it said, and when the token is refreshed again. `a` connects one (the token typed masked, then the hour in UTC; it is never drawn or logged), `f` fetches now and says what came back, `d` removes it after a `y/n` confirm. A second `f` while a fetch is running is ignored. Refusals are the page's words (`invalid_token`, `invalid_at`, `no_such_source`, `not_running`, and `already_connected` only when an account was connected on the web while the screen was open: the screen offers `a` only when there is none). | |
| 565 | - Stop running as an app at the terminal: `X` on the Deploys screen, offered only to the repository's admin who is a person while it is an app (a writer who is not an admin, an agent, a reader or a guest sees no `X` and it does nothing). It asks you to type `<owner>/<name>`; anything else says `Type <owner>/<name> to confirm.` and changes nothing. The exact name calls `disableApp`, as Settings' Stop running as an app does: production and every preview stop and their data and checkouts are removed, the code is untouched. It toasts `no longer an app` or the refusal, and the screen re-reads and says the repository is no longer an app. | |
| 564 | - Prompt source at the terminal: `i` on the Deploys screen opens the app's Instagram prompt source, as Settings › Prompts does, and is offered only to the repository's admin who is a person (an agent, a reader or a visitor sees no `i` and it does nothing). It lists the account, when it last ran and what it said, and when the token is refreshed again. `a` connects one (the token typed masked, then the hour in UTC; it is never drawn or logged), `f` fetches now and says what came back, `d` removes it after a `y/n` confirm. A second `f` while a fetch is running is ignored. Refusals are the page's words (`invalid_token`, `invalid_at`, `no_such_source`, `not_running`, and `already_connected` only when an account was connected on the web while the screen was open: the screen offers `a` only when there is none). | |
| 565 | - Stop running as an app at the terminal: `X` on the Deploys screen, offered only to the repository's admin who is a person while it is an app (a writer who is not an admin, an agent, a reader or a visitor sees no `X` and it does nothing). It asks you to type `<owner>/<name>`; anything else says `Type <owner>/<name> to confirm.` and changes nothing. The exact name calls `disableApp`, as Settings' Stop running as an app does: production and every preview stop and their data and checkouts are removed, the code is untouched. It toasts `no longer an app` or the refusal, and the screen re-reads and says the repository is no longer an app. | |
| 566 | 566 | - Everyday account at the terminal: a forge admin with no choice made sees a muted line at the head of the dashboard asking, as the web home's one line does. `E` opens Settings on the web to make the everyday account (it is made with a passkey, which the terminal cannot hold); `K` keeps admin, and the web stops asking too. Once linked, the line names the everyday account. Anyone else, and an agent, sees neither key. |
| 567 | 567 | - Events at the terminal: `v` on the About card (`I`) lists the repository's events newest first, 50 at a time; `n` loads the next page, `t` keeps only the kind of the row under the cursor (and again lifts it), `s` keeps only settings changes (the same `kind=repo.settings_updated` filter) and shows each as who changed what, from what to what (`alice changed repository settings: requireReview false → true`), `esc` goes back; it reads once on opening and does not refresh while open. The audience is `GET …/events`'s and MCP `events`' (a webhook's URL and an app's variable names are the admins'). |
| 568 | 568 | - Crew at the terminal: `C` on the About card (`I`) lists the repository's crew with their roles (`j`/`k` to move), as Settings → Crew reads it. Only an admin who is a person is offered `a` (asks for an agent's name) and `d` (takes the selected agent off); each asks a confirm first. Both go through `addToCrew`/`removeFromCrew`, and refusals are worded by `crewRefusal` (`src/actions/crew_words.ts`), as Settings → Crew flashes them. Everyone else sees the list and no write key. |
| @@ -612,7 +612,7 @@ This page is the front door. Everything else is a file of its own under | ||
| 612 | 612 | - [](DESIGN.md) — the design system's spine; its sections are under `docs/design/sections/`. |
| 613 | 613 | - [](SPIKE-CLOUDFLARE.md), [](SPIKE-SEARCH-READING.md), [](SPIKE-UNKERNEL.md), [](AUDIT-MANY-HANDS.md), [](BACKLOG.md) and [](research/) — a spike, an audit, a pointer to the map and research notes, kept as written. |
| 614 | 614 | |
| 615 | What the crew's tokens bought is on the board (`/board/returns`), in MCP `returns`, and in the terminal: the palette's Usage carries a Returns line (dollars, runs, changes landed, cost per landed change; `[`/`]` move between 1, 7, 30 and 90 days), and Usage of a repository (`owner/name`) narrows it to one app. On the forge-wide Usage, `f` opens the fleet graph (what `/fleet/graph` shows): one sparkline row per repository for runs and for spend, each with its total at the right, over 24 h by hour or 14 d by day (`w` toggles); past eight series the smallest share "N others", and a short terminal ends with a "+N more rows" line. Who may see spend is the action's rule (`src/actions/fleet-graph.ts`), not the screen's. The palette's Forge spend is the forge-wide spend (`GET /api/v1/usage`, MCP `usage` without a repo): today and the last 24 hours, and each subscription's headroom, for the apps you write (an admin sees all; a guest, nothing). Owner facts only (`src/actions/returns.ts`); see [](OPERATING.md). | |
| 615 | What the crew's tokens bought is on the board (`/board/returns`), in MCP `returns`, and in the terminal: the palette's Usage carries a Returns line (dollars, runs, changes landed, cost per landed change; `[`/`]` move between 1, 7, 30 and 90 days), and Usage of a repository (`owner/name`) narrows it to one app. On the forge-wide Usage, `f` opens the fleet graph (what `/fleet/graph` shows): one sparkline row per repository for runs and for spend, each with its total at the right, over 24 h by hour or 14 d by day (`w` toggles); past eight series the smallest share "N others", and a short terminal ends with a "+N more rows" line. Who may see spend is the action's rule (`src/actions/fleet-graph.ts`), not the screen's. The palette's Forge spend is the forge-wide spend (`GET /api/v1/usage`, MCP `usage` without a repo): today and the last 24 hours, and each subscription's headroom, for the apps you write (an admin sees all; a visitor, nothing). Owner facts only (`src/actions/returns.ts`); see [](OPERATING.md). | |
| 616 | 616 | |
| 617 | 617 | The terminal's palette has `Signed in` for anyone signed in: your browsers, tokens and this terminal's key, with when each was last seen; `d` signs the selected browser out after a confirm, as `/settings` and MCP `sessions` do, and on a token revokes it after a confirm (Keep is the default) through the same `deleteToken` action as Settings and the API, so it stops working at once (`docs/CREW.md`, "Where you are signed in"). `p` there changes your password: it asks the current one, the new one and the new one again, each masked and never echoed, and changes it through `changePassword`, the action behind Settings, so a wrong current password, a throttled account, a new one under 10 characters or over the cap is refused in Settings' words (the length is refused at the new-password prompt, before the confirm); an agent signs in with a key and is not offered `p`. |
| 618 | 618 | |
| @@ -622,7 +622,7 @@ The release keeper (`src/keeper/`, #7557) cuts, promotes and verifies releases o | ||
| 622 | 622 | - **Verify:** it records the known-good version and image before the tag, sets the Deployment's image, and has the new version spend ten minutes under page load probing `/healthz` each second, then opening the home, repository and apps pages at phone size and failing if a dialog, popover or large fixed layer covers the centre of the screen. |
| 623 | 623 | - **Roll back and hold:** three bad probes in a row hold further cuts with the numbers and set the recorded known-good image back by name, never "undo". A pull saying `release hold <N>` lets the fix through, and that release verifying lifts the hold. |
| 624 | 624 | - **Owner's hold:** set and lifted from the card, the terminal (`h`) or MCP `release_hold`, by a person who may roll back, never an agent. |
| 625 | - **Where to see it:** the **Release keeper** card on `/releases`, `Release keeper` in the terminal's palette, the **Maintenance** board under `/boards`, MCP `release_keeper` and `GET /api/v1/keeper` (JSON; 403 for a caller who may not read releases); `GET /api/v1/keeper/pulse` answers anyone with the newest beat's `{at, outcome, silent}`, never its reason, each gated as `/releases` is: a guest sees none of it. | |
| 625 | - **Where to see it:** the **Release keeper** card on `/releases`, `Release keeper` in the terminal's palette, the **Maintenance** board under `/boards`, MCP `release_keeper` and `GET /api/v1/keeper` (JSON; 403 for a caller who may not read releases); `GET /api/v1/keeper/pulse` answers anyone with the newest beat's `{at, outcome, silent}`, never its reason, each gated as `/releases` is: a visitor sees none of it. | |
| 626 | 626 | |
| 627 | 627 | How it works and how to turn it on: [](features/release-keeper.md). |
| 628 | 628 | The release tick's heartbeat (`heartbeat`, and `POST /api/v1/release/heartbeat` for a release path outside the forge): [](features/release-heartbeat.md). |
| @@ -637,7 +637,7 @@ A repository admin cuts a wave from two doors, both through `cutWaveFor` (`src/a | ||
| 637 | 637 | |
| 638 | 638 | Cmd-K finds a repository by its name first (exact, then prefix; your own ahead); a repository with an app has an "Open the app of …" option under it, and Cmd/Ctrl+Enter on the repository opens the app (`docs/features/cmd-k-repositories.md`). |
| 639 | 639 | |
| 640 | In the terminal, the palette's **Your profile** (any signed-in person, never an agent; a guest is not offered it) shows username, display name and email; `n` sets the display name and `e` the email through `updateProfile`, the action behind Settings → Account. Refusals read as the page's do (`src/actions/profile_words.ts`, including one shared fallback for a refusal with no words of its own), and a changed email says a confirmation link was sent to it and that it is unverified until followed. | |
| 640 | In the terminal, the palette's **Your profile** (any signed-in person, never an agent; a visitor is not offered it) shows username, display name and email; `n` sets the display name and `e` the email through `updateProfile`, the action behind Settings → Account. Refusals read as the page's do (`src/actions/profile_words.ts`, including one shared fallback for a refusal with no words of its own), and a changed email says a confirmation link was sent to it and that it is unverified until followed. | |
| 641 | 641 | |
| 642 | 642 | ## Agent runner settings |
| 643 | 643 |
docs/ROLES.md +18
| @@ -1,5 +1,23 @@ | ||
| 1 | 1 | # Roles |
| 2 | 2 | |
| 3 | ## The words | |
| 4 | ||
| 5 | Two words that sound alike are two different people, so each has one meaning: | |
| 6 | ||
| 7 | | Word | Who | Has an account | Where it is held | | |
| 8 | | --- | --- | --- | --- | | |
| 9 | | visitor | Anyone who has not signed in, or whose credential matched nothing | no | `Principal` kind `anonymous` (`src/core/principal.ts`) | | |
| 10 | | guest | A signed-in account that is not a member | yes | role `guest` below | | |
| 11 | | member | A signed-in account with a `member` row | yes | role `member` below | | |
| 12 | | admin | A signed-in account with the `is_admin` flag | yes | role `admin` below | | |
| 13 | ||
| 14 | A visitor is not a role: nothing is stored for one. `principalOf(auth)` builds | |
| 15 | who is asking from today's `Auth`: `anonymous` (a visitor), `session` (the | |
| 16 | account itself), one of the token kinds (`ro_token`, `rw_token`, | |
| 17 | `admin_token`, `proposal_token`, `run_token`, `contribute_token`, | |
| 18 | `read_grant_token`, `via_token`), each with a subject (a person, an agent or an | |
| 19 | app). Nothing decides on a principal yet, so no route answers differently. | |
| 20 | ||
| 3 | 21 | An account is a **guest**, a **member** or an **admin**. Admin is the |
| 4 | 22 | `is_admin` flag; a member is a row in the `member` table; everyone else is a |
| 5 | 23 | guest. `src/core/roles.ts` holds the one table below, and `test/roles.test.ts` |
docs/TOUR.md +6 −6
| @@ -37,7 +37,7 @@ checkout needs them, run `git clone --filter=blob:none <url>`. See | ||
| 37 | 37 | [](GIT.md). |
| 38 | 38 | |
| 39 | 39 | Your SSH key is your identity. A key the forge knows signs you straight in; any |
| 40 | other key browses public repos as a guest and can press `s` to sign in with a | |
| 40 | other key browses public repos as a visitor and can press `s` to sign in with a | |
| 41 | 41 | username and password — which links that key to your account, so the next |
| 42 | 42 | connection is instant. `j`/`k` to move, `enter` to open, `esc` to go back, `/` |
| 43 | 43 | to filter, `?` for the keys, `:` for the command palette, `t` for the theme. |
| @@ -56,10 +56,10 @@ re-plan as fewer, larger pieces: it lists what the planner will be given, then | ||
| 56 | 56 | `enter` confirms; the row reads *with the planner*, and `p` takes it back |
| 57 | 57 | until the planner starts. It is the same fleet operation the web |
| 58 | 58 | milestones page uses, and a move is heard by that page when it is open. |
| 59 | Anyone else sees the order and no keys to change it; a guest sees only what | |
| 59 | Anyone else sees the order and no keys to change it; a visitor sees only what | |
| 60 | 60 | the web shows them. Whoever may see owner facts also gets two lines under |
| 61 | 61 | the list for the limb under the cursor: **Cost and landed** (dollars spent, |
| 62 | changes landed) and its costliest three issues; a reader or guest sees none. | |
| 62 | changes landed) and its costliest three issues; a reader or visitor sees none. | |
| 63 | 63 | The web page has the same *Cost and landed* section on a milestone, and the |
| 64 | 64 | milestones API and MCP carry it as `spend` (`usd`, `landed`, `costliest`), |
| 65 | 65 | owner only. |
| @@ -198,7 +198,7 @@ that account, as for anyone with a key. | ||
| 198 | 198 | |
| 199 | 199 | In the terminal the palette's `SSH keys` (ctrl+k) lists your own keys; `a` adds one (a title, then the authorized_keys line), `e` renames the selected key (prefilled with its name; 1 to 64 printable characters, so each key can say which machine holds it; a name added from any door is fitted to the same rule, so the prefill always renames) and `d` removes the selected key after a confirm that warns when it is this session's key. Refusals read in MCP `ssh_keys`'s words (`keyWords`). Renaming is terminal-only for now: the web's Settings → Keys and MCP `ssh_keys` add and remove but do not rename. |
| 200 | 200 | |
| 201 | Beside it the palette's `Passkeys` (ctrl+k, people only, not agents or guests) lists your own passkeys, read only: each row is the name, then `added YYYY-MM-DD, used YYYY-MM-DD` (or `used never`). The head line says it is read only and points at Settings › Passkeys to add or remove one; with none it reads "None yet. Add one on the web: Settings › Passkeys." (`src/tui/screens/passkeys.ts`, the same rows as MCP `whoami_can kind: passkeys`). | |
| 201 | Beside it the palette's `Passkeys` (ctrl+k, people only, not agents or visitors) lists your own passkeys, read only: each row is the name, then `added YYYY-MM-DD, used YYYY-MM-DD` (or `used never`). The head line says it is read only and points at Settings › Passkeys to add or remove one; with none it reads "None yet. Add one on the web: Settings › Passkeys." (`src/tui/screens/passkeys.ts`, the same rows as MCP `whoami_can kind: passkeys`). | |
| 202 | 202 | |
| 203 | 203 | ## Page-view beacon |
| 204 | 204 | |
| @@ -386,9 +386,9 @@ measured slow. | ||
| 386 | 386 | |
| 387 | 387 | ## Search |
| 388 | 388 | |
| 389 | `/search` answers repositories and issues in full, and greps code repository by repository. A first search starts no new `git grep` after 30 ms (`codeBudgetMs` in the forge config; a soft stop, since the grep in flight still finishes, one batch of four) and shows what it has with one link, **More code results** (`?code=all`), that greps the rest. `GET /api/v1/search` applies the same budget and reports the cut as `moreCode`; `code=all` lifts it. MCP `search` does the same, and its `all` argument lifts it. The terminal palette greps everything. A one-letter query greps no code at all (`MIN_CODE_QUERY`, 2 characters): it would match every line, so the page, the API's `note` and MCP say code is searched for 2 or more characters when code was asked for (`kind=all` or `code`), and repositories and issues still answer it. The terminal palette shares the rule — one letter greps nothing and takes no guest slot — but prints no note: its sections simply show no code. | |
| 389 | `/search` answers repositories and issues in full, and greps code repository by repository. A first search starts no new `git grep` after 30 ms (`codeBudgetMs` in the forge config; a soft stop, since the grep in flight still finishes, one batch of four) and shows what it has with one link, **More code results** (`?code=all`), that greps the rest. `GET /api/v1/search` applies the same budget and reports the cut as `moreCode`; `code=all` lifts it. MCP `search` does the same, and its `all` argument lifts it. The terminal palette greps everything. A one-letter query greps no code at all (`MIN_CODE_QUERY`, 2 characters): it would match every line, so the page, the API's `note` and MCP say code is searched for 2 or more characters when code was asked for (`kind=all` or `code`), and repositories and issues still answer it. The terminal palette shares the rule — one letter greps nothing and takes no visitor slot — but prints no note: its sections simply show no code. | |
| 390 | 390 | |
| 391 | The here-manifest (`GET /api/v1/here?path=…`) reads the same for guests and | |
| 391 | The here-manifest (`GET /api/v1/here?path=…`) reads the same for visitors and | |
| 392 | 392 | members. On `/explore` and `/search` it names the page's own read, `?q=` carried |
| 393 | 393 | over and encoded: `GET /api/v1/explore?q=…` (MCP tool `explore`) or |
| 394 | 394 | `GET /api/v1/search?q=…` (MCP tool `search`), listed once. |
docs/features/agents-md.md +1 −1
| @@ -9,7 +9,7 @@ Any repository you may read answers `/<owner>/<name>/AGENTS.md`, as plain text. | ||
| 9 | 9 | - If the repository has an `AGENTS.md` in its root on the default branch, that file is the answer, word for word. |
| 10 | 10 | - If it has none, the forge writes one: how to install, how to run the tests, how commits and pulls are expected, and the contribute flow in five lines, with the exact clone URL and the one host a sandbox must allow (this forge's own). |
| 11 | 11 | - A file over 200 KB is not served; the generated text answers and says so. |
| 12 | - A private repository answers 404 to anyone who may not read it, a guest included. | |
| 12 | - A private repository answers 404 to anyone who may not read it, a visitor included. | |
| 13 | 13 | |
| 14 | 14 | `/llms.txt` opens with the same doors (git, MCP, the web) and the egress host, and points at this route per repository. |
| 15 | 15 |
docs/features/bugs.md +1 −1
| @@ -9,7 +9,7 @@ An open issue labelled `bug` is answered, fixed or closed as won't fix within a | ||
| 9 | 9 | - **Which labels count.** `bug` makes an issue a bug. Also `high`, `priority: high` or `priority:high` (any case) makes it high priority. Pull requests are not bugs. |
| 10 | 10 | - **Clocks.** 4 h from the issue's creation when high, 48 h otherwise (`src/flow/bugs.ts`). |
| 11 | 11 | - **Pickup order.** Queued agent runs about an open bug start before every other run (`startOrder` in `src/crew/dispatch.ts`). This is policy: bugs also outrank the team dials, which then order the rest. Within each side the queue keeps its order. |
| 12 | - **Alarm.** One `bug_clock` alarm names the bug that has gone longest past its clock, and how many more there are. It appears wherever alarms do (home, `/boards`, MCP and API telemetry). For a guest or an agent it counts public repositories only. | |
| 12 | - **Alarm.** One `bug_clock` alarm names the bug that has gone longest past its clock, and how many more there are. It appears wherever alarms do (home, `/boards`, MCP and API telemetry). For a visitor or an agent it counts public repositories only. | |
| 13 | 13 | - **Tile.** Home's **Open bugs** tile (admins only) shows the open count and how many are past their clock; it links to `/boards`. |
| 14 | 14 | - **Terminal.** The **Bugs** palette entry shows the same count (admins who are people) and the alarm (cut to public for everyone else). |
| 15 | 15 | - **Closing.** Closing a bug needs a reason: see `bug-close.md`. |
docs/features/changelog.md +2 −2
| @@ -6,7 +6,7 @@ row: Changelog | ||
| 6 | 6 | |
| 7 | 7 | `GET /changelog` is public. It lists the last 30 `Release <version>: …` commits on the default branch of the forge's own repository (`FORGE_REPO`), newest first. Each has a heading anchored `#<version>`, its date, and one link per pull named in the subject (`title (#N);title (#N)`). When `FORGE_REPO` is unset or its repository is private, the page answers 200 with "No releases yet". The footer links to it. |
| 8 | 8 | |
| 9 | The terminal's palette has `Changelog`, the same read for anyone, a guest included. `/` takes a word and keeps only releases whose version or carried pull titles contain it, ignoring case; the header says how many match, and `esc` clears it. Enter on a release lists its pulls (`#N title`); a release whose subject names none shows "No pulls". Enter on a pull opens it, as Enter does on any pull. `w` reads the changelog by wave, as the page's "Read it by wave" link does: Enter on a wave opens its changes, Enter on a change opens its pull, and `esc` goes back to the row you left. It goes through `sourceFor`, so a repository the reader may not open stays closed. Tested in `test/tui-changelog-waves.test.ts`. | |
| 9 | The terminal's palette has `Changelog`, the same read for anyone, a visitor included. `/` takes a word and keeps only releases whose version or carried pull titles contain it, ignoring case; the header says how many match, and `esc` clears it. Enter on a release lists its pulls (`#N title`); a release whose subject names none shows "No pulls". Enter on a pull opens it, as Enter does on any pull. `w` reads the changelog by wave, as the page's "Read it by wave" link does: Enter on a wave opens its changes, Enter on a change opens its pull, and `esc` goes back to the row you left. It goes through `sourceFor`, so a repository the reader may not open stays closed. Tested in `test/tui-changelog-waves.test.ts`. | |
| 10 | 10 | |
| 11 | 11 | One bounded `git log` read, cached per head oid; Server-Timing names `releases` and `render`. |
| 12 | 12 | |
| @@ -16,7 +16,7 @@ A pull on the page that a release carried says which: `in 0.3.0 a1b2c3d…e4f5a6 | ||
| 16 | 16 | |
| 17 | 17 | ## How close each open milestone is (#11409) |
| 18 | 18 | |
| 19 | `/changelog` opens with one line per open milestone of the forge's own repository: its name (linked to its milestone page), `N of M done` and a progress bar. A deferred or closed milestone is left out, and the block is absent when none is open or when the reader may not open the repository (a guest on a private one). The terminal's Changelog screen shows the same lines above the releases (name, `N of M done`, at most five), under the same read check. Both read `nearMilestones` in `web/pages/milestones_near.ts`; the page's `ETag` includes them. | |
| 19 | `/changelog` opens with one line per open milestone of the forge's own repository: its name (linked to its milestone page), `N of M done` and a progress bar. A deferred or closed milestone is left out, and the block is absent when none is open or when the reader may not open the repository (a visitor on a private one). The terminal's Changelog screen shows the same lines above the releases (name, `N of M done`, at most five), under the same read check. Both read `nearMilestones` in `web/pages/milestones_near.ts`; the page's `ETag` includes them. | |
| 20 | 20 | |
| 21 | 21 | ## What went live (#7672) |
| 22 | 22 |
docs/features/claim-own-name.md +1 −1
| @@ -16,7 +16,7 @@ or passkey given), so the apps already under the name stay where they are. | ||
| 16 | 16 | claim works with JavaScript off. The fragment script fills it from `#…` and |
| 17 | 17 | then hides it. |
| 18 | 18 | - **Terminal.** The terminal does not take the name: it ends at a link to finish |
| 19 | in the browser. Its guest menu's Start my forge gives that link, and a closed | |
| 19 | in the browser. Its visitor menu's Start my forge gives that link, and a closed | |
| 20 | 20 | sign-up there says to choose it. |
| 21 | 21 | - **Credit.** A run on the host's included credit is budgeted at most what is |
| 22 | 22 | left of it (`cappedByLent`), and the host is asked at the run's end |
docs/features/claimed-forge-door.md +1 −1
| @@ -9,6 +9,6 @@ On a hosted forge someone has claimed, `/` for a signed-out visitor says "This i | ||
| 9 | 9 | - **Who the owner is:** read from the record, not guessed. `parent.json` names the organisation the forge was spawned as (`org`). If a person took that name (`becomeOrg`), they are the owner; otherwise the organisation's Owners team: its one person, or, with several, the forge's own name. Code: `src/spawn/forge_owner.ts`. |
| 10 | 10 | - **When it applies:** `parent.json` exists, an admin exists, and the visitor is signed out on `/`. A signed-in viewer keeps the studio. |
| 11 | 11 | - **Sign in:** `/signin` (with `?next=` for shared words in the query), or the platform edge's login when an edge token is set. |
| 12 | - **The terminal:** unchanged. A guest's key that no account holds is refused at the door (`Permission denied (publickey)`, `src/ssh/keys.ts`), so a guest sees nothing of a claimed forge there. | |
| 12 | - **The terminal:** unchanged. A visitor's key that no account holds is refused at the door (`Permission denied (publickey)`, `src/ssh/keys.ts`), so a visitor sees nothing of a claimed forge there. | |
| 13 | 13 | - Page: `src/web/studio/door_claimed.ts`, using only the front page's classes; test: `test/home-claimed-forge.test.ts`. |
| 14 | 14 | - **Why now:** a stranger on a claimed forge was shown a sales page for a product they are already inside; it is a one-page change with no pipeline dependency. |
docs/features/client-last-activity.md +1 −1
| @@ -8,6 +8,6 @@ Each made forge's row on `/forges` says when a person last did anything in it: * | ||
| 8 | 8 | |
| 9 | 9 | - One phrase per row: when the row already carries the seen line (sent · opened · last seen), that line says it and these words are left out, on the page and in the terminal (`rowActivityWords`). |
| 10 | 10 | - Days are whole UTC days (23:59 yesterday is yesterday, 00:01 today is today). A time in the future reads as today; a value that is not a time reads as never opened. |
| 11 | - The terminal client list (`/forges` screen) shows the same words to the sender, and only to the sender, as the page does (the page is the sender's own list). They replace the older "a person last did something …" line, which a guest in the terminal still gets; the exact time is the span's `title` on the page. | |
| 11 | - The terminal client list (`/forges` screen) shows the same words to the sender, and only to the sender, as the page does (the page is the sender's own list). They replace the older "a person last did something …" line, which a visitor in the terminal still gets; the exact time is the span's `title` on the page. | |
| 12 | 12 | |
| 13 | 13 | Tests: `test/client-seen.test.ts`. |
docs/features/clog-watch.md +1 −1
| @@ -6,7 +6,7 @@ row: Clog watch | ||
| 6 | 6 | |
| 7 | 7 | Once a minute the forge reads its flow (open pulls that conflict, pulls opened and landed over 2 h, the oldest approved wait) and declares a clog on the thresholds in `src/flow/clog.ts`. A clog clears after two quiet readings. |
| 8 | 8 | |
| 9 | - **Where to see it (admin only):** home shows one muted line while a clog stands (`Clogged for 30 h (noticed 30 h in): <cause>.`) and, for a day after, the last cleared note (cause, time to detect, time to clear). The terminal's Flow dialog shows the same lines. A guest and an agent see neither. | |
| 9 | - **Where to see it (admin only):** home shows one muted line while a clog stands (`Clogged for 30 h (noticed 30 h in): <cause>.`) and, for a day after, the last cleared note (cause, time to detect, time to clear). The terminal's Flow dialog shows the same lines. A visitor and an agent see neither. | |
| 10 | 10 | - **Time to detect** is declared-minus-started. The start is the oldest approved pull's wait when that is what clogs; for any other reason it is the reading itself, so the note leaves the line out. |
| 11 | 11 | - **State:** `clog_state` (the standing clog) (with `started_at`, when it really began); the last cleared note is the `clog.cleared` event. Events `clog.started` and `clog.cleared` go to the outbox for admins. |
| 12 | 12 | - **Code:** `flow/clog_tick.ts` (the tick), `flow/clog_read.ts` (the reader), `flow/clog_watch.ts` and `flow/clog_note.ts` (the pure steps). |
docs/features/code-scanning.md +1 −1
| @@ -44,7 +44,7 @@ the findings page says so: "partial: N files not read". | ||
| 44 | 44 | `src/tui/screens/findings.ts`) lists the same findings from the same reads. |
| 45 | 45 | On an open finding, `a` asks why it may stand and accepts it through the |
| 46 | 46 | same action as the page's form (`src/actions/scan_accept.ts`): a reader, |
| 47 | an agent or a guest is refused, a guest sees nothing of a private | |
| 47 | an agent or a visitor is refused, a visitor sees nothing of a private | |
| 48 | 48 | repository, and an acceptance made there shows on the web page. |
| 49 | 49 | |
| 50 | 50 | ## Holding a release |
docs/features/data-browser.md +2 −2
| @@ -4,7 +4,7 @@ row: Data browser (core) | ||
| 4 | 4 | --- |
| 5 | 5 | # Data browser (core) |
| 6 | 6 | |
| 7 | `src/data/` reads SQLite files a viewer may see. Reach it at `/data` (the Data button on Apps, for an admin or an app's writer), in the terminal as the palette command Data, or through the MCP tool `data`. An admin or a writer of an app gets the page (an empty state until a database exists); a guest or a reader gets a 404, no palette entry, and nothing from the tool. | |
| 7 | `src/data/` reads SQLite files a viewer may see. Reach it at `/data` (the Data button on Apps, for an admin or an app's writer), in the terminal as the palette command Data, or through the MCP tool `data`. An admin or a writer of an app gets the page (an empty state until a database exists); a visitor or a reader gets a 404, no palette entry, and nothing from the tool. | |
| 8 | 8 | |
| 9 | 9 | - `listSources(db, dataDir, viewer)` — `forge.db` for admins; for each app the viewer can write, every `.db` under each environment's data dir. `findSource` resolves an id only through that list, so a reader gets `undefined` (a 404), and no input becomes a path. |
| 10 | 10 | - `tables(source)`, `rows(source, table, {filter, order, page})` — 50 rows a page; table and column names are checked against the schema. |
| @@ -32,4 +32,4 @@ Cost of a query: `query` also returns `rowsRead` (rows the query produced, the o | ||
| 32 | 32 | |
| 33 | 33 | MCP `data` with `spec: true` lists operations (`area`, `method`, `path`, `summary`; 300 at most, with `total` saying how many matched) for what the forge's contract says as your role may call it; add `q` to narrow by words, or `repo` for that app's own OpenAPI document (docs/features/api-reference.md; the same door as its API tab: a 404 where you may not enter the app, and a plain answer that it serves none when it has none). `src/data/spec_scope.ts` reads it through `reference` (`src/contract/reference.ts`), the reading the web `/api` page and the terminal API screen (`src/tui/screens/api.ts`) already use. |
| 34 | 34 | |
| 35 | Three doors, one reading. In the data tree the spec is a file named `openapi.json`: the forge's own at the bottom of `/data` and of the terminal's Data screen (only for someone who sees any file there), and each app's after its environments (the app's Data tab on the web, the app node in the terminal; Enter or `l` opens it, `y` yanks `METHOD /path`). On the web it is `?spec=1` on `/data` and on `/:owner/:name/data`; a reader and a guest get the same 404 or sign-in as for the databases, and an app's document is asked through `appSpec`, which still checks `canEnterApp`. It reads the app's production environment only; a preview's document is not read here. The canonical place to read and try operations stays `/api` and `/:owner/:name/api` (and the terminal's API screen): the `openapi.json` nodes and the MCP tool link to them and add no second listing, only the same `reference` rows. | |
| 35 | Three doors, one reading. In the data tree the spec is a file named `openapi.json`: the forge's own at the bottom of `/data` and of the terminal's Data screen (only for someone who sees any file there), and each app's after its environments (the app's Data tab on the web, the app node in the terminal; Enter or `l` opens it, `y` yanks `METHOD /path`). On the web it is `?spec=1` on `/data` and on `/:owner/:name/data`; a reader and a visitor get the same 404 or sign-in as for the databases, and an app's document is asked through `appSpec`, which still checks `canEnterApp`. It reads the app's production environment only; a preview's document is not read here. The canonical place to read and try operations stays `/api` and `/:owner/:name/api` (and the terminal's API screen): the `openapi.json` nodes and the MCP tool link to them and add no second listing, only the same `reference` rows. |
docs/features/events.md +1 −1
| @@ -8,7 +8,7 @@ row: Events in the browser | ||
| 8 | 8 | |
| 9 | 9 | `?kind=` narrows to one event kind (`?kind=pull.merged`), the same `kind` MCP `events` and `GET …/events` take; one that is not a kind (`validEventsKind`) answers 404. Each row has a button beside it in a person's words ("Merged pulls", from `eventKindLabel`) that links to its kind, 44px tall on a thumb; the raw kind appears only in the URL. A narrowed page says "Showing: Merged pulls" with an **All events** button beside the heading, and the next-page link keeps `kind`. A kind with no events says "No <kind> events" and offers All events. |
| 10 | 10 | |
| 11 | The audience is the same as MCP `events` and `GET …/events`, because the page reads the same `eventsPage`: a webhook's URL and an app's variable names are the admins'. A public repository answers a guest with 200; a private one answers 404 to anyone who cannot read it. A row links to its page when the event has one (an issue, a push's commits) and is a plain row otherwise. | |
| 11 | The audience is the same as MCP `events` and `GET …/events`, because the page reads the same `eventsPage`: a webhook's URL and an app's variable names are the admins'. A public repository answers a visitor with 200; a private one answers 404 to anyone who cannot read it. A row links to its page when the event has one (an issue, a push's commits) and is a plain row otherwise. | |
| 12 | 12 | |
| 13 | 13 | The terminal's version is `v` on the About card (see the README). `enter` on a row opens the issue or pull the event names (a `pull.*` event opens the pull, any other the issue); the issue and pull screens check access themselves, and `esc` returns to the list at the same row. A push or a settings row names no number and opens nothing, and the key bar shows `enter open` only when the selected row can open something. `t` keeps only the kind of the row under the cursor and `t` again lifts it; `s` keeps only settings changes. |
| 14 | 14 |
docs/features/explore.md +1 −1
| @@ -81,7 +81,7 @@ One rule for what `/explore` does not take (#14392): an unknown sort, kind in `q | ||
| 81 | 81 | |
| 82 | 82 | ## Mine (#13161) |
| 83 | 83 | |
| 84 | `mine=yes` (or `mine:yes` in a line) keeps the viewer's own apps and the viewer's own person row: the owner is the viewer's name. Signed out it matches nothing, never everyone. Filters live in the URL, so `/explore?kind=app&mine=yes&sort=fresh` reloads and sends as the same view, and equals choosing Apps, Mine and Fresh by hand, row for row (`test/explore-url-filters.test.ts`). The terminal's search line takes `mine:yes` the same way (`mine:yes` after `/`): a guest sees no rows, the signed-in viewer sees their own (`test/tui-dashboard-explore.test.ts`). A `mine:` value other than yes or no is an unknown word like the others. | |
| 84 | `mine=yes` (or `mine:yes` in a line) keeps the viewer's own apps and the viewer's own person row: the owner is the viewer's name. Signed out it matches nothing, never everyone. Filters live in the URL, so `/explore?kind=app&mine=yes&sort=fresh` reloads and sends as the same view, and equals choosing Apps, Mine and Fresh by hand, row for row (`test/explore-url-filters.test.ts`). The terminal's search line takes `mine:yes` the same way (`mine:yes` after `/`): a visitor sees no rows, the signed-in viewer sees their own (`test/tui-dashboard-explore.test.ts`). A `mine:` value other than yes or no is an unknown word like the others. | |
| 85 | 85 | |
| 86 | 86 | `template=<name>` (or `template:<name>` in a line) keeps the forges whose spawn record names that template, a built-in id or `owner/name`: `/explore?template=trevato/shop`. It lists forges only, and only admins see forge rows, so anyone else gets an empty list worded "No forges to show for <name>". The value is checked against the template name shapes and matched by equality, never in SQL; one that is no template name is an unknown word, refused like the others. A chip `template:<name>` clears it. The terminal's search line takes `template:<id>` the same way (`readExploreLine`). Covered by `test/explore-template.test.ts`. |
| 87 | 87 |
docs/features/first-wrong.md +1 −1
| @@ -11,7 +11,7 @@ When something needs you, home says so in one calm line under the title, with th | ||
| 11 | 11 | 3. **A pull whose check is stuck** (anyone who can write to its repository). |
| 12 | 12 | 4. **The crew past its share of the week** (admins). |
| 13 | 13 | |
| 14 | When all is well there is no line, and a guest never sees one. | |
| 14 | When all is well there is no line, and a visitor never sees one. | |
| 15 | 15 | |
| 16 | 16 | The terminal home shows the same line, read by the same function, with the web path to fix it at the end. The allowance line waits until the week has a share above zero. |
| 17 | 17 |
docs/features/flow-declines.md +1 −1
| @@ -16,4 +16,4 @@ Reasons: *already on main*, *not on main yet*, *off direction*, *other*. Each sh | ||
| 16 | 16 | - **Terminal:** the Flow command (palette), the same line under the review latency. |
| 17 | 17 | - **Agents:** the `flow` MCP tool with no arguments returns `declines` (`says`, `groups`, `runs`). |
| 18 | 18 | |
| 19 | One reader serves all three (`readDeclines` in `src/flow/declines.ts`). A site admin sees every repository; an agent or guest reader sees public repositories only. The figure is cached with the rest of the panel for 30 seconds. | |
| 19 | One reader serves all three (`readDeclines` in `src/flow/declines.ts`). A site admin sees every repository; an agent or visitor reader sees public repositories only. The figure is cached with the rest of the panel for 30 seconds. |
docs/features/flows.md +1 −1
| @@ -15,7 +15,7 @@ row: Flows | ||
| 15 | 15 | - **Link health (#9561).** Every line carries a health badge: healthy, news, diverged, unreadable, not read lately (no comparison in 90 minutes) or paused (`followHealth`, `src/flows/view.ts`). A mirror's own origin shows as a line from the head reading in `origin-ahead.md`. |
| 16 | 16 | - **Probe.** The clock already compares heads (`checkDue` for the upstream and sources, `runAheadReads` for an origin); an admin's *Compare heads now* (`POST /:owner/:name/flows/probe`, `src/flows/probe.ts`) runs the same reads on ask: admin only, never an agent, one at a time, four a minute. |
| 17 | 17 | - **Bounded.** A probe reads at most 8 enabled sources, four at a time, and answers within 30 s; it announces itself (`repo.links_probed`, readers of the repository) so an open page offers the refresh. An origin line is stale on the same 90-minute rule; every origin reading records when it was taken. |
| 18 | - **Terminal.** The Flows screen shows the same lines with health tones and the same gates: `c` compares heads (admin), `p` pulls in what's new (writer, `takeFromOrigin`), `o` names the page that offers a pull to the parent. A guest sees only what they may read. | |
| 18 | - **Terminal.** The Flows screen shows the same lines with health tones and the same gates: `c` compares heads (admin), `p` pulls in what's new (writer, `takeFromOrigin`), `o` names the page that offers a pull to the parent. A visitor sees only what they may read. | |
| 19 | 19 | - **Actions.** A writer of a mirror with news sees *Pull in what's new* (the existing `sync/take`, which refuses a diverged mirror); a writer of a fork sees *Offer what's useful* (the existing pull-to-parent page). |
| 20 | 20 | |
| 21 | 21 | - **Advisories.** The same *Read upstream releases now* also asks the npm registry's bulk advisory endpoint about each exact pin and stores a one-line answer (severity, title, `(+N more)` when there are several) in `dep_latest.advisory`. A package with one shows an *advisory* badge and the text on the page and in the terminal (`depState`, `src/flows/radar.ts`, words both). They refresh only on that button: the page never calls the registry. The advisory ask is a second request per package inside the same 30 s run deadline. |
docs/features/forge-link-states.md +1 −1
| @@ -61,7 +61,7 @@ In the terminal, **Forges you sent** has `n` (an admin's): pick an unclaimed for | ||
| 61 | 61 | ## Sent, opened, last seen |
| 62 | 62 | |
| 63 | 63 | The sender's `/forges` row and the terminal's forges screen (an admin's; a |
| 64 | guest sees none of it) carry one line from the same code (`seenOf`): | |
| 64 | visitor sees none of it) carry one line from the same code (`seenOf`): | |
| 65 | 65 | "sent 3d ago · opened 1d ago · last seen 2h ago". It replaces the separate |
| 66 | 66 | stage and "a person last did something" words, which said the same thing; a |
| 67 | 67 | resend notice and the last tell keep their own words. |
docs/features/growth.md +1 −1
| @@ -26,7 +26,7 @@ is paused, and what the caller may see. | ||
| 26 | 26 | issues opened and closed this week and how many issues and pulls are open now. The MCP `system` tool with |
| 27 | 27 | `{ kind: "growth", repo }` answers `{openIssues, openPulls, openedToday, closedToday, openedWeek, closedWeek}` |
| 28 | 28 | (today is the UTC day; the week is seven UTC days) from the same read, for a reader of the repository only; a |
| 29 | guest or a non-reader of a private repository gets a refusal, and sealed issues are left out for anyone who may | |
| 29 | visitor or a non-reader of a private repository gets a refusal, and sealed issues are left out for anyone who may | |
| 30 | 30 | not see them. Today's numbers are in that answer only; the page and terminal show the week. |
| 31 | 31 | |
| 32 | 32 | Closed-per-day has no index of its own: it walks the repository's rows through the existing `repo_id` index |
docs/features/home-plans.md +1 −1
| @@ -9,7 +9,7 @@ Where a visitor sees what a hosted forge is and how to get one (#11139). | ||
| 9 | 9 | ## Where |
| 10 | 10 | |
| 11 | 11 | - Web: the signed-out home, section **Get your own forge** (`/#yours`): one line per plan, then one **Get a forge** button to `/forges/new`, then the free, open-source way to run it yourself (the guide link and the clone commands). |
| 12 | - Terminal: the palette's **Get your own forge** (`src/tui/screens/getforge.ts`), offered to everyone, guests included: the same plans, `Get a forge: <origin>/forges/new`, and the clone commands. | |
| 12 | - Terminal: the palette's **Get your own forge** (`src/tui/screens/getforge.ts`), offered to everyone, visitors included: the same plans, `Get a forge: <origin>/forges/new`, and the clone commands. | |
| 13 | 13 | - `/llms.txt`: the "Get your own forge" line points at the plans on the home and at `/forges/new`. |
| 14 | 14 | |
| 15 | 15 | ## What a plan line says |
docs/features/issue-cost.md +2 −2
| @@ -36,11 +36,11 @@ to know what a piece of work cost before they look at the whole ledger. | ||
| 36 | 36 | `src/core/issue_cost.ts`): the viewer must read the repository's runs, see |
| 37 | 37 | the owner's facts (as the runs list hides cost from other readers), and be |
| 38 | 38 | allowed to see the issue. A sealed pull the viewer may not see is left out |
| 39 | of the sum. A guest sees nothing. | |
| 39 | of the sum. A visitor sees nothing. | |
| 40 | 40 | |
| 41 | 41 | ## API and MCP |
| 42 | 42 | |
| 43 | 43 | `GET /api/v1/repos/:owner/:name/issues/:n` and the MCP `issue` tool carry |
| 44 | 44 | `cost: {usd, own, runs, pulls: [{number, usd}]}`, the number the page prints, from |
| 45 | `issueCostFor`. The field is absent when nothing was spent, for a guest, and | |
| 45 | `issueCostFor`. The field is absent when nothing was spent, for a visitor, and | |
| 46 | 46 | for a viewer who may not read the runs or see the owner's facts. |
docs/features/keeper.md +1 −1
| @@ -23,4 +23,4 @@ Two DORA numbers (`keeper_measures.ts`, #13110), over the last 7 days, each with | ||
| 23 | 23 | |
| 24 | 24 | Still unmeasured: queue-wait p95 and rework per agent from the issue discussion. The two rates are approximations: "next check" is the first main check created within 24 hours after the landing (a release likewise: cut within 24 hours), so a red that one of several batched landings caused is counted against each; a pull landed in the last seven days may yet be reverted, so the revert rate can only rise; a release proof is matched by time, not by the commits it carried, and only for the forge's own repository; the week is rolling, not a calendar week, and no history of past weeks is kept. |
| 25 | 25 | |
| 26 | Who reads what: a site admin reads the sentence with repository names and the question with its button. Everyone else, guests and agents included, reads the cause with no repository in it (`readKeeper(db, full)`). The Flow only switch is retired (#7771), so no act asks a question today; one already on the books is answered with its button, and the answer is a `keeper.answered` event carrying the owner's id. | |
| 26 | Who reads what: a site admin reads the sentence with repository names and the question with its button. Everyone else, visitors and agents included, reads the cause with no repository in it (`readKeeper(db, full)`). The Flow only switch is retired (#7771), so no act asks a question today; one already on the books is answered with its button, and the answer is a `keeper.answered` event carrying the owner's id. |
docs/features/made-from.md +1 −1
| @@ -7,7 +7,7 @@ row: Made from: the template a forge came from | ||
| 7 | 7 | A forge made from a template repository remembers which one and at what commit. The record is the `template` entry of its `parent.json` (`{ id, repo, tip }`, written when it is made); a forge made without a template repository, or before this was kept, has none and says nothing. |
| 8 | 8 | |
| 9 | 9 | - **Settings:** `/settings` has a `Started from` row, `<owner>/<name> at <short sha>`, in the same list as the Plan row. The name links to `/templates/<owner>/<name>` only while that repository is still marked as a template and the viewer can read it; otherwise it is plain text. |
| 10 | - **Terminal:** the palette entry *Started from* (`src/tui/screens/madefrom.ts`, offered only to a signed-in person and only when the record exists; a guest is told nothing) prints `Started from <template> at <short sha>`. | |
| 10 | - **Terminal:** the palette entry *Started from* (`src/tui/screens/madefrom.ts`, offered only to a signed-in person and only when the record exists; a visitor is told nothing) prints `Started from <template> at <short sha>`. | |
| 11 | 11 | - **Parent's read:** `GET /api/v1/forge` returns `madeFrom: { template, at }` (the full commit) only when the caller shows the parent's secret; anyone else, or a wrong secret, gets no `madeFrom`. |
| 12 | 12 | - **MCP:** the `forges` tool's rows (admin) carry `madeFrom` (`{ template, at }` or null), read from the record the parent wrote; no new tool. |
| 13 | 13 | - **Try it:** make a forge from a template repository, open `/settings`. |
docs/features/map-held.md +1 −1
| @@ -6,4 +6,4 @@ row: What holds a ready issue | ||
| 6 | 6 | |
| 7 | 7 | `GET /api/v1/repos/:owner/:name/map` and the MCP `map` tool give each `ready` entry `held`: `null`, or `{ by, detail }` with `by` one of the names in `src/crew/held.ts` (`open_pull`, `hot_file`, `run_cap`, …). For `hot_file`, `detail` names the file and its count of open pulls. `startable` lists the ready numbers nothing holds. |
| 8 | 8 | |
| 9 | Holds are worked out for the viewer: a pull they may not see (a sealed one) neither counts toward a hot file nor holds an issue as `open_pull`. So a guest's `startable` can list an issue the crew will not start; read it as what the viewer can see is free, not as the crew's queue. The direction issue is never in `startable` but shows `held: null`. Hot-file counts come from memory, so a cached map can lag them by up to a minute. | |
| 9 | Holds are worked out for the viewer: a pull they may not see (a sealed one) neither counts toward a hot file nor holds an issue as `open_pull`. So a visitor's `startable` can list an issue the crew will not start; read it as what the viewer can see is free, not as the crew's queue. The direction issue is never in `startable` but shows `held: null`. Hot-file counts come from memory, so a cached map can lag them by up to a minute. |
docs/features/new-forge-template.md +1 −1
| @@ -26,7 +26,7 @@ Code: `src/cli/new_template.ts`, the two calls in `src/cli/api.ts` (`templates`, | ||
| 26 | 26 | |
| 27 | 27 | `/templates` lists what a new forge can start from: the built-in templates, then the template repositories you can read. Each row has one sentence and one secondary button, "Start a forge", which opens `/forges/new?template=<id>` with that template chosen. Signed out works too: a stranger lands on the same form with the template kept. `?template=` is accepted only when spawn accepts it (`parseTemplate`); anything else leaves Blank chosen, and it is never echoed. The plan (`do=plan`) shows "It starts from the <b>…</b> template". |
| 28 | 28 | |
| 29 | The terminal has the same list: the "Templates" command (`src/tui/screens/templates.ts`) shows the same rows; Enter on a row opens New forge with that template chosen, for people signed in, and a guest is told to sign in. Both read `templateList` (`src/spawn/template_list.ts`), so a private template repository is listed only to people who can read it, on the page and in the terminal alike. | |
| 29 | The terminal has the same list: the "Templates" command (`src/tui/screens/templates.ts`) shows the same rows; Enter on a row opens New forge with that template chosen, for people signed in, and a visitor is told to sign in. Both read `templateList` (`src/spawn/template_list.ts`), so a private template repository is listed only to people who can read it, on the page and in the terminal alike. | |
| 30 | 30 | |
| 31 | 31 | ### Filtering the list |
| 32 | 32 |
docs/features/origin-ahead.md +1 −1
| @@ -15,7 +15,7 @@ with **Take them** (`POST /:owner/:name/sync/take`). | ||
| 15 | 15 | started from the same minute tick as `runSync`), never inside the sweep's: |
| 16 | 16 | a reading stuck on a slow origin holds only the next reading, never a sync. |
| 17 | 17 | - Only a person who may write the repository sees **Take them**; everyone who |
| 18 | may read it sees the count, and a guest sees nothing on a private one. | |
| 18 | may read it sees the count, and a visitor sees nothing on a private one. | |
| 19 | 19 | - At the terminal: the palette's "New commits upstream" lists the mirrors you |
| 20 | 20 | can read that are behind (one query over the readings, not one per |
| 21 | 21 | repository); `t` takes them under the page's own check, `requireWriter` |
docs/features/report-status.md +1 −1
| @@ -35,6 +35,6 @@ The answer to a report or an offer (`…/offers`, the MCP `offer` tool) also car | ||
| 35 | 35 | - **Shows:** `kind`, `state` (received, read, planned, landed or declined), its words, and the dates it arrived, last changed and expires. Never the title, the words, a name or an id. |
| 36 | 36 | - **States:** a report is received until a person decides; accepting makes it planned, closing that issue makes it landed (done) or declined (dropped); dismissing declines it. An offer is received, then read once a reviewer reviews, then landed or declined. So a report is never `read` (a person's decision is its first change) and an offer is never `planned`; each shows only the states its own steps can reach. |
| 37 | 37 | - **The token:** 192 random bits, read-only, good 90 days; a wrong, malformed or expired one is a 404 (`src/core/outsider_status.ts`, `src/http/offer_routes.ts`). The status routes answer 429 past 60 reads a minute per client, and links past their day are deleted hourly. Pinned by `test/outsider-status.test.ts`. |
| 38 | - **Where the owner finds an offer's link (#15988):** on that pull's page, one line with Copy, and on the terminal's pull screen as a `status link:` row. Both ask `offerStatusLinkFor` (`src/core/outsider_status.ts`): writers only, because the link is a capability, and only on a pull an offer opened. A pull the owner opened, or a reader or guest looking, shows no such line. Pinned by `test/outsider-status.test.ts` (page) and `test/pull-next-tui.test.ts` (terminal). | |
| 38 | - **Where the owner finds an offer's link (#15988):** on that pull's page, one line with Copy, and on the terminal's pull screen as a `status link:` row. Both ask `offerStatusLinkFor` (`src/core/outsider_status.ts`): writers only, because the link is a capability, and only on a pull an offer opened. A pull the owner opened, or a reader or visitor looking, shows no such line. Pinned by `test/outsider-status.test.ts` (page) and `test/pull-next-tui.test.ts` (terminal). | |
| 39 | 39 | |
| 40 | 40 | Pinned by `test/report-status.test.ts`. |
docs/features/space.md +2 −2
| @@ -6,7 +6,7 @@ row: The space | ||
| 6 | 6 | |
| 7 | 7 | `/:owner/:name/space` is the map as a plane you move through (#10444). It is |
| 8 | 8 | linked from the map page ("The same work as a space to move through"). Its data |
| 9 | is `/:owner/:name/space.json`, the same plane for an agent. In the terminal it is the `space` entry in the palette (`src/tui/screens/space.ts`): pillars with their counts, issues by state, who of the crew is on what, and the week's landings, under the wave line (below), from the same `spaceOf` and so the same gate as the page (a guest sees what is public, an admin everything). | |
| 9 | is `/:owner/:name/space.json`, the same plane for an agent. In the terminal it is the `space` entry in the palette (`src/tui/screens/space.ts`): pillars with their counts, issues by state, who of the crew is on what, and the week's landings, under the wave line (below), from the same `spaceOf` and so the same gate as the page (a visitor sees what is public, an admin everything). | |
| 10 | 10 | |
| 11 | 11 | ## Use |
| 12 | 12 | |
| @@ -16,7 +16,7 @@ is `/:owner/:name/space.json`, the same plane for an agent. In the terminal it i | ||
| 16 | 16 | - **Time.** The scrubber replays the last 7 days: issues appear when opened, slide from "in review" to "landed" when they close, and crew members sit on what they were running then. **Play** runs the week in 20 seconds. At **Now** the view is live: any run, issue or pull event of the repository fetches the plane again. |
| 17 | 17 | - **Crew.** Their avatars sit on the issue they are working; tap one (or its name in the bar) to see what they are on. |
| 18 | 18 | - **Legend.** **Legend**, above the scrubber, says what size, ink and distance mean and gives each state one line. It starts closed; on a wide screen it opens once, on a first visit, and stays closed after. It is real HTML from `space_model.ts`, so it reads without the script. |
| 19 | - **The wave line.** Under the repository's name the page says which wave is in flight and how many of its issues landed (a pull merged) in the last 24 hours, or that the crew is resting when none is open (`src/story/wave_today.ts`). The terminal screen opens with the same line. Sealed work is counted only for a reader who may see it: its author, or one who sees sealed work; a guest's count leaves it out. | |
| 19 | - **The wave line.** Under the repository's name the page says which wave is in flight and how many of its issues landed (a pull merged) in the last 24 hours, or that the crew is resting when none is open (`src/story/wave_today.ts`). The terminal screen opens with the same line. Sealed work is counted only for a reader who may see it: its author, or one who sees sealed work; a visitor's count leaves it out. | |
| 20 | 20 | - **One line and `?q=`.** Above the fold, one line says size, colour and distance. The Find box is a plain GET form: `/:owner/:name/space?q=login` lists the matching issues as links (or says "No issue matches") without script; with script the view also flies to the first. In the terminal the same one line opens the screen. |
| 21 | 21 | - **Share.** The view is in the address hash: `#x=…&y=…&z=…` (centre in world units, zoom relative to Fit) and `&t=` (minutes since the epoch) when scrubbed back. |
| 22 | 22 |
docs/features/spawner-claim-link.md +1 −1
| @@ -37,7 +37,7 @@ someone else; only the person who started it can resume it". | ||
| 37 | 37 | The one-click doors keep the key for the stranger and never show it (#15126). The home page's **Start my forge** |
| 38 | 38 | sends a key it chose and keeps it in an HttpOnly, SameSite=Lax cookie named for the forge (`forge_resume_<name>`, |
| 39 | 39 | `Path=/forges/start`, a day), set on every refusal, a start that stops part way included, and cleared once the forge |
| 40 | is made (`src/web/resume_cookie.ts`). The terminal's guest **Start my forge** keeps it for the SSH session, for the last 8 names typed. Pressing | |
| 40 | is made (`src/web/resume_cookie.ts`). The terminal's visitor **Start my forge** keeps it for the SSH session, for the last 8 names typed. Pressing | |
| 41 | 41 | it again from the same browser or session resumes; any other gets `not_yours` in plain words: "Someone else is making |
| 42 | 42 | a forge by that name. Pick another name and press Start my forge again." A finished forge is answered as before. Pinned by |
| 43 | 43 | `test/spawn-resume.test.ts`, `test/spawn-resume-door.test.ts` and `test/start-forge-resume.test.ts`. |
docs/features/start-my-forge.md +1 −1
| @@ -15,7 +15,7 @@ A signed-out visitor starts their own forge from the home page, with no account | ||
| 15 | 15 | |
| 16 | 16 | The field is a slug, so it turns off autocomplete and capitalisation on phones. The form is in `src/web/studio/home.ts`; its test is `test/home-start-forge.test.ts`. |
| 17 | 17 | |
| 18 | In the terminal, a guest's "Start my forge" command (`src/tui/screens/startforge.ts`) asks for the name, goes through the same `spawnDoor` as a stranger (counted under the SSH client's address), shows a refusal in the same fixed sentences as the home page, and shows the claim link once. Signed in, "New forge" is the fuller form. Test: `test/tui-startforge.test.ts`. | |
| 18 | In the terminal, a visitor's "Start my forge" command (`src/tui/screens/startforge.ts`) asks for the name, goes through the same `spawnDoor` as a stranger (counted under the SSH client's address), shows a refusal in the same fixed sentences as the home page, and shows the claim link once. Signed in, "New forge" is the fuller form. Test: `test/tui-startforge.test.ts`. | |
| 19 | 19 | |
| 20 | 20 | ## When the door refuses |
| 21 | 21 |
docs/features/subtitle-shift.md +1 −1
| @@ -4,7 +4,7 @@ row: Shift a subtitle file | ||
| 4 | 4 | --- |
| 5 | 5 | # Shift a subtitle file |
| 6 | 6 | |
| 7 | A `.srt` or `.vtt` file's page has a "Shift every cue by (seconds)" field for writers. Type `2.5` or `-1`, press "Shift and save": every cue's start and end move by that much and the result is saved as one commit, "Shift subtitles by +2.5 s". Readers and guests see no field. | |
| 7 | A `.srt` or `.vtt` file's page has a "Shift every cue by (seconds)" field for writers. Type `2.5` or `-1`, press "Shift and save": every cue's start and end move by that much and the result is saved as one commit, "Shift subtitles by +2.5 s". Readers and visitors see no field. | |
| 8 | 8 | |
| 9 | 9 | - The offset is a signed decimal in seconds, at most 3600 either way; anything else is refused on a page that says why and writes nothing. A time never goes below zero. |
| 10 | 10 | - Only the two timestamps of each timing line change. Numbers, ids, cue settings, notes, text and line endings (LF or CRLF) are kept byte for byte. A timestamp is written as `MM:SS.mmm` with three millisecond digits (`1,5` becomes `1,500`); an hour field keeps the digits it had (`1:02:03,004` stays `1:02:03,004`), and a WebVTT stamp without hours grows one only when the shift carries it past an hour. |
docs/features/traffic-sources.md +1 −1
| @@ -59,6 +59,6 @@ seconds, dropped when views are written, so a page and its probe calls share it. | ||
| 59 | 59 | |
| 60 | 60 | **Terminal.** Palette "Traffic sources" (`src/tui/screens/trafficview.ts`) is the |
| 61 | 61 | forge's view for an admin; with a repository open, "<owner>/<name> — Traffic |
| 62 | sources" is that app's view for those who administer it. A guest is offered | |
| 62 | sources" is that app's view for those who administer it. A visitor is offered | |
| 63 | 63 | neither. `w` window, `s` people/scrapers, Enter narrows, `c` clears, `t` types |
| 64 | 64 | the path steps. It does not call the probe; use the web page for that. |
docs/features/week-pace.md +1 −1
| @@ -21,4 +21,4 @@ Bets are not in the forge yet, so the release above falls back to the lowest-num | ||
| 21 | 21 | |
| 22 | 22 | ## In the terminal (#15853) |
| 23 | 23 | |
| 24 | The terminal's week screen ends its facts with the allowance line: pulls landed in the last seven days, the percent of the weekly allowance used, and what the rest buys at that pace. The words come from `allowanceLine` in `src/actions/usage.ts`, written there for the `/week` page and MCP tool of #15818 to import; today the terminal is its only caller. The percent is the crew's own, `crewWeekFor(...).usedPct` (the figure the handover reports), so no surface computes a second one. Spend is the owner's fact: `allowanceLine` returns null for anyone `canSeeOwnerFacts` refuses, so a guest on a public repo sees the retrospective without the line, whichever surface asks. Tested in `test/tui-week-line.test.ts`. | |
| 24 | The terminal's week screen ends its facts with the allowance line: pulls landed in the last seven days, the percent of the weekly allowance used, and what the rest buys at that pace. The words come from `allowanceLine` in `src/actions/usage.ts`, written there for the `/week` page and MCP tool of #15818 to import; today the terminal is its only caller. The percent is the crew's own, `crewWeekFor(...).usedPct` (the figure the handover reports), so no surface computes a second one. Spend is the owner's fact: `allowanceLine` returns null for anyone `canSeeOwnerFacts` refuses, so a visitor on a public repo sees the retrospective without the line, whichever surface asks. Tested in `test/tui-week-line.test.ts`. |
src/core/principal.ts added +101
| @@ -0,0 +1,101 @@ | ||
| 1 | /** | |
| 2 | * Principal: who is asking, as one value. `Auth` (`http/context.ts`) is a bag | |
| 3 | * of optional fields; this names what the bag means. Anonymous is a value, not | |
| 4 | * `undefined`. A principal has a `kind` (how it arrives: no credential, the | |
| 5 | * session itself, or one of the token kinds) and, when someone is behind it, a | |
| 6 | * `subject` (what is asking: a person, an agent or an app). Additive: nothing decides on it yet, | |
| 7 | * so no route's answer changes (docs/ROLES.md, "The words"). | |
| 8 | */ | |
| 9 | ||
| 10 | import type { Auth } from "../http/context.ts"; | |
| 11 | import type { ContributeScope } from "./contribute_token.ts"; | |
| 12 | import type { Proposal } from "./proposal_token.ts"; | |
| 13 | import type { RunScope } from "./run_token.ts"; | |
| 14 | import type { TokenScope } from "./tokens.ts"; | |
| 15 | import type { User } from "./users.ts"; | |
| 16 | ||
| 17 | /** What is asking, read from an account. */ | |
| 18 | export type Subject = | |
| 19 | | { readonly kind: "person"; readonly user: User } | |
| 20 | | { readonly kind: "agent"; readonly user: User } | |
| 21 | | { readonly kind: "app"; readonly user: User; readonly appId: string }; | |
| 22 | ||
| 23 | /** Who is asking and nothing else is known; a credential sent and refused still lands here. */ | |
| 24 | export interface Anonymous { | |
| 25 | readonly kind: "anonymous"; | |
| 26 | /** A credential was sent and matched nothing. */ | |
| 27 | readonly refused: boolean; | |
| 28 | /** Seconds to wait when a password was turned away by the sign-in windows. */ | |
| 29 | readonly retryAfter?: number; | |
| 30 | } | |
| 31 | ||
| 32 | /** The account itself: a session cookie, the platform edge or the password. */ | |
| 33 | export interface SessionPrincipal { | |
| 34 | readonly kind: "session"; | |
| 35 | readonly subject: Subject; | |
| 36 | /** `none`: a terminal screen acting for the signed-in person it belongs to. */ | |
| 37 | readonly via: "session" | "edge" | "password" | "none"; | |
| 38 | readonly sessionId?: string; | |
| 39 | } | |
| 40 | ||
| 41 | interface TokenBase { | |
| 42 | readonly subject: Subject; | |
| 43 | readonly tokenId: string | undefined; | |
| 44 | readonly tokenName: string | undefined; | |
| 45 | } | |
| 46 | ||
| 47 | export type TokenPrincipal = | |
| 48 | | (TokenBase & { readonly kind: "ro_token" | "rw_token" | "admin_token" }) | |
| 49 | | (TokenBase & { readonly kind: "proposal_token"; readonly proposal: Proposal }) | |
| 50 | | (TokenBase & { readonly kind: "run_token"; readonly run: RunScope }) | |
| 51 | | (TokenBase & { readonly kind: "contribute_token"; readonly contribute: ContributeScope }) | |
| 52 | | (TokenBase & { readonly kind: "read_grant_token"; readonly appId: string }) | |
| 53 | /** The forge's own agent speaking for this person in one conversation. */ | |
| 54 | | (TokenBase & { readonly kind: "via_token"; readonly through: string }); | |
| 55 | ||
| 56 | export type Principal = Anonymous | SessionPrincipal | TokenPrincipal; | |
| 57 | export type PrincipalKind = Principal["kind"]; | |
| 58 | ||
| 59 | function subjectOf(user: User, appId: string | undefined): Subject { | |
| 60 | if (appId !== undefined) return { kind: "app", user, appId }; | |
| 61 | return user.kind === "agent" ? { kind: "agent", user } : { kind: "person", user }; | |
| 62 | } | |
| 63 | ||
| 64 | /** | |
| 65 | * The principal for today's `Auth`. A token that carries several scopes is the | |
| 66 | * narrowest: proposal, then run, contribute, an app's read grant, a via token, | |
| 67 | * then its plain `ro`/`rw`/`admin` scope — the order the gates meet them in. | |
| 68 | */ | |
| 69 | export function principalOf(auth: Auth): Principal { | |
| 70 | const user = auth.user; | |
| 71 | if (user === undefined) { | |
| 72 | return { | |
| 73 | kind: "anonymous", | |
| 74 | refused: auth.refused === true, | |
| 75 | ...(auth.retryAfter !== undefined ? { retryAfter: auth.retryAfter } : {}), | |
| 76 | }; | |
| 77 | } | |
| 78 | const subject = subjectOf(user, auth.appId); | |
| 79 | if (auth.via === "token") { | |
| 80 | const base: TokenBase = { subject, tokenId: auth.tokenId, tokenName: auth.tokenName }; | |
| 81 | if (auth.proposal) return { ...base, kind: "proposal_token", proposal: auth.proposal }; | |
| 82 | if (auth.run) return { ...base, kind: "run_token", run: auth.run }; | |
| 83 | if (auth.contribute) return { ...base, kind: "contribute_token", contribute: auth.contribute }; | |
| 84 | if (auth.appId !== undefined) return { ...base, kind: "read_grant_token", appId: auth.appId }; | |
| 85 | if (auth.through !== undefined) return { ...base, kind: "via_token", through: auth.through }; | |
| 86 | const scope: TokenScope = auth.scope ?? "ro"; | |
| 87 | return { ...base, kind: `${scope}_token` }; | |
| 88 | } | |
| 89 | return { | |
| 90 | kind: "session", | |
| 91 | subject, | |
| 92 | via: auth.via, | |
| 93 | ...(auth.sessionId !== undefined ? { sessionId: auth.sessionId } : {}), | |
| 94 | }; | |
| 95 | } | |
| 96 | ||
| 97 | /** The account behind a principal, when there is one: none for anonymous. */ | |
| 98 | export function userOf(principal: Principal): User | undefined { | |
| 99 | if (principal.kind === "anonymous") return undefined; | |
| 100 | return principal.subject.user; | |
| 101 | } |
src/http/server.ts +1 −1
| @@ -124,7 +124,7 @@ const NO_AUTH: Auth = { user: undefined, scope: undefined, via: "none" }; | ||
| 124 | 124 | /** A credential was sent and matched nothing: still no one, but `here` says so. */ |
| 125 | 125 | const NO_MATCH: Auth = { ...NO_AUTH, refused: true }; |
| 126 | 126 | |
| 127 | async function resolveAuth(app: App, request: Request): Promise<Auth> { | |
| 127 | export async function resolveAuth(app: App, request: Request): Promise<Auth> { | |
| 128 | 128 | // A read-only standby knows no one: a session or token of the main forge |
| 129 | 129 | // must not show its private pages on a copy (#9657). |
| 130 | 130 | if (app.config.readOnly === true) return NO_AUTH; |
src/http/usage_tag.ts +2 −1
| @@ -7,6 +7,7 @@ | ||
| 7 | 7 | * whatever strangers type, so the table never grows with their input. |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | import { principalOf, userOf } from "../core/principal.ts"; | |
| 10 | 11 | import type { Auth } from "./context.ts"; |
| 11 | 12 | import { METHODS, type UsageRole, type UsageSurface } from "../core/usage_count.ts"; |
| 12 | 13 | |
| @@ -33,7 +34,7 @@ const doors = new WeakMap<Request, Door>(); | ||
| 33 | 34 | |
| 34 | 35 | /** The viewer's role: a token for an agent account is `agent`. */ |
| 35 | 36 | export function roleOf(auth: Auth): UsageRole { |
| 36 | const user = auth.user; | |
| 37 | const user = userOf(principalOf(auth)); | |
| 37 | 38 | if (user === undefined) return "anon"; |
| 38 | 39 | if (user.kind === "agent") return "agent"; |
| 39 | 40 | return user.isAdmin ? "admin" : "user"; |
src/tui/forge_parts.ts +1 −1
| @@ -848,7 +848,7 @@ export function forgeCommands(session: Session): (ctx: Ctx) => Command[] { | ||
| 848 | 848 | */ |
| 849 | 849 | export function forgeSearch(session: Session): (ctx: Ctx) => PaletteSearch { |
| 850 | 850 | return (ctx) => async (query, live, signal) => { |
| 851 | // A guest is a stranger with a key: its search greps code under the same | |
| 851 | // A visitor is a stranger with a key: its search greps code under the same | |
| 852 | 852 | // limits as the page's and the API's (`http/strangers.ts`), counted |
| 853 | 853 | // under its peer address. Refused, everything but the code is searched. |
| 854 | 854 | // A one-letter query greps nothing (#11120), so it takes no slot either. |
src/tui/main.ts +1 −1
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | * The local dev runner: the same terminal UI, over stdio, against a data |
| 3 | 3 | * directory on this machine. |
| 4 | 4 | * |
| 5 | * bun run src/tui/main.ts # as a guest | |
| 5 | * bun run src/tui/main.ts # as a visitor | |
| 6 | 6 | * bun run src/tui/main.ts --user alice # as alice |
| 7 | 7 | * FORGE_DATA=./data bun run src/tui/main.ts |
| 8 | 8 | * |
src/tui/screens/api.ts +3 −2
| @@ -40,7 +40,7 @@ export interface Answer { | ||
| 40 | 40 | readonly body: string; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | /** GET `path` through the forge's router as this session's person (a guest: anonymously). */ | |
| 43 | /** GET `path` through the forge's router as this session's person (a visitor: anonymously). */ | |
| 44 | 44 | export async function runGet(f: Session, path: string): Promise<Answer> { |
| 45 | 45 | const { forgeHttp } = await import("../../http/server.ts"); |
| 46 | 46 | const http = forgeHttp(f.app); |
| @@ -94,7 +94,8 @@ function answerScreen(ctx: Ctx, op: Operation, answer: Answer): Screen { | ||
| 94 | 94 | export function apiScreen(f: Session, ctx: Ctx): Screen { |
| 95 | 95 | const state = new ListState(); |
| 96 | 96 | const filter = new Filter(); |
| 97 | // The rows this person may call, as the page cuts them: a guest reads the anonymous ones (#11286). | |
| 97 | // The rows this person may call, as the page cuts them: a visitor reads the anonymous ones | |
| 98 | // (#11286). | |
| 98 | 99 | const doc = openapiText(f.app.config.url ?? "http://localhost", announcedOr(), roleOf(f)); |
| 99 | 100 | const all = apiOperations(reference(JSON.parse(doc.text))); |
| 100 | 101 | const shown = (): Operation[] => apiOperations(narrow([{ name: "", operations: all }], filter.query)).slice(0, MAX_SHOWN); |
src/tui/screens/bets.ts +2 −2
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | * `c` cuts, `e` ends a stopped bet as done, `l` writes what is left, `d` says |
| 6 | 6 | * it feels done and `n` not yet. All of it goes through `actions/bets.ts`, so |
| 7 | 7 | * who may act, the rules and the events web pages follow are the same; an |
| 8 | * agent, a guest or a reader without admin sees nothing and does nothing. | |
| 8 | * agent, a visitor or a reader without admin sees nothing and does nothing. | |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | import { backBet, betEstimate, capBet, endBet, giveVerdict, proposeBets, stopBet, writeLeft, type BetError } from "../../actions/bets.ts"; |
| @@ -30,7 +30,7 @@ interface Line { | ||
| 30 | 30 | readonly bet: Bet; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | /** The repositories this session's person administers; none for a guest or an agent. */ | |
| 33 | /** The repositories this session's person administers; none for a visitor or an agent. */ | |
| 34 | 34 | function administered(f: Session): Repo[] { |
| 35 | 35 | const user = f.user; |
| 36 | 36 | if (user === undefined || user.kind === "agent") return []; |
src/tui/screens/bugs.ts +1 −1
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | * Bugs on a clock in the terminal (#8709): the figure home's Open bugs tile |
| 3 | 3 | * shows and the bug_clock alarm, from `flow/bugs.ts`. Gated as the page is: |
| 4 | 4 | * the count is a person-admin's (the tile counts every repository), and any |
| 5 | * other reader, an agent or a guest included, sees only the alarm cut to | |
| 5 | * other reader, an agent or a visitor included, sees only the alarm cut to | |
| 6 | 6 | * public repositories (`publicOnly`). Read-only; Esc closes it. |
| 7 | 7 | */ |
| 8 | 8 |
src/tui/screens/changelog.ts +1 −1
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * The changelog, the terminal's /changelog: the same `forgeChangelog` read the |
| 3 | * page makes, for anyone, a guest included. Each release is a row: version, | |
| 3 | * page makes, for anyone, a visitor included. Each release is a row: version, | |
| 4 | 4 | * date and the pulls it carried. `/` narrows them by a word of the version or a |
| 5 | 5 | * pull title; Enter lists a release's pulls, and Enter on a pull opens it. `w` reads it by wave, as |
| 6 | 6 | * the page's link does: Enter on a wave opens its changes, Enter on a change opens its pull, and |
src/tui/screens/dashboard.ts +4 −4
| @@ -1,11 +1,11 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * The first thing a session shows, a short launcher: your repositories (and, |
| 3 | 3 | * as you type, every repository you can see), what is on you, what is on |
| 4 | * your machine, and — for a guest — the way in. Enter opens one in the | |
| 4 | * your machine, and — for a visitor — the way in. Enter opens one in the | |
| 5 | 5 | * workspace or the review; what happened, and other people's pages, are the |
| 6 | 6 | * web's feed and explorer (#636). |
| 7 | 7 | * |
| 8 | * A guest is not a degraded user. They get the same list, filtered to what is | |
| 8 | * A visitor is not a degraded user. They get the same list, filtered to what is | |
| 9 | 9 | * public by exactly the helpers the web and the API use, plus one extra row |
| 10 | 10 | * telling them how to become someone. |
| 11 | 11 | * |
| @@ -313,7 +313,7 @@ export function dashboardScreen(f: Session, ctx: Ctx): Screen { | ||
| 313 | 313 | let firstTell = false; |
| 314 | 314 | /** |
| 315 | 315 | * "Started from <template>", the web home's muted line (#13322); null for a forge with no |
| 316 | * template or a guest. | |
| 316 | * template or a visitor. | |
| 317 | 317 | */ |
| 318 | 318 | let startedFrom: string | null = null; |
| 319 | 319 | /** The first week's three steps as one line (`core/first_week.ts`); null when none are due. */ |
| @@ -1262,7 +1262,7 @@ export function dashboardScreen(f: Session, ctx: Ctx): Screen { | ||
| 1262 | 1262 | }; |
| 1263 | 1263 | |
| 1264 | 1264 | const screen: Screen = { |
| 1265 | title: f.user ? f.user.username : "Guest", | |
| 1265 | title: f.user ? f.user.username : "Visitor", | |
| 1266 | 1266 | get keys() { |
| 1267 | 1267 | return [ |
| 1268 | 1268 | binding(["tab"], "next pane", { disabled: panes().length < 2 }), |
src/tui/screens/data.ts +1 −1
| @@ -370,7 +370,7 @@ export function dataScreen(session: Session, ctx: Ctx): Screen { | ||
| 370 | 370 | }; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | /** Offered to an admin and to an app's writers; a reader and a guest see nothing. */ | |
| 373 | /** Offered to an admin and to an app's writers; a reader and a visitor see nothing. */ | |
| 374 | 374 | export const dataCommand = (session: Session, ctx: Ctx) => |
| 375 | 375 | maySeeData(session.app.db, session.user) |
| 376 | 376 | ? [ |
src/tui/screens/decider.ts +1 −1
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | * What the decider did today, in the terminal: the board's Today line and the |
| 3 | 3 | * rows behind each count, from the same `deciderCounts` and `listDeciderPile` |
| 4 | 4 | * reads. Only repositories this person holds owner facts for are counted — |
| 5 | * the board's own gate — so a guest or a reader sees nothing. | |
| 5 | * the board's own gate — so a visitor or a reader sees nothing. | |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | import type { Database } from "bun:sqlite"; |
src/tui/screens/deploys.ts +1 −1
| @@ -15,7 +15,7 @@ | ||
| 15 | 15 | * preview opens that pull's screen. An app with none says `No previews.`. |
| 16 | 16 | * |
| 17 | 17 | * Below those, a signed-in viewer sees the app's open pulls, one line |
| 18 | * each: `#N title · check <word> · <preview address or none>`. A guest sees | |
| 18 | * each: `#N title · check <word> · <preview address or none>`. A visitor sees | |
| 19 | 19 | * none. |
| 20 | 20 | * |
| 21 | 21 | * Until production first runs, the head carries one line of where the app |
src/tui/screens/docs.ts +1 −1
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * The forge's documentation, the terminal's /docs: what the page does. The |
| 3 | 3 | * guide first, in its order, then the reference; "Search the docs" first of |
| 4 | * all, which also reaches the notes under features/. For anyone, a guest | |
| 4 | * all, which also reaches the notes under features/. For anyone, a visitor | |
| 5 | 5 | * included. Enter reads a document, rendered as markdown, scrolled with j and k. |
| 6 | 6 | */ |
| 7 | 7 |
src/tui/screens/family.ts +1 −1
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * The family across forges (#425) in a card: the same lines as /family, from |
| 3 | * the same view, so the gate (guests see the parent, admins also the | |
| 3 | * the same view, so the gate (visitors see the parent, admins also the | |
| 4 | 4 | * children) is `spawn/family.ts`'s and not this screen's. |
| 5 | 5 | */ |
| 6 | 6 |
src/tui/screens/featurefeed.ts +1 −1
| @@ -24,7 +24,7 @@ import type { PaletteEntry } from "./entries.ts"; | ||
| 24 | 24 | |
| 25 | 25 | const oneLine = (text: string): string => text.replace(/[\p{Cc}\p{Cf}\u2028\u2029]/gu, " "); |
| 26 | 26 | |
| 27 | /** One feature's items. A feature that cannot be read, or a guest, has none. */ | |
| 27 | /** One feature's items. A feature that cannot be read, or a visitor, has none. */ | |
| 28 | 28 | export function featureFeedScreen(f: Session, ctx: Ctx, feature: NavFeature): Screen { |
| 29 | 29 | const state = new ListState(); |
| 30 | 30 | let items: readonly FeedItem[] = []; |
src/tui/screens/findings.ts +1 −1
| @@ -3,7 +3,7 @@ | ||
| 3 | 3 | * reads — `listFindings`, `lastScan` — newest open first, never the matched |
| 4 | 4 | * text. `a` on an open finding asks why it may stand and accepts it through |
| 5 | 5 | * `acceptFinding`, the action the page's form calls, so the same people are |
| 6 | * refused (agents, readers, guests) and the acceptance shows on the page. | |
| 6 | * refused (agents, readers, visitors) and the acceptance shows on the page. | |
| 7 | 7 | * Access is read at every draw: a person who cannot read sees nothing. |
| 8 | 8 | */ |
| 9 | 9 |
src/tui/screens/fleet.ts +1 −1
| @@ -103,7 +103,7 @@ export function planLines(plan: Plan, width: number, most = 12): string[] { | ||
| 103 | 103 | return plan.rows.length > most ? [...rows, `and ${plan.rows.length - most} more`] : rows; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | /** A person (not a guest, not an agent) may act, as on the page. */ | |
| 106 | /** A person (not a visitor, not an agent) may act, as on the page. */ | |
| 107 | 107 | export const mayAct = (user: Session["user"]): boolean => user !== undefined && user.kind !== "agent"; |
| 108 | 108 | |
| 109 | 109 | /** The screen, and the prompt that writes its query line. */ |
src/tui/screens/forge_usage.ts +1 −1
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | * Forge-wide spend in the terminal, as `GET /api/v1/usage` and MCP `usage` |
| 3 | 3 | * without a repo answer it (`readForgeUsage`): today (since 00:00 UTC) and |
| 4 | 4 | * the rolling last 24 hours named apart, then one row per subscription with |
| 5 | * each window's headroom. The gate is theirs: a guest sees nothing, a writer | |
| 5 | * each window's headroom. The gate is theirs: a visitor sees nothing, a writer | |
| 6 | 6 | * their own apps, an admin all. Read once when the screen opens. |
| 7 | 7 | */ |
| 8 | 8 |
src/tui/screens/forgename.ts +1 −1
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * "Is a forge name free?" in the terminal: type a name and be told whether |
| 3 | 3 | * Start my forge would take it, by the same `forgeNameVerdict` as |
| 4 | * `GET /forges/name/<name>`. Offered to a guest, beside Start my forge. | |
| 4 | * `GET /forges/name/<name>`. Offered to a visitor, beside Start my forge. | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | import { forgeNameVerdict } from "../../actions/spawn.ts"; |
src/tui/screens/forges.ts +1 −1
| @@ -55,7 +55,7 @@ export function forgeLines(rows: readonly ClientRow[], sender = false, now = Dat | ||
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * The row's one last-activity phrase: the sender reads the page's words unless the seen line |
| 58 | * already says it; a guest, who never gets the seen line, keeps the older "a person last did | |
| 58 | * already says it; a visitor, who never gets the seen line, keeps the older "a person last did | |
| 59 | 59 | * something". |
| 60 | 60 | */ |
| 61 | 61 | function activityPiece(r: ClientRow, sender: boolean, now: number): string | null { |
src/tui/screens/frontms.ts +1 −1
| @@ -3,7 +3,7 @@ | ||
| 3 | 3 | * milestones, each with how far it is, what landed in 7 days and its |
| 4 | 4 | * estimate. The same read as the home's lines (`biggestMilestones` over |
| 5 | 5 | * `frontApps`): a signed-in person's own apps', and no spend, which is the |
| 6 | * owner's and has its own page. A guest is not offered it, as a signed-out | |
| 6 | * owner's and has its own page. A visitor is not offered it, as a signed-out | |
| 7 | 7 | * visitor's home has no milestone lines. Enter opens the milestone on the web. |
| 8 | 8 | */ |
| 9 | 9 |
src/tui/screens/getforge.ts +2 −2
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * "Get your own forge" in the terminal: the home page's `#yours` for anyone, |
| 3 | * guests included. Every plan with its price, what it is, its buy link when | |
| 3 | * visitors included. Every plan with its price, what it is, its buy link when | |
| 4 | 4 | * one is set, then where to get a hosted forge and how to run one yourself. |
| 5 | 5 | * The words are `billing/plan_words.ts`, the same the web row prints; the |
| 6 | 6 | * settings are read in one statement as the home reads them. |
| @@ -71,7 +71,7 @@ export function getForgeScreen(session: Session, ctx: Ctx): Screen { | ||
| 71 | 71 | }; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | /** Offered to everyone, guests included, as the packs command is. */ | |
| 74 | /** Offered to everyone, visitors included, as the packs command is. */ | |
| 75 | 75 | export const getForgeCommand = (session: Session, ctx: Ctx) => ({ |
| 76 | 76 | id: "get-a-forge", |
| 77 | 77 | title: "Get your own forge", |
src/tui/screens/health_voice.ts +1 −1
| @@ -29,7 +29,7 @@ export function healthVoiceScreen(f: Session, ctx: Ctx): Screen { | ||
| 29 | 29 | }; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | /** The palette entry: offered to every reader, guests too. */ | |
| 32 | /** The palette entry: offered to every reader, visitors too. */ | |
| 33 | 33 | export const entry: PaletteEntry = { |
| 34 | 34 | rank: 120, |
| 35 | 35 | id: "health-voice", |
src/tui/screens/iterations.ts +1 −1
| @@ -3,7 +3,7 @@ | ||
| 3 | 3 | * web page draws them (`iterationsOf`, `lanesOf`), as an indented list — a run |
| 4 | 4 | * under the build it grew from, its builds beneath. Read-only. Offered to, and |
| 5 | 5 | * read for, only someone who may read the repository; the family is what that |
| 6 | * viewer may read of it (`canRead`, `visibleForks`), so a guest sees nothing | |
| 6 | * viewer may read of it (`canRead`, `visibleForks`), so a visitor sees nothing | |
| 7 | 7 | * private. |
| 8 | 8 | */ |
| 9 | 9 |
src/tui/screens/limbs.ts +1 −1
| @@ -7,7 +7,7 @@ | ||
| 7 | 7 | * regretted) `undoFleetOp` — the fleet operation the page and the API use, |
| 8 | 8 | * verb `place`. What the screen decides is only what to draw and which keys |
| 9 | 9 | * exist; the action decides who may. A reader sees the order and no keys to |
| 10 | * change it, an agent likewise, and a guest sees what `canRead` lets the web | |
| 10 | * change it, an agent likewise, and a visitor sees what `canRead` lets the web | |
| 11 | 11 | * show — the plan is read without the owner's spend. Whoever may see owner |
| 12 | 12 | * facts (`canSeeOwnerFacts`, as on the page) also gets, under the list, what |
| 13 | 13 | * the limb under the cursor cost and landed, and its costliest issues. |
src/tui/screens/madefrom.ts +1 −1
| @@ -23,7 +23,7 @@ export function madeFromScreen(f: Session, ctx: Ctx): Screen { | ||
| 23 | 23 | title: "Started from", |
| 24 | 24 | keys: [], |
| 25 | 25 | render(area, s) { |
| 26 | // The settings page's identity: a guest is told nothing (a template may be private). | |
| 26 | // The settings page's identity: a visitor is told nothing (a template may be private). | |
| 27 | 27 | const text = !f.signedIn |
| 28 | 28 | ? "Sign in to see what this forge was made from." |
| 29 | 29 | : (madeFromScreenLine(f.app.config.dataDir) ?? "This forge was made from no template repository."); |
src/tui/screens/mesh_edit.ts +3 −3
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * Scale, move or turn an STL, in the terminal: the same action as the file page's form |
| 3 | * (`actions/mesh_edit.ts`), so the same gate (a writer only; a reader or guest is offered nothing), | |
| 4 | * the same bounds, the same commit message and the same protected-branch rule. The write goes | |
| 5 | * through `editFiles`, which announces a push, so an open web page of the file follows. | |
| 3 | * (`actions/mesh_edit.ts`), so the same gate (a writer only; a reader or visitor is offered | |
| 4 | * nothing), the same bounds, the same commit message and the same protected-branch rule. The write | |
| 5 | * goes through `editFiles`, which announces a push, so an open web page of the file follows. | |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | import { requireWriter } from "../../actions/access.ts"; |
src/tui/screens/next.ts +1 −1
| @@ -3,7 +3,7 @@ | ||
| 3 | 3 | * door and not a second implementation. A move is `rankIssue`, the action the |
| 4 | 4 | * page and MCP `next_up` reach, so who may move what is decided there: a |
| 5 | 5 | * reader sees the order and no keys to change it, an agent likewise, and a |
| 6 | * guest sees what `canRead` lets the web show, sealed issues left to the same | |
| 6 | * visitor sees what `canRead` lets the web show, sealed issues left to the same | |
| 7 | 7 | * scope the page uses. `t` puts the issue under the cursor on top, `u` and |
| 8 | 8 | * `d` move it a place, `x` ticks a row, `s` snoozes the ticked rows a day and `z` takes |
| 9 | 9 | * that batch back (the page's tick boxes and Undo, #15835), `n` puts it behind the Later gate; each |
src/tui/screens/notes.ts +2 −2
| @@ -3,8 +3,8 @@ | ||
| 3 | 3 | * the terminal's door to what the button does on an app's page, with the |
| 4 | 4 | * page's gating. A signed-in person who reads the repository may send a note |
| 5 | 5 | * and see their own with its status; the repository's admin sees every |
| 6 | * sender's and may hide a note or ban its sender, see the banned senders and unban them. A repository that is not | |
| 7 | * an app, or a guest, gets no rows. | |
| 6 | * sender's and may hide a note or ban its sender, see the banned senders and unban them. A | |
| 7 | * repository that is not an app, or a visitor, gets no rows. | |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | import { moderateNote, notesFor, ownerNotes, sendNote, unbanSender, type Sender } from "../../actions/app_notes.ts"; |
src/tui/screens/oauthgrants.ts +1 −1
| @@ -3,7 +3,7 @@ | ||
| 3 | 3 | * gave, with its client, scopes, when it was granted and last used, as the |
| 4 | 4 | * page lists it. `x` revokes the selected one after a confirm, through |
| 5 | 5 | * `revokeOAuthGrant` (the page's action and gate: your own grants only) and |
| 6 | * says the page's receipt. An agent and a guest see nothing to revoke. | |
| 6 | * says the page's receipt. An agent and a visitor see nothing to revoke. | |
| 7 | 7 | */ |
| 8 | 8 | import { myOAuthGrants, myReusedGrants, revokeOAuthGrant, revokedWords } from "../../actions/oauth_grants.ts"; |
| 9 | 9 | import type { OAuthGrant } from "../../core/oauth_grants.ts"; |
src/tui/screens/originahead.ts +1 −1
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | * New commits upstream, in the terminal: the mirrors whose origin has moved |
| 3 | 3 | * on, as the repository head shows them on the web ("N new commits upstream"). |
| 4 | 4 | * `t` takes them through `takeFromOrigin`, the page's own action, offered only |
| 5 | * to a person who may write the repository. A reader sees the count; a guest | |
| 5 | * to a person who may write the repository. A reader sees the count; a visitor | |
| 6 | 6 | * sees only what is public. |
| 7 | 7 | */ |
| 8 | 8 |
src/tui/screens/payments.ts +2 −2
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * The owner's payments in the terminal (#13093): the same rows as `/settings/payments`, from the |
| 3 | * same `paymentsFor`, so the gate is the page's: only the forges this person claimed, a guest sees | |
| 4 | * nothing. Status word first, then date, amount and the forge's plan now. | |
| 3 | * same `paymentsFor`, so the gate is the page's: only the forges this person claimed, a visitor | |
| 4 | * sees nothing. Status word first, then date, amount and the forge's plan now. | |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | 7 | import { paymentsFor, PAYMENTS_CAP } from "../../actions/forge_bill.ts"; |
src/tui/screens/pricing.ts +2 −1
| @@ -237,7 +237,8 @@ export function pricingScreen(f: Session, ctx: Ctx): Screen { | ||
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
| 240 | * Offered to everyone: the sale is open to a guest and to a signed-in person alike, as on the web. | |
| 240 | * Offered to everyone: the sale is open to a visitor and to a signed-in person alike, as on the | |
| 241 | * web. | |
| 241 | 242 | */ |
| 242 | 243 | export const pricingCommand = (session: Session, ctx: Ctx) => ({ |
| 243 | 244 | id: "pricing", |
src/tui/screens/roadmap.ts +1 −1
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * The roadmap in the terminal (#10303): the same model the map page, the API |
| 3 | 3 | * and the MCP read (`web/roadmap.ts`), as scrolling text lines. The reader is |
| 4 | * the session's person, so a guest sees what is public and only a writer | |
| 4 | * the session's person, so a visitor sees what is public and only a writer | |
| 5 | 5 | * gets Needs you. |
| 6 | 6 | */ |
| 7 | 7 |
src/tui/screens/signin.ts +2 −2
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /** |
| 2 | * Becoming someone. A guest is already connected — this screen proves a | |
| 2 | * Becoming someone. A visitor is already connected — this screen proves a | |
| 3 | 3 | * password and links the key they arrived on to the account, after which the |
| 4 | 4 | * same connection is that user. No reconnect, and no impersonation: the only |
| 5 | 5 | * account a session can take on is one whose password was just verified. |
| @@ -59,7 +59,7 @@ const edgeSignupMessage = (f: Session): string => | ||
| 59 | 59 | ? "Sign up on the web page only." |
| 60 | 60 | : `Sign up on the web page only: ${f.app.config.url}/signup`; |
| 61 | 61 | |
| 62 | /** Where a stranger who cannot sign up here goes: the guest menu's own command. */ | |
| 62 | /** Where a stranger who cannot sign up here goes: the visitor menu's own command. */ | |
| 63 | 63 | const GET_FORGE_HINT = "To get a forge of your own, press Esc and choose Start my forge."; |
| 64 | 64 | |
| 65 | 65 | /** What a closed sign-up says outside an edge: the refusal, then where to go instead. */ |
src/tui/screens/signins.ts +3 −3
| @@ -60,7 +60,7 @@ interface SignIn { | ||
| 60 | 60 | /** The tail of an id: two browsers signed in the same day still read apart. */ |
| 61 | 61 | const shortId = (id: string): string => id.slice(-6).toLowerCase(); |
| 62 | 62 | |
| 63 | /** The rows, this terminal first; empty for a guest. */ | |
| 63 | /** The rows, this terminal first; empty for a visitor. */ | |
| 64 | 64 | export function signInsOf(f: Session): SignIn[] { |
| 65 | 65 | const user = f.user; |
| 66 | 66 | if (user === undefined) return []; |
| @@ -297,7 +297,7 @@ export function signInsScreen(f: Session, ctx: Ctx): Screen { | ||
| 297 | 297 | |
| 298 | 298 | const make = (): void => { |
| 299 | 299 | const user = f.user; |
| 300 | // An agent holds no keys to mint with; a guest has no account. | |
| 300 | // An agent holds no keys to mint with; a visitor has no account. | |
| 301 | 301 | if (user === undefined || user.kind === "agent") return; |
| 302 | 302 | ctx.push(askName(user.isAdmin)); |
| 303 | 303 | }; |
| @@ -346,7 +346,7 @@ export function signInsScreen(f: Session, ctx: Ctx): Screen { | ||
| 346 | 346 | |
| 347 | 347 | const rotate = (): void => { |
| 348 | 348 | const user = f.user; |
| 349 | // An agent signs in with a key, not a password; a guest has no account. | |
| 349 | // An agent signs in with a key, not a password; a visitor has no account. | |
| 350 | 350 | if (user === undefined || user.kind === "agent") return; |
| 351 | 351 | ctx.push(askCurrent()); |
| 352 | 352 | }; |
src/tui/screens/space.ts +1 −1
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * The space in the terminal (#10444): the plane the page draws, as text. The |
| 3 | * same `spaceOf` the page and `space.json` read, so a guest sees what is | |
| 3 | * same `spaceOf` the page and `space.json` read, so a visitor sees what is | |
| 4 | 4 | * public and an admin everything. Per pillar: its counts, its issues by state, |
| 5 | 5 | * then who of the crew is on what, and the week's landings. |
| 6 | 6 | */ |
src/tui/screens/startforge.ts +3 −3
| @@ -1,11 +1,11 @@ | ||
| 1 | 1 | /** |
| 2 | * "Start my forge" in the terminal: the home page's start form for a guest. | |
| 2 | * "Start my forge" in the terminal: the home page's start form for a visitor. | |
| 3 | 3 | * One field, the name; **Enter** goes through `spawnDoor` as a stranger, as |
| 4 | 4 | * `POST /forges/start` does, so the free plan, the name rules and the visitor |
| 5 | 5 | * limits are the door's (counted under the SSH client's address). A refusal is |
| 6 | 6 | * one of the fixed sentences the home page shows (`web/start_refusal.ts`); a |
| 7 | 7 | * made forge's claim link is shown once and kept nowhere. Signed in, "New |
| 8 | * forge" is the fuller form, so this command is a guest's. | |
| 8 | * forge" is the fuller form, so this command is a visitor's. | |
| 9 | 9 | * Each name is sent with a resume key this SSH session keeps (#15126), so a |
| 10 | 10 | * start cut off before the forge is made is finished by pressing Enter again |
| 11 | 11 | * in the same session, and by nobody else. The key is never shown; a session |
| @@ -139,7 +139,7 @@ export function startForgeScreen(f: Session, ctx: Ctx): Screen { | ||
| 139 | 139 | }; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | /** A guest's: a signed-in person has "New forge". */ | |
| 142 | /** A visitor's: a signed-in person has "New forge". */ | |
| 143 | 143 | export const startForgeCommand = (session: Session, ctx: Ctx) => |
| 144 | 144 | session.signedIn |
| 145 | 145 | ? [] |
src/tui/screens/subtitle_shift.ts +1 −1
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * Shift a subtitle file's cues, in the terminal: the same action as the file |
| 3 | 3 | * page's form (`actions/subtitle_shift.ts`), so the same gate (a writer only; |
| 4 | * a reader or guest is offered nothing), the same range and the same commit | |
| 4 | * a reader or visitor is offered nothing), the same range and the same commit | |
| 5 | 5 | * message. The action writes through `editFiles`, which announces a push on |
| 6 | 6 | * the bus, so an open web page of the file follows. |
| 7 | 7 | */ |
src/tui/screens/templates.ts +1 −1
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * `/templates` in the terminal: what a new forge starts from, from the page's own list |
| 3 | * (`templateList`). Enter on a row opens New forge with that template chosen; a guest reads | |
| 3 | * (`templateList`). Enter on a row opens New forge with that template chosen; a visitor reads | |
| 4 | 4 | * the list and is told the form is for people signed in. |
| 5 | 5 | */ |
| 6 | 6 |
src/tui/screens/thoughtnotes.ts +2 −2
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | * the list is the signed-in person's own `thoughtStream` with `noteLine`'s |
| 5 | 5 | * one-line state, and `b` takes the tap the line offers (`overruleNote`, which |
| 6 | 6 | * refuses what the line does not offer). Everything is the person's own: a |
| 7 | * guest has nothing, and the palette offers the screen only when signed in. | |
| 7 | * visitor has nothing, and the palette offers the screen only when signed in. | |
| 8 | 8 | * A note written here shows live on the page, being the same row. |
| 9 | 9 | */ |
| 10 | 10 | |
| @@ -39,7 +39,7 @@ export interface NoteRow extends ListRow { | ||
| 39 | 39 | readonly overrule: "build" | "decline" | null; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | /** The viewer's notes as rows; a guest has none. */ | |
| 42 | /** The viewer's notes as rows; a visitor has none. */ | |
| 43 | 43 | export function noteRows(db: Database, viewer: User | undefined): NoteRow[] { |
| 44 | 44 | if (viewer === undefined) return []; |
| 45 | 45 | return thoughtStream(db, viewer, { limit: SHOWN }).map((n) => { |
src/tui/session.ts +3 −3
| @@ -3,7 +3,7 @@ | ||
| 3 | 3 | * every screen needs from the forge. |
| 4 | 4 | * |
| 5 | 5 | * The identity rule: a session acts as the account its *key* maps to, and |
| 6 | * nothing else. `authorize` lets every well-formed key in — a guest browses | |
| 6 | * nothing else. `authorize` lets every well-formed key in — a visitor browses | |
| 7 | 7 | * public repos exactly as an anonymous web visitor does — and signing in is |
| 8 | 8 | * the act of proving a password and *linking* this key to that account, after |
| 9 | 9 | * which the same connection is that user. There is no impersonation path |
| @@ -34,7 +34,7 @@ export interface TuiIdentity { | ||
| 34 | 34 | readonly publicKey?: string | undefined; |
| 35 | 35 | /** The registered key row this session matched, when it matched one. */ |
| 36 | 36 | readonly keyId?: string | undefined; |
| 37 | /** The account the key resolved to. Absent means a guest. */ | |
| 37 | /** The account the key resolved to. Absent means a visitor. */ | |
| 38 | 38 | readonly user?: User | undefined; |
| 39 | 39 | } |
| 40 | 40 | |
| @@ -95,7 +95,7 @@ export class Session { | ||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | * The two terminal preferences, as stored. A guest has none and gets | |
| 98 | * The two terminal preferences, as stored. A visitor has none and gets | |
| 99 | 99 | * `auto` for both — the settings exist to override a guess, never to |
| 100 | 100 | * enable the feature. |
| 101 | 101 | */ |
src/tui/ssh-guest-rate.ts +4 −4
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | /** |
| 2 | * A rate on what a guest (a key with no account) may say over ssh: `tell` and | |
| 3 | * `talk` each start work, and a key costs a guest nothing to make, so the | |
| 4 | * limit is on the address beside the key, with a cap on all guests together. | |
| 2 | * A rate on what a visitor (a key with no account) may say over ssh: `tell` and | |
| 3 | * `talk` each start work, and a key costs a visitor nothing to make, so the | |
| 4 | * limit is on the address beside the key, with a cap on all visitors together. | |
| 5 | 5 | * The address is the TCP peer's (a proxy's, when one fronts the port). |
| 6 | 6 | * Pure: the clock is passed in. |
| 7 | 7 | */ |
| @@ -10,7 +10,7 @@ export const GUEST_SAYS_PER_WINDOW = 5; | ||
| 10 | 10 | export const GUEST_SAYS_ALL_PER_WINDOW = 60; |
| 11 | 11 | export const GUEST_WINDOW_MS = 60_000; |
| 12 | 12 | |
| 13 | export const GUEST_RATE_WORDS = "slow down — a guest may tell or talk only a few times a minute; sign in to lift that"; | |
| 13 | export const GUEST_RATE_WORDS = "slow down — a visitor may tell or talk only a few times a minute; sign in to lift that"; | |
| 14 | 14 | |
| 15 | 15 | export class GuestRate { |
| 16 | 16 | private all: number[] = []; |
src/tui/ssh-tell.ts +1 −1
| @@ -25,7 +25,7 @@ import { crewCanRun } from "../web/studio/crew_key.ts"; | ||
| 25 | 25 | |
| 26 | 26 | const CRLF = "\r\n"; |
| 27 | 27 | |
| 28 | /** What an unknown key is told: it is a guest, and a guest tells nothing. */ | |
| 28 | /** What an unknown key is told: it is a visitor, and a visitor tells nothing. */ | |
| 29 | 29 | export const ACCOUNT_NEEDED_WORDS = |
| 30 | 30 | "telling the crew needs an account — sign in on the web and add this key under Settings → Keys"; |
| 31 | 31 |
src/tui/ssh.ts +6 −6
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | * |
| 6 | 6 | * The identity rule (see `session.ts`): `authorize` admits every well-formed |
| 7 | 7 | * key, and what that key *is* decides who the session acts as. An unknown key |
| 8 | * is a guest — public repos only, and a "Sign in" screen that links the key | |
| 8 | * is a visitor — public repos only, and a "Sign in" screen that links the key | |
| 9 | 9 | * on success. Nothing here can act as a user the presented key does not map |
| 10 | 10 | * to. |
| 11 | 11 | */ |
| @@ -187,12 +187,12 @@ export async function attachTui( | ||
| 187 | 187 | asPerson(() => app.start()); |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | /** Resolve the account a presented key belongs to, or a guest. */ | |
| 190 | /** Resolve the account a presented key belongs to, or a visitor. */ | |
| 191 | 191 | export function identityFor(forge: Forge, session: SshSession): TuiIdentity { |
| 192 | 192 | const match = findKeyByFingerprint(forge.db, session.key.fingerprint); |
| 193 | 193 | const found = |
| 194 | 194 | match === undefined ? undefined : getUserById(forge.db, match.userId); |
| 195 | // A suspended or removed account's key opens nothing: it is a guest. | |
| 195 | // A suspended or removed account's key opens nothing: it is a visitor. | |
| 196 | 196 | const user = found !== undefined && isActive(found) ? found : undefined; |
| 197 | 197 | if (match !== undefined && user !== undefined) |
| 198 | 198 | touchKey(forge.db, match.keyId); |
| @@ -261,7 +261,7 @@ export function forgeSshSession( | ||
| 261 | 261 | ): (session: SshSession) => void { |
| 262 | 262 | let guests = guestRates.get(forge); |
| 263 | 263 | if (guests === undefined) guestRates.set(forge, (guests = new GuestRate())); |
| 264 | // A guest's tell and talk start work; they share one rate (see ssh-guest-rate.ts). | |
| 264 | // A visitor's tell and talk start work; they share one rate (see ssh-guest-rate.ts). | |
| 265 | 265 | const guestLimited = (session: SshSession, user: unknown): boolean => { |
| 266 | 266 | if (user !== undefined) return false; |
| 267 | 267 | if (guests.allow([`key:${session.key.fingerprint}`, `addr:${session.remoteAddress}`], Date.now())) return false; |
| @@ -349,7 +349,7 @@ export function forgeSshSession( | ||
| 349 | 349 | |
| 350 | 350 | /** |
| 351 | 351 | * Git over an exec channel. The access matrix is exactly the HTTP one: |
| 352 | * upload-pack → `canRead`; a guest may read a public repo. | |
| 352 | * upload-pack → `canRead`; a visitor may read a public repo. | |
| 353 | 353 | * receive-pack → a signed-in user with `canWrite`; push-to-create makes a |
| 354 | 354 | * private repo when the target does not exist yet. |
| 355 | 355 | * A repo you cannot see is "not found", the same answer a missing one gets. |
| @@ -509,7 +509,7 @@ export async function serveForgeSsh( | ||
| 509 | 509 | ...(forge.config.selfSwap === true ? { reusePort: true } : {}), |
| 510 | 510 | hostKeyDir: options.hostKeyDir ?? join(forge.config.dataDir, "ssh"), |
| 511 | 511 | log: forge.log, |
| 512 | // Guests are welcome: the key is an identity, not a permit. | |
| 512 | // Visitors are welcome: the key is an identity, not a permit. | |
| 513 | 513 | authorize: () => true, |
| 514 | 514 | onSession: forgeSshSession(forge), |
| 515 | 515 | }); |
src/tui/ui/image.ts +1 −1
| @@ -376,7 +376,7 @@ export interface GraphicsPrefs { | ||
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | /** |
| 379 | * The two stored preferences, read-only. A guest has none and gets `auto`, | |
| 379 | * The two stored preferences, read-only. A visitor has none and gets `auto`, | |
| 380 | 380 | * which is the same answer a signed-in user who never touched settings gets — |
| 381 | 381 | * the setting exists to override a guess, not to enable the feature. |
| 382 | 382 | */ |
src/web/pages/milestones_near.ts +1 −1
| @@ -14,7 +14,7 @@ import { planFor } from "./milestones.ts"; | ||
| 14 | 14 | export type Near = { number: number; name: string; done: number; total: number }; |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | * The open milestones of `slug` ("owner/name"), for `user` (undefined is a guest), with the | |
| 17 | * The open milestones of `slug` ("owner/name"), for `user` (undefined is a visitor), with the | |
| 18 | 18 | * repository read for them. |
| 19 | 19 | */ |
| 20 | 20 | export function nearMilestones(app: App, slug: string | undefined, user: User | undefined): { repo: Repo; near: Near[] } | undefined { |
test/principal.test.ts added +131
| @@ -0,0 +1,131 @@ | ||
| 1 | /** | |
| 2 | * Principal: every way of arriving maps to exactly one kind, and no route's answer depends on it | |
| 3 | * yet. | |
| 4 | */ | |
| 5 | ||
| 6 | import { describe, expect, test } from "bun:test"; | |
| 7 | import { mkdtemp, rm } from "node:fs/promises"; | |
| 8 | import { tmpdir } from "node:os"; | |
| 9 | import { join } from "node:path"; | |
| 10 | import { createApp } from "../src/app.ts"; | |
| 11 | import { principalOf, userOf, type Principal, type Subject } from "../src/core/principal.ts"; | |
| 12 | import { createSession } from "../src/core/sessions.ts"; | |
| 13 | import { createToken } from "../src/core/tokens.ts"; | |
| 14 | import { createUser } from "../src/core/users.ts"; | |
| 15 | import { resolveAuth } from "../src/http/server.ts"; | |
| 16 | import type { Auth } from "../src/http/context.ts"; | |
| 17 | import type { User } from "../src/core/users.ts"; | |
| 18 | ||
| 19 | const person = { id: "u1", username: "ada", kind: "user", isAdmin: false } as User; | |
| 20 | const agent = { id: "u2", username: "mason", kind: "agent", isAdmin: false } as User; | |
| 21 | const token = { user: person, via: "token" as const, tokenId: "t1", tokenName: "ci" }; | |
| 22 | ||
| 23 | const PRINCIPAL_KINDS = [ | |
| 24 | "anonymous", "session", "ro_token", "rw_token", "admin_token", | |
| 25 | "proposal_token", "run_token", "contribute_token", "read_grant_token", "via_token", | |
| 26 | ] as const satisfies readonly Principal["kind"][]; | |
| 27 | ||
| 28 | const ARRIVALS: Record<string, { auth: Auth; kind: Principal["kind"]; subject?: Subject["kind"] }> = { | |
| 29 | "no credential": { auth: { user: undefined, scope: undefined, via: "none" }, kind: "anonymous" }, | |
| 30 | "a credential nothing matched": { auth: { user: undefined, scope: undefined, via: "none", refused: true }, kind: "anonymous" }, | |
| 31 | "a password turned away": { auth: { user: undefined, scope: undefined, via: "none", retryAfter: 30 }, kind: "anonymous" }, | |
| 32 | "a session cookie": { auth: { user: person, scope: "admin", via: "session", sessionId: "s1" }, kind: "session", subject: "person" }, | |
| 33 | "the platform edge": { auth: { user: person, scope: "admin", via: "edge" }, kind: "session", subject: "person" }, | |
| 34 | "the password": { auth: { user: person, scope: "admin", via: "password" }, kind: "session", subject: "person" }, | |
| 35 | "a terminal screen": { auth: { user: person, scope: undefined, via: "none" }, kind: "session", subject: "person" }, | |
| 36 | "an ro token": { auth: { ...token, scope: "ro" }, kind: "ro_token", subject: "person" }, | |
| 37 | "an rw token": { auth: { ...token, scope: "rw" }, kind: "rw_token", subject: "person" }, | |
| 38 | "an admin token": { auth: { ...token, scope: "admin" }, kind: "admin_token", subject: "person" }, | |
| 39 | "a proposal token": { | |
| 40 | auth: { ...token, scope: "rw", proposal: { tokenId: "t1", repoId: "r1", child: "kid", origin: "https://x.test" } }, | |
| 41 | kind: "proposal_token", | |
| 42 | subject: "person", | |
| 43 | }, | |
| 44 | "a run token": { auth: { ...token, user: agent, scope: "rw", run: { repoId: "r1", forkId: "f1" } }, kind: "run_token", subject: "agent" }, | |
| 45 | "a contribute token": { auth: { ...token, scope: "rw", contribute: { tokenId: "t1", repoId: "r1", agent: "mason", namespace: "mason/abc" } }, kind: "contribute_token", subject: "person" }, | |
| 46 | "an app's read grant": { auth: { ...token, scope: "ro", appId: "app1" }, kind: "read_grant_token", subject: "app" }, | |
| 47 | "a via token": { auth: { ...token, user: agent, scope: "rw", through: "conversation:c1" }, kind: "via_token", subject: "agent" }, | |
| 48 | }; | |
| 49 | ||
| 50 | describe("principalOf", () => { | |
| 51 | for (const [name, a] of Object.entries(ARRIVALS)) | |
| 52 | test(`${name} is ${a.kind}`, () => { | |
| 53 | const p = principalOf(a.auth); | |
| 54 | expect(p.kind).toBe(a.kind); | |
| 55 | if (a.subject !== undefined) expect("subject" in p ? p.subject.kind : undefined).toBe(a.subject); | |
| 56 | else expect("subject" in p).toBe(false); | |
| 57 | }); | |
| 58 | ||
| 59 | test("every kind is reached by some arrival, and no arrival is outside the list", () => { | |
| 60 | const seen = new Set(Object.values(ARRIVALS).map((a) => principalOf(a.auth).kind)); | |
| 61 | expect([...seen].sort()).toEqual([...PRINCIPAL_KINDS].sort()); | |
| 62 | }); | |
| 63 | ||
| 64 | test("anonymous is a value that remembers a refusal and a wait", () => { | |
| 65 | expect(principalOf(ARRIVALS["no credential"]!.auth)).toEqual({ kind: "anonymous", refused: false }); | |
| 66 | expect(principalOf(ARRIVALS["a credential nothing matched"]!.auth)).toEqual({ kind: "anonymous", refused: true }); | |
| 67 | expect(principalOf(ARRIVALS["a password turned away"]!.auth)).toMatchObject({ kind: "anonymous", retryAfter: 30 }); | |
| 68 | }); | |
| 69 | ||
| 70 | test("a token keeps its id and name; a session its id", () => { | |
| 71 | expect(principalOf(ARRIVALS["an rw token"]!.auth)).toMatchObject({ tokenId: "t1", tokenName: "ci" }); | |
| 72 | expect(principalOf(ARRIVALS["a session cookie"]!.auth)).toMatchObject({ sessionId: "s1", via: "session" }); | |
| 73 | }); | |
| 74 | ||
| 75 | test("the account behind each arrival is the one Auth held", () => { | |
| 76 | for (const a of Object.values(ARRIVALS)) expect(userOf(principalOf(a.auth))).toBe(a.auth.user); | |
| 77 | }); | |
| 78 | ||
| 79 | test("one Auth with several scopes is the narrowest: proposal, run, contribute, read grant, via, plain", () => { | |
| 80 | const scopes = { | |
| 81 | proposal: { tokenId: "t1", repoId: "r1", child: "kid", origin: "https://x.test" }, | |
| 82 | run: { repoId: "r1", forkId: "f1" }, | |
| 83 | contribute: { tokenId: "t1", repoId: "r1", agent: "mason", namespace: "mason/abc" }, | |
| 84 | appId: "app1", | |
| 85 | through: "conversation:c1", | |
| 86 | }; | |
| 87 | const all = { ...token, scope: "admin" as const, ...scopes }; | |
| 88 | expect(principalOf(all).kind).toBe("proposal_token"); | |
| 89 | const { proposal: _p, ...noProposal } = all; | |
| 90 | expect(principalOf(noProposal).kind).toBe("run_token"); | |
| 91 | const { run: _r, ...noRun } = noProposal; | |
| 92 | expect(principalOf(noRun).kind).toBe("contribute_token"); | |
| 93 | const { contribute: _c, ...noContribute } = noRun; | |
| 94 | expect(principalOf(noContribute).kind).toBe("read_grant_token"); | |
| 95 | const { appId: _a, ...noApp } = noContribute; | |
| 96 | expect(principalOf(noApp).kind).toBe("via_token"); | |
| 97 | const { through: _t, ...plain } = noApp; | |
| 98 | expect(principalOf(plain).kind).toBe("admin_token"); | |
| 99 | }); | |
| 100 | }); | |
| 101 | ||
| 102 | describe("principalOf on what the server builds", () => { | |
| 103 | test("a session, an ro token and no credential", async () => { | |
| 104 | const dir = await mkdtemp(join(tmpdir(), "forge-principal-")); | |
| 105 | const app = createApp({ dataDir: dir, port: 0, url: "https://forge.example" }); | |
| 106 | try { | |
| 107 | const made = await createUser(app.db, { origin: "edge", username: "ada", email: "[email protected]" }); | |
| 108 | if (!made.ok) throw new Error("no user"); | |
| 109 | const ask = (headers: Record<string, string>) => | |
| 110 | resolveAuth(app, new Request("https://forge.example/", { headers })).then(principalOf); | |
| 111 | ||
| 112 | const none = await ask({}); | |
| 113 | expect(none).toEqual({ kind: "anonymous", refused: false }); | |
| 114 | ||
| 115 | const session = createSession(app.db, made.value.id); | |
| 116 | const viaSession = await ask({ cookie: `forge_session=${session.token}` }); | |
| 117 | expect(viaSession.kind).toBe("session"); | |
| 118 | expect(userOf(viaSession)?.id).toBe(made.value.id); | |
| 119 | ||
| 120 | const ro = createToken(app.db, made.value.id, "ci", "ro"); | |
| 121 | const viaToken = await ask({ authorization: `Bearer ${ro.token}` }); | |
| 122 | expect(viaToken).toMatchObject({ kind: "ro_token", tokenId: ro.id, tokenName: "ci" }); | |
| 123 | expect(userOf(viaToken)?.id).toBe(made.value.id); | |
| 124 | ||
| 125 | expect(await ask({ authorization: "Bearer forge_nothing" })).toEqual({ kind: "anonymous", refused: true }); | |
| 126 | } finally { | |
| 127 | app.db.close(); | |
| 128 | await rm(dir, { recursive: true, force: true }); | |
| 129 | } | |
| 130 | }); | |
| 131 | }); |
test/ssh-app.test.ts +4 −4
| @@ -145,12 +145,12 @@ describe.skipIf(NO_OPENSSH)("ssh into the forge", () => { | ||
| 145 | 145 | expect(out).toContain("alice/vault"); |
| 146 | 146 | }); |
| 147 | 147 | |
| 148 | test("an unknown key is a guest, with a way to sign in", async () => { | |
| 148 | test("an unknown key is a visitor, with a way to sign in", async () => { | |
| 149 | 149 | const { out } = await connect(server.port, strangerKey); |
| 150 | // The breadcrumb names the session, and a guest is a guest. | |
| 151 | expect(out).toContain("Guest"); | |
| 150 | // The breadcrumb names the session, and a signed-out key is a visitor. | |
| 151 | expect(out).toContain("Visitor"); | |
| 152 | 152 | expect(out).toContain("alice/lighthouse"); |
| 153 | // A private repo is not in the list a guest was handed. | |
| 153 | // A private repo is not in the list a visitor was handed. | |
| 154 | 154 | expect(out).not.toContain("vault"); |
| 155 | 155 | }); |
| 156 | 156 | }); |
test/tui-changelog-waves.test.ts +2 −2
| @@ -76,8 +76,8 @@ test("w opens the waves, Enter a wave's changes, Enter a change's pull; Esc walk | ||
| 76 | 76 | expect(pull).toContain("Changelog › Waves › 0.2.0 › #1"); |
| 77 | 77 | await settleUntil(tui, "Newer thing"); |
| 78 | 78 | const head = (t: string): string => t.split("\n")[1] ?? ""; |
| 79 | expect(head(await step("\x1b"))).toBe("Guest › Changelog › Waves › 0.2.0"); | |
| 80 | expect(head(await step("\x1b"))).toBe("Guest › Changelog › Waves"); | |
| 79 | expect(head(await step("\x1b"))).toBe("Visitor › Changelog › Waves › 0.2.0"); | |
| 80 | expect(head(await step("\x1b"))).toBe("Visitor › Changelog › Waves"); | |
| 81 | 81 | const back = await step("\x1b"); |
| 82 | 82 | tui.stop?.(); |
| 83 | 83 | expect(back).toBe(list); |
test/tui-screens.test.ts +1 −1
| @@ -654,7 +654,7 @@ describe("a forge with no accounts", () => { | ||
| 654 | 654 | publicKey: KEY_LINE, |
| 655 | 655 | }); |
| 656 | 656 | await h.settle(); |
| 657 | expect(h.text()).toContain("Guest"); | |
| 657 | expect(h.text()).toContain("Visitor"); | |
| 658 | 658 | |
| 659 | 659 | await h.press("s"); |
| 660 | 660 | expect(h.text()).toContain("no accounts yet"); |
test/turnstile.test.ts +2 −2
| @@ -212,11 +212,11 @@ describe("turnstile doors", () => { | ||
| 212 | 212 | await settleApp(tui); |
| 213 | 213 | }; |
| 214 | 214 | await settleApp(tui); |
| 215 | if (!tui.screen.toText().includes("Guest ›")) { | |
| 215 | if (!tui.screen.toText().includes("Visitor ›")) { | |
| 216 | 216 | key("s"); |
| 217 | 217 | await settleApp(tui); |
| 218 | 218 | } |
| 219 | if (tui.screen.toText().includes("Guest › Sign in")) { | |
| 219 | if (tui.screen.toText().includes("Visitor › Sign in")) { | |
| 220 | 220 | key("t", true); |
| 221 | 221 | await settleApp(tui); |
| 222 | 222 | } |
new above
offline
runner, device and game_box are never produced by principalOf: remove until the slice that creates them, with a test.