/** * Embedding Subprocess Client * * Manages a child process that runs the embedding model. * MCP server uses this for non-blocking embeddings — the server * starts instantly while the model loads in the background. * * Provides the standard EmbeddingGenerator interface. * Falls back to mock embeddings on timeout or worker failure. * * @module @aitytech/agentkits-memory/embeddings/embedding-subprocess */ import type { EmbeddingGenerator } from '../types.js'; /** * Configuration for the embedding subprocess */ export interface EmbeddingSubprocessConfig { /** Cache directory for the embedding model */ cacheDir: string; /** Vector dimensions (default: 384) */ dimensions?: number; /** Timeout for worker initialization in ms (default: 60000) */ initTimeout?: number; /** Timeout for individual embed requests in ms (default: 30000) */ requestTimeout?: number; } /** * Embedding subprocess client. * * Spawns a child process that loads the embedding model. * Requests are queued until the worker is ready. * Falls back to mock embeddings on timeout. */ export declare class EmbeddingSubprocess { private child; private ready; private pending; private queue; private requestCounter; private respawnCount; private shuttingDown; private initTimer; private readonly dimensions; private readonly cacheDir; private readonly initTimeout; private readonly requestTimeout; private readonly maxRespawns; constructor(config: EmbeddingSubprocessConfig); /** * Spawn the embedding worker process. Returns immediately. * The worker loads the model in the background. */ spawn(): void; /** * Handle IPC message from worker */ private handleMessage; /** * Send all queued requests to the worker */ private drainQueue; /** * Resolve all pending and queued requests with mock embeddings */ private resolveAllWithMock; /** * Generate embedding for text. * Queues the request if worker is not ready yet. * Falls back to mock on timeout. */ embed(text: string): Promise; /** * Get an EmbeddingGenerator function compatible with ProjectMemoryService */ getGenerator(): EmbeddingGenerator; /** * Whether the worker is ready to process requests */ isReady(): boolean; /** * Shutdown the worker gracefully */ shutdown(): Promise; } //# sourceMappingURL=embedding-subprocess.d.ts.map