taladb 0.11.7 → 0.12.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.
package/README.md CHANGED
@@ -137,13 +137,13 @@ await runMigrations(db, [
137
137
 
138
138
  ## Full Documentation
139
139
 
140
- **[https://taladb.github.io/taladb](https://taladb.github.io/taladb)**
140
+ **[https://taladb.dev](https://taladb.dev)**
141
141
 
142
- - [Introduction](https://taladb.github.io/taladb/introduction)
143
- - [Web (Browser / WASM) Guide](https://taladb.github.io/taladb/guide/web)
144
- - [Node.js Guide](https://taladb.github.io/taladb/guide/node)
145
- - [React Native Guide](https://taladb.github.io/taladb/guide/react-native)
146
- - [API Reference](https://taladb.github.io/taladb/api/collection)
142
+ - [Introduction](https://taladb.dev/introduction)
143
+ - [Web (Browser / WASM) Guide](https://taladb.dev/guide/web)
144
+ - [Node.js Guide](https://taladb.dev/guide/node)
145
+ - [React Native Guide](https://taladb.dev/guide/react-native)
146
+ - [API Reference](https://taladb.dev/api/collection)
147
147
 
148
148
  ## License
149
149
 
@@ -22,6 +22,19 @@ function abortError() {
22
22
  }
23
23
  function createVectorClient(send) {
24
24
  const client = {
25
+ vectorCacheStats: () => send({ op: "cacheStats" }),
26
+ setVectorCacheBudget: async (bytes) => {
27
+ integer(bytes, "bytes");
28
+ return send({ op: "cacheBudget", bytes });
29
+ },
30
+ setVectorCacheAdaptive: async (memoryBytes) => {
31
+ if (memoryBytes !== void 0) integer(memoryBytes, "memoryBytes", 1, Number.MAX_SAFE_INTEGER);
32
+ return send({ op: "cacheAdaptive", memoryBytes });
33
+ },
34
+ notifyMemoryPressure: async (level) => {
35
+ if (!["normal", "moderate", "critical"].includes(level)) throw new Error("invalid memory pressure level");
36
+ return send({ op: "memoryPressure", level });
37
+ },
25
38
  searchVectors: async (field, vector, topK, filter, options = {}) => {
26
39
  integer(topK, "topK");
27
40
  return send({ op: "search", field, query: vectorValues(vector), topK, filter, options: queryOptions(options) });
@@ -92,6 +105,12 @@ var ENDPOINT_FIELDS = [
92
105
  "delete_endpoint"
93
106
  ];
94
107
  function validateConfig(config) {
108
+ if (config.vector_cache_memory_bytes !== void 0 && (!Number.isSafeInteger(config.vector_cache_memory_bytes) || config.vector_cache_memory_bytes <= 0)) {
109
+ throw new Error("TalaDB config: vector_cache_memory_bytes must be a positive safe integer");
110
+ }
111
+ if (config.vector_cache_bytes !== void 0 && (!Number.isSafeInteger(config.vector_cache_bytes) || config.vector_cache_bytes < 0)) {
112
+ throw new Error("TalaDB config: vector_cache_bytes must be a nonnegative safe integer");
113
+ }
95
114
  const sync = config.sync;
96
115
  if (!sync) return;
97
116
  for (const key of ENDPOINT_FIELDS) {
package/dist/index.d.mts CHANGED
@@ -62,7 +62,28 @@ interface VectorRecall {
62
62
  exactMs: number;
63
63
  annMs: number;
64
64
  }
65
+ type MemoryPressure = 'normal' | 'moderate' | 'critical';
66
+ interface VectorCacheStats {
67
+ budgetBytes: number;
68
+ baselineBudgetBytes: number;
69
+ policy: 'adaptive' | 'fixed';
70
+ memoryHintBytes: number | null;
71
+ pressure: MemoryPressure;
72
+ retainedBytes: number;
73
+ memoryBudgetBytes: number;
74
+ activeBytes: number;
75
+ peakBytes: number;
76
+ vectorIndexes: number;
77
+ graphIndexes: number;
78
+ }
65
79
  interface VectorClient<T> {
80
+ /** Cache controls apply to all collections in this database. */
81
+ vectorCacheStats(): Promise<VectorCacheStats>;
82
+ setVectorCacheBudget(bytes: number): Promise<VectorCacheStats>;
83
+ /** Omit the hint to restore the platform fallback; pressure remains active. */
84
+ setVectorCacheAdaptive(memoryBytes?: number): Promise<VectorCacheStats>;
85
+ /** Normal explicitly restores the baseline after a pressure signal. */
86
+ notifyMemoryPressure(level: MemoryPressure): Promise<VectorCacheStats>;
66
87
  searchVectors(field: string, vector: ArrayLike<number>, topK: number, filter?: Record<string, unknown>, options?: VectorQueryOptions): Promise<VectorQueryResult<T>>;
67
88
  /** Exact range search. Returns every matching document above the score threshold. */
68
89
  findWithin(field: string, vector: ArrayLike<number>, scoreThreshold: number, filter?: Record<string, unknown>): Promise<VectorQueryResult<T>>;
@@ -233,6 +254,13 @@ interface TextSearchOptions {
233
254
  * length; `1` normalises fully by length relative to the corpus average.
234
255
  */
235
256
  b?: number;
257
+ /**
258
+ * Drop common English words ("to", "the", "and", …) from the query before
259
+ * ranking, so they do not match nearly every document (default `true`). A
260
+ * query made only of such words is searched as typed. Documents are indexed
261
+ * in full either way, so changing this needs no reindex.
262
+ */
263
+ stopwords?: boolean;
236
264
  }
237
265
  interface HybridSearchResult<T extends Document = Document> {
238
266
  /** The matched document. */
@@ -813,6 +841,11 @@ interface DurabilityConfig {
813
841
  }
814
842
  /** Top-level TalaDB configuration. */
815
843
  interface TalaDbConfig {
844
+ /** Shared decoded search allowance in bytes, including active ANN scratch.
845
+ * Zero disables retention; short walks share a 64 KiB workspace. */
846
+ vector_cache_bytes?: number;
847
+ /** Device/host memory hint in bytes for adaptive sizing; fixed budgets take precedence. */
848
+ vector_cache_memory_bytes?: number;
816
849
  /** Outbound change-webhook configuration. Disabled by default. */
817
850
  webhook?: WebhookConfig;
818
851
  /** Storage durability configuration. */
@@ -1018,4 +1051,4 @@ interface OpenDBOptions {
1018
1051
  */
1019
1052
  declare function openDB(dbName?: string, options?: OpenDBOptions): Promise<TalaDB>;
1020
1053
 
1021
- export { type AggregatePipeline, type AggregateStage, type Collection, type CollectionIndexInfo, type CollectionOptions, type Document, type DurabilityConfig, type Filter, type HybridSearchOptions, type HybridSearchResult, type InsertDoc, type Migration, type OpenDBOptions, type Schema, type TalaDB, type TalaDbConfig, TalaDbValidationError, type TextSearchOptions, type TextSearchResult, type Update, type Value, type VectorBuildProgress, type VectorClient, type VectorGraphOptions, type VectorIndexOptions, type VectorIndexStatus, type VectorMetric, type VectorQuantization, type VectorQueryOptions, type VectorQueryResult, type VectorRebuildOptions, type VectorRecall, type VectorSearchResult, type WebhookConfig, type WebhookDispatcher, type WebhookEvent, type WebhookOp, type WebhookStats, applySchema, createVectorClient, createWebhookDispatcher, decorateCollection, deriveDocId, isDocId, openDB, runMigrations, validateWebhookConfig };
1054
+ export { type AggregatePipeline, type AggregateStage, type Collection, type CollectionIndexInfo, type CollectionOptions, type Document, type DurabilityConfig, type Filter, type HybridSearchOptions, type HybridSearchResult, type InsertDoc, type MemoryPressure, type Migration, type OpenDBOptions, type Schema, type TalaDB, type TalaDbConfig, TalaDbValidationError, type TextSearchOptions, type TextSearchResult, type Update, type Value, type VectorBuildProgress, type VectorCacheStats, type VectorClient, type VectorGraphOptions, type VectorIndexOptions, type VectorIndexStatus, type VectorMetric, type VectorQuantization, type VectorQueryOptions, type VectorQueryResult, type VectorRebuildOptions, type VectorRecall, type VectorSearchResult, type WebhookConfig, type WebhookDispatcher, type WebhookEvent, type WebhookOp, type WebhookStats, applySchema, createVectorClient, createWebhookDispatcher, decorateCollection, deriveDocId, isDocId, openDB, runMigrations, validateWebhookConfig };
package/dist/index.d.ts CHANGED
@@ -62,7 +62,28 @@ interface VectorRecall {
62
62
  exactMs: number;
63
63
  annMs: number;
64
64
  }
65
+ type MemoryPressure = 'normal' | 'moderate' | 'critical';
66
+ interface VectorCacheStats {
67
+ budgetBytes: number;
68
+ baselineBudgetBytes: number;
69
+ policy: 'adaptive' | 'fixed';
70
+ memoryHintBytes: number | null;
71
+ pressure: MemoryPressure;
72
+ retainedBytes: number;
73
+ memoryBudgetBytes: number;
74
+ activeBytes: number;
75
+ peakBytes: number;
76
+ vectorIndexes: number;
77
+ graphIndexes: number;
78
+ }
65
79
  interface VectorClient<T> {
80
+ /** Cache controls apply to all collections in this database. */
81
+ vectorCacheStats(): Promise<VectorCacheStats>;
82
+ setVectorCacheBudget(bytes: number): Promise<VectorCacheStats>;
83
+ /** Omit the hint to restore the platform fallback; pressure remains active. */
84
+ setVectorCacheAdaptive(memoryBytes?: number): Promise<VectorCacheStats>;
85
+ /** Normal explicitly restores the baseline after a pressure signal. */
86
+ notifyMemoryPressure(level: MemoryPressure): Promise<VectorCacheStats>;
66
87
  searchVectors(field: string, vector: ArrayLike<number>, topK: number, filter?: Record<string, unknown>, options?: VectorQueryOptions): Promise<VectorQueryResult<T>>;
67
88
  /** Exact range search. Returns every matching document above the score threshold. */
68
89
  findWithin(field: string, vector: ArrayLike<number>, scoreThreshold: number, filter?: Record<string, unknown>): Promise<VectorQueryResult<T>>;
@@ -233,6 +254,13 @@ interface TextSearchOptions {
233
254
  * length; `1` normalises fully by length relative to the corpus average.
234
255
  */
235
256
  b?: number;
257
+ /**
258
+ * Drop common English words ("to", "the", "and", …) from the query before
259
+ * ranking, so they do not match nearly every document (default `true`). A
260
+ * query made only of such words is searched as typed. Documents are indexed
261
+ * in full either way, so changing this needs no reindex.
262
+ */
263
+ stopwords?: boolean;
236
264
  }
237
265
  interface HybridSearchResult<T extends Document = Document> {
238
266
  /** The matched document. */
@@ -813,6 +841,11 @@ interface DurabilityConfig {
813
841
  }
814
842
  /** Top-level TalaDB configuration. */
815
843
  interface TalaDbConfig {
844
+ /** Shared decoded search allowance in bytes, including active ANN scratch.
845
+ * Zero disables retention; short walks share a 64 KiB workspace. */
846
+ vector_cache_bytes?: number;
847
+ /** Device/host memory hint in bytes for adaptive sizing; fixed budgets take precedence. */
848
+ vector_cache_memory_bytes?: number;
816
849
  /** Outbound change-webhook configuration. Disabled by default. */
817
850
  webhook?: WebhookConfig;
818
851
  /** Storage durability configuration. */
@@ -1018,4 +1051,4 @@ interface OpenDBOptions {
1018
1051
  */
1019
1052
  declare function openDB(dbName?: string, options?: OpenDBOptions): Promise<TalaDB>;
1020
1053
 
1021
- export { type AggregatePipeline, type AggregateStage, type Collection, type CollectionIndexInfo, type CollectionOptions, type Document, type DurabilityConfig, type Filter, type HybridSearchOptions, type HybridSearchResult, type InsertDoc, type Migration, type OpenDBOptions, type Schema, type TalaDB, type TalaDbConfig, TalaDbValidationError, type TextSearchOptions, type TextSearchResult, type Update, type Value, type VectorBuildProgress, type VectorClient, type VectorGraphOptions, type VectorIndexOptions, type VectorIndexStatus, type VectorMetric, type VectorQuantization, type VectorQueryOptions, type VectorQueryResult, type VectorRebuildOptions, type VectorRecall, type VectorSearchResult, type WebhookConfig, type WebhookDispatcher, type WebhookEvent, type WebhookOp, type WebhookStats, applySchema, createVectorClient, createWebhookDispatcher, decorateCollection, deriveDocId, isDocId, openDB, runMigrations, validateWebhookConfig };
1054
+ export { type AggregatePipeline, type AggregateStage, type Collection, type CollectionIndexInfo, type CollectionOptions, type Document, type DurabilityConfig, type Filter, type HybridSearchOptions, type HybridSearchResult, type InsertDoc, type MemoryPressure, type Migration, type OpenDBOptions, type Schema, type TalaDB, type TalaDbConfig, TalaDbValidationError, type TextSearchOptions, type TextSearchResult, type Update, type Value, type VectorBuildProgress, type VectorCacheStats, type VectorClient, type VectorGraphOptions, type VectorIndexOptions, type VectorIndexStatus, type VectorMetric, type VectorQuantization, type VectorQueryOptions, type VectorQueryResult, type VectorRebuildOptions, type VectorRecall, type VectorSearchResult, type WebhookConfig, type WebhookDispatcher, type WebhookEvent, type WebhookOp, type WebhookStats, applySchema, createVectorClient, createWebhookDispatcher, decorateCollection, deriveDocId, isDocId, openDB, runMigrations, validateWebhookConfig };
package/dist/index.js CHANGED
@@ -67,6 +67,19 @@ function abortError() {
67
67
  }
68
68
  function createVectorClient(send) {
69
69
  const client = {
70
+ vectorCacheStats: () => send({ op: "cacheStats" }),
71
+ setVectorCacheBudget: async (bytes) => {
72
+ integer(bytes, "bytes");
73
+ return send({ op: "cacheBudget", bytes });
74
+ },
75
+ setVectorCacheAdaptive: async (memoryBytes) => {
76
+ if (memoryBytes !== void 0) integer(memoryBytes, "memoryBytes", 1, Number.MAX_SAFE_INTEGER);
77
+ return send({ op: "cacheAdaptive", memoryBytes });
78
+ },
79
+ notifyMemoryPressure: async (level) => {
80
+ if (!["normal", "moderate", "critical"].includes(level)) throw new Error("invalid memory pressure level");
81
+ return send({ op: "memoryPressure", level });
82
+ },
70
83
  searchVectors: async (field, vector, topK, filter, options = {}) => {
71
84
  integer(topK, "topK");
72
85
  return send({ op: "search", field, query: vectorValues(vector), topK, filter, options: queryOptions(options) });
@@ -407,7 +420,13 @@ function wrapCollectionWithWebhook(col, collection, webhook) {
407
420
 
408
421
  // src/config.ts
409
422
  function validateConfig(config) {
423
+ if (config.vector_cache_memory_bytes !== void 0 && (!Number.isSafeInteger(config.vector_cache_memory_bytes) || config.vector_cache_memory_bytes <= 0)) {
424
+ throw new Error("TalaDB config: vector_cache_memory_bytes must be a positive safe integer");
425
+ }
410
426
  if (config.webhook) validateWebhookConfig(config.webhook);
427
+ if (config.vector_cache_bytes !== void 0 && (!Number.isSafeInteger(config.vector_cache_bytes) || config.vector_cache_bytes < 0)) {
428
+ throw new Error("TalaDB config: vector_cache_bytes must be a nonnegative safe integer");
429
+ }
411
430
  }
412
431
  async function loadConfig(configPath) {
413
432
  if (typeof process === "undefined" || typeof process.cwd !== "function") {
package/dist/index.mjs CHANGED
@@ -22,6 +22,19 @@ function abortError() {
22
22
  }
23
23
  function createVectorClient(send) {
24
24
  const client = {
25
+ vectorCacheStats: () => send({ op: "cacheStats" }),
26
+ setVectorCacheBudget: async (bytes) => {
27
+ integer(bytes, "bytes");
28
+ return send({ op: "cacheBudget", bytes });
29
+ },
30
+ setVectorCacheAdaptive: async (memoryBytes) => {
31
+ if (memoryBytes !== void 0) integer(memoryBytes, "memoryBytes", 1, Number.MAX_SAFE_INTEGER);
32
+ return send({ op: "cacheAdaptive", memoryBytes });
33
+ },
34
+ notifyMemoryPressure: async (level) => {
35
+ if (!["normal", "moderate", "critical"].includes(level)) throw new Error("invalid memory pressure level");
36
+ return send({ op: "memoryPressure", level });
37
+ },
25
38
  searchVectors: async (field, vector, topK, filter, options = {}) => {
26
39
  integer(topK, "topK");
27
40
  return send({ op: "search", field, query: vectorValues(vector), topK, filter, options: queryOptions(options) });
@@ -362,7 +375,13 @@ function wrapCollectionWithWebhook(col, collection, webhook) {
362
375
 
363
376
  // src/config.ts
364
377
  function validateConfig(config) {
378
+ if (config.vector_cache_memory_bytes !== void 0 && (!Number.isSafeInteger(config.vector_cache_memory_bytes) || config.vector_cache_memory_bytes <= 0)) {
379
+ throw new Error("TalaDB config: vector_cache_memory_bytes must be a positive safe integer");
380
+ }
365
381
  if (config.webhook) validateWebhookConfig(config.webhook);
382
+ if (config.vector_cache_bytes !== void 0 && (!Number.isSafeInteger(config.vector_cache_bytes) || config.vector_cache_bytes < 0)) {
383
+ throw new Error("TalaDB config: vector_cache_bytes must be a nonnegative safe integer");
384
+ }
366
385
  }
367
386
  async function loadConfig(configPath) {
368
387
  if (typeof process === "undefined" || typeof process.cwd !== "function") {
@@ -22,6 +22,19 @@ function abortError() {
22
22
  }
23
23
  function createVectorClient(send) {
24
24
  const client = {
25
+ vectorCacheStats: () => send({ op: "cacheStats" }),
26
+ setVectorCacheBudget: async (bytes) => {
27
+ integer(bytes, "bytes");
28
+ return send({ op: "cacheBudget", bytes });
29
+ },
30
+ setVectorCacheAdaptive: async (memoryBytes) => {
31
+ if (memoryBytes !== void 0) integer(memoryBytes, "memoryBytes", 1, Number.MAX_SAFE_INTEGER);
32
+ return send({ op: "cacheAdaptive", memoryBytes });
33
+ },
34
+ notifyMemoryPressure: async (level) => {
35
+ if (!["normal", "moderate", "critical"].includes(level)) throw new Error("invalid memory pressure level");
36
+ return send({ op: "memoryPressure", level });
37
+ },
25
38
  searchVectors: async (field, vector, topK, filter, options = {}) => {
26
39
  integer(topK, "topK");
27
40
  return send({ op: "search", field, query: vectorValues(vector), topK, filter, options: queryOptions(options) });
@@ -92,6 +105,12 @@ var ENDPOINT_FIELDS = [
92
105
  "delete_endpoint"
93
106
  ];
94
107
  function validateConfig(config) {
108
+ if (config.vector_cache_memory_bytes !== void 0 && (!Number.isSafeInteger(config.vector_cache_memory_bytes) || config.vector_cache_memory_bytes <= 0)) {
109
+ throw new Error("TalaDB config: vector_cache_memory_bytes must be a positive safe integer");
110
+ }
111
+ if (config.vector_cache_bytes !== void 0 && (!Number.isSafeInteger(config.vector_cache_bytes) || config.vector_cache_bytes < 0)) {
112
+ throw new Error("TalaDB config: vector_cache_bytes must be a nonnegative safe integer");
113
+ }
95
114
  const sync = config.sync;
96
115
  if (!sync) return;
97
116
  for (const key of ENDPOINT_FIELDS) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taladb",
3
- "version": "0.11.7",
3
+ "version": "0.12.0",
4
4
  "description": "The embedded vector database for on-device AI — documents, similarity search, and offline sync for browser, React Native, and Node.js",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -44,7 +44,7 @@
44
44
  "url": "https://github.com/taladb/taladb.git",
45
45
  "directory": "packages/clients/taladb"
46
46
  },
47
- "homepage": "https://taladb.github.io/taladb/",
47
+ "homepage": "https://taladb.dev/",
48
48
  "bugs": {
49
49
  "url": "https://github.com/taladb/taladb/issues"
50
50
  },
@@ -62,8 +62,8 @@
62
62
  "vitest": "^3.2.0"
63
63
  },
64
64
  "peerDependencies": {
65
- "@taladb/web": "0.11.7",
66
- "@taladb/node": "0.11.7"
65
+ "@taladb/web": "0.12.0",
66
+ "@taladb/node": "0.12.0"
67
67
  },
68
68
  "peerDependenciesMeta": {
69
69
  "@taladb/web": {