@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.
- package/dist/config-2Q092MUz.d.ts +470 -0
- package/dist/http.d.ts +1 -1
- package/dist/http.js +386 -105
- package/dist/index.d.ts +3 -3
- package/dist/index.js +745 -107
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +389 -105
- package/dist/search/unified-search.d.ts +3 -101
- package/dist/search/unified-search.js +387 -106
- package/dist/server/cli-http.js +395 -105
- package/dist/server/cli-mcp.js +398 -105
- package/dist/server/cli-shared.d.ts +1 -1
- package/dist/server/cli-shared.js +17 -5
- package/dist/storage/postgres-raw-message-factory.d.ts +1 -1
- package/dist/storage/raw-message-store.d.ts +3 -1
- package/dist/storage/raw-message-store.js +20 -9
- package/dist/storage/sqlite-raw-message-store.d.ts +6 -3
- package/dist/storage/sqlite-raw-message-store.js +4 -3
- package/dist/storage/sqlite-vector-index.d.ts +1 -1
- package/dist/storage/sqlite-vector-index.js +1 -1
- package/package.json +10 -9
- package/dist/config-BYfTzG3h.d.ts +0 -170
|
@@ -1,103 +1,5 @@
|
|
|
1
|
-
import {
|
|
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 {
|
|
19
|
+
export { UnifiedMemorySearchInput, UnifiedMemorySearchOutput, UnifiedMemorySearchResult, type UnifiedSearch, createUnifiedSearch };
|