hippo-memory 1.19.0 → 1.20.0
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/cli.d.ts.map +1 -1
- package/dist/cli.js +71 -2
- package/dist/cli.js.map +1 -1
- package/dist/graph-view.d.ts +72 -0
- package/dist/graph-view.d.ts.map +1 -0
- package/dist/graph-view.js +310 -0
- package/dist/graph-view.js.map +1 -0
- package/dist/graph.d.ts +30 -4
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +104 -11
- package/dist/graph.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +19 -0
- package/dist/server.js.map +1 -1
- package/dist/src/cli.js +71 -2
- package/dist/src/cli.js.map +1 -1
- package/dist/src/graph-view.js +310 -0
- package/dist/src/graph-view.js.map +1 -0
- package/dist/src/graph.js +104 -11
- package/dist/src/graph.js.map +1 -1
- package/dist/src/server.js +19 -0
- package/dist/src/server.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/extensions/openclaw-plugin/openclaw.plugin.json +1 -1
- package/extensions/openclaw-plugin/package.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAwBH,OAAO,EASL,WAAW,EAEZ,MAAM,aAAa,CAAC;AAiGrB,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAwBH,OAAO,EASL,WAAW,EAEZ,MAAM,aAAa,CAAC;AAiGrB,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AA4ChC,kFAAkF;AAClF,wBAAgB,8BAA8B,IAAI,IAAI,CAErD;AA60ED;;;GAGG;AACH,oHAAoH;AACpH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAkD/D;AAgsFD,oHAAoH;AACpH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,KAAK,CAAC;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC,EACtF,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,MAAkB,GAC1B,IAAI,CA6BN"}
|
package/dist/cli.js
CHANGED
|
@@ -66,6 +66,7 @@ import * as skillsModule from './skills.js';
|
|
|
66
66
|
import * as briefsModule from './project-briefs.js';
|
|
67
67
|
import * as customerNotesModule from './customer-notes.js';
|
|
68
68
|
import { extractGraph } from './graph-extract.js';
|
|
69
|
+
import { buildGraphModel, renderGraphHtml, renderGraphCanvas, DEFAULT_VIEW_LIMIT } from './graph-view.js';
|
|
69
70
|
import { createHash } from 'node:crypto';
|
|
70
71
|
import { detectAnchoring, hashQueryText, buildSessionKey, getOrCreateRing, appendRecall, snapshotRing, } from './recall-history.js';
|
|
71
72
|
import { detectAvailabilityBias } from './availability.js';
|
|
@@ -4522,7 +4523,7 @@ function noteUsage() {
|
|
|
4522
4523
|
console.error(' hippo note supersede <id> --text "<note>" [--change "<summary>"]');
|
|
4523
4524
|
console.error(' hippo note close <id>');
|
|
4524
4525
|
}
|
|
4525
|
-
function cmdGraph(hippoRoot, args,
|
|
4526
|
+
function cmdGraph(hippoRoot, args, flags) {
|
|
4526
4527
|
requireInit(hippoRoot);
|
|
4527
4528
|
const tenantId = resolveTenantId({});
|
|
4528
4529
|
const subcommand = args[0] ?? '';
|
|
@@ -4538,7 +4539,75 @@ function cmdGraph(hippoRoot, args, _flags) {
|
|
|
4538
4539
|
}
|
|
4539
4540
|
return;
|
|
4540
4541
|
}
|
|
4541
|
-
|
|
4542
|
+
const entity = typeof flags['entity'] === 'string' ? flags['entity'] : undefined;
|
|
4543
|
+
if (subcommand === 'show') {
|
|
4544
|
+
const model = buildGraphModel(hippoRoot, tenantId, { entity, limit: DEFAULT_VIEW_LIMIT });
|
|
4545
|
+
if (flags['json']) {
|
|
4546
|
+
console.log(JSON.stringify(model, null, 2));
|
|
4547
|
+
return;
|
|
4548
|
+
}
|
|
4549
|
+
if (model.nodes.length === 0) {
|
|
4550
|
+
console.log(entity ? `No entity named "${entity}".` : 'Graph is empty. Run `hippo graph extract` first.');
|
|
4551
|
+
return;
|
|
4552
|
+
}
|
|
4553
|
+
console.log(`Graph: ${model.nodes.length} entities, ${model.edges.length} relations${model.truncated ? ' (truncated)' : ''}`);
|
|
4554
|
+
const byType = new Map();
|
|
4555
|
+
for (const n of model.nodes) {
|
|
4556
|
+
const arr = byType.get(n.type) ?? [];
|
|
4557
|
+
arr.push({ id: n.id, name: n.name });
|
|
4558
|
+
byType.set(n.type, arr);
|
|
4559
|
+
}
|
|
4560
|
+
for (const [type, ns] of byType) {
|
|
4561
|
+
console.log(`\n${type} (${ns.length}):`);
|
|
4562
|
+
for (const n of ns)
|
|
4563
|
+
console.log(` [${n.id}] ${n.name}`);
|
|
4564
|
+
}
|
|
4565
|
+
if (model.edges.length > 0) {
|
|
4566
|
+
const nameById = new Map(model.nodes.map((n) => [n.id, n.name]));
|
|
4567
|
+
console.log('\nrelations:');
|
|
4568
|
+
for (const e of model.edges) {
|
|
4569
|
+
console.log(` ${nameById.get(e.from)} --${e.relType}--> ${nameById.get(e.to)}`);
|
|
4570
|
+
}
|
|
4571
|
+
}
|
|
4572
|
+
return;
|
|
4573
|
+
}
|
|
4574
|
+
if (subcommand === 'view') {
|
|
4575
|
+
const format = typeof flags['format'] === 'string' ? flags['format'] : 'html';
|
|
4576
|
+
if (format !== 'html' && format !== 'canvas') {
|
|
4577
|
+
console.error("graph view: --format must be 'html' or 'canvas'");
|
|
4578
|
+
process.exit(1);
|
|
4579
|
+
}
|
|
4580
|
+
const model = buildGraphModel(hippoRoot, tenantId, { entity, limit: DEFAULT_VIEW_LIMIT });
|
|
4581
|
+
const content = format === 'canvas' ? renderGraphCanvas(model) : renderGraphHtml(model);
|
|
4582
|
+
const defaultOut = format === 'canvas' ? 'hippo-graph.canvas' : 'hippo-graph.html';
|
|
4583
|
+
const out = typeof flags['out'] === 'string' ? flags['out'] : defaultOut;
|
|
4584
|
+
fs.writeFileSync(out, content, 'utf8');
|
|
4585
|
+
console.log(`Wrote ${model.nodes.length} entities + ${model.edges.length} relations to ${out}${model.truncated ? ' (truncated)' : ''}`);
|
|
4586
|
+
if (flags['open'] && format === 'html') {
|
|
4587
|
+
// Best-effort browser launch; never fail the command if it doesn't work.
|
|
4588
|
+
try {
|
|
4589
|
+
const [cmd, cmdArgs] = process.platform === 'win32'
|
|
4590
|
+
? ['cmd', ['/c', 'start', '', out]]
|
|
4591
|
+
: process.platform === 'darwin'
|
|
4592
|
+
? ['open', [out]]
|
|
4593
|
+
: ['xdg-open', [out]];
|
|
4594
|
+
const child = spawn(cmd, cmdArgs, { detached: true, stdio: 'ignore' });
|
|
4595
|
+
// A missing launcher (e.g. xdg-open absent) emits 'error' asynchronously;
|
|
4596
|
+
// an unhandled 'error' event would throw, so swallow it — the file is
|
|
4597
|
+
// already written and its path printed above.
|
|
4598
|
+
child.on('error', () => { });
|
|
4599
|
+
child.unref();
|
|
4600
|
+
}
|
|
4601
|
+
catch {
|
|
4602
|
+
/* ignore — the file is written; the path is printed above */
|
|
4603
|
+
}
|
|
4604
|
+
}
|
|
4605
|
+
return;
|
|
4606
|
+
}
|
|
4607
|
+
console.error('Usage:\n' +
|
|
4608
|
+
' hippo graph extract Rebuild the entity/relation graph from consolidated objects\n' +
|
|
4609
|
+
' hippo graph show [--entity NAME] [--json] Inspect entities + their edges (text or JSON)\n' +
|
|
4610
|
+
' hippo graph view [--out FILE] [--open] [--format html|canvas] [--entity NAME] Generate an interactive node-link diagram');
|
|
4542
4611
|
process.exit(1);
|
|
4543
4612
|
}
|
|
4544
4613
|
function cmdCustomerNote(hippoRoot, args, flags) {
|