import type { RunEventBody } from "./agent/events.js"; import { type WorkspaceBackend, type PackCodec } from "./workspace_sync.js"; /** * Production pack codec. Workspaces are dominated by source, JSON, markdown, and logs, which collapse * hard, so this is a straight win on both the storage bill and transfer time. Per-pack (not * whole-scope) so a pack decompresses independently — the property that keeps hydrate O(packs). */ export declare const zstdPackCodec: PackCodec; /** What a run persists: the WHOLE workspace, or exactly these workspace-relative dirs (possibly none). */ export type PersistSelection = true | readonly string[]; /** * Resolve what this run persists (§3): the manifest's declaration UNIONED with every * `agent({ memory })` dir the run actually used. * * The union is why this is resolved at PERSIST time. Memory dirs are undeclared by design * (`sdk/src/types.ts` — "`mcp` servers, `skills`, and `memory` — the manifest declares none of them"), * so a workflow whose manifest says nothing at all still persists, iff it used memory. `true` swallows * the list: the whole workspace already contains every memory dir. An empty array means persist * nothing, which is the common case and must stay cheap. */ export declare function resolvePersistSelection(declared: boolean | readonly string[] | undefined, memoryDirs: ReadonlySet): PersistSelection; /** * Emit-only view of the run's event emitter. Required rather than optional on purpose: an optional * sink is one a future construction site forgets to pass, which reintroduces the exact invisibility * this seam exists to fix. */ export interface WorkspaceEventSink { emit(body: RunEventBody): unknown; } export interface WorkspaceStoreDeps { /** Where the bytes live. Hosted and self-hosted differ HERE and nowhere else (I3). */ backend: WorkspaceBackend; /** The `/workspace` root to snapshot/restore. */ workspaceRoot: string; /** Read at persist time — see {@link resolvePersistSelection}. */ selection: () => PersistSelection; /** Where a dropped snapshot is reported to the author (see {@link WorkspaceEventSink}). */ events: WorkspaceEventSink; /** Overridable for tests; defaults to zstd. */ codec?: PackCodec; /** Per-scope byte ceiling; defaults to the sync layer's. */ maxScopeBytes?: number; } export declare class WorkspaceStore { private readonly deps; private readonly sync; /** A disarm is reported once, not on every suspend point. */ private reportedDisarm; constructor(deps: WorkspaceStoreDeps); /** Restore the scope at run start. Best-effort: a restore miss must not fail the run — the workflow * just re-does filesystem work, exactly as it would without persistence. */ hydrate(): Promise; /** * Store the run's selection. Returns the scope's live bytes (0 when nothing was stored), for the * caller's logging. Never throws: persistence is not allowed to break a run that otherwise succeeded. */ persist(): Promise; /** Reporting is best-effort and never fails the run: a throwing sink is caught and logged. */ private report; }