import type { ConvertConfig, ConvertTier } from './config'; import { type PlaceholderAudit } from './placeholders'; export interface ExecResult { code: number; tail: string; } /** Runs an external program (rclone, node) with its output in `logs/.log`; only the publish stages use it. */ export type ExternalRun = (command: string, args: string[], options: { id: string; cwd?: string; }) => Promise; /** Runs `helix ` (a child process of this CLI) with its output in `logs/.log`. */ export type Exec = (args: string[], options: { id: string; memMiB?: number; }) => Promise; export interface ConvertPaths { out: string; bundle: string; citySource: string; landSource: string; /** The game's own roads: `roads/` holds the restyled cells the landscape plan points at (`roads.baked`). */ roadsBaked: string; /** The capture's placed objects (`helix city objects cs2`: parked cars, ships, boats, landmark bridge towers), placed by the landscape. */ objects: string; facts: string; spawn: string; landPlan: string; land: string; /** The laid-out tiers before the collision pass; the pass reads it and never edits it, so it can be rerun. */ base: string; baseScene: string; publish: string; publishScene: string; tier(tier: ConvertTier): { dir: string; data: string; world: string; }; /** The scene root folder name a tier ships as, before the collider revision suffix. */ rootName(tier: ConvertTier): string; finalRoot(tier: ConvertTier): string; } export declare function convertPaths(bundle: string, out: string, name: string): ConvertPaths; export interface Facts { buildings: number; meshedBuildings: number; trees: number; bundleHasMeshes: boolean; meshMode: 'real' | 'masses'; seaLevelM?: number; /** Streets the capture holds no buildings beside (`auditUnbuiltStreets`): the visitor sees bare road grids, and the cause is the source, not the streaming. */ unbuiltStreets?: { cells: number; streetCells: number; districts: Array<{ bounds: { minX: number; minZ: number; maxX: number; maxZ: number; }; cells: number; buildings: number; streetKm: number; }>; }; /** The bundle carries the capture's road compositions and the config does not force the generator: the landscape uses the game's roads. */ bakedRoads?: boolean; /** Buildings the capture could not load an asset for, drawn as plain footprint boxes (`placeholders.ts`), the packs behind them, and the reason a person let them through. */ placeholders?: PlaceholderAudit & { allowed: string | null; }; } /** What a CDN warm-up fetched: files that answered, bytes, and the edge's cache status per answer (`cf-cache-status`: HIT, MISS, ...). */ export interface WarmReport { requested: number; ok: number; failed: number; bytes: number; cache: Record; } /** One URL's answer to a HEAD: what a client that accepts Brotli is served. */ export interface HeadRow { url: string; status: number; encoding: string | null; cache: string | null; } export interface StageContext { config: ConvertConfig; paths: ConvertPaths; exec: Exec; /** External programs for the publish stages; absent when the run does not publish. */ run?: ExternalRun; /** Sets a World's visibility (replaced in tests; the publish stage defaults to the platform API). */ setWorldVisibility?: (world: string, visibility: ConvertConfig['publish']['visibility'], contentRating: string | null) => Promise; /** Looks a World up by id (replaced in tests; the publish stage defaults to the platform API). */ lookupWorld?: (world: string) => Promise<{ slug: string; title: string; }>; /** Fetches URLs once through the CDN so the first visitor's cold start does not pay the origin round trips (replaced in tests; the upload stage defaults to a parallel GET). */ warmCdn?: (urls: string[]) => Promise; /** HEADs URLs through the CDN with `Accept-Encoding: br`: the headers a client is served (replaced in tests; the upload stage defaults to a parallel HEAD). */ headCdn?: (urls: string[]) => Promise; log: (line: string) => void; /** A person's reason for publishing a root whose road-budget audit fails (`--allow-over-budget`); recorded in the receipt. */ allowOverBudget?: string; /** A person's reason for converting a capture whose buildings are largely unloaded placeholder boxes (`--allow-placeholders`); recorded in the receipt. */ allowPlaceholders?: string; /** Parallel child processes for sharded prototype builds. */ jobs: number; } export interface StageResult { commands: string[][]; outputs?: Record; facts?: Record; } export interface StageDef { id: string; title: string; /** Optimizations this stage applies (ids in optimizations.ts). */ optimizations: string[]; /** What the stage's output depends on besides its upstream stages: any change reruns it. */ signature(ctx: StageContext): unknown; /** Paths that must exist for the stage to count as done. */ outputs(ctx: StageContext): string[]; run(ctx: StageContext): Promise; /** Stages that read this stage's output; used to chain signatures. Defaults to the previous stage. */ after?: string[]; } export declare function loadFacts(paths: ConvertPaths): Facts; export declare function buildLandPlan(config: ConvertConfig, facts: Facts, spawn: { x: number; z: number; yawDeg?: number; clearM?: number; }, citySource: string, bakedRoads?: string, objects?: string, cs2Trees?: string, backdrop?: string): Record; /** * Triangles per road render cell above which the baked roads are cut into quarters. The phone root commits its heaviest stream group on top of * everything eager, so a 250,000-triangle interchange cell (about 19 MiB decoded) pushed Leonida's 192 MiB profile to 206; the cut plus the structure simplification keeps one under 4.5 MiB. */ export declare const ROADS_CELL_MAX_TRIANGLES = 120000; /** Metres the concrete structure of a road cell (bridge girders, walls, decks: 58% of Leonida's road triangles) may move when it is simplified. */ export declare const ROADS_STRUCTURE_ERROR_M = 0.2; /** Metres the drivable and walkable surfaces (asphalt, sidewalk, kerb, gravel) of a road cell may move when they are welded and simplified. */ export declare const ROADS_SURFACE_ERROR_M = 0.05; /** The baked roads' far layer is 205,000 triangles (13 MiB eager) at the generator's 0.3 m; the phone's budget has no room for that. 0.6 m halved it; 1.5 m takes it to 3 MiB (it is only seen beyond the 384 m stream radius, over a terrain that is coarser than that). */ export declare const ROADS_FAR_ERROR_M = 1.5; /** Triangle budget per road collider cell: the 60,000 default weighs 3.8 MiB decoded in the heaviest phone group; 45,000 keeps the shape within the tolerance rule. */ export declare const ROADS_COLLIDER_MAX_TRIANGLES = 45000; /** Copy `from` into `to` (clone-on-write where the filesystem has it), merging directories. */ export declare function mergeInto(from: string, to: string): void; export interface PublishPlan { schema: 'helix.city-publish-plan/1'; name: string; title: string; description: string; visibility: string; scenes: { desktop?: string; mobile?: string; }; tree: string; upload: string; shell: string; /** Uploads the startup packs beside `scene/` (the pack files are Brotli as a whole, the index is plain JSON). Present when packs were cut. */ uploadPacks?: string; /** Scenes that have startup packs (`publish/packs//index.json`), for the shell's `--packs`. */ packs?: string[]; /** The cold-start transfer per tier, and the manifest value (the larger, clamped to 1 byte..4 GiB). */ streamedDataBytes?: { desktop?: number; mobile?: number; }; streamedDataBytesForManifest?: number; } export declare function buildPublishPlan(config: ConvertConfig, paths: ConvertPaths, extras?: { packs?: string[]; streamedDataBytes?: { desktop?: number; mobile?: number; }; streamedDataBytesForManifest?: number; }): PublishPlan; /** The stage list for a config and the facts known so far (`masses` maps skip the real-mesh stages). */ export declare function buildStages(config: ConvertConfig, meshMode: Facts['meshMode'] | 'unknown', bakedRoads?: boolean): StageDef[]; /** The authored-LOD index of a CS2 bundle (`/lods/lod2/prefab-meshes-v2.json`); its bytes are part of the prototype stage's identity. */ export declare function buildingLodIndex(bundle: string): string;