Infrastructure (#16696)
What runs on your own cloud, what it's for, what it costs, and when it ends; and building one more thing, through a plan you see before any money moves.
Where
- Web:
/infra(src/web/pages/infra.ts, routes insrc/http/infra_routes.ts). Each account's month against its ceiling, one sentence a line ("$13.00 of $50 a month on DigitalOcean"); a line for anything the hourly watch found at a provider that the forge did not make, linking that account's row on Cloud accounts; then each machine that bills, grouped by its experiment's question or by its app, with where it runs in plain words, its monthly cost and when it ends, Keep 7 more days and End now beside it; End now shows only where something exists at the provider (existsAtProviderinsrc/cloud/billing.ts, the same test /pinned's Retire uses), so a first deploy that made nothing offers none. What ended in the last 30 days, and anything retired that still bills, stays under a quiet Ended disclosure, each in the shared billing sentence with its day: "retired Mon 30 Nov; nothing bills", or "…; its kept disk still bills $1.00 a month" with a link to delete it on Pinned forges; older ones that bill nothing are one line with their count. A dead row (a first deploy that failed and left nothing at its provider) says "nothing exists at DigitalOcean; clear this row", with Clear this row through the confirm (clearPinned, eventpinned.cleared). Build something opens the compose form: an app, a place (the cheapest two in each city, each a row of at least 44px; a filter of city, provider or size words narrows the whole catalog on the server,/infra/live?part=places, so the page never carries it; one that cannot be ordered is listed, dimmed, with why), what it is for (a new question, a running experiment, or running the app itself), and when it ends (1, 3, 7 or 30 days; no end only for an app). The plan tray sits at the foot of the form. - Terminal: the Infrastructure screen (
src/tui/screens/infra.ts, after Cloud accounts in the palette, andIon the Cloud accounts screen). What ended is listed after what runs, each in its billing sentence.ncomposes one question at a time and shows the plan with Build;+keeps the selected machine 7 more days;xends it now after a confirm (only where something exists at its provider), andcclears a dead row after a confirm. A build's steps lead the list as they happen. - API:
GET /api/v1/admin/infra(?plan=<id>adds a build's steps),POST /api/v1/admin/infra/plan,POST /api/v1/admin/infra/apply(202). Keep isPOST /api/v1/admin/pinned/:name/keep. - Agents: the
infraMCP tool, in Talk's slot whereexperimentswas:list(everythingexperimentslisted, plus each machine's end and what it bills for, andended: what retired in the last 30 days or still bills, so a question about one is answered from its row; a dead row'sclearsentence),show(an experiment, or a plan id's build),planawant,applya plan id (a plan of dead rownamesclears them; Talk offers it, the person allows it),keep,begin,attach,record_result. Onlyapplyspends money, so the forge asks the person first.
All four read infraOf and plan through planCompose in src/actions/infra.ts, which plans with src/cloud/plan.ts; only a forge admin sees them.
The plan
Every change to the compose form is planned again on the server (POST /infra/plan); the page adds no sums. The tray's line says what is added, the month's change, the account after it against its ceiling, and the time to ready: "+ 1 machine, + 1 disk · +$13.00 a month · $13.00 of $50 · ready in about 4 min". Its steps open under it. A refusal is said in the forge's own words with a link to the exact control that fixes it: the account's write switch or ceiling on Cloud accounts, or the domain for deployed forges on Pinned forges.
Build refuses a plan that changed since it was shown, so nobody builds what they did not see. Without a script, See the plan shows the same tray.
The build
Build runs in the background and appends infra.applied (the wants and each step's sentence), then one infra.step per step (started, done or failed), or infra.refused when it was refused before its first step. The tray is a live region on those events: each step shows as it happens, then "Ready at" its name with the link. A build that stopped says why with Build again, which plans the same wants against what exists now and skips what is done.