import type { Resource } from '../../resource/base.ts'; import { CLISpec } from '../../commands/cli/types.ts'; /** * Per-name overrides for restoring installed CLIs: a plain mapping is a * fresh config (the spec resolves from the snapshot's registry key); a * [spec, config] tuple carries a live spec too, which is how copy() * shares directly installed programs. */ export type CLIOverrides = Record | [CLISpec, Record | null]>; import type { Workspace } from '../workspace/workspace.ts'; import type { MountArgs } from './config.ts'; import type { MountSnapshot, WorkspaceStateDict } from './types.ts'; export declare function toStateDict(ws: Workspace): Promise; export declare function buildMountArgs(state: WorkspaceStateDict, overrides?: Record, cliOverrides?: CLIOverrides): MountArgs; /** Builds the resource a saved mount names, or null when it cannot. */ export type SavedResourceBuilder = (entry: MountSnapshot) => Promise; /** * Whether `buildMountArgs` restores a saved mount itself, into a fresh * RAMResource, so no registry is asked about it: `disk` (its content * rides the state, and reopening the original root is exactly what a * restore must not do), and `ram` declared by its builtin name or * constructed in code. A `ram` mount whose ref points elsewhere is an * alias registered over RAMResource, and rebuilds through that alias so * the subclass survives; Python's `_construct_resource` calls `cls()` on * the class its ladder found for the same reason. */ export declare function restoresAsFreshRAM(entry: MountSnapshot): boolean; /** * What a saved mount asks a registry to build: the name and config, or * null when the registry has nothing to say. The `resource_ref` the * registry built the mount from when one was recorded (a registered name, * or a code reference, which is how a mount declared as * `./wiki.mjs:WikiResource` comes back), else the resource's `type`, the * one locator a resource constructed in code leaves. The ref comes first * because `type` is the class's `kind` and a subclass inherits it: an * alias registered over a builtin reports the builtin's type and rebuilt * as the builtin while the type was consulted first. A recorded ref this * registry cannot resolve is not a reason to fall back to that guess: the * answer is null, and `buildMountArgs` then asks for the mount live. */ export declare function savedResourceBuild(entry: MountSnapshot, known: (name: string) => boolean): { name: string; config: Record; } | null; /** * The overrides `buildMountArgs` restores with: the caller's, plus every * mount the builder can rebuild from its saved state. A mount that asks * to be handed back live (`resourceStateRequiresOverride`) is never * built here, so the refusal `buildMountArgs` raises for it stands. */ export declare function withRebuiltResources(state: WorkspaceStateDict, overrides: Record, build: SavedResourceBuilder): Promise>; export declare function applyStateDict(ws: Workspace, state: WorkspaceStateDict): Promise; //# sourceMappingURL=state.d.ts.map