/** * The forge store with a server behind it. * * The CLI keeps every forge artifact in the project's `.bitmagic/forge` (see * local-store.ts). This wraps that storage so the artifacts the BROWSER steps * write are also PUT to api-server, and anything missing locally is fetched * from it — so a job can be resumed, and a forged level edited, from a * machine that never ran the original forge. The server owns `input`, `spec` * and `forge` and refuses a client write of them; those are written locally * only (they arrive on the forge's terminal frame anyway). * * The mirror is best-effort by design: the local write is the one the run * depends on, and a server that cannot be reached must not fail a bake that * has already been paid for. A failed mirror is said once, plainly, because * its cost is real — the artifact will not be there for another machine. * Reads that fall through to the server are cached locally, so a resumed job * reads from disk from then on. */ import type { ForgeStorageEnv } from '@bitmagic/world-forger/pipeline/index.js'; import type { Environment } from '../config/environments.js'; export interface RemoteForgeStoreDeps { environment: Environment; /** * Resolved on the FIRST remote call, not when the store is built: the store * is created before the command's cheap pre-request checks, and a run that * never leaves the machine (a fresh forge with every artifact local) must * not demand a login it would not otherwise need until the request. */ accessToken: () => Promise; fetch: typeof globalThis.fetch; /** Where a failed mirror or fetch is said. */ warn: (message: string) => void; } export declare function forgeArtifactUrl(environment: Environment, jobId: string, name: string): string; /** Wrap a local storage env so forged-work artifacts are mirrored to, and fetched from, the server. */ export declare function createMirroredForgeStorage(local: ForgeStorageEnv, deps: RemoteForgeStoreDeps): ForgeStorageEnv;