wolbarg 0.5.1 → 0.5.2

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.
package/dist/index.d.cts CHANGED
@@ -49,7 +49,7 @@ declare const meta: {
49
49
  * Schema is intentionally extensible for future providers (Postgres, cloud).
50
50
  */
51
51
  /** Public operation names recorded as telemetry events. */
52
- type TelemetryOperation = "remember" | "recall" | "forget" | "compress" | "rememberBatch" | "recallBatch" | "export" | "import" | "checkpoint" | "rollback" | "error" | "startup" | "shutdown" | "ingest" | "history" | "stats" | "clear" | "deleteCheckpoint" | "listCheckpoints" | "getCheckpoint" | "linkMemories" | "getRelated" | "graphQuery";
52
+ type TelemetryOperation = "remember" | "recall" | "forget" | "compress" | "rememberBatch" | "recallBatch" | "export" | "import" | "checkpoint" | "rollback" | "error" | "startup" | "shutdown" | "ingest" | "history" | "stats" | "clear" | "deleteCheckpoint" | "listCheckpoints" | "getCheckpoint" | "linkMemories" | "getRelated" | "graphQuery" | "rememberFromMessages";
53
53
  type TelemetryStatus = "ok" | "error" | "cancelled";
54
54
  type TelemetryLogLevel = "off" | "error" | "warn" | "info" | "debug" | "trace";
55
55
  /** Stage-level latency breakdown recorded on each event. */
@@ -341,6 +341,35 @@ interface RememberOptions {
341
341
  /** Per-call dedupe override; undefined uses constructor `memory.dedupe`. */
342
342
  dedupe?: boolean | MemoryDedupeConfig;
343
343
  }
344
+ /**
345
+ * Chat turn for {@link Wolbarg.rememberFromMessages}.
346
+ * @experimental until 1.0
347
+ */
348
+ interface ConversationMessage {
349
+ role: string;
350
+ content: string;
351
+ }
352
+ /** How `mode: "raw"` selects user turns to store. */
353
+ type RememberFromMessagesRawStrategy = "last_user" | "all_user";
354
+ /**
355
+ * Options for {@link Wolbarg.rememberFromMessages}.
356
+ * @experimental until 1.0
357
+ */
358
+ interface RememberFromMessagesOptions {
359
+ /** Agent identifier that owns the stored memories. */
360
+ agent: string;
361
+ /**
362
+ * `raw` (default) — store user message text without an LLM.
363
+ * `extract` — use configured `llm` to extract atomic facts, then remember each.
364
+ */
365
+ mode?: "raw" | "extract";
366
+ /** Used when `mode` is `raw`. Defaults to `last_user`. */
367
+ rawStrategy?: RememberFromMessagesRawStrategy;
368
+ /** Optional opaque metadata attached to every stored memory. */
369
+ metadata?: MemoryMetadata;
370
+ /** Per-call dedupe override; undefined uses constructor `memory.dedupe`. */
371
+ dedupe?: boolean | MemoryDedupeConfig;
372
+ }
344
373
  /** Whether remember created a new row or updated an existing one. */
345
374
  type RememberAction = "created" | "updated";
346
375
  /** Result of {@link Wolbarg.remember} — MemoryRecord plus upsert action. */
@@ -730,7 +759,7 @@ declare function createChunkingStrategy(name?: "fixed" | "sentence" | "paragraph
730
759
 
731
760
  /**
732
761
  * LLM provider abstractions and OpenAI-compatible chat implementation.
733
- * Used exclusively for memory compression (and future ORC features).
762
+ * Used for memory compression and experimental rememberFromMessages extract mode.
734
763
  */
735
764
 
736
765
  interface ChatMessage {
@@ -1296,6 +1325,15 @@ declare class Wolbarg<HasLlm extends boolean = false> {
1296
1325
  remember(options: RememberOptions): Promise<RememberResult>;
1297
1326
  /** Batch remember — sequential when dedupe enabled; otherwise one TX batch. */
1298
1327
  rememberBatch(items: RememberOptions[]): Promise<RememberResult[]>;
1328
+ /**
1329
+ * Store memories from a chat transcript.
1330
+ *
1331
+ * **Experimental** until 1.0 — API shape may change.
1332
+ *
1333
+ * - `mode: "raw"` (default) — remember user message text (no LLM).
1334
+ * - `mode: "extract"` — require configured `llm`; extract atomic facts then remember each.
1335
+ */
1336
+ rememberFromMessages(messages: ConversationMessage[], options: RememberFromMessagesOptions): Promise<RememberResult[]>;
1299
1337
  /**
1300
1338
  * Update an existing memory by id (re-embeds when content changes).
1301
1339
  */
@@ -1388,7 +1426,7 @@ declare class Wolbarg<HasLlm extends boolean = false> {
1388
1426
  declare function wolbarg$1(options: WolbargOptions): Wolbarg;
1389
1427
 
1390
1428
  /** Published SDK semver — keep in sync with package.json `version`. */
1391
- declare const SDK_VERSION = "0.5.0";
1429
+ declare const SDK_VERSION = "0.5.2";
1392
1430
 
1393
1431
  /**
1394
1432
  * Operation-scoped errors with reason + suggestion for developer experience.
@@ -1701,6 +1739,8 @@ declare class SqliteStorageProvider implements StorageProvider {
1701
1739
  private requireStatements;
1702
1740
  private requireVectorReady;
1703
1741
  private toVectorParam;
1742
+ /** sqlite-vec vec0 PKs must be bound as BigInt under node:sqlite. */
1743
+ private toVecRowid;
1704
1744
  private describe;
1705
1745
  }
1706
1746
  /** @deprecated Prefer {@link SqliteStorageProvider}. */
@@ -2208,4 +2248,4 @@ interface BenchmarkReport {
2208
2248
  declare function runBenchmark(name: string, iterations: number, fn: () => Promise<void> | void): Promise<BenchmarkSample[]>;
2209
2249
  declare function summarizeBenchmark(samples: BenchmarkSample[], startedAt: string, finishedAt: string): BenchmarkReport;
2210
2250
 
2211
- export { type BenchmarkReport, type BenchmarkSample, type ChatMessage, type CheckpointInfo, type CheckpointMeta, type CheckpointOptions, type CheckpointProvider, type Chunk, type ChunkingOptions, type ChunkingStrategy, type ClearOptions, type CompressOptions, type CompressResult, CompressionError, type CompressionProvider, type ConcurrencyConfig$1 as ConcurrencyConfig, ConfigurationError, type CreateCheckpointOptions, type DatabaseConfig, DatabaseError, type DatabaseProvider, type DatabaseProviderName, type EmbeddingCacheConfig, type EmbeddingConfig, EmbeddingError, type EmbeddingProvider, type EventDatabase, type ExportResult, FixedChunkingStrategy, type ForgetByFilterOptions, type ForgetByIdOptions, type ForgetOptions, type GetRelatedOptions, GraphCheckpointNotSupportedError, type GraphConfig, type GraphDirection, type GraphEntityInput, type GraphHealthResult, type GraphInput$1 as GraphInput, type GraphProvider, HeadingChunkingStrategy, type HistoryEvent, type HistoryOptions, type HistoryResult, type HybridConfig, type ImportResult, type IngestOptions, type IngestResult, type InitOptions, InitializationError, type KeywordDocument, type KeywordSearchHit, type KeywordSearchProvider, type LatencyBreakdown, LlmCompressionProvider, type LlmConfig, type LlmProvider, MarkdownChunkingStrategy, type MemoryChangeCallback, type MemoryChangeEvent, type MemoryContent, type MemoryDedupeConfig, type MemoryDedupeStrategy, type MemoryFilter, type MemoryMetadata, MemoryNotFoundError, type MemoryProvider, type MemoryRecord, type MetadataFilter as MetaFilter, type MetadataComparison, type MetadataFilter, type MmrConfig, Neo4jGraphProvider, NoopTelemetryProvider, type OCRProvider, type OcrResult, ParagraphChunkingStrategy, type PersistedRecallExplainPayload, type PostgresDatabaseConfig, PostgresStorageProvider, ProviderNotConfiguredError, type RecallExplainResponse, type RecallExplanationHit, type RecallOptions, type RecallResult, type RememberAction, type RememberOptions, type RememberResult, type RerankDocument, type RerankHit, type RerankerProvider, type RetrievalConfig, SDK_VERSION, SentenceChunkingStrategy, SqliteCheckpointProvider, type SqliteDatabaseConfig, SqliteDatabaseProvider, SqliteEventDatabase, SqliteGraphProvider, SqliteStorageProvider, SqliteTelemetryProvider, type StageSpan, type StatsResult, type StorageConfig, StorageLockedError, type StorageProvider, type StorageProviderName, type SubscribableEvent, type SubscribeFilter, type TelemetryConfig, TelemetryEmitter, type TelemetryEvent, type TelemetryEventInput, type TelemetryLogLevel, type TelemetryOperation, type TelemetryProvider, type TelemetryQuery, type TelemetryQueryResult, type TelemetryStatus, type Unsubscribe, ValidationError, type VisionProvider, type VisionResult, Wolbarg, WolbargError, WolbargLogger, type WolbargOptions, type WolbargOptionsWithLlm, type WolbargOptionsWithoutLlm, bgeReranker, bm25, cohereReranker, createChunkingStrategy, createCompressionProvider, createDatabaseProvider, createEmbeddingProvider, createLlmProvider, createStorageProvider, createTelemetryProvider, wolbarg as createWolbarg, crossEncoder, geminiEmbedding, geminiVision, jinaReranker, lmStudioEmbedding, meta, neo4jGraph, ollamaEmbedding, ollamaLlm, openRouterEmbedding, openRouterLlm, openaiCompatibleEmbedding, openaiCompatibleLlm, openaiEmbedding, openaiLlm, openaiReranker, openaiVision, postgres, postgresConfig, runBenchmark, sqlite, sqliteCheckpoint, sqliteConfig, sqliteGraph, sqliteTelemetry, summarizeBenchmark, tesseract, togetherEmbedding, vllmEmbedding, wolbarg$1 as wolbarg, wrapOperationError };
2251
+ export { type BenchmarkReport, type BenchmarkSample, type ChatMessage, type CheckpointInfo, type CheckpointMeta, type CheckpointOptions, type CheckpointProvider, type Chunk, type ChunkingOptions, type ChunkingStrategy, type ClearOptions, type CompressOptions, type CompressResult, CompressionError, type CompressionProvider, type ConcurrencyConfig$1 as ConcurrencyConfig, ConfigurationError, type ConversationMessage, type CreateCheckpointOptions, type DatabaseConfig, DatabaseError, type DatabaseProvider, type DatabaseProviderName, type EmbeddingCacheConfig, type EmbeddingConfig, EmbeddingError, type EmbeddingProvider, type EventDatabase, type ExportResult, FixedChunkingStrategy, type ForgetByFilterOptions, type ForgetByIdOptions, type ForgetOptions, type GetRelatedOptions, GraphCheckpointNotSupportedError, type GraphConfig, type GraphDirection, type GraphEntityInput, type GraphHealthResult, type GraphInput$1 as GraphInput, type GraphProvider, HeadingChunkingStrategy, type HistoryEvent, type HistoryOptions, type HistoryResult, type HybridConfig, type ImportResult, type IngestOptions, type IngestResult, type InitOptions, InitializationError, type KeywordDocument, type KeywordSearchHit, type KeywordSearchProvider, type LatencyBreakdown, LlmCompressionProvider, type LlmConfig, type LlmProvider, MarkdownChunkingStrategy, type MemoryChangeCallback, type MemoryChangeEvent, type MemoryContent, type MemoryDedupeConfig, type MemoryDedupeStrategy, type MemoryFilter, type MemoryMetadata, MemoryNotFoundError, type MemoryProvider, type MemoryRecord, type MetadataFilter as MetaFilter, type MetadataComparison, type MetadataFilter, type MmrConfig, Neo4jGraphProvider, NoopTelemetryProvider, type OCRProvider, type OcrResult, ParagraphChunkingStrategy, type PersistedRecallExplainPayload, type PostgresDatabaseConfig, PostgresStorageProvider, ProviderNotConfiguredError, type RecallExplainResponse, type RecallExplanationHit, type RecallOptions, type RecallResult, type RememberAction, type RememberFromMessagesOptions, type RememberFromMessagesRawStrategy, type RememberOptions, type RememberResult, type RerankDocument, type RerankHit, type RerankerProvider, type RetrievalConfig, SDK_VERSION, SentenceChunkingStrategy, SqliteCheckpointProvider, type SqliteDatabaseConfig, SqliteDatabaseProvider, SqliteEventDatabase, SqliteGraphProvider, SqliteStorageProvider, SqliteTelemetryProvider, type StageSpan, type StatsResult, type StorageConfig, StorageLockedError, type StorageProvider, type StorageProviderName, type SubscribableEvent, type SubscribeFilter, type TelemetryConfig, TelemetryEmitter, type TelemetryEvent, type TelemetryEventInput, type TelemetryLogLevel, type TelemetryOperation, type TelemetryProvider, type TelemetryQuery, type TelemetryQueryResult, type TelemetryStatus, type Unsubscribe, ValidationError, type VisionProvider, type VisionResult, Wolbarg, WolbargError, WolbargLogger, type WolbargOptions, type WolbargOptionsWithLlm, type WolbargOptionsWithoutLlm, bgeReranker, bm25, cohereReranker, createChunkingStrategy, createCompressionProvider, createDatabaseProvider, createEmbeddingProvider, createLlmProvider, createStorageProvider, createTelemetryProvider, wolbarg as createWolbarg, crossEncoder, geminiEmbedding, geminiVision, jinaReranker, lmStudioEmbedding, meta, neo4jGraph, ollamaEmbedding, ollamaLlm, openRouterEmbedding, openRouterLlm, openaiCompatibleEmbedding, openaiCompatibleLlm, openaiEmbedding, openaiLlm, openaiReranker, openaiVision, postgres, postgresConfig, runBenchmark, sqlite, sqliteCheckpoint, sqliteConfig, sqliteGraph, sqliteTelemetry, summarizeBenchmark, tesseract, togetherEmbedding, vllmEmbedding, wolbarg$1 as wolbarg, wrapOperationError };
package/dist/index.d.ts CHANGED
@@ -49,7 +49,7 @@ declare const meta: {
49
49
  * Schema is intentionally extensible for future providers (Postgres, cloud).
50
50
  */
51
51
  /** Public operation names recorded as telemetry events. */
52
- type TelemetryOperation = "remember" | "recall" | "forget" | "compress" | "rememberBatch" | "recallBatch" | "export" | "import" | "checkpoint" | "rollback" | "error" | "startup" | "shutdown" | "ingest" | "history" | "stats" | "clear" | "deleteCheckpoint" | "listCheckpoints" | "getCheckpoint" | "linkMemories" | "getRelated" | "graphQuery";
52
+ type TelemetryOperation = "remember" | "recall" | "forget" | "compress" | "rememberBatch" | "recallBatch" | "export" | "import" | "checkpoint" | "rollback" | "error" | "startup" | "shutdown" | "ingest" | "history" | "stats" | "clear" | "deleteCheckpoint" | "listCheckpoints" | "getCheckpoint" | "linkMemories" | "getRelated" | "graphQuery" | "rememberFromMessages";
53
53
  type TelemetryStatus = "ok" | "error" | "cancelled";
54
54
  type TelemetryLogLevel = "off" | "error" | "warn" | "info" | "debug" | "trace";
55
55
  /** Stage-level latency breakdown recorded on each event. */
@@ -341,6 +341,35 @@ interface RememberOptions {
341
341
  /** Per-call dedupe override; undefined uses constructor `memory.dedupe`. */
342
342
  dedupe?: boolean | MemoryDedupeConfig;
343
343
  }
344
+ /**
345
+ * Chat turn for {@link Wolbarg.rememberFromMessages}.
346
+ * @experimental until 1.0
347
+ */
348
+ interface ConversationMessage {
349
+ role: string;
350
+ content: string;
351
+ }
352
+ /** How `mode: "raw"` selects user turns to store. */
353
+ type RememberFromMessagesRawStrategy = "last_user" | "all_user";
354
+ /**
355
+ * Options for {@link Wolbarg.rememberFromMessages}.
356
+ * @experimental until 1.0
357
+ */
358
+ interface RememberFromMessagesOptions {
359
+ /** Agent identifier that owns the stored memories. */
360
+ agent: string;
361
+ /**
362
+ * `raw` (default) — store user message text without an LLM.
363
+ * `extract` — use configured `llm` to extract atomic facts, then remember each.
364
+ */
365
+ mode?: "raw" | "extract";
366
+ /** Used when `mode` is `raw`. Defaults to `last_user`. */
367
+ rawStrategy?: RememberFromMessagesRawStrategy;
368
+ /** Optional opaque metadata attached to every stored memory. */
369
+ metadata?: MemoryMetadata;
370
+ /** Per-call dedupe override; undefined uses constructor `memory.dedupe`. */
371
+ dedupe?: boolean | MemoryDedupeConfig;
372
+ }
344
373
  /** Whether remember created a new row or updated an existing one. */
345
374
  type RememberAction = "created" | "updated";
346
375
  /** Result of {@link Wolbarg.remember} — MemoryRecord plus upsert action. */
@@ -730,7 +759,7 @@ declare function createChunkingStrategy(name?: "fixed" | "sentence" | "paragraph
730
759
 
731
760
  /**
732
761
  * LLM provider abstractions and OpenAI-compatible chat implementation.
733
- * Used exclusively for memory compression (and future ORC features).
762
+ * Used for memory compression and experimental rememberFromMessages extract mode.
734
763
  */
735
764
 
736
765
  interface ChatMessage {
@@ -1296,6 +1325,15 @@ declare class Wolbarg<HasLlm extends boolean = false> {
1296
1325
  remember(options: RememberOptions): Promise<RememberResult>;
1297
1326
  /** Batch remember — sequential when dedupe enabled; otherwise one TX batch. */
1298
1327
  rememberBatch(items: RememberOptions[]): Promise<RememberResult[]>;
1328
+ /**
1329
+ * Store memories from a chat transcript.
1330
+ *
1331
+ * **Experimental** until 1.0 — API shape may change.
1332
+ *
1333
+ * - `mode: "raw"` (default) — remember user message text (no LLM).
1334
+ * - `mode: "extract"` — require configured `llm`; extract atomic facts then remember each.
1335
+ */
1336
+ rememberFromMessages(messages: ConversationMessage[], options: RememberFromMessagesOptions): Promise<RememberResult[]>;
1299
1337
  /**
1300
1338
  * Update an existing memory by id (re-embeds when content changes).
1301
1339
  */
@@ -1388,7 +1426,7 @@ declare class Wolbarg<HasLlm extends boolean = false> {
1388
1426
  declare function wolbarg$1(options: WolbargOptions): Wolbarg;
1389
1427
 
1390
1428
  /** Published SDK semver — keep in sync with package.json `version`. */
1391
- declare const SDK_VERSION = "0.5.0";
1429
+ declare const SDK_VERSION = "0.5.2";
1392
1430
 
1393
1431
  /**
1394
1432
  * Operation-scoped errors with reason + suggestion for developer experience.
@@ -1701,6 +1739,8 @@ declare class SqliteStorageProvider implements StorageProvider {
1701
1739
  private requireStatements;
1702
1740
  private requireVectorReady;
1703
1741
  private toVectorParam;
1742
+ /** sqlite-vec vec0 PKs must be bound as BigInt under node:sqlite. */
1743
+ private toVecRowid;
1704
1744
  private describe;
1705
1745
  }
1706
1746
  /** @deprecated Prefer {@link SqliteStorageProvider}. */
@@ -2208,4 +2248,4 @@ interface BenchmarkReport {
2208
2248
  declare function runBenchmark(name: string, iterations: number, fn: () => Promise<void> | void): Promise<BenchmarkSample[]>;
2209
2249
  declare function summarizeBenchmark(samples: BenchmarkSample[], startedAt: string, finishedAt: string): BenchmarkReport;
2210
2250
 
2211
- export { type BenchmarkReport, type BenchmarkSample, type ChatMessage, type CheckpointInfo, type CheckpointMeta, type CheckpointOptions, type CheckpointProvider, type Chunk, type ChunkingOptions, type ChunkingStrategy, type ClearOptions, type CompressOptions, type CompressResult, CompressionError, type CompressionProvider, type ConcurrencyConfig$1 as ConcurrencyConfig, ConfigurationError, type CreateCheckpointOptions, type DatabaseConfig, DatabaseError, type DatabaseProvider, type DatabaseProviderName, type EmbeddingCacheConfig, type EmbeddingConfig, EmbeddingError, type EmbeddingProvider, type EventDatabase, type ExportResult, FixedChunkingStrategy, type ForgetByFilterOptions, type ForgetByIdOptions, type ForgetOptions, type GetRelatedOptions, GraphCheckpointNotSupportedError, type GraphConfig, type GraphDirection, type GraphEntityInput, type GraphHealthResult, type GraphInput$1 as GraphInput, type GraphProvider, HeadingChunkingStrategy, type HistoryEvent, type HistoryOptions, type HistoryResult, type HybridConfig, type ImportResult, type IngestOptions, type IngestResult, type InitOptions, InitializationError, type KeywordDocument, type KeywordSearchHit, type KeywordSearchProvider, type LatencyBreakdown, LlmCompressionProvider, type LlmConfig, type LlmProvider, MarkdownChunkingStrategy, type MemoryChangeCallback, type MemoryChangeEvent, type MemoryContent, type MemoryDedupeConfig, type MemoryDedupeStrategy, type MemoryFilter, type MemoryMetadata, MemoryNotFoundError, type MemoryProvider, type MemoryRecord, type MetadataFilter as MetaFilter, type MetadataComparison, type MetadataFilter, type MmrConfig, Neo4jGraphProvider, NoopTelemetryProvider, type OCRProvider, type OcrResult, ParagraphChunkingStrategy, type PersistedRecallExplainPayload, type PostgresDatabaseConfig, PostgresStorageProvider, ProviderNotConfiguredError, type RecallExplainResponse, type RecallExplanationHit, type RecallOptions, type RecallResult, type RememberAction, type RememberOptions, type RememberResult, type RerankDocument, type RerankHit, type RerankerProvider, type RetrievalConfig, SDK_VERSION, SentenceChunkingStrategy, SqliteCheckpointProvider, type SqliteDatabaseConfig, SqliteDatabaseProvider, SqliteEventDatabase, SqliteGraphProvider, SqliteStorageProvider, SqliteTelemetryProvider, type StageSpan, type StatsResult, type StorageConfig, StorageLockedError, type StorageProvider, type StorageProviderName, type SubscribableEvent, type SubscribeFilter, type TelemetryConfig, TelemetryEmitter, type TelemetryEvent, type TelemetryEventInput, type TelemetryLogLevel, type TelemetryOperation, type TelemetryProvider, type TelemetryQuery, type TelemetryQueryResult, type TelemetryStatus, type Unsubscribe, ValidationError, type VisionProvider, type VisionResult, Wolbarg, WolbargError, WolbargLogger, type WolbargOptions, type WolbargOptionsWithLlm, type WolbargOptionsWithoutLlm, bgeReranker, bm25, cohereReranker, createChunkingStrategy, createCompressionProvider, createDatabaseProvider, createEmbeddingProvider, createLlmProvider, createStorageProvider, createTelemetryProvider, wolbarg as createWolbarg, crossEncoder, geminiEmbedding, geminiVision, jinaReranker, lmStudioEmbedding, meta, neo4jGraph, ollamaEmbedding, ollamaLlm, openRouterEmbedding, openRouterLlm, openaiCompatibleEmbedding, openaiCompatibleLlm, openaiEmbedding, openaiLlm, openaiReranker, openaiVision, postgres, postgresConfig, runBenchmark, sqlite, sqliteCheckpoint, sqliteConfig, sqliteGraph, sqliteTelemetry, summarizeBenchmark, tesseract, togetherEmbedding, vllmEmbedding, wolbarg$1 as wolbarg, wrapOperationError };
2251
+ export { type BenchmarkReport, type BenchmarkSample, type ChatMessage, type CheckpointInfo, type CheckpointMeta, type CheckpointOptions, type CheckpointProvider, type Chunk, type ChunkingOptions, type ChunkingStrategy, type ClearOptions, type CompressOptions, type CompressResult, CompressionError, type CompressionProvider, type ConcurrencyConfig$1 as ConcurrencyConfig, ConfigurationError, type ConversationMessage, type CreateCheckpointOptions, type DatabaseConfig, DatabaseError, type DatabaseProvider, type DatabaseProviderName, type EmbeddingCacheConfig, type EmbeddingConfig, EmbeddingError, type EmbeddingProvider, type EventDatabase, type ExportResult, FixedChunkingStrategy, type ForgetByFilterOptions, type ForgetByIdOptions, type ForgetOptions, type GetRelatedOptions, GraphCheckpointNotSupportedError, type GraphConfig, type GraphDirection, type GraphEntityInput, type GraphHealthResult, type GraphInput$1 as GraphInput, type GraphProvider, HeadingChunkingStrategy, type HistoryEvent, type HistoryOptions, type HistoryResult, type HybridConfig, type ImportResult, type IngestOptions, type IngestResult, type InitOptions, InitializationError, type KeywordDocument, type KeywordSearchHit, type KeywordSearchProvider, type LatencyBreakdown, LlmCompressionProvider, type LlmConfig, type LlmProvider, MarkdownChunkingStrategy, type MemoryChangeCallback, type MemoryChangeEvent, type MemoryContent, type MemoryDedupeConfig, type MemoryDedupeStrategy, type MemoryFilter, type MemoryMetadata, MemoryNotFoundError, type MemoryProvider, type MemoryRecord, type MetadataFilter as MetaFilter, type MetadataComparison, type MetadataFilter, type MmrConfig, Neo4jGraphProvider, NoopTelemetryProvider, type OCRProvider, type OcrResult, ParagraphChunkingStrategy, type PersistedRecallExplainPayload, type PostgresDatabaseConfig, PostgresStorageProvider, ProviderNotConfiguredError, type RecallExplainResponse, type RecallExplanationHit, type RecallOptions, type RecallResult, type RememberAction, type RememberFromMessagesOptions, type RememberFromMessagesRawStrategy, type RememberOptions, type RememberResult, type RerankDocument, type RerankHit, type RerankerProvider, type RetrievalConfig, SDK_VERSION, SentenceChunkingStrategy, SqliteCheckpointProvider, type SqliteDatabaseConfig, SqliteDatabaseProvider, SqliteEventDatabase, SqliteGraphProvider, SqliteStorageProvider, SqliteTelemetryProvider, type StageSpan, type StatsResult, type StorageConfig, StorageLockedError, type StorageProvider, type StorageProviderName, type SubscribableEvent, type SubscribeFilter, type TelemetryConfig, TelemetryEmitter, type TelemetryEvent, type TelemetryEventInput, type TelemetryLogLevel, type TelemetryOperation, type TelemetryProvider, type TelemetryQuery, type TelemetryQueryResult, type TelemetryStatus, type Unsubscribe, ValidationError, type VisionProvider, type VisionResult, Wolbarg, WolbargError, WolbargLogger, type WolbargOptions, type WolbargOptionsWithLlm, type WolbargOptionsWithoutLlm, bgeReranker, bm25, cohereReranker, createChunkingStrategy, createCompressionProvider, createDatabaseProvider, createEmbeddingProvider, createLlmProvider, createStorageProvider, createTelemetryProvider, wolbarg as createWolbarg, crossEncoder, geminiEmbedding, geminiVision, jinaReranker, lmStudioEmbedding, meta, neo4jGraph, ollamaEmbedding, ollamaLlm, openRouterEmbedding, openRouterLlm, openaiCompatibleEmbedding, openaiCompatibleLlm, openaiEmbedding, openaiLlm, openaiReranker, openaiVision, postgres, postgresConfig, runBenchmark, sqlite, sqliteCheckpoint, sqliteConfig, sqliteGraph, sqliteTelemetry, summarizeBenchmark, tesseract, togetherEmbedding, vllmEmbedding, wolbarg$1 as wolbarg, wrapOperationError };
package/dist/index.js CHANGED
@@ -3298,12 +3298,13 @@ var SqliteStorageProvider = class _SqliteStorageProvider {
3298
3298
  insertEmbedding(rowid, embedding) {
3299
3299
  const stmts = this.requireStatements();
3300
3300
  if (this.vectorBackend === "sqlite-vec") {
3301
- stmts.insertEmbedding.run(rowid, this.toVectorParam(embedding));
3301
+ stmts.insertEmbedding.run(this.toVecRowid(rowid), this.toVectorParam(embedding));
3302
3302
  return;
3303
3303
  }
3304
- stmts.insertEmbeddingBlob.run(rowid, embeddingToBuffer(embedding));
3304
+ const id = Number(rowid);
3305
+ stmts.insertEmbeddingBlob.run(id, embeddingToBuffer(embedding));
3305
3306
  if (this.memoryIndex) {
3306
- this.memoryIndex.upsert(rowid, embedding);
3307
+ this.memoryIndex.upsert(id, embedding);
3307
3308
  this.memoryIndexDirty = false;
3308
3309
  } else {
3309
3310
  this.memoryIndexDirty = true;
@@ -3313,10 +3314,11 @@ var SqliteStorageProvider = class _SqliteStorageProvider {
3313
3314
  const stmts = this.requireStatements();
3314
3315
  try {
3315
3316
  if (this.vectorBackend === "sqlite-vec" && stmts.deleteEmbedding) {
3316
- stmts.deleteEmbedding.run(rowid);
3317
+ stmts.deleteEmbedding.run(this.toVecRowid(rowid));
3317
3318
  } else if (stmts.deleteEmbeddingBlob) {
3318
- stmts.deleteEmbeddingBlob.run(rowid);
3319
- this.memoryIndex?.remove(rowid);
3319
+ const id = Number(rowid);
3320
+ stmts.deleteEmbeddingBlob.run(id);
3321
+ this.memoryIndex?.remove(id);
3320
3322
  this.memoryIndexDirty = true;
3321
3323
  }
3322
3324
  } catch {
@@ -3333,8 +3335,8 @@ var SqliteStorageProvider = class _SqliteStorageProvider {
3333
3335
  for (let i = 0; i < rows.length; i += 1) {
3334
3336
  const row = rows[i];
3335
3337
  hits[i] = {
3336
- memoryRowid: row.memory_rowid,
3337
- distance: row.distance
3338
+ memoryRowid: Number(row.memory_rowid),
3339
+ distance: Number(row.distance)
3338
3340
  };
3339
3341
  }
3340
3342
  return hits;
@@ -3410,6 +3412,10 @@ var SqliteStorageProvider = class _SqliteStorageProvider {
3410
3412
  const buffer = embeddingToBuffer(embedding);
3411
3413
  return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
3412
3414
  }
3415
+ /** sqlite-vec vec0 PKs must be bound as BigInt under node:sqlite. */
3416
+ toVecRowid(rowid) {
3417
+ return typeof rowid === "bigint" ? rowid : BigInt(rowid);
3418
+ }
3413
3419
  describe(error) {
3414
3420
  if (error instanceof Error) {
3415
3421
  return error.message;
@@ -5138,7 +5144,7 @@ function createDatabaseProvider(config) {
5138
5144
  }
5139
5145
 
5140
5146
  // src/version.ts
5141
- var SDK_VERSION = "0.5.0";
5147
+ var SDK_VERSION = "0.5.2";
5142
5148
 
5143
5149
  // src/memory/transfer.ts
5144
5150
  var SqliteMemoryTransferProvider = class {
@@ -5264,6 +5270,96 @@ function resolvePath(p) {
5264
5270
  return path7.isAbsolute(p) ? p : path7.resolve(process.cwd(), p);
5265
5271
  }
5266
5272
 
5273
+ // src/memory/from-messages.ts
5274
+ var DEFAULT_RAW_STRATEGY = "last_user";
5275
+ function normalizeConversationMessages(messages) {
5276
+ if (!Array.isArray(messages)) {
5277
+ throw new ValidationError("messages must be an array");
5278
+ }
5279
+ if (messages.length === 0) {
5280
+ throw new ValidationError("messages must be a non-empty array");
5281
+ }
5282
+ return messages.map((message, index) => {
5283
+ if (!message || typeof message !== "object") {
5284
+ throw new ValidationError(`messages[${index}] must be an object`);
5285
+ }
5286
+ if (typeof message.role !== "string" || message.role.trim().length === 0) {
5287
+ throw new ValidationError(`messages[${index}].role must be a non-empty string`);
5288
+ }
5289
+ if (typeof message.content !== "string") {
5290
+ throw new ValidationError(`messages[${index}].content must be a string`);
5291
+ }
5292
+ return {
5293
+ role: message.role.trim(),
5294
+ content: message.content.trim()
5295
+ };
5296
+ });
5297
+ }
5298
+ function resolveRememberFromMessagesOptions(options) {
5299
+ if (!options || typeof options !== "object") {
5300
+ throw new ValidationError("options is required");
5301
+ }
5302
+ if (typeof options.agent !== "string" || options.agent.trim().length === 0) {
5303
+ throw new ValidationError("agent must be a non-empty string");
5304
+ }
5305
+ const mode = options.mode ?? "raw";
5306
+ if (mode !== "raw" && mode !== "extract") {
5307
+ throw new ValidationError('mode must be "raw" or "extract"');
5308
+ }
5309
+ const rawStrategy = options.rawStrategy ?? DEFAULT_RAW_STRATEGY;
5310
+ if (rawStrategy !== "last_user" && rawStrategy !== "all_user") {
5311
+ throw new ValidationError('rawStrategy must be "last_user" or "all_user"');
5312
+ }
5313
+ return {
5314
+ agent: options.agent.trim(),
5315
+ mode,
5316
+ rawStrategy,
5317
+ ...options.metadata !== void 0 ? { metadata: options.metadata } : {},
5318
+ ...options.dedupe !== void 0 ? { dedupe: options.dedupe } : {}
5319
+ };
5320
+ }
5321
+ function selectRawUserTexts(messages, strategy) {
5322
+ const userTexts = messages.filter((m) => m.role === "user" && m.content.length > 0).map((m) => m.content);
5323
+ if (userTexts.length === 0) {
5324
+ throw new ValidationError(
5325
+ 'no user messages with non-empty content \u2014 nothing to remember in mode "raw"'
5326
+ );
5327
+ }
5328
+ if (strategy === "last_user") {
5329
+ return [userTexts[userTexts.length - 1]];
5330
+ }
5331
+ return userTexts;
5332
+ }
5333
+ function buildExtractMessages(messages) {
5334
+ const transcript = messages.map((m) => `${m.role}: ${m.content}`).join("\n");
5335
+ return [
5336
+ {
5337
+ role: "system",
5338
+ content: "Extract durable factual memories from the conversation. Return only atomic facts, one per line. No numbering, bullets, or commentary. If there are no facts worth storing, reply with exactly NONE."
5339
+ },
5340
+ {
5341
+ role: "user",
5342
+ content: transcript
5343
+ }
5344
+ ];
5345
+ }
5346
+ function parseExtractedFacts(llmOutput) {
5347
+ const trimmed = llmOutput.trim();
5348
+ if (trimmed.length === 0 || /^none$/i.test(trimmed)) {
5349
+ return [];
5350
+ }
5351
+ const facts = [];
5352
+ for (const line of trimmed.split(/\r?\n/)) {
5353
+ let fact = line.trim();
5354
+ if (fact.length === 0) continue;
5355
+ fact = fact.replace(/^[-*•]\s+/, "");
5356
+ fact = fact.replace(/^\d+[.)]\s+/, "");
5357
+ if (fact.length === 0 || /^none$/i.test(fact)) continue;
5358
+ facts.push(fact);
5359
+ }
5360
+ return facts;
5361
+ }
5362
+
5267
5363
  // src/memory/index.ts
5268
5364
  function toMemoryRecord(row) {
5269
5365
  return {
@@ -7712,6 +7808,81 @@ var Wolbarg = class {
7712
7808
  throw wrapOperationError("rememberBatch", error);
7713
7809
  }
7714
7810
  }
7811
+ /**
7812
+ * Store memories from a chat transcript.
7813
+ *
7814
+ * **Experimental** until 1.0 — API shape may change.
7815
+ *
7816
+ * - `mode: "raw"` (default) — remember user message text (no LLM).
7817
+ * - `mode: "extract"` — require configured `llm`; extract atomic facts then remember each.
7818
+ */
7819
+ async rememberFromMessages(messages, options) {
7820
+ const parent = this.telemetry.start("rememberFromMessages");
7821
+ try {
7822
+ const normalized = normalizeConversationMessages(messages);
7823
+ const resolved = resolveRememberFromMessagesOptions(options);
7824
+ let texts;
7825
+ if (resolved.mode === "extract") {
7826
+ if (!this.llm) {
7827
+ throw new ProviderNotConfiguredError(
7828
+ "llm",
7829
+ "rememberFromMessages",
7830
+ 'pass llm: openaiLlm(...) in the constructor when mode is "extract"'
7831
+ );
7832
+ }
7833
+ const llmOutput = await this.llm.complete(
7834
+ buildExtractMessages(normalized)
7835
+ );
7836
+ texts = parseExtractedFacts(llmOutput);
7837
+ if (texts.length === 0) {
7838
+ parent.success({
7839
+ returnedCount: 0,
7840
+ agentId: resolved.agent,
7841
+ extra: { mode: "extract", factCount: 0 }
7842
+ });
7843
+ return [];
7844
+ }
7845
+ } else {
7846
+ texts = selectRawUserTexts(normalized, resolved.rawStrategy);
7847
+ }
7848
+ const out = [];
7849
+ for (const text of texts) {
7850
+ const child = parent.child("remember");
7851
+ const result = await this.rememberOne(
7852
+ {
7853
+ agent: resolved.agent,
7854
+ content: { text },
7855
+ ...resolved.metadata !== void 0 ? { metadata: resolved.metadata } : {},
7856
+ ...resolved.dedupe !== void 0 ? { dedupe: resolved.dedupe } : {}
7857
+ },
7858
+ child
7859
+ );
7860
+ child.success({
7861
+ provider: this.storage?.name,
7862
+ memoryIds: [result.id],
7863
+ returnedCount: 1,
7864
+ metadata: result.metadata,
7865
+ agentId: result.agent,
7866
+ tags: telemetryTags(result.metadata),
7867
+ extra: { upsertAction: result.action, mode: resolved.mode }
7868
+ });
7869
+ out.push(result);
7870
+ }
7871
+ parent.success({
7872
+ provider: this.storage?.name,
7873
+ memoryIds: out.map((r) => r.id),
7874
+ returnedCount: out.length,
7875
+ embeddingProvider: this.embedding?.model,
7876
+ model: this.embedding?.model,
7877
+ agentId: resolved.agent,
7878
+ extra: { mode: resolved.mode }
7879
+ });
7880
+ return out;
7881
+ } catch (error) {
7882
+ parent.failure(error, { agentId: options?.agent });
7883
+ throw wrapOperationError("rememberFromMessages", error);
7884
+ }
7885
+ }
7715
7886
  /**
7716
7887
  * Update an existing memory by id (re-embeds when content changes).
7717
7888
  */