@xdarkicex/openclaw-memory-libravdb 1.9.10-beta.24 → 1.9.10-beta.25

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 CHANGED
@@ -23495,7 +23495,7 @@ Any.fields = proto3.util.newFieldList(() => [
23495
23495
  }
23496
23496
  ]);
23497
23497
 
23498
- // node_modules/.pnpm/@xdarkicex+libravdb-contracts@2.0.25/node_modules/@xdarkicex/libravdb-contracts/gen/js/libravdb/ipc/v1/rpc_pb.js
23498
+ // node_modules/.pnpm/@xdarkicex+libravdb-contracts@2.0.27/node_modules/@xdarkicex/libravdb-contracts/gen/js/libravdb/ipc/v1/rpc_pb.js
23499
23499
  var IngestMode;
23500
23500
  (function(IngestMode2) {
23501
23501
  IngestMode2[IngestMode2["REPLACE"] = 0] = "REPLACE";
@@ -26473,6 +26473,12 @@ var ExpandSummaryRequest = class _ExpandSummaryRequest extends Message {
26473
26473
  * @generated from field: int32 max_depth = 3;
26474
26474
  */
26475
26475
  maxDepth = 0;
26476
+ /**
26477
+ * Graph mode: walk causal edges from this record ID.
26478
+ *
26479
+ * @generated from field: string record_id = 4;
26480
+ */
26481
+ recordId = "";
26476
26482
  constructor(data) {
26477
26483
  super();
26478
26484
  proto3.util.initPartial(data, this);
@@ -26500,6 +26506,13 @@ var ExpandSummaryRequest = class _ExpandSummaryRequest extends Message {
26500
26506
  kind: "scalar",
26501
26507
  T: 5
26502
26508
  /* ScalarType.INT32 */
26509
+ },
26510
+ {
26511
+ no: 4,
26512
+ name: "record_id",
26513
+ kind: "scalar",
26514
+ T: 9
26515
+ /* ScalarType.STRING */
26503
26516
  }
26504
26517
  ]);
26505
26518
  static fromBinary(bytes, options) {
@@ -29618,6 +29631,24 @@ var ExpandSummaryResponse = class _ExpandSummaryResponse extends Message {
29618
29631
  * @generated from field: bytes metadata_json = 3;
29619
29632
  */
29620
29633
  metadataJson = new Uint8Array(0);
29634
+ /**
29635
+ * Graph mode fields (populated when record_id is set):
29636
+ *
29637
+ * @generated from field: repeated string why_ids = 4;
29638
+ */
29639
+ whyIds = [];
29640
+ /**
29641
+ * @generated from field: repeated string how_ids = 5;
29642
+ */
29643
+ howIds = [];
29644
+ /**
29645
+ * @generated from field: repeated string hop_targets = 6;
29646
+ */
29647
+ hopTargets = [];
29648
+ /**
29649
+ * @generated from field: repeated libravdb.ipc.v1.ConnectedRecord connected = 7;
29650
+ */
29651
+ connected = [];
29621
29652
  constructor(data) {
29622
29653
  super();
29623
29654
  proto3.util.initPartial(data, this);
@@ -29645,7 +29676,11 @@ var ExpandSummaryResponse = class _ExpandSummaryResponse extends Message {
29645
29676
  kind: "scalar",
29646
29677
  T: 12
29647
29678
  /* ScalarType.BYTES */
29648
- }
29679
+ },
29680
+ { no: 4, name: "why_ids", kind: "scalar", T: 9, repeated: true },
29681
+ { no: 5, name: "how_ids", kind: "scalar", T: 9, repeated: true },
29682
+ { no: 6, name: "hop_targets", kind: "scalar", T: 9, repeated: true },
29683
+ { no: 7, name: "connected", kind: "message", T: ConnectedRecord, repeated: true }
29649
29684
  ]);
29650
29685
  static fromBinary(bytes, options) {
29651
29686
  return new _ExpandSummaryResponse().fromBinary(bytes, options);
@@ -29660,6 +29695,85 @@ var ExpandSummaryResponse = class _ExpandSummaryResponse extends Message {
29660
29695
  return proto3.util.equals(_ExpandSummaryResponse, a, b);
29661
29696
  }
29662
29697
  };
29698
+ var ConnectedRecord = class _ConnectedRecord extends Message {
29699
+ /**
29700
+ * @generated from field: string record_id = 1;
29701
+ */
29702
+ recordId = "";
29703
+ /**
29704
+ * @generated from field: string text = 2;
29705
+ */
29706
+ text = "";
29707
+ /**
29708
+ * @generated from field: int32 depth = 3;
29709
+ */
29710
+ depth = 0;
29711
+ /**
29712
+ * @generated from field: double edge_weight = 4;
29713
+ */
29714
+ edgeWeight = 0;
29715
+ /**
29716
+ * "why_ids", "how_ids", or "hop_targets"
29717
+ *
29718
+ * @generated from field: string edge_type = 5;
29719
+ */
29720
+ edgeType = "";
29721
+ constructor(data) {
29722
+ super();
29723
+ proto3.util.initPartial(data, this);
29724
+ }
29725
+ static runtime = proto3;
29726
+ static typeName = "libravdb.ipc.v1.ConnectedRecord";
29727
+ static fields = proto3.util.newFieldList(() => [
29728
+ {
29729
+ no: 1,
29730
+ name: "record_id",
29731
+ kind: "scalar",
29732
+ T: 9
29733
+ /* ScalarType.STRING */
29734
+ },
29735
+ {
29736
+ no: 2,
29737
+ name: "text",
29738
+ kind: "scalar",
29739
+ T: 9
29740
+ /* ScalarType.STRING */
29741
+ },
29742
+ {
29743
+ no: 3,
29744
+ name: "depth",
29745
+ kind: "scalar",
29746
+ T: 5
29747
+ /* ScalarType.INT32 */
29748
+ },
29749
+ {
29750
+ no: 4,
29751
+ name: "edge_weight",
29752
+ kind: "scalar",
29753
+ T: 1
29754
+ /* ScalarType.DOUBLE */
29755
+ },
29756
+ {
29757
+ no: 5,
29758
+ name: "edge_type",
29759
+ kind: "scalar",
29760
+ T: 9
29761
+ /* ScalarType.STRING */
29762
+ }
29763
+ ]);
29764
+ static fromBinary(bytes, options) {
29765
+ return new _ConnectedRecord().fromBinary(bytes, options);
29766
+ }
29767
+ static fromJson(jsonValue, options) {
29768
+ return new _ConnectedRecord().fromJson(jsonValue, options);
29769
+ }
29770
+ static fromJsonString(jsonString, options) {
29771
+ return new _ConnectedRecord().fromJsonString(jsonString, options);
29772
+ }
29773
+ static equals(a, b) {
29774
+ return proto3.util.equals(_ConnectedRecord, a, b);
29775
+ }
29776
+ };
29663
29777
  var QueryRawSessionResponse = class _QueryRawSessionResponse extends Message {
29664
29778
  /**
29665
29779
  * @generated from field: repeated libravdb.ipc.v1.KernelMessage messages = 1;
@@ -30931,6 +31045,17 @@ function buildToolGuidance(availableTools) {
30931
31045
  ""
30932
31046
  );
30933
31047
  }
31048
+ if (hasExpand) {
31049
+ lines.push(
31050
+ "### Causal Graph Traversal",
31051
+ "When the user asks about causes, patterns, or relationships between people/events:",
31052
+ "1. Start with `get_user_card` to anchor on identity",
31053
+ '2. Call `memory_expand` with `record_id="__user_card__"` to walk causal edges',
31054
+ "3. Follow interesting edges \u2014 use `memory_get` for full detail on connected records",
31055
+ "4. Use `memory_search` only as fallback for facts the graph doesn't cover",
31056
+ ""
31057
+ );
31058
+ }
30934
31059
  lines.push("LibraVDB memory is vector-backed and retrieved through tools, not files.", "");
30935
31060
  return lines;
30936
31061
  }
@@ -30973,11 +31098,15 @@ var MEMORY_EXPAND_SCHEMA = {
30973
31098
  items: { type: "string" },
30974
31099
  description: "Summary IDs (sum_xxx format) to expand. Use results from memory_search or memory_describe."
30975
31100
  },
31101
+ record_id: {
31102
+ type: "string",
31103
+ description: "Record ID for causal graph traversal. Use '__user_card__' for identity-anchored expansion."
31104
+ },
30976
31105
  maxDepth: {
30977
31106
  type: "number",
30978
31107
  minimum: 0,
30979
31108
  maximum: 5,
30980
- description: "Max tree traversal depth per summary (default: 1). 0 returns only the cue/metadata."
31109
+ description: "Max tree/graph traversal depth (default: 1). 0 returns only edge metadata."
30981
31110
  },
30982
31111
  maxTokens: {
30983
31112
  type: "number",
@@ -30987,10 +31116,9 @@ var MEMORY_EXPAND_SCHEMA = {
30987
31116
  },
30988
31117
  sessionId: {
30989
31118
  type: "string",
30990
- description: "Session ID the summary belongs to. If omitted, uses the current session."
31119
+ description: "Session ID. If omitted, uses the current session."
30991
31120
  }
30992
- },
30993
- required: ["summaryIds"]
31121
+ }
30994
31122
  };
30995
31123
  var MEMORY_GREP_SCHEMA = {
30996
31124
  type: "object",
@@ -31112,16 +31240,42 @@ function createMemoryExpandTool(getClient, getSessionKey, logger = console, getS
31112
31240
  return {
31113
31241
  name: "memory_expand",
31114
31242
  label: "Memory Expand",
31115
- description: "Expand compacted summaries to recover full detail. Walks the summary tree up to maxDepth levels. For large expansions (>2500 tokens), spawns a sub-agent to protect context. Use memory_describe first to check if expansion is warranted \u2014 many questions can be answered from the eviction cue alone.",
31243
+ description: "Expand compacted summaries OR walk causal graph edges from a record. Summary mode: walk the summary tree up to maxDepth levels. Graph mode (use record_id): walk causal edges (why_ids/how_ids/hop_targets) from a record \u2014 use '__user_card__' for identity-anchored traversal after get_user_card. For large expansions (>2500 tokens), spawns a sub-agent. Use memory_describe first to check if expansion is warranted.",
31116
31244
  parameters: MEMORY_EXPAND_SCHEMA,
31117
31245
  execute: async (_toolCallId, rawParams) => {
31118
31246
  const params = asParams(rawParams);
31247
+ const recordId = readStr(params, "record_id");
31119
31248
  const rawIds = params.summaryIds;
31120
31249
  const summaryIds = Array.isArray(rawIds) ? rawIds.filter((v) => typeof v === "string" && v.trim().length > 0) : [];
31121
- if (summaryIds.length === 0) throw new Error("memory_expand requires at least one summaryId");
31122
31250
  const maxDepth = readNum(params, "maxDepth", { integer: true, min: 0 }) ?? 1;
31123
31251
  let maxTokens = readNum(params, "maxTokens", { integer: true }) ?? MAX_EXPAND_TOKENS;
31124
31252
  const sessionId = readStr(params, "sessionId") ?? getSessionId() ?? "";
31253
+ if (recordId) {
31254
+ try {
31255
+ const client = await getClient();
31256
+ const resp = await client.expandSummary({ recordId, maxDepth });
31257
+ let text = resp.text ?? "";
31258
+ const connected = resp.connected;
31259
+ if (connected && connected.length > 0) {
31260
+ text = connected.map(
31261
+ (c) => `[depth=${c.depth}] ${c.recordId}: ${c.text || ""}`
31262
+ ).join("\n\n");
31263
+ }
31264
+ if (!text && resp.whyIds?.length) {
31265
+ text = `why_ids: ${resp.whyIds.join(", ")}
31266
+ how_ids: ${resp.howIds?.join(", ") ?? "none"}
31267
+ hop_targets: ${resp.hopTargets?.join(", ") ?? "none"}`;
31268
+ }
31269
+ return {
31270
+ content: [{ type: "text", text: text || "(no graph edges found)" }],
31271
+ details: { summaryId: recordId, depth: maxDepth, text: text || "", truncated: false, exceededBudget: false, parentCount: connected?.length ?? 0 }
31272
+ };
31273
+ } catch (error2) {
31274
+ logger.warn?.(`memory_expand graph mode failed: ${formatError(error2)}`);
31275
+ return { content: [{ type: "text", text: `Graph expansion failed: ${formatError(error2)}` }], details: { summaryId: recordId, depth: maxDepth, text: "", truncated: false, exceededBudget: false, parentCount: 0 } };
31276
+ }
31277
+ }
31278
+ if (summaryIds.length === 0) throw new Error("memory_expand requires at least one summaryId or record_id");
31125
31279
  const sessionKey = getSessionKey();
31126
31280
  if (sessionKey) {
31127
31281
  const grantedTokens = consumeSubagentBudget(sessionKey, maxTokens);
@@ -34150,7 +34304,7 @@ function createGrpcTransport(options) {
34150
34304
  return createTransport(validateNodeTransportOptions(options));
34151
34305
  }
34152
34306
 
34153
- // node_modules/.pnpm/@xdarkicex+libravdb-contracts@2.0.25/node_modules/@xdarkicex/libravdb-contracts/gen/js/libravdb/ipc/v1/rpc_connect.js
34307
+ // node_modules/.pnpm/@xdarkicex+libravdb-contracts@2.0.27/node_modules/@xdarkicex/libravdb-contracts/gen/js/libravdb/ipc/v1/rpc_connect.js
34154
34308
  var LibravDB = {
34155
34309
  typeName: "libravdb.ipc.v1.LibravDB",
34156
34310
  methods: {
@@ -50,6 +50,10 @@ function buildToolGuidance(availableTools) {
50
50
  }
51
51
  lines.push("", "**Do not guess specifics from a summary cue — expand if in doubt.**", "");
52
52
  }
53
+ // ── Causal graph traversal (when expand supports record_id) ──
54
+ if (hasExpand) {
55
+ lines.push("### Causal Graph Traversal", "When the user asks about causes, patterns, or relationships between people/events:", "1. Start with `get_user_card` to anchor on identity", "2. Call `memory_expand` with `record_id=\"__user_card__\"` to walk causal edges", "3. Follow interesting edges — use `memory_get` for full detail on connected records", "4. Use `memory_search` only as fallback for facts the graph doesn't cover", "");
56
+ }
53
57
  lines.push("LibraVDB memory is vector-backed and retrieved through tools, not files.", "");
54
58
  return lines;
55
59
  }
@@ -82,11 +82,15 @@ export declare function createMemoryExpandTool(getClient: ClientGetter, getSessi
82
82
  };
83
83
  readonly description: "Summary IDs (sum_xxx format) to expand. Use results from memory_search or memory_describe.";
84
84
  };
85
+ readonly record_id: {
86
+ readonly type: "string";
87
+ readonly description: "Record ID for causal graph traversal. Use '__user_card__' for identity-anchored expansion.";
88
+ };
85
89
  readonly maxDepth: {
86
90
  readonly type: "number";
87
91
  readonly minimum: 0;
88
92
  readonly maximum: 5;
89
- readonly description: "Max tree traversal depth per summary (default: 1). 0 returns only the cue/metadata.";
93
+ readonly description: "Max tree/graph traversal depth (default: 1). 0 returns only edge metadata.";
90
94
  };
91
95
  readonly maxTokens: {
92
96
  readonly type: "number";
@@ -96,10 +100,9 @@ export declare function createMemoryExpandTool(getClient: ClientGetter, getSessi
96
100
  };
97
101
  readonly sessionId: {
98
102
  readonly type: "string";
99
- readonly description: "Session ID the summary belongs to. If omitted, uses the current session.";
103
+ readonly description: "Session ID. If omitted, uses the current session.";
100
104
  };
101
105
  };
102
- readonly required: readonly ["summaryIds"];
103
106
  };
104
107
  execute: (_toolCallId: string, rawParams: unknown) => Promise<ToolResult<MemoryExpandDetails>>;
105
108
  };
@@ -31,11 +31,15 @@ const MEMORY_EXPAND_SCHEMA = {
31
31
  items: { type: "string" },
32
32
  description: "Summary IDs (sum_xxx format) to expand. Use results from memory_search or memory_describe.",
33
33
  },
34
+ record_id: {
35
+ type: "string",
36
+ description: "Record ID for causal graph traversal. Use '__user_card__' for identity-anchored expansion.",
37
+ },
34
38
  maxDepth: {
35
39
  type: "number",
36
40
  minimum: 0,
37
41
  maximum: 5,
38
- description: "Max tree traversal depth per summary (default: 1). 0 returns only the cue/metadata.",
42
+ description: "Max tree/graph traversal depth (default: 1). 0 returns only edge metadata.",
39
43
  },
40
44
  maxTokens: {
41
45
  type: "number",
@@ -45,10 +49,9 @@ const MEMORY_EXPAND_SCHEMA = {
45
49
  },
46
50
  sessionId: {
47
51
  type: "string",
48
- description: "Session ID the summary belongs to. If omitted, uses the current session.",
52
+ description: "Session ID. If omitted, uses the current session.",
49
53
  },
50
54
  },
51
- required: ["summaryIds"],
52
55
  };
53
56
  const MEMORY_GREP_SCHEMA = {
54
57
  type: "object",
@@ -191,20 +194,46 @@ export function createMemoryExpandTool(getClient, getSessionKey, logger = consol
191
194
  return {
192
195
  name: "memory_expand",
193
196
  label: "Memory Expand",
194
- description: "Expand compacted summaries to recover full detail. Walks the summary tree " +
195
- "up to maxDepth levels. For large expansions (>2500 tokens), spawns a " +
196
- "sub-agent to protect context. Use memory_describe first to check if expansion " +
197
- "is warrantedmany questions can be answered from the eviction cue alone.",
197
+ description: "Expand compacted summaries OR walk causal graph edges from a record. " +
198
+ "Summary mode: walk the summary tree up to maxDepth levels. " +
199
+ "Graph mode (use record_id): walk causal edges (why_ids/how_ids/hop_targets) " +
200
+ "from a record use '__user_card__' for identity-anchored traversal after " +
201
+ "get_user_card. For large expansions (>2500 tokens), spawns a sub-agent. " +
202
+ "Use memory_describe first to check if expansion is warranted.",
198
203
  parameters: MEMORY_EXPAND_SCHEMA,
199
204
  execute: async (_toolCallId, rawParams) => {
200
205
  const params = asParams(rawParams);
206
+ const recordId = readStr(params, "record_id");
201
207
  const rawIds = params.summaryIds;
202
208
  const summaryIds = Array.isArray(rawIds) ? rawIds.filter((v) => typeof v === "string" && v.trim().length > 0) : [];
203
- if (summaryIds.length === 0)
204
- throw new Error("memory_expand requires at least one summaryId");
205
209
  const maxDepth = readNum(params, "maxDepth", { integer: true, min: 0 }) ?? 1;
206
210
  let maxTokens = readNum(params, "maxTokens", { integer: true }) ?? MAX_EXPAND_TOKENS;
207
211
  const sessionId = readStr(params, "sessionId") ?? getSessionId() ?? "";
212
+ // Graph mode: walk causal edges from a record ID.
213
+ if (recordId) {
214
+ try {
215
+ const client = await getClient();
216
+ const resp = await client.expandSummary({ recordId, maxDepth });
217
+ let text = resp.text ?? "";
218
+ const connected = resp.connected;
219
+ if (connected && connected.length > 0) {
220
+ text = connected.map((c) => `[depth=${c.depth}] ${c.recordId}: ${c.text || ""}`).join("\n\n");
221
+ }
222
+ if (!text && resp.whyIds?.length) {
223
+ text = `why_ids: ${resp.whyIds.join(", ")}\nhow_ids: ${resp.howIds?.join(", ") ?? "none"}\nhop_targets: ${resp.hopTargets?.join(", ") ?? "none"}`;
224
+ }
225
+ return {
226
+ content: [{ type: "text", text: text || "(no graph edges found)" }],
227
+ details: { summaryId: recordId, depth: maxDepth, text: text || "", truncated: false, exceededBudget: false, parentCount: connected?.length ?? 0 },
228
+ };
229
+ }
230
+ catch (error) {
231
+ logger.warn?.(`memory_expand graph mode failed: ${formatError(error)}`);
232
+ return { content: [{ type: "text", text: `Graph expansion failed: ${formatError(error)}` }], details: { summaryId: recordId, depth: maxDepth, text: "", truncated: false, exceededBudget: false, parentCount: 0 } };
233
+ }
234
+ }
235
+ if (summaryIds.length === 0)
236
+ throw new Error("memory_expand requires at least one summaryId or record_id");
208
237
  // Subagent budget gate: if this is a subagent, check remaining expansion budget.
209
238
  const sessionKey = getSessionKey();
210
239
  if (sessionKey) {
@@ -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.9.10-beta.24",
5
+ "version": "1.9.10-beta.25",
6
6
  "kind": [
7
7
  "memory",
8
8
  "context-engine"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xdarkicex/openclaw-memory-libravdb",
3
- "version": "1.9.10-beta.24",
3
+ "version": "1.9.10-beta.25",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -80,6 +80,6 @@
80
80
  "dependencies": {
81
81
  "@connectrpc/connect": "^1.7.0",
82
82
  "@connectrpc/connect-node": "^1.7.0",
83
- "@xdarkicex/libravdb-contracts": "^2.0.25"
83
+ "@xdarkicex/libravdb-contracts": "^2.0.27"
84
84
  }
85
85
  }