import { Tokenizable } from "./tokenizable"; import { ENCODE_METHOD, DECODE_METHOD } from "../utils/encoder_symbols"; import type { DateTime } from 'luxon'; import type { AdkEncodableSnapshot } from "./encodable"; /** * Plain input object supplied to {@link Memory} at construction time. * * @remarks * Validated against `rawMemorySchema` before the `Memory` instance is created. * Temporal fields accept any value that Luxon can parse — ISO strings, Unix timestamps, * `Date` objects, or existing `DateTime` instances. */ export interface RawMemory { /** Stable unique identifier for this memory entry. */ id: string; /** The memory content as a plain string or an existing {@link @nhtio/adk!Tokenizable} instance. */ content: string | Tokenizable; /** Confidence score in the range `[0, 1]` — how certain the agent is that this memory is accurate. */ confidence: number; /** Importance score in the range `[0, 1]` — how much weight this memory should carry during retrieval. */ importance: number; /** When this memory was first recorded. */ createdAt: string | number | Date | DateTime; /** When this memory was last modified. */ updatedAt: string | number | Date | DateTime; } /** * An immutable, validated memory entry held by the agent. * * @remarks * Constructed from a {@link RawMemory} via `rawMemorySchema`. All temporal fields are * normalised to Luxon `DateTime` instances at construction time. The `content` field is * always a {@link @nhtio/adk!Tokenizable} so callers can estimate token cost without an additional * wrapping step. */ export declare class Memory { #private; /** * Validator schema that accepts a {@link RawMemory} object. * * @remarks * Reusable fragment for any schema that needs to validate or nest a memory entry — for * example, a collection schema that holds an array of memories. */ static schema: import("@nhtio/validation").ObjectSchema; /** * Returns `true` if `value` is a {@link Memory} instance. * * @remarks * Uses {@link @nhtio/adk!isInstanceOf} for cross-realm safety — `instanceof` would fail for instances * created in a different module copy or VM context. * * @param value - The value to test. * @returns `true` when `value` is a {@link Memory} instance. */ static isMemory(value: unknown): value is Memory; /** Stable unique identifier for this memory entry. */ readonly id: string; /** The memory content as a {@link @nhtio/adk!Tokenizable} for inline token estimation. */ readonly content: Tokenizable; /** Confidence score in the range `[0, 1]`. */ readonly confidence: number; /** Importance score in the range `[0, 1]`. */ readonly importance: number; /** When this memory was first recorded. */ readonly createdAt: DateTime; /** When this memory was last modified. */ readonly updatedAt: DateTime; /** * @param raw - The raw memory input validated against `rawMemorySchema`. * @throws {@link @nhtio/adk!E_INVALID_INITIAL_MEMORY_VALUE} when `raw` does not satisfy the schema. */ constructor(raw: RawMemory); /** * Serialise this Memory into an `@nhtio/encoder` snapshot. * * @remarks * Emits a {@link RawMemory}-shaped object; `content` is the live {@link @nhtio/adk!Tokenizable} and the * temporal fields are live Luxon `DateTime` instances (the encoder recurses into both). Round-trips * via {@link Memory.[DECODE_METHOD]}, which re-validates through the constructor. * * @returns A {@link RawMemory}-shaped snapshot. */ [ENCODE_METHOD](): AdkEncodableSnapshot; /** * Reconstruct a {@link Memory} from a {@link Memory.[ENCODE_METHOD]} snapshot. * * @param data - The snapshot produced by {@link Memory.[ENCODE_METHOD]}. * @returns A fully-validated {@link Memory}. */ static [DECODE_METHOD](data: AdkEncodableSnapshot): Memory; }