hippo-memory 1.20.0 → 1.21.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 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;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"}
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;AAi4ED;;;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
@@ -101,6 +101,7 @@ import { refineStore } from './refine-llm.js';
101
101
  import { wmPush, wmRead, wmClear, wmFlush } from './working-memory.js';
102
102
  import { multihopSearch } from './multihop.js';
103
103
  import { graphExpandRecall, MAX_HOPS, DEFAULT_MAX_NEIGHBORS } from './graph-recall.js';
104
+ import { DEFAULT_GRAPH_STREAM_WEIGHT } from './graph-stream.js';
104
105
  import { getReranker } from './rerankers/index.js';
105
106
  import { computeSalience } from './salience.js';
106
107
  import { computeAmbientState, renderAmbientSummary } from './ambient.js';
@@ -780,8 +781,59 @@ async function cmdRecall(hippoRoot, query, flags) {
780
781
  const recallExplicitScope = flags['scope'] !== undefined ? String(flags['scope']).trim() : null;
781
782
  const recallActiveScope = recallExplicitScope || detectScope();
782
783
  const useMultihop = flags['multihop'] === true || config.multihop.enabled;
784
+ // L1 — graph-retrieval stream. `--graph-stream` forces rrf fusion + the graph stream
785
+ // (see src/graph-stream.ts). NOTE: it implies `scoring:'rrf'` (production default is
786
+ // 'blend'), so the flag bundles two behaviours by design. CLI surface is local-store
787
+ // only for now; the library API supports a globalRoot for callers who need it.
788
+ const useGraphStream = flags['graph-stream'] === true;
789
+ let graphStreamHops;
790
+ if (useGraphStream && flags['graph-hops'] !== undefined) {
791
+ if (typeof flags['graph-hops'] === 'boolean') {
792
+ console.error(`--graph-hops requires an integer value 1..${MAX_HOPS} (e.g. --graph-hops 2).`);
793
+ process.exit(1);
794
+ }
795
+ const h = Number(flags['graph-hops']);
796
+ if (!Number.isInteger(h) || h < 1 || h > MAX_HOPS) {
797
+ console.error(`Invalid --graph-hops: "${String(flags['graph-hops'])}". Must be an integer 1..${MAX_HOPS}.`);
798
+ process.exit(1);
799
+ }
800
+ graphStreamHops = h;
801
+ }
802
+ let graphStreamSeeds;
803
+ if (useGraphStream && flags['graph-seeds'] !== undefined) {
804
+ if (typeof flags['graph-seeds'] === 'boolean') {
805
+ console.error('--graph-seeds requires a positive integer value (e.g. --graph-seeds 10).');
806
+ process.exit(1);
807
+ }
808
+ const s = Number(flags['graph-seeds']);
809
+ if (!Number.isInteger(s) || s < 1) {
810
+ console.error(`Invalid --graph-seeds: "${String(flags['graph-seeds'])}". Must be a positive integer.`);
811
+ process.exit(1);
812
+ }
813
+ graphStreamSeeds = s;
814
+ }
783
815
  let results;
784
- if (useMultihop) {
816
+ if (useGraphStream) {
817
+ if (!isEmbeddingAvailable()) {
818
+ // The graph stream fuses inside the rrf path, which only runs with embeddings; without
819
+ // them hybridSearch falls back to BM25-only and the stream is inert. Say so plainly
820
+ // rather than silently no-op.
821
+ console.error('[note] --graph-stream needs embeddings (rrf fusion); none available, so the graph stream is inert. Run `hippo embed` first.');
822
+ }
823
+ if (hasGlobal) {
824
+ console.error('[note] --graph-stream searches the local store only; global graph fusion is a follow-up.');
825
+ }
826
+ // The stream anchors on the top-`seedCount` lexical hits and re-ranks the rank>seedCount
827
+ // tail; on a pool with <= seedCount candidates EVERY candidate is a seed and the stream
828
+ // is inert (it degrades to the 2-list fusion). Tune the anchor count with --graph-seeds.
829
+ results = await hybridSearch(query, localEntries, {
830
+ budget, hippoRoot, mmr: mmrEnabled, mmrLambda, minResults, scope: recallActiveScope,
831
+ includeSuperseded, asOf,
832
+ scoring: 'rrf',
833
+ graphStream: { weight: DEFAULT_GRAPH_STREAM_WEIGHT, tenantId, hops: graphStreamHops, seedCount: graphStreamSeeds },
834
+ });
835
+ }
836
+ else if (useMultihop) {
785
837
  const allEntries = [...localEntries, ...globalEntries];
786
838
  results = multihopSearch(query, allEntries, {
787
839
  budget,
@@ -6744,6 +6796,15 @@ Commands:
6744
6796
  graph holds supersedes edges (E3.1); cross-object edges
6745
6797
  light up the same traversal once extracted.
6746
6798
  --max-neighbors <n> Per-hop fanout cap for --hops (1..200, default 25).
6799
+ --graph-stream L1: fuse a graph-retrieval stream into RRF, re-ranking
6800
+ in-pool results by graph proximity to the strong lexical
6801
+ seeds. Implies rrf scoring (default is blend). Local store
6802
+ only. Distinct from --hops (which injects out-of-pool
6803
+ neighbours); this re-ranks within the candidate pool.
6804
+ --graph-hops <n> Hops for --graph-stream (1..3, default 2).
6805
+ --graph-seeds <n> Lexical anchors for --graph-stream (default 10). The stream
6806
+ re-ranks the rank>seeds tail; on a pool with <= n candidates
6807
+ every candidate is a seed and the stream is inert.
6747
6808
  --no-mmr Disable MMR diversity re-ranking
6748
6809
  --mmr-lambda <f> MMR balance 0..1 (default: 0.7, 1.0 = pure relevance)
6749
6810
  --evc-adaptive ACC-style: when top-K shows high inter-item overlap