@amemhq/core 2.1.0 → 2.1.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.
@@ -1871,7 +1871,12 @@ async function searchMemory(query, topK = 5, agentId = "main", opts) {
1871
1871
  keywords: note.keywords,
1872
1872
  links: note.links,
1873
1873
  timestamp: note.timestamp,
1874
- similarity: embSimMap.get(id) ?? bfsSimMap.get(id) ?? 0,
1874
+ // Neither map covers a note that got here on BM25 alone: it was never in
1875
+ // the dense results, and it was not expanded into. That is a real cosine
1876
+ // nobody had measured, not a zero — and reporting 0 made a lexical match
1877
+ // look like the least relevant row in the list. Both vectors are already
1878
+ // in hand, so measuring it is one dot product.
1879
+ similarity: embSimMap.get(id) ?? bfsSimMap.get(id) ?? cosineSimilarity(queryEmbedding, note.embedding),
1875
1880
  rrf: rrfMap.get(id) ?? 0,
1876
1881
  via,
1877
1882
  topics: note.topics ?? [],
@@ -2379,4 +2384,4 @@ export {
2379
2384
  migrateCollection,
2380
2385
  switchToMigrated
2381
2386
  };
2382
- //# sourceMappingURL=chunk-XEMQZNLD.js.map
2387
+ //# sourceMappingURL=chunk-3HJV3LLV.js.map