@melandlabs/memory-store 0.2.6 → 0.3.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.
@@ -1,103 +1,5 @@
1
- import { d as UnifiedSearchDeps } from '../config-BYfTzG3h.js';
2
-
3
- /**
4
- * Pure helpers used by the unified memory search pipeline.
5
- *
6
- * Kept side-effect free so they can be reused by tests, MCP tools,
7
- * and the HTTP daemon without pulling in any of the heavier
8
- * storage/search implementations.
9
- */
10
- type UnifiedMemorySearchSource = "memory" | "insights" | "knowledge";
11
- interface UnifiedMemorySearchWarning {
12
- source: UnifiedMemorySearchSource;
13
- code: string;
14
- message: string;
15
- }
16
- interface UnifiedMemorySearchInput {
17
- userId: string;
18
- query: string;
19
- sources?: UnifiedMemorySearchSource[];
20
- limit?: number;
21
- threshold?: number;
22
- authToken?: string;
23
- includeArchivedInsights?: boolean;
24
- botIds?: string[];
25
- documentIds?: string[];
26
- /**
27
- * Optional ISO-8601 timestamp. When set, graph-aware retrieval and other
28
- * snapshot consumers drop nodes / edges whose `applicability.validFrom` /
29
- * `validUntil` window is closed at that instant. Backward-compatible:
30
- * omitted `asOf` keeps the legacy behaviour exactly.
31
- */
32
- asOf?: string;
33
- /**
34
- * How to merge per-source result lists. Defaults to `"similarity"` —
35
- * the legacy global sort by similarity, then type/id tie-break. The
36
- * alternate value `"rrf"` invokes reciprocal-rank fusion across the
37
- * lists fed via the (internal) `rankedLists` option.
38
- */
39
- mergeStrategy?: UnifiedMemoryMergeStrategy;
40
- }
41
- type UnifiedMemoryMergeStrategy = "similarity" | "rrf";
42
- /**
43
- * A single ranked list from one retrieval channel. Used by the RRF merge to
44
- * combine multiple signals (semantic + lexical + insights + knowledge) without
45
- * flattening them into a single similarity score first.
46
- */
47
- interface UnifiedMemoryRankedList {
48
- name: "memory-bm25" | "memory-semantic" | "insights" | "knowledge";
49
- hits: UnifiedMemorySearchResult[];
50
- }
51
- interface UnifiedMemorySearchResult {
52
- type: "memory" | "insight" | "knowledge";
53
- id: string;
54
- content: string;
55
- similarity: number;
56
- metadata: Record<string, unknown>;
57
- }
58
- interface UnifiedMemorySearchOutput {
59
- query: string;
60
- sources: UnifiedMemorySearchSource[];
61
- results: UnifiedMemorySearchResult[];
62
- count: number;
63
- warnings: UnifiedMemorySearchWarning[];
64
- }
65
- declare function normalizeUnifiedMemorySearchSources(sources: unknown): UnifiedMemorySearchSource[];
66
- declare function clampUnifiedMemorySearchLimit(limit: unknown): number;
67
- declare function clampUnifiedMemorySearchThreshold(threshold: unknown): number;
68
- declare function mergeUnifiedMemorySearchResults(results: UnifiedMemorySearchResult[], limit: number, options?: {
69
- strategy?: UnifiedMemoryMergeStrategy;
70
- rankedLists?: UnifiedMemoryRankedList[];
71
- }): UnifiedMemorySearchResult[];
72
- declare function normalizeUnifiedMemoryMergeStrategy(value: unknown): UnifiedMemoryMergeStrategy;
73
- /**
74
- * Reciprocal Rank Fusion across multiple ranked lists. Each list contributes
75
- * `1 / (k + rank + 1)` to a hit's accumulated score. Hits are de-duplicated by
76
- * `(type, id)` so the same message surfaced by both lexical and semantic
77
- * channels naturally outranks single-channel matches. Tie-break is
78
- * deterministic: descending RRF score, then `(type, id)` lexical.
79
- */
80
- declare function mergeUnifiedMemorySearchResultsRrf(lists: UnifiedMemoryRankedList[], limit: number, k?: number): UnifiedMemorySearchResult[];
81
- declare function toKnowledgeResult(result: {
82
- chunkId: string;
83
- documentId: string;
84
- documentName: string;
85
- content: string;
86
- similarity: number;
87
- chunkIndex: number;
88
- }): UnifiedMemorySearchResult;
89
- declare function toMemoryResult(result: {
90
- id: string;
91
- content: string;
92
- similarity: number;
93
- metadata: Record<string, unknown>;
94
- }): UnifiedMemorySearchResult;
95
- declare function isRawMemorySemanticResult(result: unknown): result is {
96
- id: string;
97
- content: string;
98
- similarity: number;
99
- metadata: Record<string, unknown>;
100
- };
1
+ import { m as UnifiedMemorySearchInput, n as UnifiedMemorySearchOutput, o as UnifiedMemorySearchResult, H as UnifiedSearchDeps } from '../config-2Q092MUz.js';
2
+ export { J as UnifiedMemoryMergeStrategy, K as UnifiedMemoryRankedList, l as UnifiedMemoryReasoningStrategy, p as UnifiedMemorySearchSource, q as UnifiedMemorySearchWarning, u as clampUnifiedMemorySearchLimit, v as clampUnifiedMemorySearchThreshold, A as isRawMemorySemanticResult, B as mergeUnifiedMemorySearchResults, L as mergeUnifiedMemorySearchResultsRrf, N as normalizeUnifiedMemoryMergeStrategy, C as normalizeUnifiedMemoryReasoningStrategy, D as normalizeUnifiedMemorySearchSources, F as toKnowledgeResult, G as toMemoryResult } from '../config-2Q092MUz.js';
101
3
 
102
4
  /**
103
5
  * Unified semantic search facade.
@@ -114,4 +16,4 @@ interface UnifiedSearch {
114
16
  }
115
17
  declare function createUnifiedSearch(deps?: UnifiedSearchDeps): UnifiedSearch;
116
18
 
117
- export { type UnifiedMemoryMergeStrategy, type UnifiedMemoryRankedList, type UnifiedMemorySearchInput, type UnifiedMemorySearchOutput, type UnifiedMemorySearchResult, type UnifiedMemorySearchSource, type UnifiedMemorySearchWarning, type UnifiedSearch, clampUnifiedMemorySearchLimit, clampUnifiedMemorySearchThreshold, createUnifiedSearch, isRawMemorySemanticResult, mergeUnifiedMemorySearchResults, mergeUnifiedMemorySearchResultsRrf, normalizeUnifiedMemoryMergeStrategy, normalizeUnifiedMemorySearchSources, toKnowledgeResult, toMemoryResult };
19
+ export { UnifiedMemorySearchInput, UnifiedMemorySearchOutput, UnifiedMemorySearchResult, type UnifiedSearch, createUnifiedSearch };