/** * BRAIN Observe — unified write path for observations + embedding backfill. * * @task T5134 * @epic T5149 */ import type { ObserveBrainParams, ObserveBrainResult } from '@cleocode/contracts'; /** * Save an observation to the BRAIN observations table. * Replaces the external claude-mem save_observation pattern. * * Auto-classifies type from text if not provided. Generates a * unique ID with O- prefix + base36 timestamp. * * @param projectRoot - Project root directory * @param params - Observation data * @returns Created observation ID, type, and timestamp * * @example * ```ts * // Save a decision observation to the BRAIN. * // The result contains the auto-generated ID, classified type, and timestamp. * const result = await observeBrain('/path/to/project', { * text: 'Decided to use ESM-only imports for better tree-shaking.', * title: 'ESM-only import decision', * type: 'decision', * sourceType: 'session-debrief', * }); * * console.assert(result.id.startsWith('O-'), 'ID uses O- prefix'); * console.assert(result.type === 'decision', 'type preserved from params'); * console.assert(typeof result.createdAt === 'string', 'createdAt is ISO timestamp'); * ``` */ export declare function observeBrain(projectRoot: string, params: ObserveBrainParams): Promise; /** Result from populateEmbeddings backfill. */ export interface PopulateEmbeddingsResult { processed: number; skipped: number; errors: number; } /** * Options for the embedding backfill pipeline. * * @example * ```ts * await populateEmbeddings(root, { * batchSize: 25, * onProgress: (current, total) => console.log(`${current}/${total}`), * }); * ``` */ export interface PopulateEmbeddingsOptions { /** Maximum items processed per batch cycle. Defaults to 50. */ batchSize?: number; /** * Progress callback invoked after each observation is attempted. * `current` is the 1-based count of observations attempted so far; * `total` is the full count of observations that need embeddings. */ onProgress?: (current: number, total: number) => void; } /** * Backfill embeddings for existing observations that lack them. * * Iterates through observations not yet in brain_embeddings and * generates vectors using the registered embedding provider. * Processes in batches to avoid memory pressure. * * An optional {@link PopulateEmbeddingsOptions.onProgress} callback is called * after each observation is attempted, enabling callers to report progress. * * @param projectRoot - Project root directory * @param options - Optional batch size and progress callback * @returns Count of processed, skipped, and errored observations * * @epic T134 * @task T142 */ export declare function populateEmbeddings(projectRoot: string, options?: PopulateEmbeddingsOptions): Promise; //# sourceMappingURL=observe.d.ts.map