@xdarkicex/openclaw-memory-libravdb 1.10.10 → 1.10.14-beta.1
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 +166 -15
- package/dist/context-engine.d.ts +2 -3
- package/dist/context-engine.js +196 -26
- package/dist/index.js +269 -47
- package/dist/manifest.js +4 -4
- package/dist/memory-provider.js +26 -11
- package/dist/tools/memory-recall.d.ts +41 -0
- package/dist/tools/memory-recall.js +66 -6
- package/openclaw.plugin.json +4 -2
- package/package.json +1 -1
|
@@ -26,6 +26,13 @@ type MemoryExpandDetails = {
|
|
|
26
26
|
truncated: boolean;
|
|
27
27
|
exceededBudget: boolean;
|
|
28
28
|
parentCount: number;
|
|
29
|
+
connected?: Array<{
|
|
30
|
+
recordId: string;
|
|
31
|
+
text: string;
|
|
32
|
+
depth: number;
|
|
33
|
+
edgeType: string;
|
|
34
|
+
edgeWeight: number;
|
|
35
|
+
}>;
|
|
29
36
|
error?: string;
|
|
30
37
|
};
|
|
31
38
|
type MemoryGrepDetails = {
|
|
@@ -213,4 +220,38 @@ export declare function createListUserCardsTool(getClient: ClientGetter, logger?
|
|
|
213
220
|
};
|
|
214
221
|
execute: (_toolCallId: string, _rawParams: unknown) => Promise<ToolResult<ListUserCardsDetails>>;
|
|
215
222
|
};
|
|
223
|
+
export declare function createSetPersonaTool(getClient: ClientGetter, logger?: LoggerLike): {
|
|
224
|
+
name: string;
|
|
225
|
+
label: string;
|
|
226
|
+
description: string;
|
|
227
|
+
parameters: {
|
|
228
|
+
readonly type: "object";
|
|
229
|
+
readonly additionalProperties: false;
|
|
230
|
+
readonly properties: {
|
|
231
|
+
readonly persona: {
|
|
232
|
+
readonly type: "string";
|
|
233
|
+
readonly description: "Prose description of how you should behave.";
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
readonly required: readonly ["persona"];
|
|
237
|
+
};
|
|
238
|
+
execute: (_toolCallId: string, rawParams: unknown) => Promise<ToolResult<{
|
|
239
|
+
ok: boolean;
|
|
240
|
+
error?: string;
|
|
241
|
+
}>>;
|
|
242
|
+
};
|
|
243
|
+
export declare function createGetPersonaTool(getClient: ClientGetter, logger?: LoggerLike): {
|
|
244
|
+
name: string;
|
|
245
|
+
label: string;
|
|
246
|
+
description: string;
|
|
247
|
+
parameters: {
|
|
248
|
+
readonly type: "object";
|
|
249
|
+
readonly additionalProperties: false;
|
|
250
|
+
readonly properties: {};
|
|
251
|
+
};
|
|
252
|
+
execute: () => Promise<ToolResult<{
|
|
253
|
+
persona?: string | null;
|
|
254
|
+
error?: string;
|
|
255
|
+
}>>;
|
|
256
|
+
};
|
|
216
257
|
export {};
|
|
@@ -199,8 +199,6 @@ export function createMemoryExpandTool(getClient, getSessionKey, logger = consol
|
|
|
199
199
|
"Graph mode (record_id): walk causal edges (why_ids/how_ids/hop_targets) " +
|
|
200
200
|
"from a record ID. Use exact IDs from memory_search or memory_get results — " +
|
|
201
201
|
"any ingested turn, memory, or summary has graph edges. " +
|
|
202
|
-
"After get_user_card for context, search for related people/events then " +
|
|
203
|
-
"expand the most relevant hit. " +
|
|
204
202
|
"For large expansions, spawns a sub-agent. " +
|
|
205
203
|
"Use memory_describe first to check if expansion is warranted.",
|
|
206
204
|
parameters: MEMORY_EXPAND_SCHEMA,
|
|
@@ -218,16 +216,22 @@ export function createMemoryExpandTool(getClient, getSessionKey, logger = consol
|
|
|
218
216
|
const client = await getClient();
|
|
219
217
|
const resp = await client.expandSummary({ recordId, maxDepth });
|
|
220
218
|
let text = resp.text ?? "";
|
|
221
|
-
const connected = resp.connected
|
|
222
|
-
|
|
223
|
-
text
|
|
219
|
+
const connected = (resp.connected ?? []).map((c) => ({
|
|
220
|
+
recordId: c.recordId,
|
|
221
|
+
text: c.text ?? "",
|
|
222
|
+
depth: c.depth,
|
|
223
|
+
edgeType: c.edgeType || "unknown",
|
|
224
|
+
edgeWeight: c.edgeWeight ?? 0,
|
|
225
|
+
}));
|
|
226
|
+
if (connected.length > 0) {
|
|
227
|
+
text = connected.map((c) => `[depth=${c.depth} edge=${c.edgeType} weight=${c.edgeWeight}] ${c.recordId}: ${c.text}`).join("\n\n");
|
|
224
228
|
}
|
|
225
229
|
if (!text && resp.whyIds?.length) {
|
|
226
230
|
text = `why_ids: ${resp.whyIds.join(", ")}\nhow_ids: ${resp.howIds?.join(", ") ?? "none"}\nhop_targets: ${resp.hopTargets?.join(", ") ?? "none"}`;
|
|
227
231
|
}
|
|
228
232
|
return {
|
|
229
233
|
content: [{ type: "text", text: text || "(no graph edges found)" }],
|
|
230
|
-
details: { summaryId: recordId, depth: maxDepth, text: text || "", truncated: false, exceededBudget: false, parentCount: connected
|
|
234
|
+
details: { summaryId: recordId, depth: maxDepth, text: text || "", truncated: false, exceededBudget: false, parentCount: connected.length, connected },
|
|
231
235
|
};
|
|
232
236
|
}
|
|
233
237
|
catch (error) {
|
|
@@ -601,3 +605,59 @@ export function createListUserCardsTool(getClient, logger = console) {
|
|
|
601
605
|
},
|
|
602
606
|
};
|
|
603
607
|
}
|
|
608
|
+
// ── Persona tools — identity of the bot itself ──
|
|
609
|
+
export function createSetPersonaTool(getClient, logger = console) {
|
|
610
|
+
return {
|
|
611
|
+
name: "set_persona",
|
|
612
|
+
label: "Set Persona",
|
|
613
|
+
description: "Define who YOU are — your personality, tone, boundaries, and behavior. " +
|
|
614
|
+
"Write in prose like you're describing yourself. This is injected as " +
|
|
615
|
+
"<bot_persona> at the start of every session. Update it when your persona " +
|
|
616
|
+
"changes. The LLM will embody this persona in all interactions.",
|
|
617
|
+
parameters: {
|
|
618
|
+
type: "object",
|
|
619
|
+
additionalProperties: false,
|
|
620
|
+
properties: {
|
|
621
|
+
persona: { type: "string", description: "Prose description of how you should behave." },
|
|
622
|
+
},
|
|
623
|
+
required: ["persona"],
|
|
624
|
+
},
|
|
625
|
+
execute: async (_toolCallId, rawParams) => {
|
|
626
|
+
const params = rawParams;
|
|
627
|
+
const persona = typeof params?.persona === "string" ? params.persona.trim() : "";
|
|
628
|
+
if (!persona)
|
|
629
|
+
return jsonResult({ ok: false, error: "set_persona requires a persona string" });
|
|
630
|
+
try {
|
|
631
|
+
const client = await getClient();
|
|
632
|
+
const resp = await client.upsertUserCard({
|
|
633
|
+
userId: "__bot_persona__",
|
|
634
|
+
cardJson: JSON.stringify({ card: persona, updatedAt: Date.now() }),
|
|
635
|
+
});
|
|
636
|
+
return jsonResult({ ok: resp.ok });
|
|
637
|
+
}
|
|
638
|
+
catch (error) {
|
|
639
|
+
logger.warn?.(`set_persona failed: ${formatError(error)}`);
|
|
640
|
+
return jsonResult({ ok: false, error: formatError(error) });
|
|
641
|
+
}
|
|
642
|
+
},
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
export function createGetPersonaTool(getClient, logger = console) {
|
|
646
|
+
return {
|
|
647
|
+
name: "get_persona",
|
|
648
|
+
label: "Get Persona",
|
|
649
|
+
description: "Read your current persona. Returns the full prose description of how you should behave.",
|
|
650
|
+
parameters: { type: "object", additionalProperties: false, properties: {} },
|
|
651
|
+
execute: async () => {
|
|
652
|
+
try {
|
|
653
|
+
const client = await getClient();
|
|
654
|
+
const resp = await client.getUserCard({ userId: "__bot_persona__" });
|
|
655
|
+
return jsonResult({ persona: resp.cardJson || null });
|
|
656
|
+
}
|
|
657
|
+
catch (error) {
|
|
658
|
+
logger.warn?.(`get_persona failed: ${formatError(error)}`);
|
|
659
|
+
return jsonResult({ error: formatError(error) });
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
};
|
|
663
|
+
}
|
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.14-beta.1",
|
|
6
6
|
"kind": [
|
|
7
7
|
"memory",
|
|
8
8
|
"context-engine"
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
"set_rule",
|
|
23
23
|
"get_rule",
|
|
24
24
|
"list_rules",
|
|
25
|
-
"delete_rule"
|
|
25
|
+
"delete_rule",
|
|
26
|
+
"set_persona",
|
|
27
|
+
"get_persona"
|
|
26
28
|
]
|
|
27
29
|
},
|
|
28
30
|
"activation": {
|