import { BaseCheckpointSaver, Checkpoint, ReadonlyCheckpoint } from "@langchain/langgraph-checkpoint"; import { RunnableConfig } from "@langchain/core/runnables"; //#region src/channels/base.d.ts /** * Structural check for a {@link DeltaChannel} without importing it (avoids an * import cycle: `delta.ts` imports `base.ts`). */ declare function isDeltaChannel(channel: BaseChannel): boolean; /** @internal */ declare abstract class BaseChannel { ValueType: ValueType; UpdateType: UpdateType; /** * The name of the channel. */ abstract lc_graph_name: string; /** @ignore */ lg_is_channel: boolean; /** * Return a new identical channel, optionally initialized from a checkpoint. * Can be thought of as a "restoration" from a checkpoint which is a "snapshot" of the channel's state. * * @param {CheckpointType | undefined} checkpoint * @param {CheckpointType | undefined} initialValue * @returns {this} */ abstract fromCheckpoint(checkpoint?: CheckpointType): this; /** * Update the channel's value with the given sequence of updates. * The order of the updates in the sequence is arbitrary. * This method is called by Pregel for all channels at the end of each step. * If there are no updates, it is called with an empty sequence. * * Raises InvalidUpdateError if the sequence of updates is invalid. * Returns True if the channel was updated, False otherwise. * * @throws {InvalidUpdateError} if the sequence of updates is invalid. * @param {Array} values * @returns {void} */ abstract update(values: UpdateType[]): boolean; /** * Return the current value of the channel. * * @throws {EmptyChannelError} if the channel is empty (never updated yet). * @returns {ValueType} */ abstract get(): ValueType; /** * Return a string representation of the channel's current state. * * @throws {EmptyChannelError} if the channel is empty (never updated yet), or doesn't support checkpoints. * @returns {CheckpointType | undefined} */ abstract checkpoint(): CheckpointType | undefined; /** * Mark the current value of the channel as consumed. By default, no-op. * A channel can use this method to modify its state, preventing the value * from being consumed again. * * Returns True if the channel was updated, False otherwise. */ consume(): boolean; /** * Notify the channel that the Pregel run is finishing. By default, no-op. * A channel can use this method to modify its state, preventing finish. * * Returns True if the channel was updated, False otherwise. */ finish(): boolean; /** * Return True if the channel is available (not empty), False otherwise. * Subclasses should override this method to provide a more efficient * implementation than calling get() and catching EmptyChannelError. */ isAvailable(): boolean; /** * Compare this channel with another channel for equality. * Used to determine if two channels with the same key are semantically equivalent. * Subclasses should override this method to provide a meaningful comparison. * * @param {BaseChannel} other - The other channel to compare with. * @returns {boolean} True if the channels are equal, false otherwise. */ equals(other: BaseChannel): boolean; } declare function emptyChannels>(channels: Cc, checkpoint: ReadonlyCheckpoint): Cc; /** * Return the set of {@link DeltaChannel} names that should snapshot now. * * A channel snapshots when EITHER its accumulated update count reaches * `snapshotFrequency` OR the total supersteps since its last snapshot reaches * `DELTA_MAX_SUPERSTEPS_SINCE_SNAPSHOT`. Pure predicate — no mutation. */ declare function deltaChannelsToSnapshot(channels: Record, countersSinceDeltaSnapshot: Record): Set; declare function createCheckpoint(checkpoint: ReadonlyCheckpoint, channels: Record> | undefined, step: number, options?: { id?: string; channelsToSnapshot?: Set; updatedChannels?: Set; getNextVersion?: (current: number | string | undefined) => number | string; }): Checkpoint; /** * Hydrate channels from a checkpoint, reconstructing any {@link DeltaChannel} * whose value is absent from `channel_values` by replaying ancestor writes. * * For most channels (and for delta channels with a {@link DeltaSnapshot} or a * migrated plain value in `channel_values`), {@link emptyChannels} is * sufficient and no saver access is required. When a delta channel is absent * from `channel_values`, an ancestor walk via `saver.getDeltaChannelHistory` * finds the nearest seed and accumulates the writes between it and the * target. All delta channels needing replay are batched into a single saver * call. */ declare function channelsFromCheckpoint>(specs: Cc, checkpoint: ReadonlyCheckpoint, options?: { saver?: BaseCheckpointSaver; config?: RunnableConfig; }): Promise; //#endregion export { BaseChannel, channelsFromCheckpoint, createCheckpoint, deltaChannelsToSnapshot, emptyChannels, isDeltaChannel }; //# sourceMappingURL=base.d.cts.map