memory-lancedb-pro 1.0.13 → 1.0.14
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/cli.ts +2 -2
- package/package.json +2 -2
- package/src/migrate.ts +2 -2
- package/src/store.ts +11 -10
package/cli.ts
CHANGED
|
@@ -514,8 +514,8 @@ export function registerMemoryCLI(program: Command, context: CLIContext): void {
|
|
|
514
514
|
vector,
|
|
515
515
|
category: (row.category as any) || "other",
|
|
516
516
|
scope: (row.scope as string | undefined) || "global",
|
|
517
|
-
importance:
|
|
518
|
-
timestamp:
|
|
517
|
+
importance: (row.importance != null) ? Number(row.importance) : 0.7,
|
|
518
|
+
timestamp: (row.timestamp != null) ? Number(row.timestamp) : Date.now(),
|
|
519
519
|
metadata: typeof row.metadata === "string" ? row.metadata : "{}",
|
|
520
520
|
};
|
|
521
521
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memory-lancedb-pro",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "OpenClaw enhanced LanceDB memory plugin with hybrid retrieval (Vector + BM25), cross-encoder rerank, multi-scope isolation, and management CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -40,4 +40,4 @@
|
|
|
40
40
|
"jiti": "^2.6.0",
|
|
41
41
|
"typescript": "^5.9.3"
|
|
42
42
|
}
|
|
43
|
-
}
|
|
43
|
+
}
|
package/src/migrate.ts
CHANGED
|
@@ -153,9 +153,9 @@ export class MemoryMigrator {
|
|
|
153
153
|
id: row.id as string,
|
|
154
154
|
text: row.text as string,
|
|
155
155
|
vector: row.vector as number[],
|
|
156
|
-
importance: row.importance
|
|
156
|
+
importance: Number(row.importance),
|
|
157
157
|
category: (row.category as LegacyMemoryEntry["category"]) || "other",
|
|
158
|
-
createdAt: row.createdAt
|
|
158
|
+
createdAt: Number(row.createdAt),
|
|
159
159
|
scope: row.scope as string | undefined,
|
|
160
160
|
}));
|
|
161
161
|
} catch (error) {
|
package/src/store.ts
CHANGED
|
@@ -258,7 +258,7 @@ export class MemoryStore {
|
|
|
258
258
|
const mapped: MemorySearchResult[] = [];
|
|
259
259
|
|
|
260
260
|
for (const row of results) {
|
|
261
|
-
const distance = row._distance ?? 0;
|
|
261
|
+
const distance = Number(row._distance ?? 0);
|
|
262
262
|
const score = 1 / (1 + distance);
|
|
263
263
|
|
|
264
264
|
if (score < minScore) continue;
|
|
@@ -277,8 +277,8 @@ export class MemoryStore {
|
|
|
277
277
|
vector: row.vector as number[],
|
|
278
278
|
category: row.category as MemoryEntry["category"],
|
|
279
279
|
scope: rowScope,
|
|
280
|
-
importance: row.importance
|
|
281
|
-
timestamp: row.timestamp
|
|
280
|
+
importance: Number(row.importance),
|
|
281
|
+
timestamp: Number(row.timestamp),
|
|
282
282
|
metadata: (row.metadata as string) || "{}",
|
|
283
283
|
},
|
|
284
284
|
score,
|
|
@@ -323,7 +323,8 @@ export class MemoryStore {
|
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
// LanceDB FTS _score is raw BM25 (unbounded). Normalize with sigmoid.
|
|
326
|
-
|
|
326
|
+
// LanceDB may return BigInt for numeric columns; coerce safely.
|
|
327
|
+
const rawScore = (row._score != null) ? Number(row._score) : 0;
|
|
327
328
|
const normalizedScore = rawScore > 0 ? 1 / (1 + Math.exp(-rawScore / 5)) : 0.5;
|
|
328
329
|
|
|
329
330
|
mapped.push({
|
|
@@ -333,8 +334,8 @@ export class MemoryStore {
|
|
|
333
334
|
vector: row.vector as number[],
|
|
334
335
|
category: row.category as MemoryEntry["category"],
|
|
335
336
|
scope: rowScope,
|
|
336
|
-
importance: row.importance
|
|
337
|
-
timestamp: row.timestamp
|
|
337
|
+
importance: Number(row.importance),
|
|
338
|
+
timestamp: Number(row.timestamp),
|
|
338
339
|
metadata: (row.metadata as string) || "{}",
|
|
339
340
|
},
|
|
340
341
|
score: normalizedScore,
|
|
@@ -423,8 +424,8 @@ export class MemoryStore {
|
|
|
423
424
|
vector: [], // Don't include vectors in list results for performance
|
|
424
425
|
category: row.category as MemoryEntry["category"],
|
|
425
426
|
scope: (row.scope as string | undefined) ?? "global",
|
|
426
|
-
importance: row.importance
|
|
427
|
-
timestamp: row.timestamp
|
|
427
|
+
importance: Number(row.importance),
|
|
428
|
+
timestamp: Number(row.timestamp),
|
|
428
429
|
metadata: (row.metadata as string) || "{}",
|
|
429
430
|
}))
|
|
430
431
|
.sort((a, b) => (b.timestamp || 0) - (a.timestamp || 0))
|
|
@@ -514,8 +515,8 @@ export class MemoryStore {
|
|
|
514
515
|
vector: updates.vector ?? (Array.from(row.vector as Iterable<number>)),
|
|
515
516
|
category: updates.category ?? (row.category as MemoryEntry["category"]),
|
|
516
517
|
scope: rowScope,
|
|
517
|
-
importance: updates.importance ?? (row.importance
|
|
518
|
-
timestamp: row.timestamp
|
|
518
|
+
importance: updates.importance ?? Number(row.importance),
|
|
519
|
+
timestamp: Number(row.timestamp), // preserve original
|
|
519
520
|
metadata: updates.metadata ?? ((row.metadata as string) || "{}"),
|
|
520
521
|
};
|
|
521
522
|
|