/** * Which half of the CDN's port window a CLI install may bind — the one thing that keeps a dev-line * and a release-line `bitmagic` out of each other's way on the same machine. * * Both lines are published as `@bitmagic/cli` and are routinely installed side by side (see the * README's `~/.bitmagic-cli/dev` / `~/.bitmagic-cli/prod` recipe). Until this existed they reached * for the same numbers: `dev` started at 3010/3011/3012 and `verify`, `forge` and `generate` scanned * the whole window from a random offset. Nothing crashed — a busy default drifts — but whichever * install started second landed somewhere unpredictable, and `bitmagic reload` falling back to a * bare 3011 could reload the OTHER install's browser tab, on a different project entirely. * * The split has to happen INSIDE 3000-3199 and cannot be the repo's usual `+100` offset. That * window is the whole of what the asset CDN allowlists as an origin (see local-port.ts); a lane * starting at 3210 would serve games whose terrain silently never loads. */ import { type UpdateTag } from './update/notice.js'; export interface PortLane { /** Inclusive scan bounds. Always wholly inside CORS_ALLOWED_PORT_MIN/MAX. */ min: number; max: number; /** Where `bitmagic dev` starts looking for the vite server that serves the game. */ gamePort: number; /** Where it starts looking for the tabbed Game/Editor shell — the URL a creator opens. */ editorPort: number; /** Where `--mobile` starts looking for the LAN bridge. */ mobilePort: number; } /** * The release line keeps the numbers it has always had. * * 3010 and 3011 are named in the README, in the docs every scaffolded project carries, and in the * bookmark of anyone who has run this before. The release line is the one that must not move; the * dev line is the one whose users opted into change. */ export declare const RELEASE_LANE: PortLane; /** * The dev line, one hundred up — the same last two digits, so a number still reads as "game", * "shell" or "phone" at a glance and only the hundreds digit says which install printed it. * * The defaults sit at 3110+ rather than at the foot of the lane on purpose. A machine running this * monorepo holds 3000-3002 in an unshifted checkout and 3100-3102 in a `+100` parallel clone * (.env.local), which are exactly the two lanes' opening ports. The scan skips a busy port either * way, but a default that never collides in the first place prints a stable number. */ export declare const DEV_LANE: PortLane; /** The lane belonging to a published line. */ export declare function portLaneFor(tag: UpdateTag): PortLane; /** * How many projects a lane holds at fixed addresses — see `slotPorts`. * * Nine, because a slot is ten ports wide and the lane's defaults sit at x10: slots 0-8 span * x10-x92, and a tenth would run past the lane's end. Nine games being developed at once on one * machine is a lot; a tenth falls back to the scan, and says so. */ export declare const DEV_PORT_SLOTS = 9; /** * The three ports a project in `slot` of `lane` serves on. * * `bitmagic dev` used to start every project at the lane's defaults and drift to a random port in * the lane when they were busy — so which project answered on 3011 depended on start order, * bookmarks went stale, and a `bitmagic reload` falling back to the default could reach the wrong * project. A slot is the same numbers, one tens-digit further along per project: slot 0 is the * defaults every doc names (3010/3011/3012), slot 1 is 3020/3021/3022, and so on. The hundreds * digit still says which install, the tens digit now says which project, and the units digit still * reads game / shell / phone. Which slot a project holds is recorded per machine in * `~/.bitmagic/dev-ports.json` (project/dev-ports.ts). */ export declare function slotPorts(lane: PortLane, slot: number): { gamePort: number; editorPort: number; mobilePort: number; }; /** * This install's lane. * * Derived from the version string alone — `updateTagFor` reads a prerelease suffix as the dev line — * so two installs separate with no config, no env var and nothing for anyone to set up. Note this * is the install's own line, NOT the project's `BITMAGIC_ENV`: which api-server a project talks to * is a different axis, and a port is a fact about the binary that bound it. * * An unreadable version reads as a release and gets the release lane, which is where every port was * before this existed. Failing closed here keeps the numbers the docs promise. */ export declare function currentPortLane(version?: string): PortLane; /** Which published line this install is on — the key the port registry files a project under. */ export declare function currentLineTag(version?: string): UpdateTag;