English
alta.control/0.1: the cloud control plane
Generated from docs/standards/alta-control-0.1.md · npm run docs:gen
Code: cloud/control/api.ts (routes, states), cloud/control/provider.ts (host provider and fake), cloud/control/billing.ts (billing and fake). Tests: tests/cloud-contract.test.ts. cloud/ and service/ are not part of the game's build (type-checked only). Frozen in P0b for H2, H3 and H4 to work in parallel.
Status: alpha. This format can still change before its 1.0; a change follows the versioning rules of the project and is announced in the changelog.
Routes
| Route | Auth | Lot |
|---|---|---|
POST /v1/auth/start, POST /v1/auth/verify, POST /v1/auth/logout | captcha / none / session | H3 |
GET /v1/plans, GET /v1/capacity | none | H2 |
POST /v1/worlds ({ captcha, email?, plan? }, idempotent, one free world per browser or account) | captcha | H2 |
GET /v1/worlds/:id, GET /v1/worlds/:id/events (SSE) | browser ticket or session | H2 |
POST /v1/worlds/:id/enter (single-use ticket, 60 s) | browser ticket or session | H2 |
POST /v1/worlds/:id/export, GET /v1/worlds/:id/export/:n | browser ticket or session | H2 |
POST /v1/worlds/:id/stop, POST /v1/worlds/:id/resume | browser ticket or session | H2 |
POST /v1/billing/checkout, POST /v1/billing/portal, POST /v1/billing/webhook | session / session / provider signature | H4 |
/v1/plans and /v1/capacity are the §3.7 additions (VM sizes as offers; the public cap of decision P20). Errors: { error, code }, status by code (STATUS). matchRoute(method, path) gives the route and its params.
World states
queued → provisioning → booting → configuring → ready → warned → stopping → stopped → archived → purged, and failed (with a readable reason, "Retry" back to queued). Allowed moves: TRANSITIONS, canMove(a, b). WorldView { id, state, offer, plan, position?, step?, endsAt?, purgeAt?, url?, reason? }: state and billing only, never the content of the VM. A world lives at https://w-<id>.<players' domain>/ (worldUrl), a domain distinct from the site's.
Host provider
HostProvider { id, limits(), create, get, start, stop, snapshot, restore, destroy, resize, warmPool? } with InstanceSpec { image (pinned by digest), cpu, memMb, diskGb, region, volume?, env (not secret), secrets (names), ingress: "gateway-only", egress, accelerator? }. destroy is reserved to the announced purge. resize keeps the VM and its disk (free → paid); a disk never shrinks. accelerator attaches a GPU (§3.7 point 6). checkSpec(spec, limits?) is the same for every adapter. createFakeProvider({ now, coldStartS, … }) is the only provider of the tests. providerContract(provider, env) returns the named cases every adapter must pass.
Billing
BillingProvider { plans, checkout, portal, verifyWebhook, subscription }; Plan { id, label, explains, cpu, memMb, diskGb, accelerator?, priceMonthly, currency, lifetimeS? } (a free plan has a lifetime: 2 h). checkPlans(plans). Only a signed webhook makes a world paid. createFakeBilling() and FAKE_PLANS (placeholders: sizes and prices are decision P21).