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

Game pages: the address a friend is given works from outside, and the last game words say what they mean #17672

opened this

Merged 10h 58m ago, live in production

scout/forge:scout/17670-game-pages-the-address-a-friend-is-given → main 0 commits fork 2 threads · 2 unresolved

  • Merged. scout/17670-game-pages-the-address-a-friend-is-given was merged into main as 5623a57.

Review

Sign in to review this change.
23 files changed +355 −97
docs/features/game-settings.md +1 −1
@@ -8,7 +8,7 @@ row: Game settings
88
99 ## A change
1010
11 Change values and press **Preview**. The preview says what each change writes, for example `VIEW_DISTANCE 10 → 12 (env)` or `paper-world-defaults entities.spawning.per-player-mob-spawns true → false (patch)`, and that the server restarts. A value out of range, not one of the choices, or a key that cannot be changed here is refused with the reason. **Commit and restart** makes one commit, `games: <service> settings: <keys>`, on the commit you previewed. If the branch moved since, nothing is committed and the forge asks you to look again. The box applies it on its next sync, as it does an env change. The commit needs write access to the compose repository, as an env change does.
11 Change values and press **Preview**. The preview says what each change writes, for example `VIEW_DISTANCE 10 → 12 (env)` or `paper-world-defaults entities.spawning.per-player-mob-spawns true → false (patch)`, and that the server restarts. A value out of range, not one of the choices, or a key that cannot be changed here is refused with the reason. **Save and restart** makes one commit, `games: <service> settings: <keys>`, on the commit you previewed. If the branch moved since, nothing is committed and the forge asks you to look again. The box applies it on its next check-in, as it does an env change. The commit needs write access to the compose repository, as an env change does.
1212
1313 ## Where a value goes
1414
docs/features/games.md +11 −3
@@ -19,6 +19,14 @@ The agent sends every string plain: terminal colour escapes and control bytes (w
1919
2020 The agent keeps one firewall rule that closes the cloud's metadata address to the box's containers, looked for at each start and each sync. A box whose firewall refuses it says so among its status lines.
2121
22 ## Words on the pages
23
24 The page, the terminal and this file say these the same way: **Preview it** (was "Plan it"): shows what a new server would add; nothing changes until Create it. **Save change** (was "Commit", the environment form): saved in the network's file; the box applies it at its next **check-in** (was "sync"), a few seconds on. **Keep it running** (was "Keep it warm"): the server runs whether or not anyone is on it. The proxy's **list of servers new players land on first** (was "try list").
25
26 ## Where a friend joins
27
28 `/games/<box>` and the terminal's Games screen give the machine's public name (else its public IP address), with `:port` added when the proxy publishes the game's 25565 on another port (`proxyPort`, `src/games/sleep.ts`, read from the compose file). When the only name is a private one (a tailnet or LAN name, or a private IP address) the page says a friend outside cannot join with it and to give the machine a public name on the Infra page; it is not offered for Copy. With no machine name it says there is no address yet (`joinAddress`, `src/games/gist.ts`).
29
2230 ## Sleep and wake
2331
2432 Each game server is warm or sleeps when empty. A sleeping server container stops after 10 minutes with nobody on it, which frees all its memory (not the bill: the machine it runs on is billed in full, asleep or not), and starts again when a player joins through the proxy: the player waits on the join screen while it boots (measured 13.9 to 15.2 s for Paper 1.21.6 once its world exists, 30 s on its first boot). The Minecraft client gives up on a silent join after about 30 s, so a boot that takes longer means one rejoin.
@@ -62,14 +70,14 @@ Uploading a world file is still to come: a link is how a world comes in today.
6270
6371 ## New servers
6472
65 "Give me a new void world with FAWE and bedwars" makes a server (#17284 G6), on `/games/<box>` (New server: words, Plan it, then Create it), with `n` on the terminal Games screen, through the `games` tool `create_server` (`words`, or `name`, `level` and `plugins`; it plans, and commits with `dryRun: false` and the plan's `sha`) or from Talk. Every door commits only on the commit its plan was made on: when the repository moved, it says "The box changed since the preview; plan it again." The plan says, before anything is written:
73 "Give me a new void world with FAWE and bedwars" makes a server (#17284 G6), on `/games/<box>` (New server: words, Preview it, then Create it), with `n` on the terminal Games screen, through the `games` tool `create_server` (`words`, or `name`, `level` and `plugins`; it plans, and commits with `dryRun: false` and the plan's `sha`) or from Talk. Every door commits only on the commit its plan was made on: when the repository moved, it says "The box changed since the preview; preview it again." The plan says, before anything is written:
6674
6775 - the server: Paper at the network's own version, its world (void: one layer of air in the void biome; flat; or normal), its memory, sleeping when empty and waking on join;
6876 - each plugin resolved for its loader and version and pinned in its lockfile with what it requires, or refused if it does not run there (`fawe` and `worldedit` are FastAsyncWorldEdit, `bedwars` is Screaming BedWars);
6977 - the memory math, a sleeping server's heap counted free: "velocity 0.8G + hub 1G + survival 3G = 4.8G awake; bedwars 1.5G sleep, counted free; the box has 7.7G, 1G kept for itself: fits", refused when it does not;
7078 - where players join: `<name>.<the network's domain>` (the wildcard name already points at the box) or `/server <name>`.
7179
72 Creating it is one commit to the network's compose file: the service from the Paper anchor with its own RCON key, a volume, the proxy's `[servers]` and `[forced-hosts]` lines, sleep's label and waker lists, and its lockfile beside it. Remove on the server's row, `d` on the terminal Games screen, or `remove_server` takes the service and its proxy lines back out by commit, its plan shown first, and keeps its world's volume (`src/games/presets.ts`). The proxy, the waker, and a server the proxy's `try` list or another forced host still names are refused.
80 Creating it is one commit to the network's compose file: the service from the Paper anchor with its own RCON key, a volume, the proxy's `[servers]` and `[forced-hosts]` lines, sleep's label and waker lists, and its lockfile beside it. Remove on the server's row, `d` on the terminal Games screen, or `remove_server` takes the service and its proxy lines back out by commit, its plan shown first, and keeps its world's volume (`src/games/presets.ts`). The proxy, the waker, and a server the proxy's list of servers new players land on first (its `try` line) or another forced host still names are refused.
7381
7482 ## From in the game
7583
@@ -79,7 +87,7 @@ A linked name that holds any role on the server it types on, viewer too, can ask
7987
8088 A linked name that holds operator on the server it types on can also say:
8189
82 - `!forge give me a new void world with FAWE and bedwars`: planned like `create_server` (see New servers), and the plan's lines and memory math come back in chat, then "type !forge yes within 5 minutes". `!forge yes` commits that plan as the linked account, or says "The box changed since the preview; plan it again." when the repository moved; `!forge no` drops it. A plan answers only the same name on the same server. It changes the whole network, so it takes operator of the box, asked at the plan, at the yes and again right before the commit; operator of one server is refused.
90 - `!forge give me a new void world with FAWE and bedwars`: planned like `create_server` (see New servers), and the plan's lines and memory math come back in chat, then "type !forge yes within 5 minutes". `!forge yes` commits that plan as the linked account, or says "The box changed since the preview; preview it again." when the repository moved; `!forge no` drops it. A plan answers only the same name on the same server. It changes the whole network, so it takes operator of the box, asked at the plan, at the yes and again right before the commit; operator of one server is refused.
8391 - `!forge help`.
8492 - `!forge <anything else>`: a new Talk conversation of the linked account. The crew's first answer comes back in chat (its first lines, then a link to the conversation): nothing the account could not read on the forge itself.
8593
src/games/ask.ts +3 −5
@@ -13,7 +13,7 @@ import { composeServices, serviceEnv } from "./compose.ts";
1313 import { peopleOf } from "./people.ts";
1414 import { needLines, whyLines } from "./player_events.ts";
1515 import { forcedHosts } from "./presets.ts";
16 import { proxyOf } from "./sleep.ts";
16 import { proxyOf, proxyPort } from "./sleep.ts";
1717 import { mayDo, roleOn, servicesOf, type GameBox } from "./store.ts";
1818
1919 export type Question =
@@ -84,10 +84,8 @@ export async function answerTo(app: App, user: User, box: GameBox, compose: stri
8484 function addressLines(compose: string, seen: readonly string[]): string[] {
8585 const hosts = forcedHosts(compose).filter((h) => seen.includes(h.server));
8686 if (hosts.length === 0) return ["This network's file names no address. Use the one you joined with."];
87 const proxy = proxyOf(compose);
88 const ports = (Bun.YAML.parse(compose) as { services: Record<string, { ports?: unknown }> }).services[proxy ?? ""]?.ports;
89 const published = Array.isArray(ports) ? ports.map((p) => /^(?:[\d.]+:)?(\d+):25565(?:\/tcp)?$/.exec(String(p))?.[1]).find((p) => p !== undefined) : undefined;
90 const port = published === undefined || published === "25565" ? "" : `:${published}`;
87 const published = proxyPort(compose);
88 const port = published === 25565 ? "" : `:${String(published)}`;
9189 const [main, ...rest] = hosts;
9290 return [`Address: ${main!.host}${port}`, ...rest.map((h) => `${h.server}: ${h.host}${port}`)];
9391 }
src/games/chat.ts +3 −3
@@ -536,7 +536,7 @@ export function runChat(app: App, boxId: string): Promise<void> {
536536 }
537537 }
538538 } catch (e) {
539 if (!app.closing.signal.aborted) app.log.error("!forge commands stopped until the next sync", { error: String(e) });
539 if (!app.closing.signal.aborted) app.log.error("!forge commands stopped until the next check-in", { error: String(e) });
540540 } finally {
541541 boxes.delete(boxId);
542542 }
@@ -604,7 +604,7 @@ async function runJob(app: App, box: GameBox, job: Job): Promise<void> {
604604 if (job.name !== "") {
605605 const compose = await readCompose(app, box);
606606 if (compose !== undefined && compose.sha !== job.sha && composeServices(compose.text).includes(job.name))
607 return finish(app, box, job, `built ${compose.sha.slice(0, 10)}`, [`${job.name} is in the network. The box brings it up on its next sync.`], "green");
607 return finish(app, box, job, `built ${compose.sha.slice(0, 10)}`, [`${job.name} is in the network. The box brings it up on its next check-in.`], "green");
608608 }
609609 const wish = await wishOn(app, box, job.words);
610610 const planned = await planServer(app, box, wish);
@@ -615,7 +615,7 @@ async function runJob(app: App, box: GameBox, job: Job): Promise<void> {
615615 db.query("UPDATE game_chat_job SET name = ?2 WHERE id = ?1").run(job.id, wish.name);
616616 const done = await commitServer(app, still, box, planned.value, job.sha);
617617 if (!done.ok) return finish(app, box, job, done.error, [`Not built: ${done.error}`], "red");
618 finish(app, box, job, `built ${done.sha.slice(0, 10)}`, [`${planned.value.done}. The box brings it up on its next sync.`], "green");
618 finish(app, box, job, `built ${done.sha.slice(0, 10)}`, [`${planned.value.done}. The box brings it up on its next check-in.`], "green");
619619 }
620620
621621 /**
src/games/gist.ts +45 −3
@@ -6,6 +6,8 @@
66 */
77
88 import type { Database } from "bun:sqlite";
9 import { isIP } from "node:net";
10 import { isPublicAddress } from "../apps/egress.ts";
911 import { peopleOf } from "./people.ts";
1012 import type { GameService } from "./store.ts";
1113
@@ -51,11 +53,51 @@ export function nowWords(s: GameService | undefined, pending: string | undefined
5153 /** The one button a server leads with: Start while it is not running, else Restart. */
5254 export const mainPower = (s: GameService | undefined): "start" | "restart" => (s?.state === "running" && s.asleep !== true ? "restart" : "start");
5355
56 const NAME = /^[a-z0-9][a-z0-9.-]{0,252}$/i;
57 /** Names that only resolve inside a network: a tailnet, a LAN, a router's own. */
58 const PRIVATE_NAME = /(^[^.]+$|\.(ts\.net|local|lan|internal|home\.arpa|localdomain|localhost|intranet|corp|home)$)/i;
59
5460 /**
55 * Where a friend joins: the box's machine name (the game's own port, 25565, is the default), or
56 * none yet.
61 * Whether a friend outside can reach this name: a public IP address, or a name with a public
62 * ending.
5763 */
58 export const joinAddress = (host: string | undefined): string | undefined => (host !== undefined && /^[a-z0-9][a-z0-9.-]{0,252}$/i.test(host) ? host : undefined);
64 function reachable(host: string): boolean {
65 if (isIP(host) !== 0) return isPublicAddress(host);
66 return NAME.test(host) && !PRIVATE_NAME.test(host) && !/^\d+(\.\d+){3}$/.test(host);
67 }
68
69 /**
70 * Where a friend joins: an address to hand out, or the one private name there is (not to be
71 * offered).
72 */
73 export type Join = { readonly address: string } | { readonly private: string };
74
75 /**
76 * Where a friend joins, from the box's machine records (its public name, else its public address):
77 * the name, then `:port` unless it is the game's own 25565. When the only name is a private one
78 * (tailnet, LAN, private IP) it comes back as `private`, never as an address. None when the machine
79 * has no name.
80 */
81 export function joinAddress(machine: { readonly host: string; readonly address: string } | undefined, port = 25565): Join | undefined {
82 const names = machine === undefined ? [] : [machine.host, machine.address].filter((h) => NAME.test(h) || isIP(h) !== 0);
83 const open = names.find(reachable);
84 if (open !== undefined) return { address: `${isIP(open) === 6 ? `[${open}]` : open}${port === 25565 ? "" : `:${String(port)}`}` };
85 return names[0] === undefined ? undefined : { private: names[0] };
86 }
87
88 /**
89 * What to tell the operator when the only name is private: why it is not offered, and what to set.
90 */
91 export const privateWords = (host: string): string =>
92 `The machine's only name is ${host}, a private one (a tailnet or LAN name, or a private IP address): a friend outside cannot join with it, so it is not offered to copy. Give the machine a public name or its public IP address on the Infra page, then it shows here.`;
93
94 /** What Save change does, beside the button on the page and the prompt in the terminal. */
95 export const SAVE_WORDS = "Saved in the network's file; the box applies it at its next check-in, a few seconds on.";
96 /** What Preview it does, beside its button and in the terminal. */
97 export const PREVIEW_WORDS = "Shows what would be added; nothing changes until you press Create it.";
98
99 /** The words when the box has no machine name at all. */
100 export const NO_ADDRESS = "There is no address to give yet: this box has no machine name, so a friend cannot join until it has one.";
59101
60102 /** Who is on, server by server. Servers nobody is on are left out. */
61103 export function whoIsOn(db: Database, boxId: string, services: readonly string[]): { service: string; names: string[] }[] {
src/games/mods.ts +2 −2
@@ -182,7 +182,7 @@ function diffLines(m: Mods, next: readonly Locked[], adopted: ReadonlySet<string
182182 lines.push(
183183 `VERSION is ${m.target.versionSaid}: these are for ${m.target.gameVersion}; set VERSION=${m.target.gameVersion} so the next Minecraft release does not outrun them`,
184184 );
185 lines.push(`Restarts the server with the new set on the box's next sync`);
185 lines.push(`Restarts the server with the new set on the box's next check-in`);
186186 return lines;
187187 }
188188
@@ -319,7 +319,7 @@ function packPlan(m: Mods, service: string, pack: LockedPack, verb: "install" |
319319 ...(m.lock.length === 0 ? [] : [`Removes ${m.lock.map((l) => l.title).join(", ")}: a modpack server takes its mods from the pack`]),
320320 ...(m.loose.length === 0 ? [] : [`Drops ${m.loose.join(", ")} from MODRINTH_PROJECTS`]),
321321 "The image does not check a pack's file hashes; the lockfile keeps each one, so any change shows in review",
322 "Restarts the server with the pack on the box's next sync",
322 "Restarts the server with the pack on the box's next check-in",
323323 ];
324324 return {
325325 lines,
src/games/player_events.ts +1 −1
@@ -350,7 +350,7 @@ export function findingsOf(db: Database, boxId: string, service: string, now = n
350350 // Tried with Velocity 3.5.1, a Fabric server and an unmodded client (2026-12-02): without
351351 // AutoStopper in between, Velocity says the reason and sends the player to its next server.
352352 if (g.text === "")
353 fix.push(`Turn Sleep off for ${service}: the player then sees the reason and lands on another server. Tested with Velocity 3.5.1. The proxy's try list must hold another server.`);
353 fix.push(`Turn Sleep off for ${service}: the player then sees the reason and lands on another server. Tested with Velocity 3.5.1. The proxy's list of servers new players land on first must hold another server.`);
354354 if (fix.length === 0) fix.push(`Read the reason, then ${service}'s console at that time.`);
355355 return { says: `${String(g.n)} joins to ${service} were refused in the last day.${g.text === "" ? " The proxy did not log why." : ` ${service} said: ${g.text}`}`, fix, at: g.at };
356356 });
src/games/presets.ts +2 −2
@@ -194,7 +194,7 @@ function serverEnv(text: string, wish: Wish): Record<string, string> {
194194 return env;
195195 }
196196
197 const CHANGED = "The box changed since the preview; plan it again.";
197 const CHANGED = "The box changed since the preview; preview it again.";
198198
199199 export interface ServerPlan {
200200 readonly lines: readonly string[];
@@ -322,7 +322,7 @@ export async function planRemoveServer(app: App, box: GameBox, name: string): Pr
322322 // Still in the proxy's `try` or another name's forced host: without it players would land
323323 // nowhere.
324324 if (text.split("\n").some((l) => /^\s+(try|"[a-z0-9.-]+")\s*=\s*\[/.test(l) && l.includes(`"${name}"`)))
325 throw new Error(`The proxy sends players to ${name} (its try list or a forced host); change that first.`);
325 throw new Error(`The proxy sends players to ${name} (the proxy's list of servers new players land on first, or a forced host); change that first.`);
326326 } catch (e) {
327327 return { ok: false, error: e instanceof Error ? e.message : String(e) };
328328 }
src/games/settings.ts +1 −1
@@ -528,7 +528,7 @@ export function planSettings(
528528 const theirs = env["PATCH_DEFINITIONS"];
529529 if (patchChanges.length > 0 && theirs !== undefined && theirs !== PATCH_TARGET)
530530 return { ok: false, error: `${service} already takes its patches from ${theirs}; change Paper's settings there.` };
531 lines.push("Restarts the server with the new settings on the box's next sync");
531 lines.push("Restarts the server with the new settings on the box's next check-in");
532532 const edit = (base: string): string => {
533533 const baseEnv = serviceEnv(base, service);
534534 const sets: Record<string, string> = { ...envChanges };
src/games/sleep.ts +8
@@ -104,6 +104,14 @@ export function proxyOf(text: string): string | undefined {
104104 return Object.keys(doc.services ?? {}).find((s) => isProxy(doc, s));
105105 }
106106
107 /** The port players join on: the proxy's published port for the game's 25565, else 25565 itself. */
108 export function proxyPort(text: string): number {
109 const proxy = proxyOf(text);
110 const ports = (Bun.YAML.parse(text) as { services?: Record<string, { ports?: unknown }> }).services?.[proxy ?? ""]?.ports;
111 const published = Array.isArray(ports) ? ports.map((p) => /^(?:[\d.]+:)?(\d+):25565(?:\/tcp)?$/.exec(String(p))?.[1]).find((p) => p !== undefined) : undefined;
112 return published === undefined ? 25565 : Number(published);
113 }
114
107115 /** Whether a service is a game server, on any image: one a player can be on, so neither the waker nor the proxy. */
108116 export const isGameServer = (text: string, service: string): boolean => !isWaker(service) && !isProxy(parse(text), service);
109117
src/http/mcp/tools/games.ts +8 −8
@@ -105,7 +105,7 @@ export const tool: Tool = {
105105 if (!planned.ok) return bad("refused", planned.error);
106106 if (args["dryRun"] !== false) return good({ planned: true, says: "This is the plan; send dryRun: false with this sha to commit it.", sha: planned.value.sha, lines: planned.value.lines });
107107 const done = await commitServer(ctx.app, user, box, planned.value, str(args["sha"]));
108 return done.ok ? good({ says: `${planned.value.done} (${done.sha.slice(0, 10)}); the box brings it up on its next sync.`, sha: done.sha, lines: planned.value.lines }) : bad("refused", done.error);
108 return done.ok ? good({ says: `${planned.value.done} (${done.sha.slice(0, 10)}); the box brings it up on its next check-in.`, sha: done.sha, lines: planned.value.lines }) : bad("refused", done.error);
109109 }
110110 const service = str(args["service"]);
111111 if (action === "metrics") {
@@ -139,7 +139,7 @@ export const tool: Tool = {
139139 if (action === "console") {
140140 const text = str(args["text"]).trim();
141141 if (text === "") return bad("invalid", "say the command as text");
142 return good({ says: "Queued; the box runs it on its next sync.", id: queueCommand(db, box.id, service, "rcon", text, user.id) });
142 return good({ says: "Queued; the box runs it on its next check-in.", id: queueCommand(db, box.id, service, "rcon", text, user.id) });
143143 }
144144 if (action === "power") {
145145 const kind = str(args["kind"]);
@@ -149,7 +149,7 @@ export const tool: Tool = {
149149 if (action === "env") {
150150 const value = str(args["value"]);
151151 const done = await commitServiceEnv(ctx.app, user, box, service, { [str(args["key"])]: value === "" ? null : value });
152 return done.ok ? good({ says: `Committed ${done.sha.slice(0, 10)}.`, sha: done.sha }) : bad("refused", done.error);
152 return done.ok ? good({ says: `Saved ${done.sha.slice(0, 10)}.`, sha: done.sha }) : bad("refused", done.error);
153153 }
154154 if (action.startsWith("mods")) {
155155 const mods = await modsOf(ctx.app, box, service);
@@ -207,7 +207,7 @@ export const tool: Tool = {
207207 if (args["dryRun"] !== false) return good({ planned: true, says: "This is the plan; send dryRun: false to commit it.", lines: planned.value.lines });
208208 const done = await commitPlan(ctx.app, user, box, service, m, planned.value);
209209 return done.ok
210 ? good({ says: `${planned.value.done} (${done.value.slice(0, 10)}); the server restarts with it on the box's next sync.`, sha: done.value, lines: planned.value.lines })
210 ? good({ says: `${planned.value.done} (${done.value.slice(0, 10)}); the server restarts with it on the box's next check-in.`, sha: done.value, lines: planned.value.lines })
211211 : bad("refused", done.error);
212212 }
213213 if (action === "people") {
@@ -217,7 +217,7 @@ export const tool: Tool = {
217217 return good({ service, online, ...lists, network: networkOf(db, box.id), latest: eventsOf(db, box.id, service, 50), findings: kickFindingsOf(db, box.id, service), refusals: findingsOf(db, box.id, service) });
218218 }
219219 const queued = await queuePeople(ctx.app, box, service, op, str(args["player"]), user, str(args["to"]));
220 return queued.ok ? good({ says: `Queued: ${peopleWords(JSON.stringify({ op, player: str(args["player"]), server: str(args["to"]) }))}; the box does it on its next sync.`, id: queued.id }) : bad("refused", queued.error);
220 return queued.ok ? good({ says: `Queued: ${peopleWords(JSON.stringify({ op, player: str(args["player"]), server: str(args["to"]) }))}; the box does it on its next check-in.`, id: queued.id }) : bad("refused", queued.error);
221221 }
222222 if (action === "config_set") {
223223 const plan = await previewSettings(ctx.app, box, service, { [str(args["key"])]: str(args["value"]) });
@@ -225,13 +225,13 @@ export const tool: Tool = {
225225 if (args["dryRun"] !== false)
226226 return good({ lines: plan.value.lines, sha: plan.value.sha, says: "This is the plan; nothing changed. Send dryRun: false to commit it." });
227227 const done = await commitSettings(ctx.app, user, box, service, plan.value);
228 return done.ok ? good({ says: `Committed ${done.value.slice(0, 10)}; the server restarts on the box's next sync.`, lines: plan.value.lines, sha: done.value }) : bad("refused", done.error);
228 return done.ok ? good({ says: `Saved ${done.value.slice(0, 10)}; the server restarts on the box's next check-in.`, lines: plan.value.lines, sha: done.value }) : bad("refused", done.error);
229229 }
230230 if (action === "sleep") {
231231 const policy = str(args["value"]);
232232 if (policy !== "warm" && policy !== "sleep") return bad("invalid", "value is warm or sleep");
233233 const done = await commitPolicy(ctx.app, user, box, service, policy);
234 return done.ok ? good({ says: `${service} ${policy === "sleep" ? "sleeps when empty" : "stays warm"} once the box redeploys (${done.sha.slice(0, 10)}).`, sha: done.sha }) : bad("refused", done.error);
234 return done.ok ? good({ says: `${service} ${policy === "sleep" ? "sleeps when empty" : "stays running"} once the box redeploys (${done.sha.slice(0, 10)}).`, sha: done.sha }) : bad("refused", done.error);
235235 }
236236 if (action === "world") {
237237 const op = str(args["op"]);
@@ -245,7 +245,7 @@ export const tool: Tool = {
245245 : ({ ok: false, error: "op is import, restore or snapshot" } as const);
246246 // The link is a secret: only its host and path come back.
247247 return queued.ok
248 ? good({ says: "Queued; the box runs it on its next sync and reports each step.", id: queued.id, ...(op === "import" ? { from: linkShown(str(args["url"])) } : {}) })
248 ? good({ says: "Queued; the box runs it on its next check-in and reports each step.", id: queued.id, ...(op === "import" ? { from: linkShown(str(args["url"])) } : {}) })
249249 : bad("refused", queued.error);
250250 }
251251 return bad("bad_action", "action is list, metrics, console, power, env, mods, mods_search, mods_pack_search, mods_install, mods_update, mods_remove, mods_pack, people, config, config_set, sleep or world");
src/tui/screens/game_mods.ts +1 −1
@@ -134,7 +134,7 @@ export function gameModsScreen(f: Session, ctx: Ctx, box: GameBox, service: stri
134134 hits = [];
135135 await load();
136136 }
137 say(done.ok ? `${plan.done} (${done.value.slice(0, 10)}); the server restarts with it on the box's next sync.` : done.error);
137 say(done.ok ? `${plan.done} (${done.value.slice(0, 10)}); the server restarts with it on the box's next check-in.` : done.error);
138138 });
139139 } else return false;
140140 return true;
src/tui/screens/games.ts +38 −23
@@ -1,11 +1,12 @@
11 /**
22 * Games in the terminal (forge games): every service of every game box the person may see, as
33 * /games lists them, with `s` start, `x` stop and `r` restart for an operator, each queued for the
4 * box's next sync through `games/store.ts`, the same queue the page and the MCP tool use. `enter`
5 * opens a service as /games/<box>/<service> does: its console (the log tail, and `:` queues an
6 * rcon command), its env (`e` sets or clears a key, committed through `commitServiceEnv`) and its
7 * Modrinth projects (`m` opens them: `game_mods.ts`, the page's model; uploading a jar is the
8 * page's alone); `c` opens its settings (server.properties and Paper's, as the page's Settings block:
4 * box's next check-in through `games/store.ts`, the same queue the page and the MCP tool use.
5 * `enter` opens a service as /games/<box>/<service> does: its console (the log tail, and `:` queues
6 * an rcon command), its env (`e` sets or clears a key, committed through `commitServiceEnv`) and
7 * its Modrinth projects (`m` opens them: `game_mods.ts`, the page's model; uploading a jar is the
8 * page's alone); `c` opens its settings (server.properties and Paper's, as the page's Settings
9 * block:
910 * `enter` sets one, the preview shows on top, `y` commits it through `commitSettings`). `G` opens
1011 * the box's grants, which an owner sets with `a` there, through `grant`; `b` the box itself, as
1112 * /games/<box>'s Box block (its diagnosis, the volume's device and log among it).
@@ -14,10 +15,10 @@
1415 import { movedKey } from "./moved_key.ts";
1516 import { emptyText } from "../../core/empty_words.ts";
1617 import { consoleText, crashOf } from "../../games/console.ts";
17 import { commitPolicy, policyOf, STILL_BILLED } from "../../games/sleep.ts";
18 import { commitPolicy, policyOf, proxyPort, STILL_BILLED } from "../../games/sleep.ts";
1819 import { SHELL_SERVICE, queueShell } from "../../games/shell.ts";
1920 import { watchBox } from "../../games/notify.ts";
20 import { joinAddress, nowWords, powerNow } from "../../games/gist.ts";
21 import { joinAddress, NO_ADDRESS, nowWords, powerNow, PREVIEW_WORDS, privateWords, SAVE_WORDS } from "../../games/gist.ts";
2122 import { findingLine, findingsOf as kickFindingsOf } from "../../games/findings.ts";
2223 import { eventsOf, eventWords, isBedrock, peopleOf, peopleWords, queuePeople } from "../../games/people.ts";
2324 import { findingsOf } from "../../games/player_events.ts";
@@ -80,11 +81,25 @@ export function gamesScreen(f: Session, ctx: Ctx): Screen {
8081 const line = row === undefined ? undefined : cloudLine(f.app, row);
8182 return line === undefined ? [] : [{ title: `${b.name}'s machine`, secondary: line, meta: "" }];
8283 });
84 /** The port each box's proxy publishes, from its compose file once that is read. */
85 const ports = new Map<string, number>();
86 const readPorts = (): void => {
87 for (const b of listBoxes(f.app.db))
88 if (seesBox(f.app.db, f.user, b.id) && !ports.has(b.id))
89 void readCompose(f.app, b).then((c) => {
90 if (c === undefined) return;
91 ports.set(b.id, proxyPort(c.text));
92 ctx.invalidate();
93 });
94 };
95 readPorts();
96 const firstBox = (): GameBox | undefined => listBoxes(f.app.db).find((b) => seesBox(f.app.db, f.user, b.id));
8397 /** How to join, as the page says it: the address of the first box's machine. */
8498 const joinLine = (): string => {
85 const box = listBoxes(f.app.db).find((b) => seesBox(f.app.db, f.user, b.id));
86 const address = box === undefined ? undefined : joinAddress(pinnedOfBox(f.app, box)?.host);
87 return address === undefined ? "Each service of each game box you may see. There is no address to join yet: no machine name." : `To join, add this server in Minecraft: ${address}`;
99 const box = firstBox();
100 const join = box === undefined ? undefined : joinAddress(pinnedOfBox(f.app, box), ports.get(box.id) ?? 25565);
101 if (join === undefined) return `Each service of each game box you may see. ${NO_ADDRESS}`;
102 return "address" in join ? `To join, add this server in Minecraft: ${join.address}` : privateWords(join.private);
88103 };
89104 const rows = () =>
90105 listBoxes(f.app.db)
@@ -126,7 +141,7 @@ export function gamesScreen(f: Session, ctx: Ctx): Screen {
126141 binding(["r"], "restart"),
127142 binding(["n"], "new server"),
128143 binding(["d"], "remove a server"),
129 binding(["z"], "sleep when empty, or keep warm"),
144 binding(["z"], "sleep when empty, or keep running"),
130145 binding(["L"], "link your Minecraft name (!forge)"),
131146 ],
132147 render(area, s) {
@@ -202,7 +217,7 @@ export function gamesScreen(f: Session, ctx: Ctx): Screen {
202217 ctx.push(
203218 promptScreen(ctx, screen, {
204219 title: `New server on ${box.name}`,
205 label: "What kind (a void world with FAWE and bedwars)",
220 label: `What kind (a void world with FAWE and bedwars). ${PREVIEW_WORDS}`,
206221 onSubmit: async (words) => {
207222 showPlan(box, `New server on ${box.name}`, "Create it", await planServer(f.app, box, await wishOn(f.app, box, words)));
208223 },
@@ -223,12 +238,12 @@ export function gamesScreen(f: Session, ctx: Ctx): Screen {
223238 if (!mayDo(roleOn(f.app.db, f.user, at.box.id, at.service.name), "operator")) note = `You are not an operator of ${at.service.name}.`;
224239 else {
225240 const { box, service } = at;
226 note = `${box.name}/${service.name}: committing…`;
241 note = `${box.name}/${service.name}: saving…`;
227242 void (async () => {
228243 const compose = await readCompose(f.app, box);
229244 const next = compose !== undefined && policyOf(compose.text, service.name) === "sleep" ? "warm" : "sleep";
230245 const done = await commitPolicy(f.app, f.user!, box, service.name, next);
231 note = done.ok ? `${box.name}/${service.name} ${next === "sleep" ? "sleeps when empty" : "stays warm"} once the box redeploys (${done.sha.slice(0, 10)}).${next === "sleep" ? ` ${STILL_BILLED}` : ""}` : done.error;
246 note = done.ok ? `${box.name}/${service.name} ${next === "sleep" ? "sleeps when empty" : "stays running"} once the box redeploys (${done.sha.slice(0, 10)}).${next === "sleep" ? ` ${STILL_BILLED}` : ""}` : done.error;
232247 ctx.invalidate();
233248 })();
234249 }
@@ -311,7 +326,7 @@ export function gameServiceScreen(f: Session, ctx: Ctx, box: GameBox, service: s
311326 if (!loaded) return ["Reading the compose file…"];
312327 if (compose === undefined) return [`No ${box.path} on ${box.repo}@${box.branch}.`];
313328 const env = Object.entries(serviceEnv(compose, service));
314 return env.length === 0 ? ["No environment set for this service."] : env.map(([k, v]) => `${k}=${v}`);
329 return [...(env.length === 0 ? ["No environment set for this service."] : env.map(([k, v]) => `${k}=${v}`)), `e sets one. ${SAVE_WORDS}`];
315330 };
316331 const ask = (title: string, label: string, run: (value: string) => Promise<string>, history?: readonly string[]): void => {
317332 if (!operator()) return say(`You are not an operator of ${service}.`);
@@ -370,7 +385,7 @@ export function gameServiceScreen(f: Session, ctx: Ctx, box: GameBox, service: s
370385 return "Sent; the answer shows under the console.";
371386 }, commandHistory(f.app.db, box.id, service));
372387 else if (e.key === "e")
373 ask("Env", "KEY=VALUE (an empty value removes the key)", async (raw) => {
388 ask("Env", `KEY=VALUE (an empty value removes the key). ${SAVE_WORDS}`, async (raw) => {
374389 const at = raw.indexOf("=");
375390 const key = (at < 0 ? raw : raw.slice(0, at)).trim();
376391 const value = at < 0 ? "" : raw.slice(at + 1);
@@ -378,7 +393,7 @@ export function gameServiceScreen(f: Session, ctx: Ctx, box: GameBox, service: s
378393 if (!done.ok) return done.error;
379394 part = "env";
380395 await load();
381 return `Committed ${done.sha.slice(0, 10)}; the box redeploys on its next sync.`;
396 return `Saved ${done.sha.slice(0, 10)}; the box redeploys on its next check-in.`;
382397 });
383398 else if (e.key === "c") ctx.push(gameSettingsScreen(f, ctx, box, service));
384399 else if (e.key === "p")
@@ -393,7 +408,7 @@ export function gameServiceScreen(f: Session, ctx: Ctx, box: GameBox, service: s
393408 const world = (op: WorldOp): string => {
394409 const queued = queueWorld(f.app.db, boxNamed(f.app.db, box.name) ?? box, service, op, f.user);
395410 part = "world";
396 return queued.ok ? "Asked: the box starts on its next sync, and its steps show here." : queued.error;
411 return queued.ok ? "Asked: the box starts on its next check-in, and its steps show here." : queued.error;
397412 };
398413 if (e.key === "i") ask("Import a world", "A link to a .zip or .tar.gz with its level.dat (the world it has is kept first)", async (url) => world({ op: "import", url }));
399414 else if (e.key === "u")
@@ -490,9 +505,9 @@ export function gameSettingsScreen(f: Session, ctx: Ctx, box: GameBox, service:
490505 wanted = {};
491506 plan = undefined;
outdated

Leftover 'Committing…' beside the new 'Saved' wording on the same screen (box 3). Say 'Saving…'.

492507 await load();
493 say(`Committed ${done.value.slice(0, 10)}; the server restarts with the new settings on the box's next sync.`);
508 say(`Saved ${done.value.slice(0, 10)}; the server restarts with the new settings on the box's next check-in.`);
494509 });
495 return say("Committing…");
510 return say("Saving…");
496511 }
497512 if (e.key !== "enter") return false;
498513 const at = values[state.index];
@@ -545,7 +560,7 @@ export function gameBoxScreen(f: Session, ctx: Ctx, box: GameBox): Screen {
545560 }
546561 const plain = boxStatus(b.diag);
547562 const tails = boxTails(b.diag);
548 if (plain.length + tails.length === 0) return [...lend, ...spare, "The box has sent no diagnosis yet: its agent sends one with every sync."];
563 if (plain.length + tails.length === 0) return [...lend, ...spare, "The box has sent no diagnosis yet: its agent sends one with every check-in."];
549564 return [...lend, ...spare, ...plain, ...tails.flatMap(([k, v]) => ["", `== ${k}`, ...v.split("\n")])];
550565 };
551566 return {
@@ -639,7 +654,7 @@ export function gameShellScreen(f: Session, ctx: Ctx, box: GameBox): Screen {
639654 s.text(head!.x, head!.y, truncate(note !== "" ? note : `A shell on ${box.name}: bash -lc, 30 s, no terminal, 16 KB back. : runs one.`, head!.w), style(c.mutedFg, c.bg), head!.x + head!.w);
640655 const lines = recentCommands(f.app.db, box.id, SHELL_SERVICE, 10)
641656 .reverse()
642 .flatMap((cmd) => [`$ ${cmd.text}`, ...(cmd.done ? cmd.output.split("\n") : ["(waiting for the box's next sync)"])]);
657 .flatMap((cmd) => [`$ ${cmd.text}`, ...(cmd.done ? cmd.output.split("\n") : ["(waiting for the box's next check-in)"])]);
643658 lines.slice(-body!.h).forEach((l, i) => s.text(body!.x, body!.y + i, truncate(l, body!.w), style(c.fg, c.bg), body!.x + body!.w));
644659 },
645660 key(e) {
@@ -651,7 +666,7 @@ export function gameShellScreen(f: Session, ctx: Ctx, box: GameBox): Screen {
651666 onSubmit: (text) => {
652667 const queued = queueShell(f.app, f.user, box, text);
653668 if (!queued.ok) return queued.error;
654 note = "Sent; the answer shows here at the box's next sync.";
669 note = "Sent; the answer shows here at the box's next check-in.";
655670 ctx.invalidate();
656671 return undefined;
657672 },
src/web/pages/games.ts +27 −24
@@ -61,7 +61,7 @@ import { avatar, badge, btn, disclosure, field as input, row, rowList, time } fr
6161 import { watchBox } from "../../games/notify.ts";
6262 import { accountLinks, chatLog, newLinkCode, playersOn, unlink } from "../../games/chat.ts";
6363 import { commitServer, planRemoveServer, planServer, wishOn } from "../../games/presets.ts";
64 import { canSleep, commitPolicy, EMPTY_SECONDS, isGameServer, policyOf, STILL_BILLED } from "../../games/sleep.ts";
64 import { canSleep, commitPolicy, EMPTY_SECONDS, isGameServer, policyOf, proxyPort, STILL_BILLED } from "../../games/sleep.ts";
6565 import { CLOUD_EVENT, cloudFacts, GAME_CLOUD_EVENT, pinnedOfBox } from "../../actions/cloud_says.ts";
6666 import { topologyBlock, TOPOLOGY_CSS } from "./games_topology.ts";
6767 import { defaultHeadResponse, headResponse } from "../../games/heads.ts";
@@ -70,7 +70,7 @@ import { queueWorld, undoOf, worldWords } from "../../games/worlds.ts";
7070 import { emptyLine, emptyNote } from "../empty_words.ts";
7171 import { findingsOf, type GameFinding } from "../../games/player_events.ts";
7272 import { findingsOf as kickFindingsOf } from "../../games/findings.ts";
73 import { joinAddress, mainPower, nowWords, PEOPLE_BUTTON, PEOPLE_CHOICES, powerNow, whoIsOn } from "../../games/gist.ts";
73 import { joinAddress, mainPower, NO_ADDRESS, PREVIEW_WORDS, privateWords, SAVE_WORDS, nowWords, PEOPLE_BUTTON, PEOPLE_CHOICES, powerNow, whoIsOn } from "../../games/gist.ts";
7474 import { metricsSeries, playerEvents, recentErrors, type Point } from "../../games/metrics.ts";
7575 import { daySpark } from "../studio/kpi_row.ts";
7676
@@ -100,10 +100,10 @@ function newServerBlock(box: GameBox, words: string, preview: Awaited<ReturnType
100100 <h2>New server</h2>
101101 <form method="get" action="/games/${box.name}" class="row-fields">
102102 ${input({ name: "words", label: "What kind", placeholder: "a void world with FAWE and bedwars", required: true, value: words })}
103 ${btn("Plan it", { variant: "secondary" })}
103 ${btn("Preview it", { variant: "secondary" })}
104104 </form>
105105 ${preview === undefined
106 ? html`<p class="muted small">Void, flat or normal; FAWE, BedWars or LuckPerms by name; it sleeps when empty, so its memory counts free.</p>`
106 ? html`<p class="muted small">${PREVIEW_WORDS} Void, flat or normal; FAWE, BedWars or LuckPerms by name; it sleeps when empty, so its memory counts free.</p>`
107107 : preview.ok
108108 ? previewBlock(preview.value, `/games/${box.name}/servers`, { op: "create", words }, "Create it", `/games/${box.name}`)
109109 : html`<p role="alert">${preview.error}</p>`}
@@ -135,7 +135,7 @@ export async function gameServersSubmit(ctx: Ctx): Promise<Response> {
135135 : await planServer(ctx.app, got.box, await wishOn(ctx.app, got.box, field(form, "words")));
136136 if (!planned.ok) return flashTo(ctx, `/games/${got.box.name}`, { tone: "danger", message: planned.error });
137137 const done = await commitServer(ctx.app, ctx.auth.user!, got.box, planned.value, field(form, "sha"));
138 return flashTo(ctx, `/games/${got.box.name}`, done.ok ? { message: `${planned.value.done} (${done.sha.slice(0, 10)}); the box brings it up on its next sync.` } : { tone: "danger", message: done.error });
138 return flashTo(ctx, `/games/${got.box.name}`, done.ok ? { message: `${planned.value.done} (${done.sha.slice(0, 10)}); the box brings it up on its next check-in.` } : { tone: "danger", message: done.error });
139139 }
140140
141141 function boxOf(ctx: Ctx, need: Role, service = ""): { box: GameBox; role: Role } | Response {
@@ -243,15 +243,17 @@ const power = (box: GameBox, service: string, s: GameService | undefined, extra:
243243 * How to join and who is on, the box page's first lines: the address with Copy, then each server's
244244 * people.
245245 */
246 function joinBlock(ctx: Ctx, box: GameBox, names: readonly string[]): Html {
246 function joinBlock(ctx: Ctx, box: GameBox, names: readonly string[], compose: string | undefined): Html {
247247 const machine = pinnedOfBox(ctx.app, box);
248 const address = joinAddress(machine?.host);
248 const join = joinAddress(machine, compose === undefined ? 25565 : proxyPort(compose));
249249 const on = whoIsOn(ctx.app.db, box.id, names);
250250 return html`<section class="settings-block" id="join">
251251 <h2>How to join</h2>
252 ${address === undefined
253 ? html`<p class="muted">There is no address to give yet: this box has no machine name, so a friend cannot join until it has one.</p>`
254 : rowList([row({ title: html`<code class="mono" id="game-address">${address}</code>`, meta: html`In Minecraft: Multiplayer, Add Server, paste this.`, trail: btn("Copy", { type: "button", copy: "game-address", icon: "copy", size: "sm", label: "Copy the server address" }) })])}
252 ${join === undefined
253 ? html`<p class="muted">${NO_ADDRESS}</p>`
254 : "address" in join
255 ? rowList([row({ title: html`<code class="mono" id="game-address">${join.address}</code>`, meta: html`In Minecraft: Multiplayer, Add Server, paste this.`, trail: btn("Copy", { type: "button", copy: "game-address", icon: "copy", size: "sm", label: "Copy the server address" }) })])
256 : html`<p class="muted" id="game-address-private">${privateWords(join.private)}</p>`}
255257 ${on.length === 0 ? html`<p class="muted small">Nobody is on right now.</p>` : html`<p>On now: ${on.map((x, i) => html`${i === 0 ? "" : "; "}<a href="/games/${box.name}/${x.service}">${x.service}</a>: ${x.names.join(", ")}`)}</p>`}
256258 </section>`;
257259 }
@@ -290,7 +292,7 @@ export async function gameBoxPage(ctx: Ctx): Promise<Response> {
290292 ${cloud === undefined
291293 ? null
292294 : html`<div id="game-machine" data-live="${CLOUD_EVENT},${GAME_CLOUD_EVENT}">${rowList([row({ title: "Its machine", facts: [cloud] })])}</div>`}
293 ${joinBlock(ctx, box, visible)}
295 ${joinBlock(ctx, box, visible, compose?.text)}
294296 ${visible.length === 0
295297 ? emptyLine("gameServices")
296298 : rowList(
@@ -328,7 +330,7 @@ export async function gameBoxPage(ctx: Ctx): Promise<Response> {
328330 */
329331 function shellBlock(ctx: Ctx, box: GameBox): Html {
330332 const done = recentCommands(ctx.app.db, box.id, SHELL_SERVICE, 10).reverse();
331 const lines = done.flatMap((c) => [`$ ${c.text}`, c.done ? c.output : "(waiting for the box's next sync)"]);
333 const lines = done.flatMap((c) => [`$ ${c.text}`, c.done ? c.output : "(waiting for the box's next check-in)"]);
332334 return html`<section class="settings-block" id="shell">
333335 <h2>Console</h2>
334336 <p class="muted small">A shell on ${box.name}: each command runs as <code>bash -lc</code> for at most 30 s, with no terminal, and says back at most 16 KB. Every command and its output go to the audit.</p>
@@ -342,7 +344,7 @@ ${lines.join("\n")}${lines.length > 0 ? "\n" : ""}</pre
342344 </section>`;
343345 }
344346
345 // POST /games/:box/@shell: the owner's shell command, queued for the box's next sync.
347 // POST /games/:box/@shell: the owner's shell command, queued for the box's next check-in.
346348 export async function gameShellSubmit(ctx: Ctx): Promise<Response> {
347349 const got = boxOf(ctx, "owner");
348350 if (got instanceof Response) return got;
@@ -412,7 +414,7 @@ function boxBlock(box: GameBox, packs: readonly string[]): Html {
412414 return html`<section class="settings-block">
413415 <h2>Box</h2>
414416 ${lines.length === 0 && raw.length === 0
415 ? html`<p class="muted">The box has sent no diagnosis yet: its agent sends one with every sync.</p>`
417 ? html`<p class="muted">The box has sent no diagnosis yet: its agent sends one with every check-in.</p>`
416418 : html`${lines.map((l) => html`<p>${l}</p>`)}
417419 ${raw.length === 0
418420 ? null
@@ -638,7 +640,8 @@ ${rawView ? tail.lines.join("\n") : raw(consoleHtml(tail.lines).join("\n"))}${ta
638640 ${act
639641 ? html`<form method="post" action="${base}/env" class="row-fields">
640642 ${input({ name: "key", label: "Key", required: true, mono: true })}
641 ${input({ name: "value", label: "Value (empty removes it)", mono: true })} ${btn("Commit", { variant: "secondary" })}
643 ${input({ name: "value", label: "Value (empty removes it)", mono: true })} ${btn("Save change", { variant: "secondary" })}
644 <span class="muted small">${SAVE_WORDS}</span>
642645 </form>`
643646 : null}
644647 </section>`)}
@@ -1009,7 +1012,7 @@ export async function gameWorldSubmit(ctx: Ctx): Promise<Response> {
10091012 : op === "snapshot"
10101013 ? queueWorld(ctx.app.db, got.box, got.service, { op: "snapshot" }, ctx.auth.user)
10111014 : ({ ok: false, error: "Choose import, restore or snapshot." } as const);
1012 return flashTo(ctx, back, queued.ok ? { message: "Asked: the box starts on its next sync, and its steps show under World." } : { tone: "danger", message: queued.error });
1015 return flashTo(ctx, back, queued.ok ? { message: "Asked: the box starts on its next check-in, and its steps show under World." } : { tone: "danger", message: queued.error });
10131016 }
10141017
10151018 async function operatorForm(ctx: Ctx): Promise<{ box: GameBox; service: string; form: Form } | Response> {
@@ -1034,7 +1037,7 @@ export async function gameCrashShare(ctx: Ctx): Promise<Response> {
10341037 return flashTo(ctx, `${back}?shared=${shared.id}`, { message: `Shared publicly on mclo.gs: https://mclo.gs/${shared.id}` });
10351038 }
10361039
1037 // POST /games/:box/:service/command: an RCON command, queued for the box's next sync.
1040 // POST /games/:box/:service/command: an RCON command, queued for the box's next check-in.
10381041 export async function gameCommandSubmit(ctx: Ctx): Promise<Response> {
10391042 const got = await operatorForm(ctx);
10401043 if (got instanceof Response) return got;
@@ -1111,7 +1114,7 @@ function settingsBlock(o: {
11111114 <form method="post" action="${o.base}/settings" class="row-fields">
11121115 ${o.preview.value.keys.map((k) => html`<input type="hidden" name="s.${k}" value="${o.wanted[k] ?? ""}" />`)}
11131116 <input type="hidden" name="sha" value="${o.sha}" />
1114 ${btn("Commit and restart", { variant: "primary" })} ${btn("Cancel", { variant: "ghost", href: `${o.base}#settings` })}
1117 ${btn("Save and restart", { variant: "primary" })} ${btn("Cancel", { variant: "ghost", href: `${o.base}#settings` })}
11151118 </form>
11161119 </div>
11171120 </div>`
@@ -1151,7 +1154,7 @@ export async function gameSettingsSubmit(ctx: Ctx): Promise<Response> {
11511154 return flashTo(
11521155 ctx,
11531156 back,
1154 done.ok ? { message: `Committed ${done.value.slice(0, 10)}; the server restarts with the new settings on the box's next sync.` } : { tone: "danger", message: done.error },
1157 done.ok ? { message: `Saved ${done.value.slice(0, 10)}; the server restarts with the new settings on the box's next check-in.` } : { tone: "danger", message: done.error },
11551158 );
11561159 }
11571160
@@ -1166,7 +1169,7 @@ export async function gameEnvSubmit(ctx: Ctx): Promise<Response> {
11661169 ctx,
11671170 `/games/${got.box.name}/${got.service}`,
11681171 done.ok
1169 ? { message: `Committed ${done.sha.slice(0, 10)}; the box redeploys on its next sync.` }
1172 ? { message: `Saved ${done.sha.slice(0, 10)}; the box redeploys on its next check-in.` }
11701173 : { tone: "danger", message: done.error },
11711174 );
11721175 }
@@ -1180,7 +1183,7 @@ function sleepBlock(box: GameBox, service: string, text: string, asleep: boolean
11801183 ? asleep
11811184 ? `Asleep now: it is stopped and holds no memory. ${wait}`
11821185 : `Stops after ${EMPTY_SECONDS / 60} minutes with nobody on it, which frees its memory. ${wait}`
1183 : "Kept warm: it runs whether or not anyone is on it.";
1186 : "Kept running: it runs whether or not anyone is on it.";
11841187 return html`<section class="settings-block">
11851188 <h2>Sleep</h2>
11861189 <p>${now}</p>
@@ -1188,7 +1191,7 @@ function sleepBlock(box: GameBox, service: string, text: string, asleep: boolean
11881191 ${act
11891192 ? html`<form method="post" action="/games/${box.name}/${service}/sleep" class="row-fields">
11901193 <input type="hidden" name="policy" value="${policy === "sleep" ? "warm" : "sleep"}" />
1191 ${btn(policy === "sleep" ? "Keep it warm" : "Let it sleep when empty", { variant: "secondary" })}
1194 ${btn(policy === "sleep" ? "Keep it running" : "Let it sleep when empty", { variant: "secondary" })}
11921195 </form>`
11931196 : null}
11941197 </section>`;
@@ -1204,7 +1207,7 @@ export async function gameSleepSubmit(ctx: Ctx): Promise<Response> {
12041207 return flashTo(
12051208 ctx,
12061209 `/games/${got.box.name}/${got.service}`,
1207 done.ok ? { message: `${got.service} ${policy === "sleep" ? "sleeps when empty" : "stays warm"} once the box redeploys (${done.sha.slice(0, 10)}).` } : { tone: "danger", message: done.error },
1210 done.ok ? { message: `${got.service} ${policy === "sleep" ? "sleeps when empty" : "stays running"} once the box redeploys (${done.sha.slice(0, 10)}).` } : { tone: "danger", message: done.error },
12081211 );
12091212 }
12101213
@@ -1294,7 +1297,7 @@ async function modsSubmit(ctx: Ctx, plan: (m: Mods, service: string, project: st
12941297 return flashTo(
12951298 ctx,
12961299 `${back}#mods`,
1297 done.ok ? { message: `${planned.value.done} (${done.value.slice(0, 10)}); the server restarts with it on the box's next sync.` } : { tone: "danger", message: done.error },
1300 done.ok ? { message: `${planned.value.done} (${done.value.slice(0, 10)}); the server restarts with it on the box's next check-in.` } : { tone: "danger", message: done.error },
12981301 );
12991302 }
13001303
test/game-chat.test.ts +3 −3
@@ -437,7 +437,7 @@ echo '{"type":"result","subtype":"success","is_error":false,"result":"The hub re
437437 const built = told();
438438 expect(built).toHaveLength(1);
439439 expect(built[0]!.color).toBe("green");
440 expect(built[0]!.text).toContain("The box brings it up on its next sync.");
440 expect(built[0]!.text).toContain("The box brings it up on its next check-in.");
441441 const now = (await readCompose(app, box()))!;
442442 expect(serviceEnv(now.text, "build")).toMatchObject({ TYPE: "PAPER", LEVEL_TYPE: "FLAT" });
443443 expect(chatLog(app, box().id, 1)[0]).toMatchObject({ kind: "yes", words: "give me a flat world called build" });
@@ -540,7 +540,7 @@ echo '{"type":"result","subtype":"success","is_error":false,"result":"The hub re
540540 const moved = await commitToBranch(app, ada, repo, { message: "a note", files: [{ path: "NOTE.md", content: "x" }] });
541541 if (!moved.ok) throw new Error(JSON.stringify(moved.error));
542542 await say("!forge yes");
543 expect(told()[0]!.text).toBe("Not built: The box changed since the preview; plan it again.");
543 expect(told()[0]!.text).toBe("Not built: The box changed since the preview; preview it again.");
544544 expect((await readCompose(app, box()))!.text).not.toContain("container_name: moved");
545545 });
546546
@@ -622,7 +622,7 @@ echo '{"type":"result","subtype":"success","is_error":false,"result":"The hub re
622622 const tip = (await readCompose(app, box()))!.sha;
623623 job("yes", "a flat world called build", "0".repeat(40), "build");
624624 await sync({});
625 expect(told().map((t) => t.text)).toEqual(["build is in the network. The box brings it up on its next sync."]);
625 expect(told().map((t) => t.text)).toEqual(["build is in the network. The box brings it up on its next check-in."]);
626626 expect((await readCompose(app, box()))!.sha).toBe(tip);
627627 });
628628
test/game-door.test.ts +1 −1
@@ -161,7 +161,7 @@ test("a typed yes builds nothing; the plan's own confirmation does, and chat's y
161161 expect(jobs()).toBe(0);
162162 expect(chatLog(app, box.id, 1)[0]).toMatchObject({ kind: "yes", outcome: "nothing waiting" });
163163 const [built] = await send([request("yes", { confirms: plan.id })]);
164 expect(built!.text).toContain("The box brings it up on its next sync.");
164 expect(built!.text).toContain("The box brings it up on its next check-in.");
165165 expect((await readCompose(app, box))!.text).toContain("\n build:\n");
166166 }, 30_000);
167167
test/game-gist.test.ts +42 −5
@@ -10,8 +10,9 @@ import { join } from "node:path";
1010 import { createApp, type App } from "../src/app.ts";
1111 import { createSession } from "../src/core/sessions.ts";
1212 import { createUser } from "../src/core/users.ts";
13 import { joinAddress, mainPower, nowWords, PEOPLE_CHOICES, powerNow } from "../src/games/gist.ts";
13 import { joinAddress, mainPower, nowWords, PEOPLE_CHOICES, powerNow, PREVIEW_WORDS, SAVE_WORDS } from "../src/games/gist.ts";
1414 import { synced } from "../src/games/notify.ts";
15 import { proxyPort } from "../src/games/sleep.ts";
1516 import { boxNamed, createGameBox, grant, queueCommand, servicesOf } from "../src/games/store.ts";
1617 import { forgeHttp, type ForgeHttp } from "../src/http/server.ts";
1718 import { quietLogs } from "./helpers/globals.ts";
@@ -19,11 +20,47 @@ import { quietLogs } from "./helpers/globals.ts";
1920 quietLogs();
2021
2122 describe("the words", () => {
22 test("joinAddress and the choices", () => {
23 expect(joinAddress("play.example.com")).toBe("play.example.com");
24 expect(joinAddress("bad host; rm")).toBeUndefined();
25 expect(joinAddress("")).toBeUndefined();
23 const at = (host: string, address = "") => ({ host, address });
24 test("joinAddress: a public name on 25565, on another port, and the private ones", () => {
25 expect(joinAddress(at("play.example.com"))).toEqual({ address: "play.example.com" });
26 expect(joinAddress(at("play.example.com"), 25570)).toEqual({ address: "play.example.com:25570" });
27 expect(joinAddress(at("203.0.113.9"))).toEqual({ address: "203.0.113.9" });
28 expect(joinAddress(at("mc.tail1234.ts.net"))).toEqual({ private: "mc.tail1234.ts.net" });
29 expect(joinAddress(at("mc.lan"), 25570)).toEqual({ private: "mc.lan" });
30 expect(joinAddress(at("192.168.1.20"))).toEqual({ private: "192.168.1.20" });
31 expect(joinAddress(at("100.64.0.7"))).toEqual({ private: "100.64.0.7" });
32 expect(joinAddress(at("localhost"))).toEqual({ private: "localhost" });
33 // A private name with a public address: the address is what a friend uses.
34 expect(joinAddress(at("mc.tail1234.ts.net", "203.0.113.9"))).toEqual({ address: "203.0.113.9" });
35 expect(joinAddress(at("bad host; rm"))).toBeUndefined();
36 expect(joinAddress(at(""))).toBeUndefined();
2637 expect(joinAddress(undefined)).toBeUndefined();
38 });
39 test("proxyPort reads the port the proxy publishes for 25565", () => {
40 const file = (ports: string) => `services:\n proxy:\n image: itzg/mc-proxy\n ports:\n - "${ports}"\n`;
41 expect(proxyPort(file("25565:25565"))).toBe(25565);
42 expect(proxyPort(file("25570:25565"))).toBe(25570);
43 expect(proxyPort("services:\n a:\n image: x\n")).toBe(25565);
44 });
45 test("the docs name the changed words", async () => {
outdated

This test reads source text, not rendered output. It would pass if the word never reached a page or screen (box 4). Render the web page and the terminal screen and compare what they say.

46 const docs = await Bun.file("docs/features/games.md").text();
47 for (const w of ["Preview it", "Save change", "Keep it running", "check-in", "list of servers new players land on first"]) expect(docs).toContain(w);
48 expect(SAVE_WORDS).toContain("check-in");
49 expect(PREVIEW_WORDS).toContain("Create it");
50 });
51 test("the settings form says Save and restart, and a player reads check-in, not sync", async () => {
52 const page = await Bun.file("src/web/pages/games.ts").text();
53 const doc = await Bun.file("docs/features/game-settings.md").text();
54 expect(page).toContain('btn("Save and restart"');
55 for (const text of [page, doc]) expect(text).not.toContain("Commit and restart");
56 expect(doc).toContain("**Save and restart**");
57 expect(doc).toContain("next check-in");
58 expect(doc).not.toContain("next sync");
59 for (const f of ["src/web/pages/games.ts", "src/tui/screens/games.ts"]) {
60 expect(await Bun.file(f).text()).toContain("its agent sends one with every check-in.");
61 }
62 });
63 test("the choices", () => {
2764 expect(PEOPLE_CHOICES.map((c) => c[2])).toEqual(["whitelist", "op", "ban", "pardon"]);
2865 });
2966 });
test/game-join.test.ts added +147
@@ -0,0 +1,147 @@
1 /**
2 * Where a friend joins (#17670): the box page and the terminal give the machine's public name, with
3 * the proxy's port when it is not 25565; a private name is said not to work from outside and is not
4 * offered for Copy; a box with no machine says there is no address yet.
5 */
6 import { afterAll, beforeAll, 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 { commitToBranch, createRepo } from "../src/actions/repos.ts";
11 import { createApp, type App } from "../src/app.ts";
12 import { insertPinned } from "../src/core/pinned.ts";
13 import { createSession } from "../src/core/sessions.ts";
14 import { createUser, getUserByName, type User } from "../src/core/users.ts";
15 import { NO_ADDRESS, privateWords, SAVE_WORDS } from "../src/games/gist.ts";
16 import { boxNamed, createGameBox, grant, recordSync } from "../src/games/store.ts";
17 import { forgeHttp, type ForgeHttp } from "../src/http/server.ts";
18 import { createForgeApp } from "../src/tui/forge.ts";
19 import { gameServiceScreen, gamesScreen } from "../src/tui/screens/games.ts";
20 import { headlessTerminal } from "../src/tui/term/terminal.ts";
21 import { quietLogs } from "./helpers/globals.ts";
22 import { settleApp, settleUntil } from "./helpers/tui.ts";
23
24 quietLogs();
25
26 const compose = (published: string) => `services:
27 hub:
28 image: itzg/minecraft-server
29 velocity:
30 image: itzg/mc-proxy:latest
31 ports:
32 - "${published}:25565"
33 `;
34
35 let dir = "";
36 let app: App;
37 let http: ForgeHttp;
38 const users = new Map<string, User>();
39 const BOXES = [
40 ["plain", "play.example.com", "a/compose.yml"],
41 ["ported", "play.example.com", "b/compose.yml"],
42 ["tail", "mc.tail1234.ts.net", "a/compose.yml"],
43 ["bare", undefined, "a/compose.yml"],
44 ] as const;
45
46 beforeAll(async () => {
47 dir = await mkdtemp(join(tmpdir(), "forge-game-join-"));
48 app = createApp({ dataDir: dir, port: 0, modrinthFetch: async () => Response.json([]) });
49 http = forgeHttp(app);
50 for (const [i, username] of ["ownr", ...BOXES.map((b) => `v${b[0]}`)].entries()) {
51 const made = await createUser(app.db, { origin: "seed", trusted: true, username, email: `${username}@f.test`, password: "a-good-passphrase", adminIfFirst: i === 0 });
52 if (!made.ok) throw new Error(made.error);
53 users.set(username, getUserByName(app.db, username)!);
54 }
55 const owner = users.get("ownr")!;
56 const repo = await createRepo(app, owner, { name: "mc-network", visibility: "private" });
57 if (!repo.ok) throw new Error(String(repo.error));
58 const seeded = await commitToBranch(app, owner, repo.value, {
59 message: "network",
60 files: [
61 { path: "a/compose.yml", content: compose("25565") },
62 { path: "b/compose.yml", content: compose("25570") },
63 ],
64 });
65 if (!seeded.ok) throw new Error(JSON.stringify(seeded.error));
66 for (const [name, host, path] of BOXES) {
67 let pinnedId = "";
68 if (host !== undefined) {
69 const m = insertPinned(
70 app.db,
71 { name: `m-${name}`, target: "digitalocean", account: "main", app: "", source: "", version: "", config: {}, host, claimHash: "", claimExpires: "", datacenter: "nyc1", size: "s-4vcpu-8gb" },
72 owner.id,
73 );
74 pinnedId = m.id;
75 }
76 const box = createGameBox(app.db, { name, repo: "ownr/mc-network", path, pinnedId });
77 recordSync(app.db, boxNamed(app.db, name)!, { composeSha: "", services: [{ name: "hub", state: "running", health: "", startedAt: "", cpuPct: 1, memMiB: 900 }], logs: {}, results: [], host: { memMiB: 8000, memUsedMiB: 4000, load1: 0.2, diskFreeGiB: 60 } });
78 grant(app.db, box.id, users.get(`v${name}`)!.id, "viewer");
79 }
80 }, 30_000);
81
82 afterAll(async () => {
83 app.close();
84 await rm(dir, { recursive: true, force: true });
85 });
86
87 const page = async (name: string): Promise<string> => {
88 const cookie = `forge_session=${createSession(app.db, users.get(`v${name}`)!.id).token}`;
89 return (await http.handle(new Request(`http://forge.test/games/${name}`, { headers: { cookie } }))).text();
90 };
91 const terminal = async (name: string, want: string): Promise<string> => {
92 const term = headlessTerminal(200, 30);
93 const user = users.get(`v${name}`)!;
94 const { app: tui, session } = createForgeApp(app, { sshUsername: user.username, remoteAddress: "127.0.0.1", fingerprint: "SHA256:test", user }, { terminal: term, exitHooks: false });
95 tui.start();
96 tui.ctx.push(gamesScreen(session, tui.ctx));
97 await settleApp(tui);
98 await settleUntil(tui, want);
99 return tui.screen.toText();
100 };
101
102 test("a public name on 25565 is the address, with Copy", async () => {
103 const html = await page("plain");
104 expect(html).toContain('<code class="mono" id="game-address">play.example.com</code>');
105 expect(html).toContain("Copy the server address");
106 });
107
108 test("a public name with the proxy on another port carries the port", async () => {
109 expect(await page("ported")).toContain('id="game-address">play.example.com:25570</code>');
110 });
111
112 test("a private name is not offered: the page says why and what to set", async () => {
113 const html = await page("tail");
114 expect(html).not.toContain('id="game-address"');
115 expect(html).not.toContain("Copy the server address");
116 expect(html).toContain(privateWords("mc.tail1234.ts.net").replace("'", "&#39;"));
117 });
118
119 test("a box with no machine says there is no address yet", async () => {
120 const html = await page("bare");
121 expect(html).toContain(NO_ADDRESS);
122 expect(html).not.toContain('id="game-address"');
123 });
124
125 test("the terminal says what the page says", async () => {
126 expect(await terminal("plain", "To join, add this server in Minecraft: play.example.com")).toContain("play.example.com");
127 expect(await terminal("ported", "play.example.com:25570")).toContain("play.example.com:25570");
128 expect(await terminal("tail", "a private one")).toContain("a friend outside cannot join with it");
129 expect(await terminal("bare", "no machine name")).toContain("no machine name");
130 });
131
132 test("the env form says the same on the page and in the terminal, and nothing says Committing", async () => {
133 const owner = users.get("ownr")!;
134 const cookie = `forge_session=${createSession(app.db, owner.id).token}`;
135 const html = await (await http.handle(new Request("http://forge.test/games/plain/hub", { headers: { cookie } }))).text();
136 expect(html).toContain("Save change");
137 expect(html).toContain(SAVE_WORDS.replace("'", "&#39;"));
138 const term = headlessTerminal(200, 30);
139 const { app: tui, session } = createForgeApp(app, { sshUsername: owner.username, remoteAddress: "127.0.0.1", fingerprint: "SHA256:test", user: owner }, { terminal: term, exitHooks: false });
140 tui.start();
141 tui.ctx.push(gameServiceScreen(session, tui.ctx, boxNamed(app.db, "plain")!, "hub"));
142 await settleApp(tui);
143 term.feed("\t");
144 await settleApp(tui);
145 expect(tui.screen.toText()).toContain(SAVE_WORDS);
146 expect(await Bun.file("src/tui/screens/games.ts").text()).not.toMatch(/ommitting/);
147 });
test/game-mods.test.ts +2 −2
@@ -389,7 +389,7 @@ describe("Modrinth", () => {
389389 "Adds Chunky 1.4.28",
390390 "Adds ChunkyLib 1.0.2 (required by Chunky)",
391391 "Pins EssentialsX 2.21.0 (it was in MODRINTH_PROJECTS unpinned)",
392 "Restarts the server with the new set on the box's next sync",
392 "Restarts the server with the new set on the box's next check-in",
393393 ]);
394394 const done = await commitPlan(app, alice, box, "hub", m, plan.value);
395395 if (!done.ok) throw new Error(done.error);
@@ -545,7 +545,7 @@ describe("modpacks", () => {
545545 "2 override files: overrides/, then server-overrides/ over them",
546546 "Changes Minecraft 1.21.4 → 1.21.1: a world saved by a newer Minecraft may not open in an older one",
547547 "The image does not check a pack's file hashes; the lockfile keeps each one, so any change shows in review",
548 "Restarts the server with the pack on the box's next sync",
548 "Restarts the server with the pack on the box's next check-in",
549549 ]);
550550 expect((await commitPlan(app, alice, box, "survival", m, plan.value)).ok).toBe(true);
551551 const compose = (await readCompose(app, box))!;
test/game-presets.test.ts +1 −1
@@ -308,7 +308,7 @@ describe("on a forge", () => {
308308 expect(plan["planned"]).toBe(true);
309309 const create = { action: "create_server", box: "mc", words: "a flat world called build", dryRun: false };
310310 // No sha, or another commit's, is a yes to a plan nobody was shown.
311 for (const sha of [undefined, "0".repeat(40)]) expect((await call({ ...create, sha }))["refused"]).toContain("The box changed since the preview; plan it again.");
311 for (const sha of [undefined, "0".repeat(40)]) expect((await call({ ...create, sha }))["refused"]).toContain("The box changed since the preview; preview it again.");
312312 const made = await call({ ...create, sha: plan["sha"] });
313313 expect(made["says"]).toContain("build is in the network, at build.mc.trevato.dev");
314314 const box = boxNamed(app.db, "mc")!;
test/game-settings.test.ts +4 −4
@@ -83,7 +83,7 @@ describe("a change", () => {
8383 "VIEW_DISTANCE 10 → 12 (env)",
8484 "paper-world-defaults entities.spawning.per-player-mob-spawns true → false (patch)",
8585 "paper-global misc.max-joins-per-tick 5 → 10 (patch)",
86 "Restarts the server with the new settings on the box's next sync",
86 "Restarts the server with the new settings on the box's next check-in",
8787 ]);
8888 const text = plan.value.edit(COMPOSE);
8989 const d = doc(text);
@@ -196,7 +196,7 @@ describe("server.properties without an env var, and the image's other ways", ()
196196 expect(plan.value.lines).toEqual([
197197 "enable-code-of-conduct false → true (env CUSTOM_SERVER_PROPERTIES)",
198198 "WHITELIST_PROP true → false (env)",
199 "Restarts the server with the new settings on the box's next sync",
199 "Restarts the server with the new settings on the box's next check-in",
200200 ]);
201201 expect(plan.value.keys).toEqual(["enable-code-of-conduct", "white-list"]);
202202 const text = plan.value.edit(LOBBY);
@@ -322,13 +322,13 @@ describe("on the service page, one commit on the commit previewed", () => {
322322 const box = boxNamed(app.db, "net")!;
323323 const before = (await readCompose(app, box))!.sha;
324324 const plan = await call({ action: "config_set", key: "simulation-distance", value: "8" });
325 expect(plan).toMatchObject({ lines: ["SIMULATION_DISTANCE 10 → 8 (env)", "Restarts the server with the new settings on the box's next sync"] });
325 expect(plan).toMatchObject({ lines: ["SIMULATION_DISTANCE 10 → 8 (env)", "Restarts the server with the new settings on the box's next check-in"] });
326326 expect((await readCompose(app, box))!.sha).toBe(before);
327327 expect(await call({ action: "config_set", key: "simulation-distance", value: "99", dryRun: false })).toEqual({
328328 refused: expect.stringContaining("simulation-distance is a whole number from 3 to 32."),
329329 });
330330 const done = await call({ action: "config_set", key: "simulation-distance", value: "8", dryRun: false });
331 expect(String(done["says"])).toStartWith("Committed ");
331 expect(String(done["says"])).toStartWith("Saved ");
332332 expect(serviceEnv((await readCompose(app, box))!.text, "hub")["SIMULATION_DISTANCE"]).toBe("8");
333333 });
334334
test/game-sleep.test.ts +1 −1
@@ -239,7 +239,7 @@ describe("changing it", () => {
239239 test("the service page offers it, and its commit writes the label, the waker and the plugin", async () => {
240240 const page = await (await http.handle(new Request("http://forge.test/games/net/hunting", { headers: { cookie } }))).text();
241241 expect(page).toContain("<h2>Sleep</h2>");
242 expect(page).toContain("Kept warm: it runs whether or not anyone is on it.</p>");
242 expect(page).toContain("Kept running: it runs whether or not anyone is on it.</p>");
243243 const proxy = await (await http.handle(new Request("http://forge.test/games/net/velocity", { headers: { cookie } }))).text();
244244 expect(proxy).not.toContain("<h2>Sleep</h2>");
245245 const box = boxNamed(app.db, "net")!;
test/tui-games.test.ts +3 −3
@@ -129,7 +129,7 @@ test("a service's console shows its log and queues an rcon command; env commits
129129 await type("e");
130130 await type("MOTD=welcome");
131131 terminal.feed("\r");
132 await settleUntil(tui, "Committed ");
132 await settleUntil(tui, "Saved ");
133133 expect(serviceEnv((await readCompose(app, box))!.text, "hub")["MOTD"]).toBe("welcome");
134134 expect(tui.screen.toText()).toContain("MOTD=welcome");
135135 // Mods: the page's model, its refusals in its words.
@@ -248,7 +248,7 @@ test("settings: `c` from a service lists them; a value is previewed, a bad one r
248248 terminal.feed("\r");
249249 await settleUntil(tui, "MAX_PLAYERS 20 → 200 (env)");
250250 await type("y");
251 await settleUntil(tui, "Committed ");
251 await settleUntil(tui, "Saved ");
252252 expect(serviceEnv((await readCompose(app, box))!.text, "hub")["MAX_PLAYERS"]).toBe("200");
253253 tui.stop?.();
254254 });
@@ -262,7 +262,7 @@ test("z on the games list: choosing sleep says the machine is still billed; goin
262262 await settleUntil(tui, "sleeps when empty");
263263 expect(tui.screen.toText().replace(/\s+/g, " ")).toContain(STILL_BILLED);
264264 await type("z");
265 await settleUntil(tui, "stays warm");
265 await settleUntil(tui, "stays running");
266266 expect(tui.screen.toText()).not.toContain("still billed");
267267 tui.stop?.();
268268 });

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

Keyboard shortcuts

Docs