import { type ZodType, z } from "zod"; import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessResult, type FunctionAgentFn, type Message } from "../agents/agent.js"; import type { PromiseOrValue } from "../utils/type-utils.js"; import type { Memory } from "./memory.js"; /** * Input for memory recording operations. * * This interface represents the data needed to record new memories * in the system. The content array can contain any type of data that * should be stored as memories. */ export interface MemoryRecorderInput extends Message { content: { input?: Message; output?: Message; source?: string; }[]; } /** * @hidden */ export declare const memoryRecorderInputSchema: ZodType; /** * Output from memory recording operations. * * This interface represents the result of recording new memories, * including the newly created memory objects with their IDs and timestamps. */ export interface MemoryRecorderOutput extends Message { /** * Array of newly created memory objects. * Each memory includes a unique ID, the stored content, and a creation timestamp. */ memories: Memory[]; } /** * @hidden */ export declare const memoryRecorderOutputSchema: z.ZodObject<{ memories: z.ZodArray; createdAt: z.ZodString; }, "strip", z.ZodTypeAny, { id: string; content: {}; createdAt: string; }, { id: string; content: {}; createdAt: string; }>, "many">; }, "strip", z.ZodTypeAny, { memories: { id: string; content: {}; createdAt: string; }[]; }, { memories: { id: string; content: {}; createdAt: string; }[]; }>; export interface MemoryRecorderOptions extends Omit, "inputSchema" | "outputSchema"> { process?: FunctionAgentFn; } /** * Abstract base class for agents that record and store memories. * * The MemoryRecorder serves as a foundation for implementing specific memory storage * mechanisms. Implementations of this class are responsible for: * * 1. Converting input content into standardized memory objects * 2. Assigning unique IDs to new memories * 3. Storing memories in an appropriate backend (database, file system, etc.) * 4. Ensuring proper timestamping of memories * * Custom implementations should extend this class and provide concrete * implementations of the process method to handle the actual storage logic. */ export declare class MemoryRecorder extends Agent { tag: string; /** * Creates a new MemoryRecorder instance with predefined input and output schemas. * * @param options - Configuration options for the memory recorder agent */ constructor(options: MemoryRecorderOptions); private _process?; process(input: MemoryRecorderInput, options: AgentInvokeOptions): PromiseOrValue>; }