import { SerializerProtocol } from "./serde/base.js"; import { CheckpointMetadata, CheckpointPendingWrite, PendingWrite } from "./types.js"; import { RunnableConfig } from "@langchain/core/runnables"; //#region src/base.d.ts /** @inline */ type ChannelVersion = number | string; type ChannelVersions = Record; interface Checkpoint { /** * The version of the checkpoint format. Currently 4 */ v: number; /** * Checkpoint ID {uuid6} */ id: string; /** * Timestamp {new Date().toISOString()} */ ts: string; /** * @default {} */ channel_values: Record; /** * @default {} */ channel_versions: Record; /** * @default {} */ versions_seen: Record>; } interface ReadonlyCheckpoint extends Readonly { readonly channel_values: Readonly>; readonly channel_versions: Readonly>; readonly versions_seen: Readonly>>>; } declare function deepCopy(obj: T): T; /** @hidden */ declare function emptyCheckpoint(): Checkpoint; /** @hidden */ declare function copyCheckpoint(checkpoint: ReadonlyCheckpoint): Checkpoint; interface CheckpointTuple { config: RunnableConfig; checkpoint: Checkpoint; metadata?: CheckpointMetadata; parentConfig?: RunnableConfig; pendingWrites?: CheckpointPendingWrite[]; } type CheckpointListOptions = { limit?: number; before?: RunnableConfig; filter?: Record; }; declare abstract class BaseCheckpointSaver { serde: SerializerProtocol; constructor(serde?: SerializerProtocol); get(config: RunnableConfig): Promise; abstract getTuple(config: RunnableConfig): Promise; abstract list(config: RunnableConfig, options?: CheckpointListOptions): AsyncGenerator; abstract put(config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata, newVersions: ChannelVersions): Promise; /** * Store intermediate writes linked to a checkpoint. */ abstract putWrites(config: RunnableConfig, writes: PendingWrite[], taskId: string): Promise; /** * Delete all checkpoints and writes associated with a specific thread ID. * @param threadId The thread ID whose checkpoints should be deleted. */ abstract deleteThread(threadId: string): Promise; /** * Generate the next version ID for a channel. * * Default is to use integer versions, incrementing by 1. If you override, you can use str/int/float versions, * as long as they are monotonically increasing. */ getNextVersion(current: V | undefined): V; } declare function compareChannelVersions(a: ChannelVersion, b: ChannelVersion): number; declare function maxChannelVersion(...versions: ChannelVersion[]): ChannelVersion; /** * Mapping from error type to error index. * Regular writes just map to their index in the list of writes being saved. * Special writes (e.g. errors) map to negative indices, to avoid those writes from * conflicting with regular writes. * Each Checkpointer implementation should use this mapping in put_writes. */ declare const WRITES_IDX_MAP: Record; declare function getCheckpointId(config: RunnableConfig): string; //#endregion export { BaseCheckpointSaver, ChannelVersions, Checkpoint, CheckpointListOptions, CheckpointTuple, ReadonlyCheckpoint, WRITES_IDX_MAP, compareChannelVersions, copyCheckpoint, deepCopy, emptyCheckpoint, getCheckpointId, maxChannelVersion }; //# sourceMappingURL=base.d.ts.map