@xdarkicex/openclaw-memory-libravdb 1.10.3 → 1.10.4
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 +4 -0
- package/dist/index.js +9 -3
- package/dist/rules.d.ts +1 -0
- package/dist/rules.js +5 -2
- package/dist/types.d.ts +2 -0
- package/openclaw.plugin.json +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -205,6 +205,8 @@ Keywords: "acme corp, acmecorp, acme.com"
|
|
|
205
205
|
If the agent's reply contains any of those keywords, it's blocked and replaced
|
|
206
206
|
with "I cannot answer that." — regardless of what the model chose to say.
|
|
207
207
|
|
|
208
|
+
**Config:** `maxRules` sets the cap (default 20, set to 0 to disable rules entirely).
|
|
209
|
+
|
|
208
210
|
**Storage:** persisted to `~/.openclaw/cache/libravdb/rules.json`. Survives
|
|
209
211
|
gateway restarts and plugin updates.
|
|
210
212
|
|
|
@@ -307,6 +309,8 @@ All keys are optional. For the full reference, see [Configuration](./docs/config
|
|
|
307
309
|
| `onnxDevice` | string | `cpu` | ONNX execution provider; `cpu` is the default; `auto` lets libravdbd auto-detect |
|
|
308
310
|
| `userId` | string | auto-derived | Stable identity for cross-session durable memory |
|
|
309
311
|
| `tenantId` | string | auto-derived | Multi-tenant identifier. Resolved as `cfg.tenantId` > `LIBRAVDB_AGENT_ID` env > `userId`. Isolates the agent to a dedicated `.libravdb` file. |
|
|
312
|
+
| `tenantIdByAgent` | object | — | Per-agent tenant map. `{"agent1": "t1"}`. Unlisted agents fall through to `tenantId` → `userId`. |
|
|
313
|
+
| `maxRules` | number | 20 | Max hard constraint rules. Set to 0 to disable rules entirely. |
|
|
310
314
|
| `crossSessionRecall` | boolean | `true` | When `false`, only session-scoped memories are retrieved |
|
|
311
315
|
| `compactSessionTokenBudget` | number | `2000` | Auto-compaction token threshold; `0` disables |
|
|
312
316
|
|
package/dist/index.js
CHANGED
|
@@ -18436,7 +18436,10 @@ import { join as join3 } from "node:path";
|
|
|
18436
18436
|
// src/rules.ts
|
|
18437
18437
|
import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
18438
18438
|
import { dirname as dirname2 } from "node:path";
|
|
18439
|
-
var
|
|
18439
|
+
var maxRules = 20;
|
|
18440
|
+
function setMaxRules(n) {
|
|
18441
|
+
maxRules = Math.max(0, n);
|
|
18442
|
+
}
|
|
18440
18443
|
function jsonResult(details) {
|
|
18441
18444
|
return { content: [{ type: "text", text: JSON.stringify(details, null, 2) }], details };
|
|
18442
18445
|
}
|
|
@@ -18475,7 +18478,7 @@ function getRule(id) {
|
|
|
18475
18478
|
}
|
|
18476
18479
|
function setRule(ruleText, keywords, priority) {
|
|
18477
18480
|
let replaced = false;
|
|
18478
|
-
if (rules.length >=
|
|
18481
|
+
if (maxRules > 0 && rules.length >= maxRules) {
|
|
18479
18482
|
let minIdx = 0;
|
|
18480
18483
|
for (let i = 1; i < rules.length; i++) {
|
|
18481
18484
|
if (rules[i].priority < rules[minIdx].priority) minIdx = i;
|
|
@@ -35516,7 +35519,10 @@ function register(api) {
|
|
|
35516
35519
|
const runtimeOrNull = isLightweight ? null : createPluginRuntime(cfg, logger);
|
|
35517
35520
|
if (runtimeOrNull && !isLightweight) {
|
|
35518
35521
|
const cacheDir = api.cacheDir ?? process.env.OPENCLAW_CACHE_DIR ?? (process.env.HOME || process.env.USERPROFILE || "") + "/.openclaw/cache";
|
|
35519
|
-
if (cacheDir)
|
|
35522
|
+
if (cacheDir) {
|
|
35523
|
+
initRuleStore(cacheDir + "/libravdb", logger);
|
|
35524
|
+
if (cfg.maxRules !== void 0) setMaxRules(cfg.maxRules);
|
|
35525
|
+
}
|
|
35520
35526
|
}
|
|
35521
35527
|
registerMemoryCli(api, runtimeOrNull, cfg, logger);
|
|
35522
35528
|
const ownsMemorySlot = memSlot === MEMORY_ID;
|
package/dist/rules.d.ts
CHANGED
package/dist/rules.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname } from "node:path";
|
|
3
|
-
|
|
3
|
+
let maxRules = 20;
|
|
4
|
+
export function setMaxRules(n) {
|
|
5
|
+
maxRules = Math.max(0, n);
|
|
6
|
+
}
|
|
4
7
|
function jsonResult(details) {
|
|
5
8
|
return { content: [{ type: "text", text: JSON.stringify(details, null, 2) }], details };
|
|
6
9
|
}
|
|
@@ -41,7 +44,7 @@ export function getRule(id) {
|
|
|
41
44
|
}
|
|
42
45
|
export function setRule(ruleText, keywords, priority) {
|
|
43
46
|
let replaced = false;
|
|
44
|
-
if (rules.length >=
|
|
47
|
+
if (maxRules > 0 && rules.length >= maxRules) {
|
|
45
48
|
let minIdx = 0;
|
|
46
49
|
for (let i = 1; i < rules.length; i++) {
|
|
47
50
|
if (rules[i].priority < rules[minIdx].priority)
|
package/dist/types.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export interface PluginConfig {
|
|
|
10
10
|
/** Per-agent tenant overrides. Maps agentId → tenantId. Agents not in this
|
|
11
11
|
* map fall through to tenantId → userId. Opt-in. */
|
|
12
12
|
tenantIdByAgent?: Record<string, string>;
|
|
13
|
+
/** Maximum number of hard constraint rules. Default 20. */
|
|
14
|
+
maxRules?: number;
|
|
13
15
|
/** Stable identity for cross-session durable memory. When set, all sessions
|
|
14
16
|
* share memories under user:{userId}. When unset, the plugin auto-derives
|
|
15
17
|
* identity from the OS and persists it to the identity file. */
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "libravdb-memory",
|
|
3
3
|
"name": "LibraVDB Memory",
|
|
4
4
|
"description": "Cognitive memory engine — causal graph reasoning, predictive context, identity tracking, and hybrid vector recall with back-door adjustment scoring",
|
|
5
|
-
"version": "1.10.
|
|
5
|
+
"version": "1.10.4",
|
|
6
6
|
"kind": [
|
|
7
7
|
"memory",
|
|
8
8
|
"context-engine"
|
|
@@ -86,6 +86,12 @@
|
|
|
86
86
|
"additionalProperties": { "type": "string" },
|
|
87
87
|
"description": "Per-agent tenant overrides. Maps agentId to tenantId. Agents not listed fall through to tenantId -> userId. Example: {\"jarvis\": \"jarvis\", \"gideon\": \"gideon\"}."
|
|
88
88
|
},
|
|
89
|
+
"maxRules": {
|
|
90
|
+
"type": "number",
|
|
91
|
+
"default": 20,
|
|
92
|
+
"minimum": 0,
|
|
93
|
+
"description": "Maximum hard constraint rules. 0 disables rules. Default 20."
|
|
94
|
+
},
|
|
89
95
|
"userId": {
|
|
90
96
|
"type": "string",
|
|
91
97
|
"description": "Stable identity for cross-session durable memory. When set, sessions share memories under user:{userId}."
|