@wrongstack/vector-memory 1.0.6 → 1.0.8
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 +15 -5
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -747,6 +747,7 @@ async function runSearchRace(query, lexical, vectorStore, options = {}) {
|
|
|
747
747
|
const mem = lexicalCapped[i];
|
|
748
748
|
const score = lexicalCapped.length <= 1 ? 1 : 1 - i / Math.max(1, lexicalCapped.length - 1);
|
|
749
749
|
const id = mem.id;
|
|
750
|
+
if (seenIds.has(id)) continue;
|
|
750
751
|
seenIds.add(id);
|
|
751
752
|
overlap.push({
|
|
752
753
|
id,
|
|
@@ -952,7 +953,10 @@ var VectorMemoryStore = class _VectorMemoryStore {
|
|
|
952
953
|
this.assertOpen();
|
|
953
954
|
const row = this.db.prepare("SELECT * FROM entries WHERE content_hash = ? LIMIT 1").get(contentHash);
|
|
954
955
|
if (!row) return void 0;
|
|
955
|
-
const vectorRow = this.db.prepare(
|
|
956
|
+
const vectorRow = this.db.prepare(
|
|
957
|
+
`SELECT * FROM vectors WHERE entry_id = ?
|
|
958
|
+
ORDER BY (provider_id = ?) DESC, created_at DESC LIMIT 1`
|
|
959
|
+
).get(row.id, this.provider.id);
|
|
956
960
|
return this.rowToEntry(row, vectorRow);
|
|
957
961
|
}
|
|
958
962
|
/**
|
|
@@ -975,7 +979,10 @@ var VectorMemoryStore = class _VectorMemoryStore {
|
|
|
975
979
|
LIMIT 1`
|
|
976
980
|
).get(sageId);
|
|
977
981
|
if (!row) return void 0;
|
|
978
|
-
const vectorRow = this.db.prepare(
|
|
982
|
+
const vectorRow = this.db.prepare(
|
|
983
|
+
`SELECT * FROM vectors WHERE entry_id = ?
|
|
984
|
+
ORDER BY (provider_id = ?) DESC, created_at DESC LIMIT 1`
|
|
985
|
+
).get(row.id, this.provider.id);
|
|
979
986
|
return this.rowToEntry(row, vectorRow);
|
|
980
987
|
}
|
|
981
988
|
/**
|
|
@@ -1059,7 +1066,10 @@ var VectorMemoryStore = class _VectorMemoryStore {
|
|
|
1059
1066
|
this.assertOpen();
|
|
1060
1067
|
const row = this.db.prepare("SELECT * FROM entries WHERE id = ?").get(id);
|
|
1061
1068
|
if (!row) return void 0;
|
|
1062
|
-
const vectorRow = this.db.prepare(
|
|
1069
|
+
const vectorRow = this.db.prepare(
|
|
1070
|
+
`SELECT * FROM vectors WHERE entry_id = ?
|
|
1071
|
+
ORDER BY (provider_id = ?) DESC, created_at DESC LIMIT 1`
|
|
1072
|
+
).get(id, this.provider.id);
|
|
1063
1073
|
return this.rowToEntry(row, vectorRow);
|
|
1064
1074
|
}
|
|
1065
1075
|
/** Hard-delete an entry by id. Wrapped in `withFileLock` for cross-process safety. */
|
|
@@ -1263,8 +1273,8 @@ var VectorMemoryStore = class _VectorMemoryStore {
|
|
|
1263
1273
|
const toRemove = total - keepMostRecent;
|
|
1264
1274
|
const stmt = this.db.prepare(
|
|
1265
1275
|
`DELETE FROM embedding_cache
|
|
1266
|
-
WHERE
|
|
1267
|
-
SELECT
|
|
1276
|
+
WHERE rowid IN (
|
|
1277
|
+
SELECT rowid FROM embedding_cache
|
|
1268
1278
|
ORDER BY last_used_at ASC
|
|
1269
1279
|
LIMIT ?
|
|
1270
1280
|
)`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wrongstack/vector-memory",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
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,9 +27,9 @@
|
|
|
27
27
|
"README.md"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@wrongstack/core": "1.0.
|
|
31
|
-
"@wrongstack/persistence": "1.0.
|
|
32
|
-
"@wrongstack/sage": "1.0.
|
|
30
|
+
"@wrongstack/core": "1.0.8",
|
|
31
|
+
"@wrongstack/persistence": "1.0.8",
|
|
32
|
+
"@wrongstack/sage": "1.0.8"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^26.2.0",
|