/** * State-Sync - Context-Diff Bridge * * Provides utilities for generating and applying deltas between * Bash snapshots. This is used for efficient synchronization * of agentic workspaces. */ import type { BashSnapshot } from "../Bash.js"; import type { FileSystemSnapshot } from "../fs/interface.js"; import type { InterpreterState } from "../interpreter/types.js"; export interface BashDelta { /** Map of changed environment variables. Null indicates deletion. */ envDelta?: Record; /** Map of changed functions. Null indicates deletion. */ funcDelta?: Record; /** Filesystem changes. */ fsDelta?: FsDelta; /** Metadata like CWD. */ cwd?: string; } export interface FsDelta { /** New or modified files: path -> content (string or base64) */ modified: Record; /** Deleted absolute paths */ deleted: string[]; } /** * Generates a delta between a base snapshot and current state. */ export declare function diffState(base: BashSnapshot, current: BashSnapshot): BashDelta; /** * Diffs two VFS snapshots. Handles both raw Maps and MountableFs snapshot objects. */ export declare function diffFs(baseFs: FileSystemSnapshot, currentFs: FileSystemSnapshot): FsDelta; /** * Applies a delta to an interpreter state. */ export declare function applyStateDelta(state: InterpreterState, delta: BashDelta): void;