import type { ArtifactRef, ArtifactValue } from "./types.js"; /** * Value externalization for run bundles (see docs/run-bundles.md): string * leaves larger than the threshold are written once, content-addressed, under * `artifacts/` and replaced by `{ "$artifact": ref }`. Because artifacts are * immutable and deduplicated by hash, the same output appearing in `outputs`, * `results`, `steps`, and the trace costs one file plus small references. */ export declare const ARTIFACT_THRESHOLD_BYTES = 4096; export declare const ARTIFACTS_DIR = "artifacts"; export declare function isArtifactValue(value: unknown): value is ArtifactValue; /** * Writes externalized string leaves for one run bundle. Instances serialize * their writes and deduplicate by content hash, so encoding the same large * string in several value positions touches the filesystem once. */ export declare class ArtifactWriter { private readonly runDir; private readonly written; private chain; private dirCreated; constructor(runDir: string); /** True once any artifact exists for this run. */ get hasArtifacts(): boolean; externalize(text: string): Promise; } /** * Encode a persisted value: externalize large string leaves and escape * single-key `$artifact`/`$escaped` objects so the sentinel stays * unambiguous. Returns the original value when nothing changed. */ export declare function encodeValue(value: unknown, writer: ArtifactWriter, thresholdBytes?: number): Promise; /** * Walk a persisted value, replacing every `$artifact` sentinel via `resolve` * and unwrapping `$escaped` objects. `resolve` may return the artifact * contents or a placeholder; it receives the reference untouched. */ export declare function decodeValueWith(value: unknown, resolve: (ref: ArtifactRef) => unknown): unknown; /** Resolve every artifact reference in `value` by reading the bundle files. */ export declare function resolveArtifacts(value: unknown, runDir: string): Promise;