/** * Snapshot helpers for agent state capture and restoration. * * These functions provide the shared implementation for {@link LocalAgent.takeSnapshot} * and {@link LocalAgent.loadSnapshot}. Since all `LocalAgent` implementations share the * same snapshot logic, these helpers avoid duplication. The canonical public API is * `agent.takeSnapshot()` / `agent.loadSnapshot()` — prefer calling those directly. */ import type { JSONValue } from '../types/json.js'; import type { LocalAgent } from '../types/agent.js'; import type { Snapshot } from '../types/snapshot.js'; /** * All available fields that can be included in a snapshot. */ export declare const ALL_SNAPSHOT_FIELDS: readonly ["messages", "state", "systemPrompt", "modelState", "interrupts"]; /** * Strongly typed preset definitions for snapshot field selection. * This object allows easy evolution of presets and type-safe access. */ export declare const SNAPSHOT_PRESETS: { readonly session: readonly ["messages", "state", "systemPrompt", "modelState", "interrupts"]; }; /** * Preset name for snapshot field selection. */ export type SnapshotPreset = keyof typeof SNAPSHOT_PRESETS; /** * Valid snapshot field names. */ export type SnapshotField = (typeof ALL_SNAPSHOT_FIELDS)[number]; /** * Creates an ISO 8601 timestamp string. * * @returns Current timestamp in ISO 8601 format */ export declare function createTimestamp(): string; /** * Options for taking a snapshot of agent state. */ export type TakeSnapshotOptions = { /** * Preset to use as the starting set of fields. * If not specified, starts with an empty set (unless include is specified). */ preset?: SnapshotPreset; /** * Fields to add to the snapshot. * These are added to the preset fields (if any). */ include?: SnapshotField[]; /** * Fields to exclude from the snapshot. * Applied after preset and include to filter out specific fields. */ exclude?: SnapshotField[]; /** * Application-owned data to store in the snapshot. * Strands does not read or modify this data. */ appData?: Record; }; /** * Shared implementation for {@link LocalAgent.takeSnapshot}. * Prefer calling `agent.takeSnapshot(options)` directly. * * @param agent - The agent to snapshot * @param options - Snapshot options * @returns A snapshot of the agent's state */ export declare function takeSnapshot(agent: LocalAgent, options: TakeSnapshotOptions): Snapshot; /** * Shared implementation for {@link LocalAgent.loadSnapshot}. * Prefer calling `agent.loadSnapshot(snapshot)` directly. * * @param agent - The agent to restore state into * @param snapshot - The snapshot to load */ export declare function loadSnapshot(agent: LocalAgent, snapshot: Snapshot): void; /** * Resolves snapshot fields based on preset/include/exclude parameters. * * Order of operations: * 1. Start with preset fields (if specified) * 2. Add include fields * 3. Remove exclude fields * * @param options - Snapshot options containing preset, include, and exclude fields * @returns Set of resolved field names * @throws Error if no fields would be included */ export declare function resolveSnapshotFields(options?: TakeSnapshotOptions): Set; //# sourceMappingURL=snapshot.d.ts.map