memory-lancedb-pro 1.0.25 → 1.0.26
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/CHANGELOG.md +15 -0
- package/README.md +14 -1
- package/README_CN.md +14 -1
- package/index.ts +243 -85
- package/openclaw.plugin.json +15 -1
- package/package.json +1 -1
- package/src/access-tracker.ts +330 -0
- package/src/retriever.ts +183 -68
- package/src/store.ts +207 -67
- package/src/tools.ts +339 -87
- package/test/access-tracker.test.mjs +770 -0
- package/test/cli-smoke.mjs +22 -0
package/test/cli-smoke.mjs
CHANGED
|
@@ -78,6 +78,28 @@ async function runCliSmoke() {
|
|
|
78
78
|
"--dry-run",
|
|
79
79
|
]);
|
|
80
80
|
|
|
81
|
+
// 3) Access reinforcement formula smoke test
|
|
82
|
+
const { parseAccessMetadata, buildUpdatedMetadata, computeEffectiveHalfLife } =
|
|
83
|
+
jiti("../src/access-tracker.ts");
|
|
84
|
+
|
|
85
|
+
// Verify formula basics
|
|
86
|
+
const hl0 = computeEffectiveHalfLife(60, 0, 0, 0.5, 3);
|
|
87
|
+
assert.equal(hl0, 60, "zero access = base half-life");
|
|
88
|
+
|
|
89
|
+
const hl10 = computeEffectiveHalfLife(60, 10, Date.now(), 0.5, 3);
|
|
90
|
+
assert.ok(hl10 > 60 && hl10 < 180, `10 accesses: ${hl10} should be between 60 and 180`);
|
|
91
|
+
|
|
92
|
+
const hlCapped = computeEffectiveHalfLife(60, 100000, Date.now(), 0.5, 3);
|
|
93
|
+
assert.equal(hlCapped, 180, "capped at 3x");
|
|
94
|
+
|
|
95
|
+
// Verify metadata round-trip
|
|
96
|
+
const meta = buildUpdatedMetadata("{}", 5);
|
|
97
|
+
const parsed = parseAccessMetadata(meta);
|
|
98
|
+
assert.equal(parsed.accessCount, 5);
|
|
99
|
+
assert.ok(parsed.lastAccessedAt > 0);
|
|
100
|
+
|
|
101
|
+
console.log("OK: Access reinforcement formula verified");
|
|
102
|
+
|
|
81
103
|
rmSync(workDir, { recursive: true, force: true });
|
|
82
104
|
}
|
|
83
105
|
|