import { z } from "zod"; export type Observation = { id: string; content: string; validFrom: string; validTo: string | null; }; export type Entity = { id: string; name: string; type: string; source: string; createdAt: string; observations: Observation[]; }; export type Relation = { id: string; from: string; to: string; type: string; source: string; validFrom: string; validTo: string | null; }; export type MemoryGraphData = { entities: Entity[]; relations: Relation[]; nextId: number; }; export type ConversationSummary = { summary: string; lastCompactedAt: string; messagesSummarized: number; }; export type EmbeddingEntry = { id: string; vector: number[]; }; /** * `formatVersion` distinguishes embeddings built from different source * texts. Bumped to 2 when we started feeding the embedder a * contextualized "{name} ({type}): {content}" string per observation * instead of the bare observation content. * * Load-side behaviour (`MemoryManager.getEntry`): if the on-disk * index's `formatVersion` is missing (treated as v1) or older than * this constant, we discard the index in memory, log a warning so the * discard is visible, and start with an empty `EmbeddingManager`. The * graph and summary are NOT touched — only embeddings get rebuilt. * The next mutation (any `applyExtractionFromLLM` call) embeds the * affected observations in the current format and persists. Until * then, Tier 2 (embedding similarity) silently produces zero hits * and recall falls back to Tier 1 + Tier 3. * * If the source-text shape changes again, bump this constant; the * load guard handles the rest. */ export declare const EMBEDDING_FORMAT_VERSION = 2; export type EmbeddingIndex = { formatVersion?: number; model: string; entries: EmbeddingEntry[]; }; export type MemoryConfig = { dir: string; /** Model used for memory's internal LLM calls (extraction, recall, * forget, compaction, summary merge). Resolution order: * this field > the top-level `defaultModel` from `agency.json` > * the hardcoded fallback (`"gpt-4o-mini"`). Set this when you want * a specific cheap model for memory work that differs from the * agent's primary model. */ model?: string; autoExtract?: { interval?: number; }; compaction?: { trigger?: "token" | "messages"; threshold?: number; }; embeddings?: { /** Explicit embedding model. When set, it (with `provider`) is used as-is * and overrides provider-derivation. When omitted, the embedding model is * derived from the active LLM provider (openai/google/ollama); providers * without an embedding endpoint (anthropic, llama-cpp, custom) disable * Tier-2 semantic recall. */ model?: string; /** Explicit embedding provider for `model`. Optional; normally derived. */ provider?: string; }; }; export type MemoryStore = { loadGraph(memoryId: string): Promise; saveGraph(memoryId: string, graph: MemoryGraphData): Promise; loadEmbeddings(memoryId: string): Promise; saveEmbeddings(memoryId: string, index: EmbeddingIndex): Promise; loadSummary(memoryId: string): Promise; saveSummary(memoryId: string, summary: ConversationSummary): Promise; }; export declare const MemoryGraphDataSchema: z.ZodObject<{ entities: z.ZodArray; }, z.core.$strip>>; }, z.core.$strip>>; relations: z.ZodArray; }, z.core.$strip>>; nextId: z.ZodNumber; }, z.core.$strip>; export declare const EmbeddingIndexSchema: z.ZodObject<{ formatVersion: z.ZodOptional; model: z.ZodString; entries: z.ZodArray; }, z.core.$strip>>; }, z.core.$strip>; export declare const ConversationSummarySchema: z.ZodObject<{ summary: z.ZodString; lastCompactedAt: z.ZodString; messagesSummarized: z.ZodNumber; }, z.core.$strip>;