import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import type { EmbeddingProvider } from "@mono-agent/memory/search"; import type { MemoryStatus, MemoryType } from "@mono-agent/memory/store"; import type { MemoryRecallEmbeddings, MemoryRecallSettings } from "./memory-recall-settings.js"; export { resolveMemoryRecallSettings } from "./memory-recall-settings.js"; export type { MemoryRecallBujoSettings, MemoryRecallEmbeddings, MemoryRecallEmbeddingsCircuitBreaker, MemoryRecallSettings, MemoryRecallSupermemory, MemoryRecallSupermemorySettings, ResolveMemoryRecallSettingsOptions, } from "./memory-recall-settings.js"; /** * Read-only memory recall, wired from the SINGLE `config.memory` block. * * When memory is configured and `config.memory.recallTool.enabled` is not explicitly false, the app exposes a `MemoryRecall` MCP tool * (server name {@link MEMORY_RECALL_MCP_SERVER_NAME}) to the agent. The normal app path registers * the tool against the request-scoped shared retrieval service in `memory-retrieval.ts`, so * automatic recall and explicit tool calls use the same store and per-turn cache. Recall needs only * embeddings + FTS — no chat LLM — and still serves FTS-only (lexical) results when embeddings are * absent. Capture stays in-app (unchanged); this module never touches it. * * The separately published `mono-agent-memory-recall` binary remains a standalone compatibility * surface. It reads explicitly supplied `MONO_AGENT_MEMORY_*` settings through * {@link memoryRecallSettingsFromEnv}; the app itself does not construct or inject a stdio-child * server spec. * * MCP tools are not gated by `tools.allowedTools`, so no allowlist entry is required. */ export declare const MEMORY_RECALL_MCP_SERVER_NAME = "mono-agent-memory"; /** Read-only recall surface the MCP server formats. Both backend stores satisfy it structurally. */ export interface RecallCapableStore { recall(query: string, options?: { readonly topK?: number; readonly trackAccess?: boolean; }): Promise; /** Optional deterministic one-hop expansion, used only by the explicit tool. */ expandGraph?(query: string, directHits: Awaited>, options?: { readonly topK?: number; }): Awaited> | Promise>>; /** Explicit capability check for stores whose graph method is tier-dependent. */ supportsGraphExpansion?(): boolean; /** Record only the final hits actually served by the tool. */ recordAccess?(ids: readonly string[]): void; flush?(): Promise; close(): Promise; } export interface MemoryRecallRuntimeExtension { readonly runtimeOptions: { readonly mcpServers: Record; }; readonly cleanup: () => Promise; } /** * Bound embeddings calls in the recall child so a slow/cold backend cannot stall a turn for the * provider default. Mirrors the in-app `createConfiguredMemory` host default (agent-host). */ export declare const DEFAULT_RECALL_EMBEDDINGS_TIMEOUT_MS = 10000; /** * Re-read recall settings from the recall server's own environment (the stdio child process). * * Only `MONO_AGENT_MEMORY_PATH` is required. When the embeddings provider/model are both absent the * child runs FTS-only (no embedding provider). When present, the embeddings slice — including the * resilience knobs (timeout + circuit breaker) — is rehydrated. When * `MONO_AGENT_MEMORY_EMBEDDINGS_API_KEY_ENV` is set, that named inherited value is authoritative and * must resolve; a literal `MONO_AGENT_MEMORY_EMBEDDINGS_API_KEY` is accepted only for the inline-key * case where no env-var name was declared. */ export declare function memoryRecallSettingsFromEnv(env: Record): MemoryRecallSettings; /** * Build a RECALL-ONLY store: embeddings + FTS, no chat LLM (recall needs none, so capture/reflect * stay disabled here). With no embeddings (lite tier / explicit FTS-only opt-in) the store is built * without an embedding provider and serves FTS-only recall. * * The embedding provider is wrapped with the SAME resilience as the in-app store * (`createConfiguredMemory`): a bounded per-call timeout (default * {@link DEFAULT_RECALL_EMBEDDINGS_TIMEOUT_MS}) keeps a slow backend from stalling recall, and a * circuit breaker fast-fails after repeated failures so a sustained outage stops blocking it. */ export declare function createRecallStore(settings: MemoryRecallSettings): Promise; /** Build the configured embedding provider used by recall and safe index maintenance. */ export declare function createMemoryEmbeddingProvider(embeddings: MemoryRecallEmbeddings): Promise; /** Register the single read-only `MemoryRecall` tool against a store (bujo or external backend). */ export declare function createMemoryRecallServer(store: RecallCapableStore): McpServer; //# sourceMappingURL=memory-recall.d.ts.map