import { type BigIntStats } from "node:fs"; export declare const BACKGROUND_SNAPSHOT_SCHEMA = "mono-agent.background-snapshot.v1"; /** * Secret-free evidence for the exact durable inputs a worker observed. * Secret-bearing files use identity/version metadata plus a keyed commitment; * plaintext and offline-testable content digests never enter argv or traces. */ export interface BackgroundSnapshot { readonly schema: typeof BACKGROUND_SNAPSHOT_SCHEMA; readonly configPath: string; readonly configFingerprint: string; readonly dotenvPath: string; readonly dotenvFingerprint: string; readonly identityPath: string; readonly identityFingerprint: string; readonly soulPath?: string; readonly soulFingerprint?: string; readonly mcpConfigPath?: string; readonly mcpConfigFingerprint?: string; readonly operationalEnvironmentFingerprint: string; } /** * Encode the secret-free approved snapshot for the owner-private LaunchAgent * ProgramArguments. base64url keeps the value XML/shell inert while remaining * visible and deterministic for diagnostics. */ export declare function encodeBackgroundSnapshot(snapshot: BackgroundSnapshot): string; /** Fail closed when an internal managed-worker snapshot argument is malformed. */ export declare function decodeBackgroundSnapshot(encoded: string): BackgroundSnapshot; export interface MaterializedBackgroundRuntimeInputs { /** Owner-only immutable copy read by every app/channel config loader. */ readonly configPath: string; /** Frozen effective environment; Identity/Soul/MCP config resolve to owner-only copies. */ readonly environment: Record; dispose(): Promise; } export interface CaptureBackgroundSnapshotInput { readonly cwd: string; readonly configPath: string; readonly envFile?: string; /** Effective worker environment after dotenv loading/sanitisation. */ readonly env: Readonly>; /** Test/internal seam. Production uses the owner-only per-config key. */ readonly proofKey?: Uint8Array; } export interface CaptureDurableBackgroundSnapshotInput { readonly cwd: string; readonly configPath: string; readonly envFile?: string; /** The exact non-secret values materialised into the LaunchAgent plist. */ readonly operationalEnvironment: Readonly>; /** Test/internal seam. Production uses the owner-only per-config key. */ readonly proofKey?: Uint8Array; } export interface DurableBackgroundInputs { /** Exact environment a managed worker reconstructs from dotenv + plist. */ readonly environment: Readonly>; /** Snapshot captured with that same reconstructed environment. */ readonly snapshot: BackgroundSnapshot; /** Internal setup guard only; contains a digest and must never be serialized. */ readonly configSourceFingerprint: string; } /** * Reconstruct the worker environment without inheriting shell credentials or * config overrides, then attest it. This mirrors managed-worker startup: * operational plist values exist first and dotenv fills every other key. */ export declare function captureDurableBackgroundSnapshot(input: CaptureDurableBackgroundSnapshotInput): Promise; /** * Reconstruct and attest one indivisible durable worker input. Returning the * environment with its snapshot prevents callers from accidentally validating * one environment and launching with a shell-enriched variant. */ export declare function captureDurableBackgroundInputs(input: CaptureDurableBackgroundSnapshotInput): Promise; export declare function loadDurableBackgroundEnvironment(input: Pick): Promise>; export declare function captureBackgroundSnapshot(input: CaptureBackgroundSnapshotInput): Promise; /** * Freeze the exact config and context bytes attested by `snapshot` before any * app/channel loader runs. The app advertises the canonical config path, but * reads this private copy so an edit/revert during startup cannot produce a * mixed worker while retaining the old trace proof. */ export declare function materializeBackgroundRuntimeInputs(input: { readonly snapshot: BackgroundSnapshot; readonly cwd: string; readonly env: Readonly>; /** Managed worker home; defaults to the current OS user's home. */ readonly homeDir?: string; /** Test seam; production defaults below the current user's home. */ readonly runtimeRoot?: string; /** Test/internal seam. Workers otherwise load the existing owner-only key. */ readonly proofKey?: Uint8Array; }): Promise; export declare function sameBackgroundSnapshot(left: BackgroundSnapshot, right: BackgroundSnapshot): boolean; /** Fail-closed parser for untrusted trace-source metadata. */ export declare function backgroundSnapshotFromMetadata(metadata: Record | undefined): BackgroundSnapshot | undefined; type BackgroundRegularFileVersion = Pick; /** Build durable evidence without persisting the mount's boot-local device number. */ export declare function fingerprintBackgroundRegularFile(input: { readonly path: string; readonly label: string; readonly proofKey: Uint8Array; readonly bytes: Uint8Array; readonly version: BackgroundRegularFileVersion; }): string; /** Same-access identity fence; device identity remains load-bearing here. */ export declare function sameBackgroundRegularFileVersion(left: BackgroundRegularFileVersion, right: BackgroundRegularFileVersion): boolean; export {}; //# sourceMappingURL=background-snapshot.d.ts.map