Cloud accounts
The forge keeps the provider tokens (a cloud vendor's API token) its repositories use, sealed. Four doors show them, all a forge admin's alone; anyone else finds no such page, screen, tool or route. No door ever returns a secret: a token is typed once, checked, sealed, and never drawn, kept in a note or sent back.
- Page: Settings → Cloud accounts,
/settings/cloud. Each account with what it is used for, when it was verified and last used, and today's vendor calls. Attach, verify, allow writes, rename, rotate, audit and remove are forms on the page. - Terminal: the "Cloud accounts" screen (
src/tui/screens/cloud.ts), opened from the palette.aattaches (token typed masked),vre-verifies,rrotates,nrenames,xremoves,Psets the project its forges are filed in. The checks are the page's (src/actions/cloud.ts). - MCP:
cloud_accountstakes no arguments and returns the accounts with each token's use, verification, write permission and today's calls. It counts as a write, so arotoken never lists them. - HTTP:
GET /api/v1/cloud/accountsreturns the same body ascloud_accounts(both build it withcloudOverview).
curl -H "authorization: Bearer $FORGE_TOKEN" "$FORGE_URL/api/v1/cloud/accounts"
Answers: 401 with no signed-in user, 403 for a read-only token (every vendor call is audited, so listing is a write-scoped act), 404 for anyone who is not a forge admin.
Not done: the route only lists. Attaching, rotating and removing stay on the page and in the terminal, where the token can be typed masked.
The project a forge is filed in (#16340)
- A DigitalOcean account can name the cloud project its forges go in: a text field on its row at
/settings/cloud,Pon the terminal screen,set_projecton the MCPcloud_accounttool. Empty is the provider's default project. An admin only; the name is checked, and the project must exist when a forge is deployed, or the deploy is refused before anything is made. - A deploy files the droplet and volume in it and tags both with the forge's name. A forge made earlier is filed with
file(seedocs/features/pinned-forge.md). Hetzner shows no field: a Hetzner token already belongs to one project, so setting one is refused.
Places and prices in US dollars (#16203)
GET /api/v1/places lists where a forge can run: provider + datacenter + machine size, each with vCPU, memory, disk, included traffic, city and country, costCents (machine + the 10 GiB volume + a public address, US dollars a month), the vendor's own price and the rate that converted it, readAt, orderable and, when not, why. Filters: plan, provider, country. defaults names each plan's default place and says why; the rule is: the cheapest place in the United States that can be ordered now and meets the plan's minimum, among providers with an account that allows writes (a provider with no such place in the United States falls back to its cheapest place anywhere); PUT /api/v1/places/pin (admin) pins one instead.
- Prices come from the provider's API (Hetzner
/pricing,/server_types, which carries each size's stock and price for every location, and/locationsfor the city and country; DigitalOcean/sizes,/regions) and are kept as the provider answered, so the dollars are derived at read time. A failed read keeps the last good one. Typed in by hand, and said so: DigitalOcean's block storage price (its API has none) and its regions' countries. - Every amount a person sees is dollars. A vendor billing in euro is converted at the European Central Bank's daily reference rate (
src/cloud/rates.ts, no key), kept with its date; if the fetch fails the last good rate stands and the answer carriesrate.ageDays. All conversion istoUsdinsrc/cloud/prices.ts; money that guards spending roundsup. - A refresh runs when a forge administrator reads the catalog with a write-scoped token and a read is over six hours old; a read-only token gets the kept catalog and starts no vendor call, since every vendor call is audited. One refresh runs at a time, every concurrent read waits on it, and a provider is tried again no sooner than five minutes after its last try, whether or not it answered. A vendor's answer is read to at most 2 MB. No timer yet.
PUT /api/v1/places/pintakes{plan, place}(an empty place clears the pin) and answers the validated plan and place; a place id over 200 characters is a422. A member is refused (403by the admin gate), and a pin is announced ascloud.place_pinned, which an admin's web session hears live.- Each item carries
priceNote, the curious path's sentence, such as€5.99 at 1.08 on 24 Nov; empty when nothing was converted.
In the terminal: the palette's Places (src/tui/screens/places.ts) shows the rule, each plan's default and why, and every place by price in dollars. Anyone signed in reads it; a forge admin who is a person also presses p to pin a plan (plan, then place id; empty clears) through pinPlace, the same act as the API. Opening it as an admin refreshes a stale catalog first.
Not done: deploying by place id, the buyer's "Choose where it runs" disclosure and the owner's margin page; they build on this catalog.
Where it runs, on New forge
A site admin who has attached a cloud account that allows writes sees "Where it runs" on /forges/new and on the terminal's New forge screen (src/spawn/clouds_offered.ts). Anyone else sees no such choice, and a cloud named in a request from a non-admin is refused.
- Here is the default: the forge runs inside this forge.
- A cloud account runs the forge on its own machine. It is free to the admin; the cloud bills its own account. The page says "No charge to you; the cloud bills its account."
- Each cloud option shows the catalog's default place for the size, its price a month and the account's room under its ceiling, for example "New York · $14.00 a month; $36.00 of $50 left this month". The default is the cheapest orderable place in the United States. A provider with no such place, such as Hetzner, whose cheap line is in Europe only, falls back to its cheapest orderable place anywhere and shows that city, for example "Hetzner · Nuremberg · $8.48 a month".
- Change place, under the option, lists one entry for each other datacenter of that provider, at the cheapest size that meets the plan, cheapest first. Two datacenters in one city carry their number ("New York 1", "New York 3"), so no label repeats. Pick one to run there instead of the default.
- A refused deploy is shown with the reason, and the option cannot be selected. The reasons are no account that allows writes, or a place that would go over the account's ceiling. The message links to Cloud accounts, where the account and its ceiling are set.
- Terminal: the "Where it runs" field is chosen with left and right. The first choice is empty and means here. The others are
<provider>/<account>, then<provider>/<account>@<place>for each other place. The same value is what the page posts aswhere.
A forge on a cloud keeps its plan out of it: the place is chosen under Where it runs, not under Plan.
The warm pool (#16362)
A prepared machine already booted and waiting, unclaimed and with no name, answers a purchase in seconds. It costs money while it waits, so none is kept by default: each place (provider:datacenter:size) of an account has a configured most, 0 until a forge admin sets it (about 3 once customers come).
wantedWarm(src/cloud/warm_pool.ts) says how many to hold now: 0 when the setting is 0; otherwise one, raised to cover two hours of purchases at the last day's rate, never past the setting and never past what the account's ceiling leaves room for. Falling demand lowers it; nothing is torn down to save money by this rule alone.- A warm machine is a pinned row in state
warm, so the ceiling counts every one (rowCents) and the account's cost already includes them; Settings → Cloud and the terminal screen show each place's held count, setting and cost beside the ceiling. - Set it with the MCP
cloud_accountverbset_warm(place,count0 to 10, admin scope); it is recorded ascloud.warm_target.
Not done: making and refilling the machines themselves, and a form on the page and a key in the terminal to set the count; this lands the policy, the setting, the counting and the display.
The hourly watch (#16329)
The ceiling counts only what the forge's own rows say it made. The cloud-watch duty (src/maintain/duties/cloud_watch.ts, src/cloud/watch.ts) looks at the provider itself once an hour for each DigitalOcean or Hetzner account that allows writes: read-only GETs of droplets or servers and volumes, recorded like the other cloud calls (maintain:cloud-watch).
- A thing named
forge-<name>orforge-<name>-datawith no live pinned row is an orphan. A thing not named so, and not acknowledged, is outside. Each is priced from the Places catalog beside the forge's own reckoning and the ceiling. - An orphan, an outside thing, real cost over the ceiling, or a provider that could not be read raises a card in
/healthneeds, one notification to admins and one issue (Cloud account <provider>/<account> shows more than the forge made). Each sentence names the thing, its age, its monthly cost and the one action that resolves it. - While an orphan stands, a create on that account is refused with that sentence.
- Acknowledge as not the forge's (Settings → Cloud accounts,
oin the terminal screen,src/tui/screens/cloud.ts) records everything standing as not the forge's; later readings are quiet about it, and a new one is not. - Quiet when all is as expected: one line on the account says when the watch last looked and what it found.
Not done: adopting an orphan into a pinned row (retire it in the provider's console, or acknowledge it), and a read of the provider's actual bill.
The watch keeps when the standing problems began, so a standing orphan is one notification and one /health card, not one an hour. A forge-named thing made in the last two hours, or named for a live pinned row, is a deploy in flight and not an orphan. A create stays refused until the next hourly reading even after an orphan is retired in the provider's console; the refusal says so.