wolbarg 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1149 @@
1
+ /**
2
+ * Metadata filter AST for advanced recall filtering.
3
+ */
4
+ /** Comparison operators on a single metadata field. */
5
+ type MetadataComparison = {
6
+ eq: unknown;
7
+ } | {
8
+ contains: string;
9
+ } | {
10
+ gt: number | string;
11
+ } | {
12
+ gte: number | string;
13
+ } | {
14
+ lt: number | string;
15
+ } | {
16
+ lte: number | string;
17
+ } | {
18
+ between: [number | string, number | string];
19
+ };
20
+ /** Recursive metadata filter supporting boolean combinators. */
21
+ type MetadataFilter = {
22
+ field: string;
23
+ op: MetadataComparison;
24
+ } | {
25
+ and: MetadataFilter[];
26
+ } | {
27
+ or: MetadataFilter[];
28
+ } | {
29
+ not: MetadataFilter;
30
+ };
31
+ /** Helpers for building filters fluently. */
32
+ declare const meta: {
33
+ eq: (field: string, value: unknown) => MetadataFilter;
34
+ contains: (field: string, value: string) => MetadataFilter;
35
+ gt: (field: string, value: number | string) => MetadataFilter;
36
+ gte: (field: string, value: number | string) => MetadataFilter;
37
+ lt: (field: string, value: number | string) => MetadataFilter;
38
+ lte: (field: string, value: number | string) => MetadataFilter;
39
+ between: (field: string, lo: number | string, hi: number | string) => MetadataFilter;
40
+ and: (...filters: MetadataFilter[]) => MetadataFilter;
41
+ or: (...filters: MetadataFilter[]) => MetadataFilter;
42
+ not: (filter: MetadataFilter) => MetadataFilter;
43
+ };
44
+
45
+ /**
46
+ * Public configuration and domain types for Wolbarg v0.2.
47
+ */
48
+
49
+ /** Opaque, user-defined metadata. Never validated or modified by the SDK. */
50
+ type MemoryMetadata = Record<string, unknown>;
51
+ /** Memory content payload. */
52
+ interface MemoryContent {
53
+ /** Plain-text content used for embedding generation. */
54
+ text: string;
55
+ }
56
+ /** Supported storage / database providers. */
57
+ type DatabaseProviderName = "sqlite" | "postgres";
58
+ /** @deprecated Prefer `StorageProviderName`. */
59
+ type StorageProviderName = DatabaseProviderName;
60
+ /** SQLite database configuration. */
61
+ interface SqliteDatabaseConfig {
62
+ provider: "sqlite";
63
+ /**
64
+ * Path to the SQLite database file, or `:memory:` for an in-memory database.
65
+ * Relative paths are resolved from `process.cwd()`.
66
+ */
67
+ connectionString: string;
68
+ }
69
+ /** PostgreSQL database configuration. */
70
+ interface PostgresDatabaseConfig {
71
+ provider: "postgres";
72
+ /** Postgres connection string (e.g. `postgres://user:pass@host:5432/db`). */
73
+ connectionString: string;
74
+ /** Optional max pool size. Defaults to 10. */
75
+ maxPoolSize?: number;
76
+ }
77
+ /** Discriminated union of database configs. */
78
+ type DatabaseConfig = SqliteDatabaseConfig | PostgresDatabaseConfig;
79
+ /** Alias used by the constructor-based API. */
80
+ type StorageConfig = DatabaseConfig;
81
+ /**
82
+ * OpenAI-compatible embedding endpoint configuration.
83
+ * Works with OpenAI, Ollama, LM Studio, OpenRouter, Azure OpenAI, Gemini, etc.
84
+ */
85
+ interface EmbeddingConfig {
86
+ /** Base URL of the OpenAI-compatible API (e.g. `https://api.openai.com/v1`). */
87
+ baseUrl: string;
88
+ /** API key sent as `Authorization: Bearer <apiKey>`. */
89
+ apiKey: string;
90
+ /** Embedding model identifier. */
91
+ model: string;
92
+ /** Optional request timeout in milliseconds. Defaults to 30_000. */
93
+ timeoutMs?: number;
94
+ }
95
+ /**
96
+ * OpenAI-compatible chat completion endpoint used for compression.
97
+ * May differ from the embedding provider.
98
+ */
99
+ interface LlmConfig {
100
+ /** Base URL of the OpenAI-compatible API. */
101
+ baseUrl: string;
102
+ /** API key sent as `Authorization: Bearer <apiKey>`. */
103
+ apiKey: string;
104
+ /** Chat model identifier. */
105
+ model: string;
106
+ /** Sampling temperature. Defaults to 0.2. */
107
+ temperature?: number;
108
+ /** Maximum tokens for the completion. Defaults to 4096. */
109
+ maxTokens?: number;
110
+ /** Optional request timeout in milliseconds. Defaults to 60_000. */
111
+ timeoutMs?: number;
112
+ }
113
+ /** Hybrid score fusion weights. */
114
+ interface HybridConfig {
115
+ /** Weight for semantic similarity. Defaults to 0.7. */
116
+ semanticWeight?: number;
117
+ /** Weight for keyword relevance. Defaults to 0.3. */
118
+ keywordWeight?: number;
119
+ }
120
+ /** MMR diversification options. */
121
+ interface MmrConfig {
122
+ /** Trade-off between relevance and diversity (0–1). Defaults to 0.5. */
123
+ lambda?: number;
124
+ }
125
+ /** Retrieval pipeline defaults applied when constructing Wolbarg. */
126
+ interface RetrievalConfig {
127
+ /** Default over-fetch multiplier for candidate generation. Defaults to 4. */
128
+ overFetchFactor?: number;
129
+ /** Default hybrid fusion weights. */
130
+ hybrid?: HybridConfig;
131
+ /** Default MMR lambda. */
132
+ mmr?: MmrConfig;
133
+ }
134
+ /**
135
+ * Full SDK initialization options (v0.1 compat + v0.2 extensions).
136
+ * Prefer the constructor API with `storage` / provider instances.
137
+ */
138
+ interface InitOptions {
139
+ /** Organization namespace isolating memories within a shared database. */
140
+ organization: string;
141
+ /** Database provider configuration. */
142
+ database: DatabaseConfig;
143
+ /** Embedding provider configuration. */
144
+ embedding: EmbeddingConfig;
145
+ /**
146
+ * LLM provider configuration used for compression.
147
+ * Optional in v0.2 — required only when calling `compress`.
148
+ */
149
+ llm?: LlmConfig;
150
+ }
151
+ /** Input for {@link Wolbarg.remember}. */
152
+ interface RememberOptions {
153
+ /** Agent identifier that owns this memory. */
154
+ agent: string;
155
+ /** Content to store and embed. */
156
+ content: MemoryContent;
157
+ /** Optional opaque metadata. Stored and returned as-is. */
158
+ metadata?: MemoryMetadata;
159
+ }
160
+ /** Optional filter applied to recall / forget / compress operations. */
161
+ interface MemoryFilter {
162
+ /** Restrict results to a specific agent. */
163
+ agent?: string;
164
+ /**
165
+ * When `true`, include archived memories.
166
+ * Defaults to `false` for recall and compress.
167
+ */
168
+ includeArchived?: boolean;
169
+ /** Structured metadata filter (AND/OR/NOT + comparisons). */
170
+ metadata?: MetadataFilter;
171
+ }
172
+ /** Input for {@link Wolbarg.recall}. */
173
+ interface RecallOptions {
174
+ /** Natural-language query to embed and search against. */
175
+ query: string;
176
+ /** Maximum number of results to return. Defaults to 5. */
177
+ topK?: number;
178
+ /**
179
+ * Minimum cosine similarity (0–1) required for a result.
180
+ * Defaults to `0` (no threshold).
181
+ */
182
+ threshold?: number;
183
+ /** Optional filters. */
184
+ filter?: MemoryFilter;
185
+ /**
186
+ * When `true`, apply the configured reranker if available.
187
+ * Skips silently when no reranker is configured.
188
+ */
189
+ rerank?: boolean;
190
+ /** Enable MMR diversification. */
191
+ mmr?: boolean | MmrConfig;
192
+ /**
193
+ * Enable hybrid (semantic + keyword) search when a keyword provider exists.
194
+ * Falls back to semantic-only when keyword search is not configured.
195
+ */
196
+ hybrid?: boolean | HybridConfig;
197
+ }
198
+ /** A single recalled memory with similarity score. */
199
+ interface RecallResult {
200
+ id: string;
201
+ organization: string;
202
+ agent: string;
203
+ content: MemoryContent;
204
+ metadata: MemoryMetadata;
205
+ archived: boolean;
206
+ similarity: number;
207
+ createdAt: Date;
208
+ updatedAt: Date;
209
+ }
210
+ /** Persisted memory record (without embedding vector). */
211
+ interface MemoryRecord {
212
+ id: string;
213
+ organization: string;
214
+ agent: string;
215
+ content: MemoryContent;
216
+ metadata: MemoryMetadata;
217
+ archived: boolean;
218
+ /** ID of the summary memory this was compressed into, if any. */
219
+ compressedInto: string | null;
220
+ createdAt: Date;
221
+ updatedAt: Date;
222
+ }
223
+ /** Input for {@link Wolbarg.compress}. */
224
+ interface CompressOptions {
225
+ /** Agent whose memories should be compressed. */
226
+ agent: string;
227
+ /**
228
+ * Maximum number of active memories to include in compression.
229
+ * Defaults to 50.
230
+ */
231
+ limit?: number;
232
+ }
233
+ /** Result of a successful compression. */
234
+ interface CompressResult {
235
+ /** Newly created summary memory. */
236
+ summary: MemoryRecord;
237
+ /** IDs of memories that were archived. */
238
+ archivedIds: string[];
239
+ }
240
+ /** Forget by exact memory ID. */
241
+ interface ForgetByIdOptions {
242
+ id: string;
243
+ filter?: never;
244
+ }
245
+ /** Forget by filter (e.g. all memories for an agent). */
246
+ interface ForgetByFilterOptions {
247
+ id?: never;
248
+ filter: MemoryFilter & {
249
+ agent: string;
250
+ };
251
+ }
252
+ /** Input for {@link Wolbarg.forget}. */
253
+ type ForgetOptions = ForgetByIdOptions | ForgetByFilterOptions;
254
+ /** Input for {@link Wolbarg.history}. */
255
+ interface HistoryOptions {
256
+ /** Memory ID whose lineage should be returned. */
257
+ id: string;
258
+ }
259
+ /** A single event in a memory's history. */
260
+ interface HistoryEvent {
261
+ id: string;
262
+ memoryId: string;
263
+ eventType: "created" | "archived" | "compressed";
264
+ relatedMemoryId: string | null;
265
+ createdAt: Date;
266
+ }
267
+ /** Full history response for a memory. */
268
+ interface HistoryResult {
269
+ memory: MemoryRecord;
270
+ events: HistoryEvent[];
271
+ }
272
+ /** Input for {@link Wolbarg.clear}. */
273
+ interface ClearOptions {
274
+ /**
275
+ * Must be `true` to confirm irreversible deletion of all memories
276
+ * in the current organization.
277
+ */
278
+ confirm: true;
279
+ }
280
+ /** Aggregate statistics for the current organization. */
281
+ interface StatsResult {
282
+ /**
283
+ * Total memory rows including archived (historical) memories.
284
+ * Prefer {@link activeMemories} for “live set” size.
285
+ */
286
+ totalMemories: number;
287
+ /** Non-archived memories currently eligible for recall / compression. */
288
+ activeMemories: number;
289
+ /** Soft-archived memories retained for lineage after compression. */
290
+ archivedMemories: number;
291
+ totalAgents: number;
292
+ databaseSizeBytes: number;
293
+ embeddingModel: string;
294
+ /** Configured LLM model, or `null` when compression is not configured. */
295
+ llmModel: string | null;
296
+ organization: string;
297
+ embeddingDimensions: number;
298
+ }
299
+ /** Supported document input for {@link Wolbarg.ingest}. */
300
+ interface IngestOptions {
301
+ /** Agent that owns the ingested chunks. */
302
+ agent: string;
303
+ /**
304
+ * File path, Buffer, or raw text content.
305
+ * When `text` is provided, parsing is skipped.
306
+ */
307
+ source: {
308
+ path: string;
309
+ mimeType?: string;
310
+ } | {
311
+ buffer: Buffer;
312
+ filename?: string;
313
+ mimeType?: string;
314
+ } | {
315
+ text: string;
316
+ filename?: string;
317
+ };
318
+ /** Optional metadata attached to every produced chunk memory. */
319
+ metadata?: MemoryMetadata;
320
+ /** Override chunking for this call. */
321
+ chunking?: {
322
+ strategy?: "fixed" | "sentence" | "paragraph" | "markdown" | "heading";
323
+ chunkSize?: number;
324
+ overlap?: number;
325
+ };
326
+ }
327
+ /** Result of document ingestion. */
328
+ interface IngestResult {
329
+ /** Memory records created from document chunks. */
330
+ memories: MemoryRecord[];
331
+ /** Extracted text length before chunking. */
332
+ extractedChars: number;
333
+ /** Chunk count produced. */
334
+ chunkCount: number;
335
+ /** Whether OCR contributed text. */
336
+ usedOcr: boolean;
337
+ /** Whether vision contributed captions. */
338
+ usedVision: boolean;
339
+ }
340
+
341
+ /**
342
+ * Chunking strategies for document ingestion.
343
+ */
344
+ interface Chunk {
345
+ text: string;
346
+ index: number;
347
+ }
348
+ interface ChunkingOptions {
349
+ chunkSize?: number;
350
+ overlap?: number;
351
+ }
352
+ interface ChunkingStrategy {
353
+ readonly name: string;
354
+ chunk(text: string, options?: ChunkingOptions): Chunk[];
355
+ }
356
+ declare class FixedChunkingStrategy implements ChunkingStrategy {
357
+ readonly name = "fixed";
358
+ chunk(text: string, options?: ChunkingOptions): Chunk[];
359
+ }
360
+ declare class SentenceChunkingStrategy implements ChunkingStrategy {
361
+ readonly name = "sentence";
362
+ chunk(text: string, options?: ChunkingOptions): Chunk[];
363
+ }
364
+ declare class ParagraphChunkingStrategy implements ChunkingStrategy {
365
+ readonly name = "paragraph";
366
+ chunk(text: string, options?: ChunkingOptions): Chunk[];
367
+ }
368
+ declare class MarkdownChunkingStrategy implements ChunkingStrategy {
369
+ readonly name = "markdown";
370
+ chunk(text: string, options?: ChunkingOptions): Chunk[];
371
+ }
372
+ declare class HeadingChunkingStrategy implements ChunkingStrategy {
373
+ readonly name = "heading";
374
+ chunk(text: string, options?: ChunkingOptions): Chunk[];
375
+ }
376
+ declare function createChunkingStrategy(name?: "fixed" | "sentence" | "paragraph" | "markdown" | "heading"): ChunkingStrategy;
377
+
378
+ /**
379
+ * LLM provider abstractions and OpenAI-compatible chat implementation.
380
+ * Used exclusively for memory compression (and future ORC features).
381
+ */
382
+
383
+ interface ChatMessage {
384
+ role: "system" | "user" | "assistant";
385
+ content: string;
386
+ }
387
+ /** Contract for any chat completion backend. */
388
+ interface LlmProvider {
389
+ readonly model: string;
390
+ complete(messages: ChatMessage[]): Promise<string>;
391
+ /** Lightweight connectivity probe. */
392
+ validate(): Promise<void>;
393
+ }
394
+ declare function createLlmProvider(config: LlmConfig): LlmProvider;
395
+ declare const openaiCompatibleLlm: (config: LlmConfig) => LlmProvider;
396
+ declare const openaiLlm: (config: Omit<LlmConfig, "baseUrl"> & {
397
+ baseUrl?: string;
398
+ }) => LlmProvider;
399
+ declare const ollamaLlm: (config: Omit<LlmConfig, "baseUrl"> & {
400
+ baseUrl?: string;
401
+ }) => LlmProvider;
402
+ declare const openRouterLlm: (config: Omit<LlmConfig, "baseUrl"> & {
403
+ baseUrl?: string;
404
+ }) => LlmProvider;
405
+
406
+ /**
407
+ * Memory compression — provider-based summarization.
408
+ */
409
+
410
+ /** Contract for memory compression backends. */
411
+ interface CompressionProvider {
412
+ readonly name: string;
413
+ compress(memories: MemoryRecord[]): Promise<string>;
414
+ }
415
+ /** Default compression provider wrapping an {@link LlmProvider}. */
416
+ declare class LlmCompressionProvider implements CompressionProvider {
417
+ readonly name = "llm";
418
+ private readonly llm;
419
+ constructor(llm: LlmProvider);
420
+ compress(memories: MemoryRecord[]): Promise<string>;
421
+ }
422
+ declare function createCompressionProvider(llm: LlmProvider): CompressionProvider;
423
+
424
+ /**
425
+ * Embedding providers and named factories.
426
+ */
427
+
428
+ /** Contract for any embedding backend. */
429
+ interface EmbeddingProvider {
430
+ readonly model: string;
431
+ /** Produce a float embedding for the given text. */
432
+ embed(text: string): Promise<Float32Array>;
433
+ /** Optional batch embedding. SDK falls back to parallel `embed` when absent. */
434
+ embedBatch?(texts: string[]): Promise<Float32Array[]>;
435
+ /** Lightweight connectivity + dimension probe. */
436
+ validate(): Promise<{
437
+ dimensions: number;
438
+ }>;
439
+ }
440
+ declare function createEmbeddingProvider(config: EmbeddingConfig): EmbeddingProvider;
441
+ declare const openaiCompatibleEmbedding: (config: EmbeddingConfig) => EmbeddingProvider;
442
+ declare const openaiEmbedding: (config: Omit<EmbeddingConfig, "baseUrl"> & {
443
+ baseUrl?: string;
444
+ }) => EmbeddingProvider;
445
+ declare const ollamaEmbedding: (config: Omit<EmbeddingConfig, "baseUrl"> & {
446
+ baseUrl?: string;
447
+ }) => EmbeddingProvider;
448
+ declare const openRouterEmbedding: (config: Omit<EmbeddingConfig, "baseUrl"> & {
449
+ baseUrl?: string;
450
+ }) => EmbeddingProvider;
451
+ declare const lmStudioEmbedding: (config: Omit<EmbeddingConfig, "baseUrl"> & {
452
+ baseUrl?: string;
453
+ }) => EmbeddingProvider;
454
+ declare const geminiEmbedding: (config: Omit<EmbeddingConfig, "baseUrl"> & {
455
+ baseUrl?: string;
456
+ }) => EmbeddingProvider;
457
+ declare const togetherEmbedding: (config: Omit<EmbeddingConfig, "baseUrl"> & {
458
+ baseUrl?: string;
459
+ }) => EmbeddingProvider;
460
+ declare const vllmEmbedding: (config: Omit<EmbeddingConfig, "baseUrl"> & {
461
+ baseUrl?: string;
462
+ }) => EmbeddingProvider;
463
+
464
+ /**
465
+ * Keyword / BM25 search providers.
466
+ */
467
+ interface KeywordSearchHit {
468
+ memoryId: string;
469
+ score: number;
470
+ }
471
+ interface KeywordDocument {
472
+ id: string;
473
+ text: string;
474
+ }
475
+ /** Contract for keyword / lexical search. */
476
+ interface KeywordSearchProvider {
477
+ readonly name: string;
478
+ search(query: string, documents: KeywordDocument[], topK: number): Promise<KeywordSearchHit[]>;
479
+ }
480
+ /** Factory for in-memory BM25 keyword search. */
481
+ declare function bm25(options?: {
482
+ k1?: number;
483
+ b?: number;
484
+ }): KeywordSearchProvider;
485
+
486
+ /**
487
+ * Optional OCR provider — extract text from images.
488
+ */
489
+ interface OcrResult {
490
+ text: string;
491
+ }
492
+ interface OCRProvider {
493
+ readonly name: string;
494
+ recognize(image: Buffer, mimeType?: string): Promise<OcrResult>;
495
+ }
496
+ /**
497
+ * Placeholder Tesseract adapter.
498
+ * Requires optional peer packages (`tesseract.js`) when used.
499
+ */
500
+ declare function tesseract(): OCRProvider;
501
+
502
+ /**
503
+ * Reranker provider abstractions.
504
+ */
505
+ interface RerankDocument {
506
+ id: string;
507
+ text: string;
508
+ }
509
+ interface RerankHit {
510
+ id: string;
511
+ score: number;
512
+ }
513
+ /** Contract for cross-encoder / API rerankers. */
514
+ interface RerankerProvider {
515
+ readonly name: string;
516
+ rerank(query: string, documents: RerankDocument[], topK: number): Promise<RerankHit[]>;
517
+ }
518
+ /** Lightweight local cross-encoder proxy (OpenAI-compatible score endpoint fallback = identity order). */
519
+ declare function crossEncoder(options: {
520
+ baseUrl: string;
521
+ apiKey: string;
522
+ model?: string;
523
+ timeoutMs?: number;
524
+ }): RerankerProvider;
525
+ declare function jinaReranker(options: {
526
+ apiKey: string;
527
+ model?: string;
528
+ timeoutMs?: number;
529
+ }): RerankerProvider;
530
+ declare function cohereReranker(options: {
531
+ apiKey: string;
532
+ model?: string;
533
+ timeoutMs?: number;
534
+ }): RerankerProvider;
535
+ /** Alias for BGE-style remote rerank endpoints that speak the Jina/Cohere shape. */
536
+ declare function bgeReranker(options: {
537
+ apiKey: string;
538
+ baseUrl: string;
539
+ model?: string;
540
+ timeoutMs?: number;
541
+ }): RerankerProvider;
542
+ /**
543
+ * OpenAI chat-based reranker (no Cohere/Jina key required).
544
+ * Scores query–document relevance via chat completions and reorders hits.
545
+ */
546
+ declare function openaiReranker(options: {
547
+ apiKey: string;
548
+ model?: string;
549
+ baseUrl?: string;
550
+ timeoutMs?: number;
551
+ }): RerankerProvider;
552
+
553
+ /**
554
+ * Shared provider contracts for Wolbarg v0.2.
555
+ */
556
+
557
+ /** Row shape returned from the memories table. */
558
+ interface MemoryRow {
559
+ id: string;
560
+ organization: string;
561
+ agent: string;
562
+ content_text: string;
563
+ metadata_json: string;
564
+ archived: number;
565
+ compressed_into: string | null;
566
+ created_at: string;
567
+ updated_at: string;
568
+ rowid?: number;
569
+ }
570
+ /** Row shape for memory history events. */
571
+ interface HistoryRow {
572
+ id: string;
573
+ memory_id: string;
574
+ event_type: "created" | "archived" | "compressed";
575
+ related_memory_id: string | null;
576
+ created_at: string;
577
+ }
578
+ /** Payload for inserting a new memory. */
579
+ interface InsertMemoryInput {
580
+ id: string;
581
+ organization: string;
582
+ agent: string;
583
+ contentText: string;
584
+ metadata: MemoryMetadata;
585
+ embedding: Float32Array;
586
+ createdAt: string;
587
+ updatedAt: string;
588
+ }
589
+ /** Payload for updating memory content / metadata. */
590
+ interface UpdateMemoryInput {
591
+ id: string;
592
+ organization: string;
593
+ contentText?: string;
594
+ metadata?: MemoryMetadata;
595
+ embedding?: Float32Array;
596
+ updatedAt: string;
597
+ }
598
+ /** Filters used by repository queries. */
599
+ interface RepositoryFilter {
600
+ organization: string;
601
+ agent?: string;
602
+ includeArchived?: boolean;
603
+ metadata?: MetadataFilter;
604
+ }
605
+ /** Semantic search hit from the vector index. */
606
+ interface VectorSearchHit {
607
+ memoryRowid: number;
608
+ distance: number;
609
+ }
610
+ /**
611
+ * Low-level storage provider contract.
612
+ * Public API never depends on a specific engine.
613
+ */
614
+ interface StorageProvider {
615
+ readonly name: string;
616
+ /** Open connection, enable WAL / pragmas, run migrations, prepare statements. */
617
+ open(): Promise<void>;
618
+ /** Close the underlying connection. */
619
+ close(): Promise<void>;
620
+ /** Ensure the vector table exists for the given embedding dimensionality. */
621
+ ensureVectorSchema(dimensions: number): Promise<void>;
622
+ /** Current embedding dimensionality stored in meta, or null if unset. */
623
+ getEmbeddingDimensions(): Promise<number | null>;
624
+ /** Persist embedding dimensionality in the meta table. */
625
+ setEmbeddingDimensions(dimensions: number): Promise<void>;
626
+ /** Insert a memory + embedding inside a single ACID transaction. */
627
+ insertMemory(input: InsertMemoryInput): Promise<MemoryRow>;
628
+ /** Batch insert memories + embeddings in one transaction. */
629
+ insertMemoriesBatch(inputs: InsertMemoryInput[]): Promise<MemoryRow[]>;
630
+ /** Update memory fields and optionally replace embedding. */
631
+ updateMemory(input: UpdateMemoryInput): Promise<MemoryRow | null>;
632
+ /** Fetch a memory by UUID. */
633
+ getMemoryById(id: string, organization: string): Promise<MemoryRow | null>;
634
+ /** Fetch a memory by its integer rowid. */
635
+ getMemoryByRowid(rowid: number, organization: string): Promise<MemoryRow | null>;
636
+ /**
637
+ * Batch fetch memories by rowids (one query). Optional — Wolbarg falls
638
+ * back to parallel getMemoryByRowid when absent.
639
+ */
640
+ getMemoriesByRowids?(rowids: number[], organization: string): Promise<Map<number, MemoryRow>>;
641
+ /** List memories matching a filter. */
642
+ listMemories(filter: RepositoryFilter, limit?: number): Promise<MemoryRow[]>;
643
+ /** Search memories by metadata filter only. */
644
+ searchByMetadata(filter: RepositoryFilter, limit?: number): Promise<MemoryRow[]>;
645
+ /** KNN search against the vector index. */
646
+ searchVectors(embedding: Float32Array, topK: number): Promise<VectorSearchHit[]>;
647
+ /**
648
+ * Optional: KNN + memory rows in one round-trip, org-scoped.
649
+ */
650
+ searchVectorsWithMemories?(embedding: Float32Array, topK: number, organization: string, options?: {
651
+ agent?: string;
652
+ includeArchived?: boolean;
653
+ }): Promise<Array<{
654
+ row: MemoryRow;
655
+ distance: number;
656
+ }>>;
657
+ /**
658
+ * Optional: native keyword / BM25 search (e.g. SQLite FTS5).
659
+ * When present, hybrid recall can skip loading the full corpus.
660
+ */
661
+ searchKeyword?(query: string, organization: string, topK: number): Promise<Array<{
662
+ memoryId: string;
663
+ score: number;
664
+ }>>;
665
+ /**
666
+ * Soft-archive memories and record lineage linking them to a summary.
667
+ * Returns the archived memory IDs.
668
+ */
669
+ archiveMemories(ids: string[], organization: string, compressedIntoId: string, archivedAt: string): Promise<string[]>;
670
+ /** Hard-delete a single memory and its embedding. */
671
+ deleteMemoryById(id: string, organization: string): Promise<boolean>;
672
+ /** Hard-delete memories matching a filter. Returns deleted count. */
673
+ deleteMemoriesByFilter(filter: RepositoryFilter): Promise<number>;
674
+ /** Delete every memory for an organization. Returns deleted count. */
675
+ clearOrganization(organization: string): Promise<number>;
676
+ /** History events for a memory, oldest first. */
677
+ getHistory(memoryId: string): Promise<HistoryRow[]>;
678
+ /** Append a history event. */
679
+ insertHistoryEvent(event: HistoryRow): Promise<void>;
680
+ /** Count memories / distinct agents for an organization. */
681
+ getStats(organization: string): Promise<{
682
+ totalMemories: number;
683
+ activeMemories: number;
684
+ archivedMemories: number;
685
+ totalAgents: number;
686
+ }>;
687
+ /** Approximate on-disk database size in bytes. */
688
+ getDatabaseSizeBytes(): Promise<number>;
689
+ /** Run `fn` inside a single ACID transaction. */
690
+ withTransaction<T>(fn: () => T | Promise<T>): T | Promise<T>;
691
+ }
692
+ /** Back-compat alias. */
693
+ type DatabaseProvider = StorageProvider;
694
+
695
+ /**
696
+ * Optional vision provider — captions / descriptions / entities from images.
697
+ */
698
+ interface VisionResult {
699
+ caption: string;
700
+ description: string;
701
+ entities: string[];
702
+ }
703
+ interface VisionProvider {
704
+ readonly name: string;
705
+ analyze(image: Buffer, mimeType?: string): Promise<VisionResult>;
706
+ }
707
+ declare function geminiVision(options: {
708
+ apiKey: string;
709
+ model?: string;
710
+ baseUrl?: string;
711
+ timeoutMs?: number;
712
+ }): VisionProvider;
713
+ declare function openaiVision(options: {
714
+ apiKey: string;
715
+ model?: string;
716
+ baseUrl?: string;
717
+ timeoutMs?: number;
718
+ }): VisionProvider;
719
+
720
+ /**
721
+ * Constructor options for Wolbarg v0.2.
722
+ */
723
+
724
+ type EmbeddingInput = EmbeddingProvider | EmbeddingConfig;
725
+ type LlmInput = LlmProvider | LlmConfig;
726
+ type StorageInput = StorageProvider | StorageConfig;
727
+ interface WolbargOptionsBase {
728
+ /** Organization namespace isolating memories within a shared database. */
729
+ organization: string;
730
+ /** Storage provider instance or config. */
731
+ storage: StorageInput;
732
+ /** Embedding provider instance or config. */
733
+ embedding: EmbeddingInput;
734
+ /** Optional reranker — skipped when absent. */
735
+ reranker?: RerankerProvider;
736
+ /** Optional keyword search — enables hybrid recall when present. */
737
+ keywordSearch?: KeywordSearchProvider;
738
+ /** Optional OCR for image ingest. */
739
+ ocr?: OCRProvider;
740
+ /** Optional vision model for image captions. */
741
+ vision?: VisionProvider;
742
+ /** Optional compression provider (overrides llm-backed default). */
743
+ compression?: CompressionProvider;
744
+ /** Optional default chunking strategy for ingest. */
745
+ chunking?: ChunkingStrategy;
746
+ /** Optional retrieval defaults. */
747
+ retrieval?: RetrievalConfig;
748
+ }
749
+ interface WolbargOptionsWithoutLlm extends WolbargOptionsBase {
750
+ llm?: undefined;
751
+ }
752
+ interface WolbargOptionsWithLlm extends WolbargOptionsBase {
753
+ /** Chat model used for compression. */
754
+ llm: LlmInput;
755
+ }
756
+ type WolbargOptions = WolbargOptionsWithoutLlm | WolbargOptionsWithLlm;
757
+
758
+ /**
759
+ * Wolbarg — modular semantic memory SDK for AI agents (v0.2).
760
+ *
761
+ * @example
762
+ * ```ts
763
+ * import { Wolbarg, sqlite, openaiEmbedding, openaiLlm } from "wolbarg";
764
+ *
765
+ * const ctx = new Wolbarg({
766
+ * organization: "my-org",
767
+ * storage: sqlite("./memory.db"),
768
+ * embedding: openaiEmbedding({
769
+ * apiKey: process.env.OPENAI_API_KEY!,
770
+ * model: "text-embedding-3-small",
771
+ * }),
772
+ * llm: openaiLlm({
773
+ * apiKey: process.env.OPENAI_API_KEY!,
774
+ * model: "gpt-4.1-mini",
775
+ * }),
776
+ * });
777
+ *
778
+ * await ctx.ready();
779
+ * await ctx.remember({ agent: "research", content: { text: "…" } });
780
+ * const hits = await ctx.recall({ query: "…", topK: 5 });
781
+ * ```
782
+ */
783
+
784
+ declare class Wolbarg<HasLlm extends boolean = false> {
785
+ /** Compile-time capability flag — `true` when constructed with `llm`. */
786
+ readonly __hasLlm: HasLlm;
787
+ private initialized;
788
+ private booting;
789
+ private organization;
790
+ private storage;
791
+ private embedding;
792
+ private llm;
793
+ private compression;
794
+ private reranker;
795
+ private keywordSearch;
796
+ private ocr;
797
+ private vision;
798
+ private chunking;
799
+ private retrievalConfig;
800
+ private embeddingDimensions;
801
+ private readonly writeMutex;
802
+ /**
803
+ * Create an Wolbarg instance.
804
+ * When options are provided, providers are wired immediately and
805
+ * storage opens lazily on the first API call (or {@link ready}).
806
+ *
807
+ * Pass `llm` to enable {@link compress} (typed at compile time).
808
+ */
809
+ constructor(options: WolbargOptionsWithLlm);
810
+ constructor(options: WolbargOptionsWithoutLlm);
811
+ constructor();
812
+ /**
813
+ * Backwards-compatible initialization (v0.1 API).
814
+ * Prefer the constructor with `storage` / `embedding` / optional `llm`.
815
+ */
816
+ init(options: InitOptions): Promise<void>;
817
+ /** Ensure storage is open and embedding dimensions are known. */
818
+ ready(): Promise<void>;
819
+ private boot;
820
+ /** Store a semantic memory for an agent. */
821
+ remember(options: RememberOptions): Promise<MemoryRecord>;
822
+ /**
823
+ * Semantic / hybrid search over stored memories.
824
+ * Optional keyword, metadata, MMR, and rerank stages degrade gracefully.
825
+ */
826
+ recall(options: RecallOptions): Promise<RecallResult[]>;
827
+ /**
828
+ * Compress related memories for an agent into a single summarized memory.
829
+ * Only available when `llm` (or `compression`) was configured at construction.
830
+ */
831
+ compress(this: Wolbarg<true>, options: CompressOptions): Promise<CompressResult>;
832
+ /** @internal */
833
+ private runCompress;
834
+ /** Ingest a document: parse → OCR/vision (optional) → chunk → embed → store. */
835
+ ingest(options: IngestOptions): Promise<IngestResult>;
836
+ /** Delete memories by ID or filter. */
837
+ forget(options: ForgetOptions): Promise<number>;
838
+ /** Return the history of a memory. */
839
+ history(options: HistoryOptions): Promise<HistoryResult>;
840
+ /** Aggregate statistics for the current organization. */
841
+ stats(): Promise<StatsResult>;
842
+ /** Delete every memory in the current organization. */
843
+ clear(options: ClearOptions): Promise<number>;
844
+ /**
845
+ * Serialize writes for SQLite (single connection). Postgres uses a pool and
846
+ * per-statement atomic CTEs — locking here only serializes throughput.
847
+ */
848
+ private withWriteLock;
849
+ /** Close the database connection and release resources. */
850
+ close(): Promise<void>;
851
+ /** Whether providers are ready for API calls. */
852
+ get isInitialized(): boolean;
853
+ private requireReady;
854
+ private assertEmbeddingDimensions;
855
+ }
856
+
857
+ /**
858
+ * Custom error hierarchy for Wolbarg.
859
+ * Raw SQLite / network errors are never exposed to consumers.
860
+ */
861
+ /** Base class for all Wolbarg errors. */
862
+ declare class WolbargError extends Error {
863
+ readonly code: string;
864
+ constructor(message: string, code: string, options?: ErrorOptions);
865
+ }
866
+ /** Thrown when SDK initialization fails. */
867
+ declare class InitializationError extends WolbargError {
868
+ constructor(message: string, options?: ErrorOptions);
869
+ }
870
+ /** Thrown when configuration values are missing or invalid. */
871
+ declare class ConfigurationError extends WolbargError {
872
+ constructor(message: string, options?: ErrorOptions);
873
+ }
874
+ /** Thrown when method arguments fail validation. */
875
+ declare class ValidationError extends WolbargError {
876
+ constructor(message: string, options?: ErrorOptions);
877
+ }
878
+ /** Thrown when a database operation fails. */
879
+ declare class DatabaseError extends WolbargError {
880
+ constructor(message: string, options?: ErrorOptions);
881
+ }
882
+ /** Thrown when an embedding request fails. */
883
+ declare class EmbeddingError extends WolbargError {
884
+ constructor(message: string, options?: ErrorOptions);
885
+ }
886
+ /** Thrown when compression (LLM summarization) fails. */
887
+ declare class CompressionError extends WolbargError {
888
+ constructor(message: string, options?: ErrorOptions);
889
+ }
890
+ /** Thrown when a requested memory does not exist. */
891
+ declare class MemoryNotFoundError extends WolbargError {
892
+ constructor(message: string, options?: ErrorOptions);
893
+ }
894
+ /**
895
+ * Thrown when a method requires an optional provider that was not configured.
896
+ * Prefer TypeScript narrowing (e.g. compress without llm) when possible.
897
+ */
898
+ declare class ProviderNotConfiguredError extends ConfigurationError {
899
+ readonly provider: string;
900
+ constructor(provider: string, method: string, hint: string);
901
+ }
902
+
903
+ /**
904
+ * Public factory helpers for storage / providers.
905
+ */
906
+
907
+ /** Create a SQLite storage provider from a path or `:memory:`. */
908
+ declare function sqlite(connectionString: string): StorageProvider;
909
+ /** Create a SQLite storage config object (for init / options). */
910
+ declare function sqliteConfig(connectionString: string): SqliteDatabaseConfig;
911
+ /** Create a PostgreSQL storage provider. Requires optional peer dependency `pg`. */
912
+ declare function postgres(options: string | {
913
+ connectionString: string;
914
+ maxPoolSize?: number;
915
+ }): StorageProvider;
916
+ /** Create a PostgreSQL storage config object. */
917
+ declare function postgresConfig(connectionString: string, options?: {
918
+ maxPoolSize?: number;
919
+ }): PostgresDatabaseConfig;
920
+
921
+ /**
922
+ * SQLite + sqlite-vec database provider (Node.js built-in `node:sqlite`).
923
+ *
924
+ * Responsibilities:
925
+ * - WAL mode + crash-safe pragmas
926
+ * - Automatic migrations / schema creation
927
+ * - Prepared statements
928
+ * - ACID transactions
929
+ * - Vector index via sqlite-vec vec0 when available
930
+ * - Blob + cosine fallback on unsupported platforms (e.g. win32-arm64)
931
+ */
932
+
933
+ interface SqliteProviderOptions {
934
+ connectionString: string;
935
+ }
936
+ declare class SqliteStorageProvider implements StorageProvider {
937
+ readonly name = "sqlite";
938
+ private readonly connectionString;
939
+ private db;
940
+ private statements;
941
+ private vectorDimensions;
942
+ private vectorBackend;
943
+ private sqliteVecLoaded;
944
+ /** Hot in-process ANN for blob backend (sqlite-vec unavailable platforms). */
945
+ private memoryIndex;
946
+ private memoryIndexDirty;
947
+ /** Resolved absolute path (or `:memory:`) — avoid re-resolving on size checks. */
948
+ private resolvedPath;
949
+ constructor(options: SqliteProviderOptions);
950
+ open(): Promise<void>;
951
+ close(): Promise<void>;
952
+ ensureVectorSchema(dimensions: number): Promise<void>;
953
+ getEmbeddingDimensions(): Promise<number | null>;
954
+ setEmbeddingDimensions(dimensions: number): Promise<void>;
955
+ insertMemory(input: InsertMemoryInput): Promise<MemoryRow>;
956
+ insertMemoriesBatch(inputs: InsertMemoryInput[]): Promise<MemoryRow[]>;
957
+ updateMemory(input: UpdateMemoryInput): Promise<MemoryRow | null>;
958
+ searchByMetadata(filter: RepositoryFilter, limit?: number): Promise<MemoryRow[]>;
959
+ /** Keyword search via FTS5 BM25. Returns memory IDs ranked by relevance. */
960
+ searchKeyword(query: string, organization: string, topK: number): Promise<Array<{
961
+ memoryId: string;
962
+ score: number;
963
+ }>>;
964
+ getMemoryById(id: string, organization: string): Promise<MemoryRow | null>;
965
+ getMemoryByRowid(rowid: number, organization: string): Promise<MemoryRow | null>;
966
+ getMemoriesByRowids(rowids: number[], organization: string): Promise<Map<number, MemoryRow>>;
967
+ listMemories(filter: RepositoryFilter, limit?: number): Promise<MemoryRow[]>;
968
+ searchVectors(embedding: Float32Array, topK: number): Promise<VectorSearchHit[]>;
969
+ /**
970
+ * Org-scoped KNN + memory rows.
971
+ * Caller (Wolbarg.recall) already passes an overfetched topK — do not multiply again.
972
+ */
973
+ searchVectorsWithMemories(embedding: Float32Array, topK: number, organization: string, options?: {
974
+ agent?: string;
975
+ includeArchived?: boolean;
976
+ }): Promise<Array<{
977
+ row: MemoryRow;
978
+ distance: number;
979
+ }>>;
980
+ archiveMemories(ids: string[], organization: string, compressedIntoId: string, archivedAt: string): Promise<string[]>;
981
+ deleteMemoryById(id: string, organization: string): Promise<boolean>;
982
+ deleteMemoriesByFilter(filter: RepositoryFilter): Promise<number>;
983
+ clearOrganization(organization: string): Promise<number>;
984
+ getHistory(memoryId: string): Promise<HistoryRow[]>;
985
+ insertHistoryEvent(event: HistoryRow): Promise<void>;
986
+ getStats(organization: string): Promise<{
987
+ totalMemories: number;
988
+ activeMemories: number;
989
+ archivedMemories: number;
990
+ totalAgents: number;
991
+ }>;
992
+ getDatabaseSizeBytes(): Promise<number>;
993
+ withTransaction<T>(fn: () => T): T;
994
+ private tryLoadSqliteVec;
995
+ private runMigrations;
996
+ /**
997
+ * Rebuild FTS from active (non-archived) memories when counts diverge.
998
+ * Guarantees keyword/hybrid correctness after crashes or interrupted writes.
999
+ */
1000
+ private ensureFtsConsistency;
1001
+ private backfillFts;
1002
+ private prepareStatements;
1003
+ private listMemoriesSync;
1004
+ /** Insert-only FTS row (new memory IDs never collide). */
1005
+ private insertFtsRow;
1006
+ private upsertFts;
1007
+ private deleteFts;
1008
+ private ensureVectorStorage;
1009
+ private hydrateMemoryIndex;
1010
+ private reprepareVectorStatements;
1011
+ private insertEmbedding;
1012
+ private deleteEmbedding;
1013
+ private searchWithSqliteVec;
1014
+ private searchWithBlobFallback;
1015
+ private setMeta;
1016
+ private readMetaNumber;
1017
+ private readMetaString;
1018
+ private readMetaNumberFromDb;
1019
+ private resolvePath;
1020
+ private requireDb;
1021
+ private requireStatements;
1022
+ private requireVectorReady;
1023
+ private toVectorParam;
1024
+ private describe;
1025
+ }
1026
+ /** @deprecated Prefer {@link SqliteStorageProvider}. */
1027
+ declare const SqliteDatabaseProvider: typeof SqliteStorageProvider;
1028
+
1029
+ /**
1030
+ * PostgreSQL storage provider with optional pgvector support.
1031
+ * Requires the optional `pg` peer dependency.
1032
+ *
1033
+ * Performance design:
1034
+ * - Per-operation pool queries (no global write lock / shared tx client race)
1035
+ * - AsyncLocalStorage for nested transactions
1036
+ * - Single-statement CTE inserts (no BEGIN/COMMIT for one memory)
1037
+ * - Named prepared statements (parse/plan once per connection)
1038
+ * - Concurrent insert coalescing into unnest batches; sequential path is immediate
1039
+ * - COPY protocol for large ingest batches
1040
+ * - Org-filtered ANN with adaptive overfetch + HNSW iterative scan when available
1041
+ * - Joined vector search returning memories in one round-trip when possible
1042
+ */
1043
+
1044
+ interface PostgresProviderOptions {
1045
+ connectionString: string;
1046
+ maxPoolSize?: number;
1047
+ }
1048
+ declare class PostgresStorageProvider implements StorageProvider {
1049
+ readonly name = "postgres";
1050
+ private readonly connectionString;
1051
+ private readonly maxPoolSize;
1052
+ private pool;
1053
+ private vectorDimensions;
1054
+ private hasPgvector;
1055
+ private hnswIndexEnsured;
1056
+ private hnswCreateFailures;
1057
+ private hasContentTsv;
1058
+ private iterativeScanEnabled;
1059
+ /** Coalesce concurrent insertMemory callers into one unnest batch. */
1060
+ private insertQueue;
1061
+ private insertFlushScheduled;
1062
+ private insertFlushInFlight;
1063
+ constructor(options: PostgresProviderOptions);
1064
+ getPoolStats(): {
1065
+ max: number;
1066
+ total: number;
1067
+ idle: number;
1068
+ waiting: number;
1069
+ };
1070
+ open(): Promise<void>;
1071
+ close(): Promise<void>;
1072
+ ensureVectorSchema(dimensions: number): Promise<void>;
1073
+ private ensureVectorTables;
1074
+ /**
1075
+ * Soft reset for a single organization. Drops HNSW only when the embeddings
1076
+ * table is empty so other corpora on a shared bench DB stay intact.
1077
+ */
1078
+ resetOrganization(organization: string): Promise<void>;
1079
+ /**
1080
+ * Wipe all Wolbarg tables (explicit opt-in). Prefer {@link resetOrganization}.
1081
+ */
1082
+ wipeAllData(): Promise<void>;
1083
+ /** Build HNSW once before the first KNN query (bulk-friendly inserts). */
1084
+ private ensureHnswIndex;
1085
+ getEmbeddingDimensions(): Promise<number | null>;
1086
+ setEmbeddingDimensions(dimensions: number): Promise<void>;
1087
+ insertMemory(input: InsertMemoryInput): Promise<MemoryRow>;
1088
+ private flushInsertQueue;
1089
+ /** Single-row insert without coalescing (used by flush + batch of 1). */
1090
+ private insertMemoryImmediate;
1091
+ insertMemoriesBatch(inputs: InsertMemoryInput[]): Promise<MemoryRow[]>;
1092
+ private insertBatchPgvector;
1093
+ /** Split large ingest batches into parallel unnest chunks (pool pipelining). */
1094
+ private insertBatchChunked;
1095
+ private insertOneBlob;
1096
+ updateMemory(input: UpdateMemoryInput): Promise<MemoryRow | null>;
1097
+ getMemoryById(id: string, organization: string): Promise<MemoryRow | null>;
1098
+ getMemoryByRowid(rowid: number, organization: string): Promise<MemoryRow | null>;
1099
+ getMemoriesByRowids(rowids: number[], organization: string): Promise<Map<number, MemoryRow>>;
1100
+ listMemories(filter: RepositoryFilter, limit?: number): Promise<MemoryRow[]>;
1101
+ searchByMetadata(filter: RepositoryFilter, limit?: number): Promise<MemoryRow[]>;
1102
+ searchKeyword(query: string, organization: string, topK: number): Promise<Array<{
1103
+ memoryId: string;
1104
+ score: number;
1105
+ }>>;
1106
+ searchVectors(embedding: Float32Array, topK: number): Promise<VectorSearchHit[]>;
1107
+ searchVectorsWithMemories(embedding: Float32Array, topK: number, organization: string, options?: {
1108
+ agent?: string;
1109
+ includeArchived?: boolean;
1110
+ }): Promise<Array<{
1111
+ row: MemoryRow;
1112
+ distance: number;
1113
+ }>>;
1114
+ archiveMemories(ids: string[], organization: string, compressedIntoId: string, archivedAt: string): Promise<string[]>;
1115
+ deleteMemoryById(id: string, organization: string): Promise<boolean>;
1116
+ deleteMemoriesByFilter(filter: RepositoryFilter): Promise<number>;
1117
+ clearOrganization(organization: string): Promise<number>;
1118
+ getHistory(memoryId: string): Promise<HistoryRow[]>;
1119
+ insertHistoryEvent(event: HistoryRow): Promise<void>;
1120
+ getStats(organization: string): Promise<{
1121
+ totalMemories: number;
1122
+ activeMemories: number;
1123
+ archivedMemories: number;
1124
+ totalAgents: number;
1125
+ }>;
1126
+ getDatabaseSizeBytes(): Promise<number>;
1127
+ withTransaction<T>(fn: () => T | Promise<T>): Promise<T>;
1128
+ private runMigrations;
1129
+ private tryEnablePgvector;
1130
+ private insertEmbedding;
1131
+ private deleteEmbedding;
1132
+ private query;
1133
+ /** Named prepared statement — parse/plan cached per pool connection. */
1134
+ private queryNamed;
1135
+ private mapRow;
1136
+ private requirePool;
1137
+ private requireVectorReady;
1138
+ private describe;
1139
+ }
1140
+
1141
+ /**
1142
+ * Storage provider factory and re-exports.
1143
+ */
1144
+
1145
+ declare function createStorageProvider(config: StorageConfig | DatabaseConfig): StorageProvider;
1146
+ /** @deprecated Prefer {@link createStorageProvider}. */
1147
+ declare function createDatabaseProvider(config: DatabaseConfig): StorageProvider;
1148
+
1149
+ export { type ChatMessage, type Chunk, type ChunkingOptions, type ChunkingStrategy, type ClearOptions, type CompressOptions, type CompressResult, CompressionError, type CompressionProvider, ConfigurationError, type DatabaseConfig, DatabaseError, type DatabaseProvider, type DatabaseProviderName, type EmbeddingConfig, EmbeddingError, type EmbeddingProvider, FixedChunkingStrategy, type ForgetByFilterOptions, type ForgetByIdOptions, type ForgetOptions, HeadingChunkingStrategy, type HistoryEvent, type HistoryOptions, type HistoryResult, type HybridConfig, type IngestOptions, type IngestResult, type InitOptions, InitializationError, type KeywordDocument, type KeywordSearchHit, type KeywordSearchProvider, LlmCompressionProvider, type LlmConfig, type LlmProvider, MarkdownChunkingStrategy, type MemoryContent, type MemoryFilter, type MemoryMetadata, MemoryNotFoundError, type MemoryRecord, type MetadataFilter as MetaFilter, type MetadataComparison, type MetadataFilter, type MmrConfig, type OCRProvider, type OcrResult, ParagraphChunkingStrategy, type PostgresDatabaseConfig, PostgresStorageProvider, ProviderNotConfiguredError, type RecallOptions, type RecallResult, type RememberOptions, type RerankDocument, type RerankHit, type RerankerProvider, type RetrievalConfig, SentenceChunkingStrategy, type SqliteDatabaseConfig, SqliteDatabaseProvider, SqliteStorageProvider, type StatsResult, type StorageConfig, type StorageProvider, type StorageProviderName, ValidationError, type VisionProvider, type VisionResult, Wolbarg, WolbargError, type WolbargOptions, type WolbargOptionsWithLlm, type WolbargOptionsWithoutLlm, bgeReranker, bm25, cohereReranker, createChunkingStrategy, createCompressionProvider, createDatabaseProvider, createEmbeddingProvider, createLlmProvider, createStorageProvider, crossEncoder, geminiEmbedding, geminiVision, jinaReranker, lmStudioEmbedding, meta, ollamaEmbedding, ollamaLlm, openRouterEmbedding, openRouterLlm, openaiCompatibleEmbedding, openaiCompatibleLlm, openaiEmbedding, openaiLlm, openaiReranker, openaiVision, postgres, postgresConfig, sqlite, sqliteConfig, tesseract, togetherEmbedding, vllmEmbedding };