import { BaseCheckpointSaver } from "@langchain/langgraph"; import { OnModuleDestroy } from "@nestjs/common"; import { ConfigService } from "@nestjs/config"; import { BaseConfigInterface } from "../../../config/interfaces/base.config.interface"; /** Default number of days an operator approval may stay pending. */ export declare const OPERATOR_DEFAULT_APPROVAL_TTL_DAYS = 7; /** * OperatorCheckpointerService - Durable checkpoint storage for the operator agent. * * Lazily constructs and caches a LangGraph checkpoint saver: * - `RedisSaver` (from `@langchain/langgraph-checkpoint-redis`) when a Redis * connection is configured, using the same `redis` config block the * QueueModule reads from ConfigService. * - `MemorySaver` fallback when no Redis config is present (tests). * * Checkpoints expire after `(operator.approvalTtlDays ?? 7) + 1` days, one day * past the approval expiry so a pending approval never outlives its checkpoint. */ export declare class OperatorCheckpointerService implements OnModuleDestroy { private readonly configService; private readonly logger; private saverPromise?; constructor(configService: ConfigService); /** Lazily constructs and caches the saver; MemorySaver fallback when redis config is absent (tests). */ getSaver(): Promise; /** Closes the Redis connection on shutdown; never throws. */ onModuleDestroy(): Promise; private createSaver; /** * Probes the Redis server for the module commands RedisSaver depends on, * using a short-lived ioredis client (already a dependency of this package — * the node-redis `redis` package used by the saver is not resolvable from * here under pnpm's strict isolation). * * `COMMAND INFO ` replies with a single-element array whose element is * nil (`[null]`) when the command is unknown, and a populated array when it * exists. It is preferred over `MODULE LIST` because on Redis 8+ the JSON * and search commands are built into core (no module entry), while * COMMAND INFO reports them uniformly on redis-stack, module-loaded Redis, * and Redis 8+. * * Connection failures reject and propagate to the caller, exactly like a * `RedisSaver.fromUrl` failure: getSaver() clears the cached promise so the * next call retries. */ private probeMissingRedisCommands; /** * RedisSaver.fromUrl creates its node-redis client without an "error" * listener, so a socket error after startup would crash the process. The * client is a TypeScript-private but runtime-reachable field; attach a * logging handler when it is reachable, and degrade silently when a future * library version hides it. */ private attachSaverErrorHandler; private buildRedisUrl; } //# sourceMappingURL=operator.checkpointer.service.d.ts.map