@wrongstack/vector-memory 0.309.1 → 0.310.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/dist/index.js +5 -10
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -271,9 +271,9 @@ function decodeVector(buf) {
|
|
|
271
271
|
import { createHash, randomUUID } from "node:crypto";
|
|
272
272
|
import * as fs from "node:fs";
|
|
273
273
|
import * as path from "node:path";
|
|
274
|
-
import { DatabaseSync } from "node:sqlite";
|
|
275
|
-
import { HashingEmbeddingProvider, cosineSimilarity } from "@wrongstack/sage";
|
|
276
274
|
import { withFileLock } from "@wrongstack/core/utils";
|
|
275
|
+
import { loadRuntimeDatabaseSync } from "@wrongstack/persistence";
|
|
276
|
+
import { cosineSimilarity, HashingEmbeddingProvider } from "@wrongstack/sage";
|
|
277
277
|
var DEFAULT_DIRECTORY = ".wrongstack/vector-memory";
|
|
278
278
|
var DEFAULT_FILENAME = "vector-memory.db";
|
|
279
279
|
var DEFAULT_LOCK_TIMEOUT_MS = 5e3;
|
|
@@ -301,7 +301,8 @@ var VectorMemoryStore = class _VectorMemoryStore {
|
|
|
301
301
|
fs.mkdirSync(rootDir, { recursive: true });
|
|
302
302
|
this.rootDir = rootDir;
|
|
303
303
|
this.dbPath = path.join(rootDir, filename);
|
|
304
|
-
|
|
304
|
+
const Database = loadRuntimeDatabaseSync();
|
|
305
|
+
this.db = new Database(this.dbPath);
|
|
305
306
|
initVectorSchema(this.db);
|
|
306
307
|
this.recordActiveProvider();
|
|
307
308
|
}
|
|
@@ -617,13 +618,7 @@ var VectorMemoryStore = class _VectorMemoryStore {
|
|
|
617
618
|
vector = excluded.vector,
|
|
618
619
|
dimensions = excluded.dimensions,
|
|
619
620
|
created_at = excluded.created_at`
|
|
620
|
-
).run(
|
|
621
|
-
row.id,
|
|
622
|
-
this.provider.id,
|
|
623
|
-
v.length,
|
|
624
|
-
encodeVector(v),
|
|
625
|
-
now
|
|
626
|
-
);
|
|
621
|
+
).run(row.id, this.provider.id, v.length, encodeVector(v), now);
|
|
627
622
|
this.cacheVector(row.text, v, now);
|
|
628
623
|
processed++;
|
|
629
624
|
} catch {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/vector-memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.310.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "WrongStack Vector Memory — an additional vector-search memory store powered by @huggingface/transformers (local ONNX embeddings), alongside the SAGE lexical memory system.",
|
|
6
6
|
"repository": {
|
|
@@ -27,8 +27,9 @@
|
|
|
27
27
|
"README.md"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@wrongstack/
|
|
31
|
-
"@wrongstack/
|
|
30
|
+
"@wrongstack/core": "0.310.0",
|
|
31
|
+
"@wrongstack/sage": "0.310.0",
|
|
32
|
+
"@wrongstack/persistence": "0.310.0"
|
|
32
33
|
},
|
|
33
34
|
"optionalDependencies": {
|
|
34
35
|
"@huggingface/transformers": "^4.2.0"
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
},
|
|
45
46
|
"scripts": {
|
|
46
47
|
"build": "node ../../scripts/build-package.mjs",
|
|
47
|
-
"typecheck": "tsc --noEmit",
|
|
48
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json",
|
|
48
49
|
"test": "vitest run",
|
|
49
50
|
"test:integration": "WRONGSTACK_VECTOR_INTEGRATION=1 vitest run tests/integration.test.ts",
|
|
50
51
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
|