Public: anyone can read this; the crew can change it.

Access 3, terminal: the palette offers a screen by its `asks` through may(); the entries' own gates go #18431

opened this

Merged 8h 54m ago, live in production

torque/forge:torque/18426-access-3-terminal-the-palette-offers-a-s → main 0 commits fork

  • Merged. torque/18426-access-3-terminal-the-palette-offers-a-s was merged into main as 55693b7.

Review

Sign in to review this change.
171 files changed +384 −339
docs/features/may.md +14 −9
@@ -64,15 +64,20 @@ token is refused (403), a person who is not the admin is told not found and a st
6464 admin's look at `GET /api/v1/places` refreshes a stale catalog only when `may` grants `forge.administer` with the
6565 credential sent.
6666
67 **The terminal's screens ask it.** A palette entry whose gate is the forge's admin names `forge.administer` beside it,
68 and one whose gate is an account names `forge.read` (opening a screen is a read); the palette asks `may` that action as
69 the terminal's account, once a session for each entry and answer, not on every build (`src/tui/screens/entries.ts`, the
70 entry's `asks`). The entry's own gate still decides what the palette offers; where the two part the count's door is
71 `terminal <entry>`. Whether there is anything to show (a file, the forge's own key, runs) is the entry's `shows`, asked
72 first: a screen with nothing to show is not offered and counts nothing. Two partings are expected: signed out, every
73 screen for accounts (as on the web), and an admin agent, on the screens that are a person's. A screen gated on
74 something `may` has no action for (a telemetry role, a subscription, an organization, a game grant) or on nothing names
75 no action and says why beside its gate.
67 **The terminal's screens ask it alone.** A palette entry for the forge's admin names `forge.administer`, and one for
68 any account names `forge.read` (opening a screen is a read); the palette offers it when `may` grants that action to the
69 terminal's account (`src/tui/screens/entries.ts`, the entry's `asks`). The entries' own gates are gone (#18426), and
70 `test/door-inline-checks.test.ts` keeps them gone. Whether there is anything to show (a file, the forge's own key,
71 runs) is the entry's `shows`, asked first. The two partings the shadow expected are decided:
72
73 - **Signed out**, `forge.read` is open to all, yet a signed-out terminal is offered no entry that names an action:
74 it has no account to ask as, and a screen for accounts asks you to sign in, as on the web.
75 - **An admin agent** holds `forge.administer`, yet a screen marked `for: "person"` (billing, people, profile, …) is
76 not offered to it: the screen is a person's work, not a permission the agent lacks. The admin's other screens are.
77
78 Nothing anyone is offered changed: the palette offers just what the old gates did. A screen gated on something `may`
79 has no action for (a telemetry role, a subscription, an organization, a game grant) or on nothing names no action and
80 keeps its own `offered`, with a `// Names no \`asks\`: …` comment beside it saying why.
7681
7782 **The game grants ask it.** A game box's grant checks (the box and server pages, the games MCP tool, the game door's
7883 API, the map, and the terminal's Games screens and keys) go through `mayOnGame` (`src/games/game_may.ts`): the grant still
src/core/access_disagreement.ts +1 −1
@@ -35,7 +35,7 @@ export function noteDisagreement(
3535
3636 /**
3737 * Ask `may` beside `old`, the answer of the check it is replacing, and count a parting under
38 * `door`: what every door in shadow does (the terminal's palette, the game grants). Returns what
38 * `door`: what every door in shadow does (the game grants). Returns what
3939 * `may` said; a door still in shadow keeps its old answer itself.
4040 */
4141 export function askBeside(db: Database, asking: Principal, door: string, action: Action, old: boolean, resource?: Resource): boolean {
src/design/door_checks.ts +32 −5
@@ -6,6 +6,9 @@
66 * finds each line that gates on the account inline: a refusal on `isAdmin` (`!user.isAdmin`,
77 * `isAdmin !== true`, or `isAdmin` in an `if`), a `scopeAllows(…, "rw")` write floor, or a
88 * signed-out test (`!ctx.auth.user`, `ctx.auth.user === undefined` in a condition).
9 * The terminal's palette entries under `src/tui/screens/` offer by `may` too (#18426): there the
10 * gate is an entry's own `offered`, and one is found unless the comment right above it says why
11 * the entry names no action (`// Names no \`asks\`: …`).
912 *
1013 * Only gate shapes count: a role passed on for display (`familyView(app, user.isAdmin === true)`)
1114 * is a read, not a door, and is not matched. `scopeAllows(…, "admin")` is how far a token reaches,
@@ -17,7 +20,7 @@
1720 */
1821 import { tsSources, type Source } from "./ratchets.ts";
1922
20 export type DoorCheck = "isAdmin" | "scopeAllows" | "signedOut";
23 export type DoorCheck = "isAdmin" | "scopeAllows" | "signedOut" | "entryGate";
2124
2225 /** One line found: its file, line number, which check, and the line's trimmed text. */
2326 export interface DoorFound {
@@ -32,12 +35,13 @@ const HELPER: Record<DoorCheck, string> = {
3235 isAdmin: `adminPage(ctx) or personAdminPage(ctx) on a page, holds(db, principalOf(ctx.auth), "forge.administer") on a route`,
3336 scopeAllows: `holds(db, principalOf(ctx.auth), "forge.write") (mayToolWrite in the MCP)`,
3437 signedOut: "signedInPage(ctx)",
38 entryGate: `asks: "forge.administer" or "forge.read" on the entry, with for: "person" for a person's screen`,
3539 };
3640
3741 /** The fix that ends each finding: which helper, or which list line to delete. */
3842 export const DOOR_FIX = {
3943 newLine: (c: DoorCheck): string =>
40 `Fix: ask ${HELPER[c]} (src/http/page_may.ts, src/core/may.ts); never add the line to DOOR_LINES in src/design/door_checks.ts.`,
44 `Fix: ask ${HELPER[c]} (${c === "entryGate" ? "src/tui/screens/entries.ts" : "src/http/page_may.ts, src/core/may.ts"}); never add the line to DOOR_LINES in src/design/door_checks.ts.`,
4145 gone: "Fix: the check is gone, so delete its entry from DOOR_LINES in src/design/door_checks.ts; lowering is the right move.",
4246 } as const;
4347
@@ -49,8 +53,31 @@ const SHAPES: readonly (readonly [DoorCheck, RegExp])[] = [
4953 ["signedOut", /!\s*ctx\.auth\.user\b(?!\s*\??\.)|(?:\bif\s*\(|\|\||&&)\s*ctx\.auth\.user\s*===?\s*(?:undefined|null)\b/],
5054 ];
5155
52 /** Every gate-shaped inline check in one file, a line at a time; comment lines are skipped. */
56 const SCREENS = "src/tui/screens/";
57 const ENTRY_GATE = /^offered\s*[:(]/;
58 const SAYS_WHY = "Names no `asks`";
59
60 /**
61 * Each palette entry's own `offered` in a screen file whose comment block right above does not
62 * say why the entry names no action.
63 */
64 function entryGates(src: Source): DoorFound[] {
65 const lines = src.text.split("\n").map((l) => l.trim());
66 return lines.flatMap((text, i) => {
67 if (!ENTRY_GATE.test(text)) return [];
68 let j = i - 1;
69 while (j >= 0 && lines[j]!.startsWith("//")) j--;
70 const why = lines.slice(j + 1, i).join(" ");
71 return why.includes(SAYS_WHY) ? [] : [{ file: src.path, line: i + 1, check: "entryGate" as const, text }];
72 });
73 }
74
75 /**
76 * Every gate-shaped inline check in one file, a line at a time; comment lines are skipped. A
77 * terminal screen file is read for its entries' gates alone: its screens read the account to draw.
78 */
5379 export function doorChecks(src: Source): DoorFound[] {
80 if (src.path.startsWith(SCREENS)) return entryGates(src);
5481 return src.text.split("\n").flatMap((raw, i) => {
5582 const text = raw.trim();
5683 if (text.startsWith("*") || text.startsWith("//") || text.startsWith("/*")) return [];
@@ -63,12 +90,12 @@ const MOVED = new Set(["src/http/mcp.ts", "src/http/infra_routes.ts"]);
6390
6491 /**
6592 * The files the moved doors live in: repository route modules and the cloud API under
66 * src/http/api, the infrastructure pages, the MCP, and the web pages.
93 * src/http/api, the infrastructure pages, the MCP, the web pages, and the terminal's screens.
6794 */
6895 export function doorSources(root: string): Source[] {
6996 const api = tsSources(root, "src/http/api").filter((f) => f.text.includes("/api/v1/repos/") || f.path === "src/http/api/cloud.ts");
7097 const mcp = tsSources(root, "src/http").filter((f) => MOVED.has(f.path));
71 return [...api, ...mcp, ...tsSources(root, "src/http/mcp"), ...tsSources(root, "src/web/pages")];
98 return [...api, ...mcp, ...tsSources(root, "src/http/mcp"), ...tsSources(root, "src/web/pages"), ...tsSources(root, SCREENS.slice(0, -1))];
7299 }
73100
74101 /** A line that keeps its inline check, by file and exact trimmed text, and why. Only shrinks. */
src/tui/screens/abstractions.ts +2 −2
@@ -4,7 +4,7 @@
44 * Anyone else sees nothing: the gate is the action's.
55 */
66
7 import { listAbstractions, mayReadAtlas } from "../../actions/abstractions.ts";
7 import { listAbstractions } from "../../actions/abstractions.ts";
88 import type { Abstraction } from "../../core/abstractions.ts";
99 import { abstractionFacts, atlasSummary, rowWords } from "../../view/abstraction_words.ts";
1010 import type { Ctx, Screen } from "../app/app.ts";
@@ -60,6 +60,6 @@ export const entry: PaletteEntry = {
6060 title: "Tables",
6161 hint: "the forge's tables: how much each is used, and what builds on what",
6262 asks: "forge.administer",
63 offered: (session) => mayReadAtlas(session.user),
63 for: "person",
6464 run: (session, ctx) => ctx.push(abstractionsScreen(session, ctx)),
6565 };
src/tui/screens/access.ts +1 −1
@@ -121,6 +121,6 @@ export const entry: PaletteEntry = {
121121 hint: "what outside agents tried",
122122 after: ["file-holds"],
123123 asks: "forge.administer",
124 offered: (session) => session.user?.isAdmin === true && session.user.kind !== "agent",
124 for: "person",
125125 run: (session, ctx) => ctx.push(accessScreen(session, ctx)),
126126 };
src/tui/screens/account_access.ts +1 −1
@@ -174,6 +174,6 @@ export const entry: PaletteEntry = {
174174 hint: "search people, reset access, end sessions",
175175 after: ["people"],
176176 asks: "forge.administer",
177 offered: (session) => session.user?.isAdmin === true && session.user.kind === "user",
177 for: "person",
178178 run: (session, ctx) => ctx.push(accountAccessScreen(session, ctx)),
179179 };
src/tui/screens/advisories.ts +1 −1
@@ -74,6 +74,6 @@ export const entry: PaletteEntry = {
7474 hint: "known vulnerabilities in your lockfiles",
7575 after: ["resilience"],
7676 asks: "forge.administer",
77 offered: (session) => session.user?.isAdmin === true && session.user.kind !== "agent",
77 for: "person",
7878 run: openAdvisories,
7979 };
src/tui/screens/agents.ts +1 −1
@@ -157,6 +157,6 @@ export const entry: PaletteEntry = {
157157 hint: "each agent's model, budget and brief",
158158 after: ["teams", "limits", "quotas", "people"],
159159 asks: "forge.administer",
160 offered: (session) => session.user?.isAdmin === true && session.user.kind !== "agent",
160 for: "person",
161161 run: (session, ctx) => ctx.push(agentsScreen(session, ctx)),
162162 };
src/tui/screens/app_templates.ts +1 −1
@@ -170,6 +170,6 @@ export const entry: PaletteEntry = {
170170 hint: "the repositories New app offers; mark or unmark one",
171171 after: ["economics"],
172172 asks: "forge.administer",
173 offered: (session) => mayMark(session),
173 for: "person",
174174 run: (session, ctx) => ctx.push(appTemplatesScreen(session, ctx)),
175175 };
src/tui/screens/appleusage.ts +1 −1
@@ -98,6 +98,6 @@ export const entry: PaletteEntry = {
9898 hint: "the Apple app's anonymous usage: counts and timings per version",
9999 after: ["limits"],
100100 asks: "forge.administer",
101 offered: (session) => session.user?.isAdmin === true && session.user.kind !== "agent",
101 for: "person",
102102 run: (session, ctx) => ctx.push(appleUsageScreen(session, ctx)),
103103 };
src/tui/screens/apps_crew.ts +1 −1
@@ -93,7 +93,7 @@ export const entry: PaletteEntry = {
9393 id: "apps-crew",
9494 title: "What the crew is doing",
9595 hint: "one plain sentence per app: who is on what",
96 // Names no `asks`: offered to everyone, so there is no gate for `may` to be asked beside.
96 // Names no `asks`: offered to everyone, signed out too, so there is nothing for `may` to answer.
9797 offered: () => true,
9898 run: (session, ctx) => ctx.push(appsCrewScreen(session, ctx)),
9999 };
src/tui/screens/archived.ts −1
@@ -109,6 +109,5 @@ export const entry: PaletteEntry = {
109109 title: "Archive",
110110 hint: "what is put away, who put it there: open one or unarchive it",
111111 asks: "forge.read",
112 offered: (session) => session.user !== undefined,
113112 run: (session, ctx) => ctx.push(archivedScreen(session, ctx)),
114113 };
src/tui/screens/ask_data.ts +1 −1
@@ -156,6 +156,6 @@ export const entry: PaletteEntry = {
156156 hint: "start from a question about the forge's data",
157157 after: ["boards"],
158158 asks: "forge.administer",
159 offered: mayExplore,
159 for: "person",
160160 run: (session, ctx) => ctx.push(askDataScreen(session, ctx)),
161161 };
src/tui/screens/audit.ts +1 −1
@@ -110,7 +110,7 @@ export const entry: PaletteEntry = {
110110 id: "audit",
111111 title: "Who can do what",
112112 hint: "each app's doors from its contract.json: yes, own or no",
113 // Names no `asks`: offered to everyone, so there is no gate for `may` to be asked beside.
113 // Names no `asks`: offered to everyone, signed out too, so there is nothing for `may` to answer.
114114 offered: () => true,
115115 run: (session, ctx) =>
116116 runAsync(ctx, async () => {
src/tui/screens/bets.ts +1 −1
@@ -198,6 +198,6 @@ export const entry: PaletteEntry = {
198198 title: "Bets",
199199 hint: "back, stop and finish a repository's bets",
200200 asks: "forge.read",
201 offered: (session) => session.user !== undefined && session.user.kind !== "agent",
201 for: "person",
202202 run: (session, ctx) => ctx.push(betsScreen(session, ctx)),
203203 };
src/tui/screens/billing.ts +1 −1
@@ -135,6 +135,6 @@ export const entry: PaletteEntry = {
135135 title: "Billing",
136136 hint: "each forge's plan, and grant one by hand",
137137 asks: "forge.administer",
138 offered: isAdmin,
138 for: "person",
139139 run: (session, ctx) => ctx.push(billingScreen(session, ctx)),
140140 };
src/tui/screens/bills.ts +1 −1
@@ -68,6 +68,6 @@ export const entry: PaletteEntry = {
6868 hint: "this month's cost of each forge you claimed",
6969 asks: "forge.read",
7070 shows: (session) => session.user === undefined || billNames(session.app, session.user).length > 0,
71 offered: (session) => session.user !== undefined && session.user.kind === "user" && billNames(session.app, session.user).length > 0,
71 for: "person",
7272 run: (session, ctx) => ctx.push(billsScreen(session, ctx)),
7373 };
src/tui/screens/boards.ts +1 −1
@@ -424,6 +424,6 @@ export const entry: PaletteEntry = {
424424 hint: "the forge's boards and their panels",
425425 after: ["sentinel"],
426426 asks: "forge.administer",
427 offered: (session) => session.user?.isAdmin === true && session.user.kind !== "agent",
427 for: "person",
428428 run: (session, ctx) => ctx.push(boardsScreen(session, ctx)),
429429 };
src/tui/screens/buckets.ts −1
@@ -111,6 +111,5 @@ export const entry: PaletteEntry = {
111111 title: "Buckets",
112112 hint: "an object bucket's price a month, and binding it to an app",
113113 asks: "forge.read",
114 offered: (session) => session.user !== undefined,
115114 run: (session, ctx) => ctx.push(bucketsScreen(session, ctx)),
116115 };
src/tui/screens/budgets.ts −1
@@ -91,6 +91,5 @@ export const entry: PaletteEntry = {
9191 title: "Cloud budgets",
9292 hint: "each cloud account's monthly budget against its projected spend",
9393 asks: "forge.administer",
94 offered: (session) => session.user?.isAdmin === true,
9594 run: (session, ctx) => ctx.push(budgetsScreen(session, ctx)),
9695 };
src/tui/screens/bugs.ts +1 −1
@@ -52,7 +52,7 @@ export const entry: PaletteEntry = {
5252 title: "Bugs",
5353 hint: "open bugs and the bug clock",
5454 after: ["boards"],
55 // Names no `asks`: offered to everyone, so there is no gate for `may` to be asked beside.
55 // Names no `asks`: offered to everyone, signed out too, so there is nothing for `may` to answer.
5656 offered: () => true,
5757 run: (session, ctx) => ctx.push(bugsScreen(session, ctx)),
5858 };
src/tui/screens/bulk.ts +1 −1
@@ -170,6 +170,6 @@ export const entry: PaletteEntry = {
170170 hint: "your last bulk actions; u undoes one inside its day",
171171 after: ["invites", "teams", "limits"],
172172 asks: "forge.read",
173 offered: isPerson,
173 for: "person",
174174 run: (session, ctx) => ctx.push(bulkScreen(session, ctx)),
175175 };
src/tui/screens/childcredit.ts −1
@@ -53,7 +53,6 @@ export const entry: PaletteEntry = {
5353 hint: "set the dollars a forge you sent may spend on this one's model credential",
5454 after: ["forges"],
5555 asks: "forge.administer",
56 offered: (session) => session.user?.isAdmin === true,
5756 run: (session, ctx) =>
5857 runAsync(ctx, async () => {
5958 const rows = (await clientRows(session.app)).filter((r) => r.made);
src/tui/screens/claim_start.ts +1 −1
@@ -72,6 +72,6 @@ export const entry: PaletteEntry = {
7272 hint: "claim the repositories an agent started, from its one-time link",
7373 after: ["invites", "repos"],
7474 asks: "forge.read",
75 offered: (session) => session.user?.kind === "user",
75 for: "person",
7676 run: (session, ctx) => ctx.push(claimStartScreen(session, ctx)),
7777 };
src/tui/screens/cloud.ts −1
@@ -277,6 +277,5 @@ export const entry: PaletteEntry = {
277277 title: "Cloud accounts",
278278 hint: "provider tokens, what they are used for, today's calls",
279279 asks: "forge.administer",
280 offered: (session) => session.user?.isAdmin === true,
281280 run: (session, ctx) => ctx.push(cloudScreen(session, ctx)),
282281 };
src/tui/screens/cloudcost.ts +1 −1
@@ -56,6 +56,6 @@ export const entry: PaletteEntry = {
5656 hint: "each account against its budget, and what costs most",
5757 after: ["footing", "system"],
5858 asks: "forge.administer",
59 offered: mayRead,
59 for: "person",
6060 run: (session, ctx) => ctx.push(cloudCostScreen(session, ctx)),
6161 };
src/tui/screens/cloudtree.ts −1
@@ -324,6 +324,5 @@ export const entry: PaletteEntry = {
324324 hint: "every resource on every cloud, what it costs, filtered",
325325 after: ["cloud"],
326326 asks: "forge.administer",
327 offered: (session) => session.user?.isAdmin === true,
328327 run: (session, ctx) => ctx.push(cloudTreeScreen(session, ctx)),
329328 };
src/tui/screens/codes.ts +1 −2
@@ -17,7 +17,6 @@ import type { Session } from "../session.ts";
1717 import { ListState, confirmScreen, drawList, live, yesNo, type ListRow } from "./common.ts";
1818 import type { PaletteEntry } from "./entries.ts";
1919
20 const isAdmin = (f: Session): boolean => f.user?.isAdmin === true && f.user.kind !== "agent";
2120
2221 export function codeRows(f: Session): { rows: ListRow[]; ids: string[]; plans: string[] } {
2322 const read = readCodes(f.app, f.user);
@@ -100,6 +99,6 @@ export const entry: PaletteEntry = {
10099 title: "Gift codes",
101100 hint: "make a code that gives a plan for free, and revoke one",
102101 asks: "forge.administer",
103 offered: isAdmin,
102 for: "person",
104103 run: (session, ctx) => ctx.push(codesScreen(session, ctx)),
105104 };
src/tui/screens/connections.ts +1 −1
@@ -167,6 +167,6 @@ export const entry: PaletteEntry = {
167167 title: "Connected accounts",
168168 hint: "the hosts your mirrors come from",
169169 asks: "forge.read",
170 offered: (session) => session.user !== undefined && session.user.kind !== "agent",
170 for: "person",
171171 run: (session, ctx) => ctx.push(connectionsScreen(session, ctx)),
172172 };
src/tui/screens/controls.ts +1 −2
@@ -16,7 +16,6 @@ import type { Session } from "../session.ts";
1616 import { ListState, drawList, type ListRow } from "./common.ts";
1717 import type { PaletteEntry } from "./entries.ts";
1818
19 const isAdmin = (f: Session): boolean => f.user?.isAdmin === true && f.user.kind !== "agent";
2019
2120 /** The same four words as the page's badge. */
2221 function stateWord(ok: boolean, attention: boolean): string {
@@ -73,6 +72,6 @@ export const entry: PaletteEntry = {
7372 title: "Security controls",
7473 hint: "each safeguard, its state, and when it was last checked",
7574 asks: "forge.administer",
76 offered: isAdmin,
75 for: "person",
7776 run: (session, ctx) => ctx.push(controlsScreen(session, ctx)),
7877 };
src/tui/screens/cores.ts −1
@@ -31,7 +31,6 @@ export const entry: PaletteEntry = {
3131 after: ["plan-row", "limits"],
3232 asks: "forge.administer",
3333 shows: () => coresLine() !== undefined,
34 offered: (session) => session.user?.isAdmin === true && coresLine() !== undefined,
3534 run: (session, ctx) => {
3635 if (session.user?.isAdmin === true) ctx.push(coresScreen(session, ctx));
3736 },
src/tui/screens/crewbudgets.ts +1 −1
@@ -94,6 +94,6 @@ export const entry: PaletteEntry = {
9494 asks: "forge.administer",
9595 // The budgets are the forge's own key's: a forge sent to someone has none to set.
9696 shows: (session) => isOwnForge(session.app),
97 offered: mayAct,
97 for: "person",
9898 run: (session, ctx) => ctx.push(crewBudgetsScreen(session, ctx)),
9999 };
src/tui/screens/crewfallback.ts +1 −1
@@ -93,6 +93,6 @@ export const entry: PaletteEntry = {
9393 hint: "the capped key the crew falls back to when every plan's window is full",
9494 after: ["crewbudgets"],
9595 asks: "forge.administer",
96 offered: mayAct,
96 for: "person",
9797 run: (session, ctx) => ctx.push(crewFallbackScreen(session, ctx)),
9898 };
src/tui/screens/crewhandover.ts −1
@@ -113,6 +113,5 @@ export const entry: PaletteEntry = {
113113 hint: "issues parked twice, and the last restore drill",
114114 after: ["crew-scorecard"],
115115 asks: "forge.administer",
116 offered: (session) => session.user?.isAdmin === true,
117116 run: (session, ctx) => ctx.push(crewHandoverScreen(session, ctx)),
118117 };
src/tui/screens/crewkey.ts +1 −1
@@ -67,6 +67,6 @@ export const entry: PaletteEntry = {
6767 hint: "what the crew runs on; add your own model key",
6868 after: ["subscriptions"],
6969 asks: "forge.administer",
70 offered: isAdmin,
70 for: "person",
7171 run: (session, ctx) => ctx.push(crewKeyScreen(session, ctx)),
7272 };
src/tui/screens/crewsplits.ts −1
@@ -82,6 +82,5 @@ export const entry: PaletteEntry = {
8282 hint: "agent runs per model and per prompt version",
8383 after: ["usage", "trusted-hosts", "secrets"],
8484 asks: "forge.administer",
85 offered: (session) => session.user?.isAdmin === true,
8685 run: (session, ctx) => ctx.push(crewSplitsScreen(session, ctx)),
8786 };
src/tui/screens/crewtop.ts −1
@@ -160,6 +160,5 @@ export const entry: PaletteEntry = {
160160 hint: "who is on what, what waits, accounts, the week and runs that failed early",
161161 after: ["scorecard"],
162162 asks: "forge.administer",
163 offered: mayReadCrewTop,
164163 run: (session, ctx) => ctx.push(crewTopScreen(session, ctx)),
165164 };
src/tui/screens/dataset.ts +1 −1
@@ -68,6 +68,6 @@ export const entry: PaletteEntry = {
6868 hint: "what the forge's dataset holds, and what it already answers",
6969 after: ["bottleneck", "system"],
7070 asks: "forge.administer",
71 offered: mayRead,
71 for: "person",
7272 run: (session, ctx) => ctx.push(datasetScreen(session, ctx)),
7373 };
src/tui/screens/design.ts −1
@@ -143,6 +143,5 @@ export const entry: PaletteEntry = {
143143 hint: "colours and scales, the AA verdict; publish or revert",
144144 after: ["footing"],
145145 asks: "forge.read",
146 offered: (session) => session.user !== undefined,
147146 run: (session, ctx) => ctx.push(designScreen(session, ctx)),
148147 };
src/tui/screens/devices.ts +1 −1
@@ -183,6 +183,6 @@ export const entry: PaletteEntry = {
183183 hint: "LAN printers: model, state, supplies; declare or remove one",
184184 after: ["app-templates"],
185185 asks: "forge.administer",
186 offered: (session) => mayUse(session),
186 for: "person",
187187 run: (session, ctx) => ctx.push(devicesScreen(session, ctx)),
188188 };
src/tui/screens/disks.ts +2 −2
@@ -6,7 +6,7 @@
66 * `mayHandleDisks`.
77 */
88
9 import { mayHandleDisks, readMachine, readMachines } from "../../actions/disk_readings.ts";
9 import { readMachine, readMachines } from "../../actions/disk_readings.ts";
1010 import { printable, type MachineSummary } from "../../machines/disk_readings.ts";
1111 import type { Ctx, Screen } from "../app/app.ts";
1212 import { binding } from "../app/keys.ts";
@@ -70,7 +70,7 @@ export const entry: PaletteEntry = {
7070 hint: "machines' disk readings: 30-day write rate and projected rated-TBW date",
7171 after: ["system"],
7272 asks: "forge.administer",
73 offered: (session) => mayHandleDisks(session.user),
73 for: "person",
7474 run: (session, ctx) => {
7575 const names = readMachines(session.app, session.user);
7676 if (!names.ok || names.value.length === 0) return ctx.toast("No disk readings yet");
src/tui/screens/displays.ts −1
@@ -82,6 +82,5 @@ export const entry: PaletteEntry = {
8282 hint: "the displays you may read",
8383 after: ["repos"],
8484 asks: "forge.read",
85 offered: (session) => session.user !== undefined,
8685 run: (session, ctx) => ctx.push(displaysScreen(session, ctx)),
8786 };
src/tui/screens/domains.ts +1 −1
@@ -137,6 +137,6 @@ export const entry: PaletteEntry = {
137137 title: "Failure domains",
138138 hint: "failure domains and their last drill",
139139 asks: "forge.administer",
140 offered: (session) => session.user?.isAdmin === true && session.user.kind !== "agent",
140 for: "person",
141141 run: (session, ctx) => ctx.push(domainsScreen(session, ctx)),
142142 };
src/tui/screens/dotfiles.ts +1 −1
@@ -67,6 +67,6 @@ export const entry: PaletteEntry = {
6767 title: "Your dotfiles",
6868 hint: "the repository every shell you open copies from",
6969 asks: "forge.read",
70 offered: (session) => session.user !== undefined && session.user.kind !== "agent",
70 for: "person",
7171 run: (session, ctx) => ctx.push(dotfilesScreen(session, ctx)),
7272 };
src/tui/screens/drift.ts +1 −1
@@ -83,6 +83,6 @@ export const entry: PaletteEntry = {
8383 hint: "open pulls far behind main, and the one action that brings each up to date",
8484 after: ["boards"],
8585 asks: "forge.administer",
86 offered: mayDrift,
86 for: "person",
8787 run: (session, ctx) => ctx.push(driftScreen(session, ctx)),
8888 };
src/tui/screens/dutybudgets.ts +1 −1
@@ -79,6 +79,6 @@ export const entry: PaletteEntry = {
7979 hint: "runs per day and dollars per day a duty may use",
8080 after: ["maintenance-duties", "maintenance-runs"],
8181 asks: "forge.administer",
82 offered: mayAct,
82 for: "person",
8383 run: (session, ctx) => ctx.push(dutyBudgetScreen(session, ctx)),
8484 };
src/tui/screens/dutyswitch.ts +1 −1
@@ -98,6 +98,6 @@ export const entry: PaletteEntry = {
9898 hint: "switch a duty off, or on again after it paused itself",
9999 after: ["maintenance-runs", "maintenance"],
100100 asks: "forge.administer",
101 offered: mayAct,
101 for: "person",
102102 run: (session, ctx) => ctx.push(dutySwitchScreen(session, ctx)),
103103 };
src/tui/screens/economics.ts +1 −1
@@ -203,6 +203,6 @@ export const entry: PaletteEntry = {
203203 hint: "the profit slider's position, the margin, the owned-node label and the prices; change one",
204204 after: ["limits"],
205205 asks: "forge.administer",
206 offered: (session) => session.user?.isAdmin === true && session.user.kind !== "agent",
206 for: "person",
207207 run: (session, ctx) => ctx.push(economicsScreen(session, ctx)),
208208 };
src/tui/screens/edgeonly.ts +1 −2
@@ -17,7 +17,6 @@ import { emptyState } from "../ui/widgets.ts";
1717 import { ListState, drawList, type ListRow } from "./common.ts";
1818 import type { PaletteEntry } from "./entries.ts";
1919
20 const isAdmin = (f: Session): boolean => f.user?.isAdmin === true && f.user.kind !== "agent";
2120
2221 export function edgeOnlyScreen(f: Session, ctx: Ctx): Screen {
2322 const state = new ListState();
@@ -58,6 +57,6 @@ export const entry: PaletteEntry = {
5857 title: "Edge-only accounts",
5958 hint: "who would be locked out if the platform edge sign-in went off",
6059 asks: "forge.administer",
61 offered: isAdmin,
60 for: "person",
6261 run: (session, ctx) => ctx.push(edgeOnlyScreen(session, ctx)),
6362 };
src/tui/screens/entries.ts +29 −36
@@ -9,15 +9,14 @@
99 * `forge.ts`, never the reverse.
1010 */
1111
12 import { askBeside } from "../../core/access_disagreement.ts";
13 import type { Action } from "../../core/may.ts";
12 import { type Action, holds } from "../../core/may.ts";
1413 import { principalOfUser } from "../../core/principal.ts";
1514 import type { Ctx } from "../app/app.ts";
1615 import type { Command } from "../app/palette.ts";
1716 import type { Session } from "../session.ts";
1817 import { SCREEN_MODULES } from "../../generated/screens.ts";
1918
20 export interface PaletteEntry {
19 interface EntryBase {
2120 readonly id: string;
2221 /**
2322 * Where the palette offers it: lower first, grouped by purpose and spaced
@@ -32,24 +31,28 @@ export interface PaletteEntry {
3231 * `addEntries` is called.
3332 */
3433 readonly after?: readonly string[];
35 /** Whether this session is offered the entry: the whole answer, callers may ask it alone. */
36 offered(session: Session): boolean;
3734 /**
38 * The part of `offered` that is not who is asking (a file the forge has, a repository with
39 * runs): asked first, and when it says no the entry is not offered and `may` is not asked, so a
40 * screen with nothing to show counts no parting.
35 * The part of the answer that is not who is asking (a file the forge has, a repository with
36 * runs): asked first, and when it says no the entry is not offered.
4137 */
4238 shows?(session: Session): boolean;
43 /**
44 * The action `offered` stands for, when its gate is the forge's admin (`forge.administer`) or an
45 * account (`forge.read`, opening a screen): `may` is asked it beside `offered`, which still
46 * decides, and a parting is counted under `terminal <id>` (#18396). An entry gated on anything
47 * else (a grant, a subscription, a telemetry role, or nothing) names none, and says why.
48 */
49 readonly asks?: Action;
5039 run(session: Session, ctx: Ctx): void;
5140 }
5241
42 /**
43 * Who decides whether a session is offered the entry. An entry whose gate is the forge's admin
44 * names `forge.administer`, one whose gate is an account names `forge.read` (opening a screen is a
45 * read), and `may` alone answers it, as the terminal's account (#18426). `for: "person"` says the
46 * screen is a person's: an agent is not offered it, whatever it may do. An entry gated on anything
47 * `may` has no action for (a grant, a subscription, an organization, or nothing) keeps its own
48 * `offered` and says why beside it.
49 */
50 type Gate =
51 | { readonly asks: Action; readonly for?: "person"; readonly offered?: never }
52 | { readonly offered: (session: Session) => boolean; readonly asks?: never; readonly for?: never };
53
54 export type PaletteEntry = EntryBase & Gate;
55
5356 /**
5457 * Every entry the screen files declare, by rank, then file name, then export name. The roster is
5558 * `src/generated/screens.ts`.
@@ -59,29 +62,19 @@ export const ENTRIES: readonly PaletteEntry[] = SCREEN_MODULES.flatMap(([mod, na
5962 );
6063
6164 /**
62 * What each session's palette has asked `may` already: an entry, the account and the gate's answer.
63 * The palette is built on every open, and an answer asked once is not asked again, so a session
64 * writes at most one parting per entry and not one per build.
65 * Whether the session is offered `e`. What there is to show is asked first. An entry that names an
66 * action is offered when `may` grants it to the terminal's account (`none`: the terminal acts for
67 * the person signed in to it). A signed-out terminal has no account to ask as, so it is offered
68 * only the entries that name none: on the web too a screen for accounts asks you to sign in, though
69 * `forge.read` is open to all. A person's screen (`for: "person"`) is not offered to an agent, an
70 * admin agent included: the screen is a person's work, not a permission the agent lacks.
6571 */
66 const asked = new WeakMap<Session, Set<string>>();
67
68 /**
69 * Whether the session is offered `e`: its own gate decides; when the entry names the action that
70 * gate stands for, `may` is asked it beside, once a session, as the screen's account (`none`: the
71 * terminal acts for the person signed in to it), and a parting is counted.
72 */
73 function offers(e: PaletteEntry, session: Session): boolean {
72 export function offers(e: PaletteEntry, session: Session): boolean {
7473 if (e.shows?.(session) === false) return false;
75 const old = e.offered(session);
76 if (e.asks === undefined) return old;
77 const key = `${e.id} ${session.user?.id ?? ""} ${session.user?.isAdmin === true} ${old}`;
78 let seen = asked.get(session);
79 if (seen === undefined) asked.set(session, (seen = new Set()));
80 if (!seen.has(key)) {
81 seen.add(key);
82 askBeside(session.app.db, principalOfUser(session.user), `terminal ${e.id}`, e.asks, old);
83 }
84 return old;
74 if (e.asks === undefined) return e.offered(session);
75 const user = session.user;
76 if (user === undefined || (e.for === "person" && user.kind === "agent")) return false;
77 return holds(session.app.db, principalOfUser(user), e.asks);
8578 }
8679
8780 /**
src/tui/screens/experiments.ts −1
@@ -152,6 +152,5 @@ export const entry: PaletteEntry = {
152152 hint: "what each cloud machine costs and answers",
153153 after: ["pinned"],
154154 asks: "forge.administer",
155 offered: (session) => session.user?.isAdmin === true,
156155 run: (session, ctx) => ctx.push(experimentsScreen(session, ctx)),
157156 };
src/tui/screens/featurefeed.ts −1
@@ -122,6 +122,5 @@ export const entry: PaletteEntry = {
122122 hint: "the feed items about an absorbed app, as Settings › Features shows them",
123123 after: ["feature-review"],
124124 asks: "forge.read",
125 offered: (session) => session.user !== undefined,
126125 run: (session, ctx) => ctx.push(featureFeedPicker(session, ctx)),
127126 };
src/tui/screens/features.ts +1 −1
@@ -79,6 +79,6 @@ export const entry: PaletteEntry = {
7979 title: "Menu entries to review",
8080 hint: "absorbed apps whose declared name or page changed: accept them",
8181 asks: "forge.administer",
82 offered: mayReview,
82 for: "person",
8383 run: (session, ctx) => ctx.push(featuresScreen(session, ctx)),
8484 };
src/tui/screens/featureswitch.ts +1 −1
@@ -163,6 +163,6 @@ export const entry: PaletteEntry = {
163163 title: "Features",
164164 hint: "apps that declare a feature: absorb one, change its settings",
165165 asks: "forge.administer",
166 offered: mayFeatures,
166 for: "person",
167167 run: (session, ctx) => ctx.push(featureSwitchScreen(session, ctx)),
168168 };
src/tui/screens/feed.ts −1
@@ -338,6 +338,5 @@ export const entry: PaletteEntry = {
338338 title: "Feed",
339339 hint: "what happened, ranked; r replies on a post about an issue or pull, l likes, h who liked, p its permalink, o a run's log",
340340 asks: "forge.read",
341 offered: (session) => session.user !== undefined,
342341 run: (session, ctx) => ctx.push(feedScreen(session, ctx)),
343342 };
src/tui/screens/flowsall.ts +1 −1
@@ -73,6 +73,6 @@ export const entry: PaletteEntry = {
7373 hint: "every repository's flow lines, by kind and stale",
7474 after: ["limits"],
7575 asks: "forge.administer",
76 offered: mayRead,
76 for: "person",
7777 run: (session, ctx) => ctx.push(flowsAllScreen(session, ctx)),
7878 };
src/tui/screens/footing.ts +1 −1
@@ -77,6 +77,6 @@ export const entry: PaletteEntry = {
7777 hint: "each piece on another machine, in the order it would break the forge",
7878 after: ["stalls", "system"],
7979 asks: "forge.administer",
80 offered: mayRead,
80 for: "person",
8181 run: (session, ctx) => ctx.push(footingScreen(session, ctx)),
8282 };
src/tui/screens/forgeready.ts −1
@@ -18,7 +18,6 @@ export const entry: PaletteEntry = {
1818 after: ["forges"],
1919 // Admin only, as `forges` is: the list names every forge this one sent.
2020 asks: "forge.administer",
21 offered: (session) => session.user?.isAdmin === true,
2221 run: (session, ctx: Ctx) =>
2322 runAsync(ctx, async () => {
2423 // From the ledger alone: filling the picker probes no child.
src/tui/screens/forges.ts −1
@@ -505,7 +505,6 @@ export const entry: PaletteEntry = {
505505 title: "Forges you sent",
506506 hint: "each forge sent, claimed or not, and its apps",
507507 asks: "forge.administer",
508 offered: (session) => session.user?.isAdmin === true,
509508 run: (session, ctx) => runAsync(ctx, async () => {
510509 ctx.push(forgesScreen(ctx, await clientRows(session.app), session));
511510 }),
src/tui/screens/forgeview.ts −1
@@ -78,6 +78,5 @@ export const entry: PaletteEntry = {
7878 hint: "the forge's counts, and Foundry when it is installed",
7979 after: ["now"],
8080 asks: "forge.read",
81 offered: (session) => session.user !== undefined,
8281 run: (session, ctx) => ctx.push(forgeViewScreen(session, ctx)),
8382 };
src/tui/screens/front.ts +1 −1
@@ -156,7 +156,7 @@ export const entry: PaletteEntry = {
156156 id: "front",
157157 title: "Front page",
158158 hint: "the apps a first visitor sees, ranked; an admin pins or hides",
159 // Names no `asks`: offered to everyone, so there is no gate for `may` to be asked beside.
159 // Names no `asks`: offered to everyone, signed out too, so there is nothing for `may` to answer.
160160 offered: () => true,
161161 run: (session, ctx) => ctx.push(frontScreen(session, ctx)),
162162 };
src/tui/screens/frontms.ts −1
@@ -59,6 +59,5 @@ export const entry: PaletteEntry = {
5959 hint: "the biggest open milestones: how far, what landed this week",
6060 after: ["now"],
6161 asks: "forge.read",
62 offered: (f) => f.user !== undefined,
6362 run: (session, ctx) => ctx.push(frontMilestonesScreen(session, ctx)),
6463 };
src/tui/screens/funnel.ts +1 −1
@@ -51,6 +51,6 @@ export const entry: PaletteEntry = {
5151 title: "From visit to paid",
5252 hint: "the last 7 days: home visits, plans seen, plan clicks, forges made, paid",
5353 asks: "forge.administer",
54 offered: mayRead,
54 for: "person",
5555 run: (f, ctx) => ctx.push(funnelScreen(f, ctx)),
5656 };
src/tui/screens/health_voice.ts +1 −1
@@ -36,7 +36,7 @@ export const entry: PaletteEntry = {
3636 title: "Health — spoken",
3737 hint: "how the forge is, in two plain sentences",
3838 after: ["system", "flow", "boards"],
39 // Names no `asks`: offered to everyone, so there is no gate for `may` to be asked beside.
39 // Names no `asks`: offered to everyone, signed out too, so there is nothing for `may` to answer.
4040 offered: () => true,
4141 run: (session, ctx) => ctx.push(healthVoiceScreen(session, ctx)),
4242 };
src/tui/screens/home_pins.ts +1 −1
@@ -91,6 +91,6 @@ export const entry: PaletteEntry = {
9191 hint: "the panels pinned to home: reorder and unpin",
9292 after: ["boards"],
9393 asks: "forge.administer",
94 offered: mayPin,
94 for: "person",
9595 run: (session, ctx) => ctx.push(homePinsScreen(session, ctx)),
9696 };
src/tui/screens/hostreach.ts +1 −1
@@ -184,6 +184,6 @@ export const entry: PaletteEntry = {
184184 hint: "answer what a hosted forge asked to reach, and take a grant back",
185185 after: ["forges"],
186186 asks: "forge.administer",
187 offered: (session) => session.user?.isAdmin === true && session.user.kind !== "agent",
187 for: "person",
188188 run: (session, ctx) => ctx.push(hostReachScreen(session, ctx)),
189189 };
src/tui/screens/infra.ts −1
@@ -694,6 +694,5 @@ export const entry: PaletteEntry = {
694694 hint: "what runs on your own cloud, what it costs, when it ends",
695695 after: ["cloud"],
696696 asks: "forge.administer",
697 offered: (session) => session.user?.isAdmin === true,
698697 run: (session, ctx) => ctx.push(infraScreen(session, ctx)),
699698 };
src/tui/screens/inventory.ts −1
@@ -119,6 +119,5 @@ export const entry: PaletteEntry = {
119119 hint: "every repository on your connected accounts, what it holds, where its move stands",
120120 after: ["migrate"],
121121 asks: "forge.read",
122 offered: (session) => session.user !== undefined,
123122 run: (session, ctx) => ctx.push(inventoryScreen(session, ctx)),
124123 };
src/tui/screens/invites.ts +1 −1
@@ -221,6 +221,6 @@ export const entry: PaletteEntry = {
221221 hint: "make a single-use link, see which are open, revoke one",
222222 after: ["teams", "limits", "quotas", "people", "can"],
223223 asks: "forge.administer",
224 offered: (session) => session.user?.isAdmin === true && session.user.kind === "user",
224 for: "person",
225225 run: (session, ctx) => ctx.push(invitesScreen(session, ctx)),
226226 };
src/tui/screens/knobs.ts −1
@@ -71,6 +71,5 @@ export const entry: PaletteEntry = {
7171 hint: "speed, weekly budget, polish, autonomy, feedback first",
7272 after: ["crew-scorecard", "usage"],
7373 asks: "forge.administer",
74 offered: (session) => session.user?.isAdmin === true,
7574 run: (session, ctx) => ctx.push(knobsScreen(session, ctx)),
7675 };
src/tui/screens/lapsed.ts +1 −2
@@ -24,7 +24,6 @@ import type { PaletteEntry } from "./entries.ts";
2424 /** Said when `p` is pressed on a forge whose link has expired: no checkout is made. */
2525 export const EXPIRED_NOTE = "This link has expired; ask the operator before paying.";
2626
27 const isAdmin = (f: Session): boolean => f.user?.isAdmin === true && f.user.kind !== "agent";
2827
2928 /** The forges asleep for want of payment, with the lines that say why and how to export. */
3029 export function lapsedForges(f: Session): { name: string; expired: boolean; lines: string[] }[] {
@@ -95,6 +94,6 @@ export const entry: PaletteEntry = {
9594 hint: "forges asleep until paid, when their data goes, pay again",
9695 after: ["billing"],
9796 asks: "forge.administer",
98 offered: isAdmin,
97 for: "person",
9998 run: (session, ctx) => ctx.push(lapsedScreen(session, ctx)),
10099 };
src/tui/screens/limits.ts +1 −1
@@ -111,6 +111,6 @@ export const entry: PaletteEntry = {
111111 hint: "what the forge caps, with default and bounds; change one",
112112 after: ["quotas", "people", "can"],
113113 asks: "forge.administer",
114 offered: (session) => session.user?.isAdmin === true && session.user.kind !== "agent",
114 for: "person",
115115 run: (session, ctx) => ctx.push(limitsScreen(session, ctx)),
116116 };
src/tui/screens/loopstalls.ts +1 −1
@@ -150,6 +150,6 @@ export const entry: PaletteEntry = {
150150 hint: "the last hour's stall ms by route",
151151 after: ["system"],
152152 asks: "forge.administer",
153 offered: mayRead,
153 for: "person",
154154 run: (session, ctx) => ctx.push(stallsScreen(session, ctx)),
155155 };
src/tui/screens/madefrom.ts −1
@@ -44,6 +44,5 @@ export const entry: PaletteEntry = {
4444 after: ["plan-row"],
4545 asks: "forge.read",
4646 shows: (session) => madeFromOf(session.app.config.dataDir) !== undefined,
47 offered: (session) => session.signedIn && madeFromOf(session.app.config.dataDir) !== undefined,
4847 run: (session, ctx) => ctx.push(madeFromScreen(session, ctx)),
4948 };
src/tui/screens/maintainruns.ts −1
@@ -34,6 +34,5 @@ export const entry: PaletteEntry = {
3434 hint: "what each duty found, did and probed",
3535 after: ["maintenance"],
3636 asks: "forge.administer",
37 offered: mayRead,
3837 run: (session, ctx) => ctx.push(maintainRunsScreen(session, ctx)),
3938 };
src/tui/screens/maintenance.ts +1 −1
@@ -281,6 +281,6 @@ export const entry: PaletteEntry = {
281281 hint: "prepare the forge for a power-off, check the drain, or end maintenance",
282282 after: ["resilience", "capacity", "flow", "sentinel"],
283283 asks: "forge.administer",
284 offered: (session) => session.user?.isAdmin === true && session.user.kind !== "agent",
284 for: "person",
285285 run: (session, ctx) => ctx.push(maintenanceScreen(session, ctx)),
286286 };
src/tui/screens/mergedbranches.ts +1 −1
@@ -79,6 +79,6 @@ export const entry: PaletteEntry = {
7979 hint: "delete the merged pulls' branches in one receipted step",
8080 after: ["maintenance", "maintenance-runs", "stale-pulls"],
8181 asks: "forge.administer",
82 offered: mayAct,
82 for: "person",
8383 run: (session, ctx) => ctx.push(mergedBranchesScreen(session, ctx)),
8484 };
src/tui/screens/mirrorpacks.ts +1 −1
@@ -68,6 +68,6 @@ export const entry: PaletteEntry = {
6868 hint: "bring each pack's upstream projects in as read-only repositories",
6969 after: ["packs"],
7070 asks: "forge.administer",
71 offered: (session) => session.user?.isAdmin === true && session.user.kind !== "agent",
71 for: "person",
7272 run: (session, ctx) => ctx.push(mirrorPacksScreen(session, ctx)),
7373 };
src/tui/screens/model.ts +2 −2
@@ -366,7 +366,7 @@ export const modelGrantEntry: PaletteEntry = {
366366 hint: "give an account dollars a month, or take it back",
367367 after: ["model"],
368368 asks: "forge.administer",
369 offered: (session) => session.user?.isAdmin === true && session.user.kind === "user",
369 for: "person",
370370 run: (session, ctx) => ctx.push(modelGrantPrompt(session, ctx, blank("Model grant"))),
371371 };
372372
@@ -378,6 +378,6 @@ export const modelCeilingEntry: PaletteEntry = {
378378 hint: "set an account's dollars a day and a run",
379379 after: ["model-grant"],
380380 asks: "forge.administer",
381 offered: (session) => session.user?.isAdmin === true && session.user.kind === "user",
381 for: "person",
382382 run: (session, ctx) => ctx.push(modelCeilingPrompt(session, ctx, blank("Model ceiling"))),
383383 };
src/tui/screens/money.ts +1 −1
@@ -100,7 +100,7 @@ export const entry: PaletteEntry = {
100100 hint: "this month's cost, revenue and gap, and the last 30 days",
101101 after: ["economics"],
102102 asks: "forge.administer",
103 offered: (f) => f.user?.isAdmin === true && f.user.kind !== "agent",
103 for: "person",
104104 run: (f, ctx) => ctx.push(moneyScreen(f, ctx)),
105105 };
106106
src/tui/screens/newissue.ts −1
@@ -49,6 +49,5 @@ export const entry: PaletteEntry = {
4949 hint: "pick a repository",
5050 after: ["repos"],
5151 asks: "forge.read",
52 offered: (session) => session.user !== undefined,
5352 run: (session, ctx) => ctx.push(newIssuePickScreen(session, ctx)),
5453 };
src/tui/screens/next.ts +1 −2
@@ -285,7 +285,6 @@ export function nextScreen(f: Session, ctx: Ctx, repo: Repo): Screen {
285285 /**
286286 * Next up across repositories (#15870): read-only, the same `nextAll` as `/next` and the MCP tool.
287287 */
288 const mayReadAll = (session: Session): boolean => session.user !== undefined && session.user.kind !== "agent";
289288
290289 /** One line for each repository, then one per row: " 1. title (#7, on it: ada)". */
291290 export function nextAllLines(groups: readonly NextGroup[]): string[] {
@@ -325,7 +324,7 @@ export const nextAllEntry: PaletteEntry = {
325324 hint: "the top of each list you administer",
326325 after: ["waiting-for-me"],
327326 asks: "forge.read",
328 offered: mayReadAll,
327 for: "person",
329328 run: (session, ctx) => {
330329 if (session.user === undefined) return;
331330 ctx.push(nextAllScreen(ctx, nextAll(session.app, session.user)));
src/tui/screens/nowlist.ts +1 −1
@@ -63,6 +63,6 @@ export const entry: PaletteEntry = {
6363 hint: "what check, review, land and live count, with the rows",
6464 after: ["boards"],
6565 asks: "forge.administer",
66 offered: (session) => mayReadNow(session.user),
66 for: "person",
6767 run: (session, ctx) => ctx.push(nowScreen(session, ctx)),
6868 };
src/tui/screens/offers.ts +1 −2
@@ -15,7 +15,6 @@ import { style } from "../term/style.ts";
1515 import { Scroll, drawLines, hitScroll } from "./common.ts";
1616 import type { PaletteEntry } from "./entries.ts";
1717
18 const mayRead = (session: Session): boolean => session.user !== undefined && session.user.kind !== "agent";
1918
2019 /**
2120 * One receipt as text lines, the page's rows in the page's words; detail lines start with a space.
@@ -98,7 +97,7 @@ export const entry: PaletteEntry = {
9897 hint: "the receipts of what you offered from your forks",
9998 after: ["waiting-for-me"],
10099 asks: "forge.read",
101 offered: mayRead,
100 for: "person",
102101 run: (session, ctx) => {
103102 if (session.user === undefined) return;
104103 ctx.push(offersScreen(ctx, listForkOffers(session.app.db, session.user), session));
src/tui/screens/offsite.ts +1 −1
@@ -76,6 +76,6 @@ export const entry: PaletteEntry = {
7676 hint: "where the sealed lane writes, when it last succeeded, and the last restore drill",
7777 after: ["footing"],
7878 asks: "forge.administer",
79 offered: mayRead,
79 for: "person",
8080 run: (session, ctx) => ctx.push(offsiteScreen(session, ctx)),
8181 };
src/tui/screens/originahead.ts +1 −1
@@ -80,7 +80,7 @@ export const entry: PaletteEntry = {
8080 id: "origin-ahead",
8181 title: "New commits upstream",
8282 hint: "mirrors whose origin has moved on: take them",
83 // Names no `asks`: offered to everyone, so there is no gate for `may` to be asked beside.
83 // Names no `asks`: offered to everyone, signed out too, so there is nothing for `may` to answer.
8484 offered: () => true,
8585 run: (session, ctx) => ctx.push(originAheadScreen(session, ctx)),
8686 };
src/tui/screens/owner.ts +1 −1
@@ -77,6 +77,6 @@ export const entry: PaletteEntry = {
7777 title: "Owner's needs",
7878 hint: "what needs the owner, snapshots, failure domains",
7979 asks: "forge.administer",
80 offered: (session) => session.user?.isAdmin === true && session.user.kind !== "agent",
80 for: "person",
8181 run: (session, ctx) => ctx.push(ownerScreen(session, ctx)),
8282 };
src/tui/screens/packrepos.ts +1 −1
@@ -79,6 +79,6 @@ export const entry: PaletteEntry = {
7979 hint: "which repositories /packs lists",
8080 after: ["mirror-packs", "packs"],
8181 asks: "forge.administer",
82 offered: (session) => session.user?.isAdmin === true && session.user.kind !== "agent",
82 for: "person",
8383 run: (session, ctx) => ctx.push(packReposScreen(session, ctx)),
8484 };
src/tui/screens/payments.ts +1 −1
@@ -72,6 +72,6 @@ export const entry: PaletteEntry = {
7272 title: "Payments",
7373 hint: "what was charged for the forges you claimed",
7474 asks: "forge.read",
75 offered: (session) => session.user !== undefined && session.user.kind === "user",
75 for: "person",
7676 run: (session, ctx) => ctx.push(paymentsScreen(session, ctx)),
7777 };
src/tui/screens/people.ts +1 −1
@@ -193,6 +193,6 @@ export const entry: PaletteEntry = {
193193 hint: "who is a guest, a member or an admin; promote or demote",
194194 after: ["can"],
195195 asks: "forge.administer",
196 offered: (session) => session.user?.isAdmin === true && session.user.kind === "user",
196 for: "person",
197197 run: (session, ctx) => ctx.push(peopleScreen(session, ctx)),
198198 };
src/tui/screens/pinned.ts −1
@@ -288,6 +288,5 @@ export const entry: PaletteEntry = {
288288 hint: "deploy, update and roll back a forge on your cloud",
289289 after: ["cloud"],
290290 asks: "forge.administer",
291 offered: (session) => session.user?.isAdmin === true,
292291 run: (session, ctx) => ctx.push(pinnedScreen(session, ctx)),
293292 };
src/tui/screens/planner.ts −1
@@ -38,6 +38,5 @@ export const entry: PaletteEntry = {
3838 hint: "its last pass, its spend this week and what became of what it filed",
3939 after: ["crewbudgets"],
4040 asks: "forge.administer",
41 offered: (f) => f.user?.isAdmin === true,
4241 run: (session, ctx) => ctx.push(plannerScreen(session, ctx)),
4342 };
src/tui/screens/planrow.ts −1
@@ -75,6 +75,5 @@ export const entry: PaletteEntry = {
7575 hint: "this forge's plan, its last backup, and where its owner manages billing",
7676 after: ["billing-links", "limits"],
7777 asks: "forge.administer",
78 offered: (session) => session.user?.isAdmin === true,
7978 run: (session, ctx) => ctx.push(planRowScreen(session, ctx)),
8079 };
src/tui/screens/plans.ts +1 −1
@@ -132,6 +132,6 @@ export const entry: PaletteEntry = {
132132 hint: "free, small, medium and large: size, price, crew credit, forges; change one",
133133 after: ["limits"],
134134 asks: "forge.administer",
135 offered: (session: Session) => session.user?.isAdmin === true && session.user.kind !== "agent",
135 for: "person",
136136 run: (session, ctx) => ctx.push(plansScreen(session, ctx)),
137137 };
src/tui/screens/previewdirs.ts +1 −1
@@ -78,6 +78,6 @@ export const entry: PaletteEntry = {
7878 hint: "remove the old previews' data in one receipted step",
7979 after: ["maintenance", "maintenance-runs", "merged-branches"],
8080 asks: "forge.administer",
81 offered: mayAct,
81 for: "person",
8282 run: (session, ctx) => ctx.push(previewDirsScreen(session, ctx)),
8383 };
src/tui/screens/profile.ts +1 −1
@@ -227,6 +227,6 @@ export const entry: PaletteEntry = {
227227 title: "Your profile",
228228 hint: "display name and email",
229229 asks: "forge.read",
230 offered: (session) => session.user !== undefined && session.user.kind !== "agent",
230 for: "person",
231231 run: (session, ctx) => ctx.push(profileScreen(session, ctx)),
232232 };
src/tui/screens/quotas.ts +1 −1
@@ -105,6 +105,6 @@ export const entry: PaletteEntry = {
105105 hint: "what one account may own, and who changed it",
106106 after: ["people", "can"],
107107 asks: "forge.administer",
108 offered: (session) => session.user?.isAdmin === true && session.user.kind !== "agent",
108 for: "person",
109109 run: (session, ctx) => ctx.push(quotasScreen(session, ctx)),
110110 };

71 more files not shown.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs