@melandlabs/memory-store 1.2.5 → 1.3.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.
- package/README.md +47 -16
- package/dist/{config-Dw4aXj2a.d.ts → config-CbE2t4SW.d.ts} +172 -17
- package/dist/http.d.ts +2 -1
- package/dist/http.js +594 -270
- package/dist/index.d.ts +10 -6
- package/dist/index.js +316 -99
- package/dist/mcp.d.ts +2 -1
- package/dist/mcp.js +615 -250
- package/dist/search/derive.d.ts +2 -1
- package/dist/search/distill.d.ts +2 -1
- package/dist/search/unified-search.d.ts +3 -2
- package/dist/search/unified-search.js +316 -99
- package/dist/server/cli-http.js +966 -320
- package/dist/server/cli-mcp.js +987 -300
- package/dist/server/cli-shared.d.ts +20 -7
- package/dist/server/cli-shared.js +370 -48
- package/dist/storage/postgres-raw-message-factory.d.ts +2 -1
- package/dist/storage/raw-message-store.d.ts +20 -2
- package/dist/storage/sqlite-raw-message-store.d.ts +8 -1
- package/dist/storage/sqlite-vector-index.d.ts +2 -1
- package/dist/storage/sqlite-vector-index.js +1 -1
- package/dist/{unified-search-DfE8ek7W.d.ts → unified-search-2YQ6EGuQ.d.ts} +17 -6
- package/package.json +15 -11
package/README.md
CHANGED
|
@@ -87,6 +87,25 @@ opencontext-memory-mcp \
|
|
|
87
87
|
--memory-backend sqlite-vec
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
Local cross-encoder reranking is also opt-in and runs after RRF/source
|
|
91
|
+
fusion but before the public Top-K limit:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
opencontext-memory-http \
|
|
95
|
+
--embedding-provider local \
|
|
96
|
+
--memory-backend sqlite-vec \
|
|
97
|
+
--reranker-provider local \
|
|
98
|
+
--reranker-model Xenova/ms-marco-MiniLM-L-6-v2
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The equivalent environment variables are `RERANKER_PROVIDER=local`,
|
|
102
|
+
`LOCAL_RERANKER_MODEL`, `LOCAL_RERANKER_CACHE_DIR`,
|
|
103
|
+
`LOCAL_RERANKER_BATCH_SIZE`, and `LOCAL_RERANKER_MAX_TOKENS`. Optional
|
|
104
|
+
`LOCAL_RERANKER_DTYPE=q8` selects the quantized CPU model and
|
|
105
|
+
`LOCAL_RERANKER_LOCAL_ONLY=true` requires all weights to exist in the cache.
|
|
106
|
+
A configured reranker is warmed up at startup; model download or runtime
|
|
107
|
+
errors fail startup instead of silently falling back to RRF-only ordering.
|
|
108
|
+
|
|
90
109
|
Once the daemon is up, `POST /v1/search` (HTTP) and `memory.search` (MCP)
|
|
91
110
|
honor a `reasoningStrategy` field:
|
|
92
111
|
|
|
@@ -108,9 +127,11 @@ programmatic equivalents.
|
|
|
108
127
|
| `db.getDb()` | yes for postgres backend | Drizzle DB handle factory |
|
|
109
128
|
| `db.tables.rawMessages` / `db.tables.memorySummaries` | when using postgres backend | Drizzle table references owned by the host |
|
|
110
129
|
| `dbPath` | optional | SQLite path override (also reads `MEMORY_STORE_DB_PATH`) |
|
|
111
|
-
| `vector.backend` |
|
|
130
|
+
| `vector.backend` | `sqlite-vec`, `chroma`, `lancedb`, or `milvus` | raw-message child vector backend |
|
|
112
131
|
| `vector.sqliteVec.dbPath` | when backend = sqlite-vec | sqlite-vec DB path |
|
|
113
132
|
| `vector.chroma.url` | when backend = chroma | chroma server URL |
|
|
133
|
+
| `vector.lancedb.uri` | when backend = lancedb | LanceDB local directory or URI |
|
|
134
|
+
| `vector.milvus.address` | when backend = milvus | Milvus endpoint |
|
|
114
135
|
| `unified.embedQuery` | yes for unified search | query embedder |
|
|
115
136
|
| `unified.searchKnowledge` | optional | RAG over uploaded documents |
|
|
116
137
|
| `unified.searchInsights` | optional | semantic search over extracted insights |
|
|
@@ -133,9 +154,9 @@ SQLite at `~/.opencontext/memory/store.db`; set
|
|
|
133
154
|
registered Postgres factory (call `registerPostgresFactory` at startup).
|
|
134
155
|
|
|
135
156
|
If any of `unified.embedQuery`, `unified.searchKnowledge`, `unified.searchInsights`,
|
|
136
|
-
or
|
|
157
|
+
or the configured raw-message search provider are absent, the corresponding source in
|
|
137
158
|
`searchUnifiedMemory` returns empty results with a warning. The SDK still
|
|
138
|
-
works
|
|
159
|
+
works and lexical child search remains available when the SQLite catalog is present.
|
|
139
160
|
|
|
140
161
|
See `src/config.ts` for the full type surface.
|
|
141
162
|
|
|
@@ -214,9 +235,8 @@ const store = await createMemoryStore({
|
|
|
214
235
|
});
|
|
215
236
|
```
|
|
216
237
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
the fallback — same semantics as the web app.
|
|
238
|
+
Chroma stores only child chunks for dense retrieval. SQLite child FTS5 provides
|
|
239
|
+
the lexical channel, and the full parent text remains in the raw-message store.
|
|
220
240
|
|
|
221
241
|
### 4. Cross-source search wiring
|
|
222
242
|
|
|
@@ -475,8 +495,8 @@ Endpoints:
|
|
|
475
495
|
|
|
476
496
|
| Method + path | Body |
|
|
477
497
|
| -------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
|
478
|
-
| `GET /health` | —
|
|
479
|
-
| `POST /v1/search` | `{ userId, query, limit?, threshold?, sources?, botIds?, documentIds?, factTypes?, synthesize?, reasoningStrategy? }` |
|
|
498
|
+
| `GET /health` | — (includes safe retrieval backend/readiness details when configured) |
|
|
499
|
+
| `POST /v1/search` | `{ userId, query, limit?, threshold?, mergeStrategy?, includeRetrievalDiagnostics?, sources?, botIds?, documentIds?, factTypes?, synthesize?, reasoningStrategy? }` |
|
|
480
500
|
| `POST /v1/consolidate:apply` | `{ userId, query, ownerScope, tiers?, limit?, threshold?, dryRun?, expectedVersion?, llmPlanReview? }` |
|
|
481
501
|
| `POST /v1/raw-messages` | `{ userId, messages: RawMessage[] }` |
|
|
482
502
|
| `GET /v1/raw-messages/:id?userId=...` | — |
|
|
@@ -525,8 +545,8 @@ Tools exposed over stdio:
|
|
|
525
545
|
|
|
526
546
|
| Tool | Required args |
|
|
527
547
|
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
528
|
-
| `memory.health` | —
|
|
529
|
-
| `memory.search` | `userId`, `query`, optional `limit`, `threshold`, `sources`, `botIds`, `documentIds`, `factTypes`, `synthesize`, `tiers`, **`reasoningStrategy`** (`"none" \| "rewrite" \| "iterative"`)
|
|
548
|
+
| `memory.health` | — (returns safe backend, embedding identity/dimensions, child counts, and readiness) |
|
|
549
|
+
| `memory.search` | `userId`, `query`, optional `limit`, `threshold`, `mergeStrategy`, `includeRetrievalDiagnostics`, `sources`, `botIds`, `documentIds`, `factTypes`, `synthesize`, `tiers`, **`reasoningStrategy`** (`"none" \| "rewrite" \| "iterative"`) |
|
|
530
550
|
| `memory.writeRawMessage` | `userId`, `message: { role, content, platform?, botId?, factType?, peer?, ... }` |
|
|
531
551
|
| `memory.getRawMessage` | `userId`, `messageId` |
|
|
532
552
|
| `memory.consolidate` | `userId`, `query`, `ownerScope`, optional `tiers`, `dryRun`, `expectedVersion`, `llmPlanReview`, `plan` |
|
|
@@ -602,16 +622,27 @@ editor. Tool calls appear in the chat like any other MCP tool.
|
|
|
602
622
|
`{ query, sources, results: [], count: 0, warnings: [] }` without
|
|
603
623
|
touching any backend.
|
|
604
624
|
- If `isRawMessageStorageAvailable()` returns `false`, the memory source
|
|
605
|
-
emits a `raw_message_storage_unavailable` warning instead of
|
|
606
|
-
Chroma / postgres search.
|
|
625
|
+
emits a `raw_message_storage_unavailable` warning instead of searching.
|
|
607
626
|
- When `botIds` is provided, the memory source fans out across each
|
|
608
627
|
`botId` filter in parallel (`Promise.all(filters.map(...))`) and
|
|
609
628
|
flattens the results. If `botIds` is empty, a single unfiltered query
|
|
610
629
|
is sent.
|
|
611
|
-
- `limit`
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
630
|
+
- `limit` caps final results. Internally, each channel gathers
|
|
631
|
+
`min(50, max(limit, 4 × limit))` candidates so RRF and a configured reranker
|
|
632
|
+
operate on a useful window. RRF is the default merge strategy; when its
|
|
633
|
+
threshold is omitted, the full ranked candidate window is fused. Explicit
|
|
634
|
+
`threshold` values are clamped to `[-1, 1]`.
|
|
635
|
+
- `retrievalDiagnostics.reranker` reports whether reranking was enabled, its
|
|
636
|
+
non-secret provider/model identity, input/output counts, latency, and whether
|
|
637
|
+
it changed candidate order. Health reports the same configured model and
|
|
638
|
+
readiness state.
|
|
639
|
+
- `RawMessage.content` remains the complete parent text. Search indexing uses
|
|
640
|
+
400-estimated-token child chunks with 80-token overlap. Short-message hits
|
|
641
|
+
return the complete parent; long-message hits return the matched child plus
|
|
642
|
+
its same-parent predecessor and successor as one continuous source slice.
|
|
643
|
+
- SQLite uses child sqlite-vec plus child FTS5; Chroma uses dense child search
|
|
644
|
+
plus SQLite FTS5; LanceDB and Milvus use their native dense/BM25 hybrid path.
|
|
645
|
+
All four return the parent `messageId` and the same bounded content semantics.
|
|
615
646
|
- `reflect()` and `consolidate()` reuse the same evidence pipeline;
|
|
616
647
|
`reflect()` is read-only, `consolidate()` additionally persists
|
|
617
648
|
via the graph store + storage adapter.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as _melandlabs_memory_consolidation from '@melandlabs/memory-consolidation';
|
|
2
|
+
import { MemoryApplicabilityContext } from '@melandlabs/memory-consolidation';
|
|
2
3
|
import * as _melandlabs_contracts_peer from '@melandlabs/contracts/peer';
|
|
3
4
|
import { Peer } from '@melandlabs/contracts/peer';
|
|
4
5
|
import { FactType } from '@melandlabs/contracts';
|
|
5
6
|
import { DerivedFact } from '@melandlabs/contracts/derived-fact';
|
|
6
7
|
import { EntityEdge } from '@melandlabs/contracts/entity-edge';
|
|
8
|
+
import { RawMessage, RawMessageSearchChunk } from '@melandlabs/indexeddb';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Reranker adapter contract.
|
|
@@ -55,7 +57,7 @@ type UnifiedMemorySearchSource = "memory" | "insights" | "knowledge";
|
|
|
55
57
|
* - `entity` — entity-link match supplied by the host's
|
|
56
58
|
* `entitySearch` dep.
|
|
57
59
|
*/
|
|
58
|
-
type HitChannel = "semantic" | "lexical" | "entity";
|
|
60
|
+
type HitChannel = "semantic" | "lexical" | "hybrid" | "entity";
|
|
59
61
|
/**
|
|
60
62
|
* Per-hit score breakdown. Always emitted by `search()` (default merge
|
|
61
63
|
* strategy) so callers can threshold / re-rank without losing the
|
|
@@ -74,6 +76,8 @@ interface HitSignals {
|
|
|
74
76
|
semantic?: number;
|
|
75
77
|
/** Lexical sub-query BM25 score (undefined when absent). */
|
|
76
78
|
lexical?: number;
|
|
79
|
+
/** Native backend dense+BM25 fused score (undefined when absent). */
|
|
80
|
+
hybrid?: number;
|
|
77
81
|
/** Entity sub-query match score (undefined when absent). */
|
|
78
82
|
entity?: number;
|
|
79
83
|
/** RRF-fused score (only when mergeStrategy === "rrf"). */
|
|
@@ -156,10 +160,8 @@ interface UnifiedMemorySearchInput {
|
|
|
156
160
|
*/
|
|
157
161
|
dateTo?: string;
|
|
158
162
|
/**
|
|
159
|
-
* How to merge per-source result lists. Defaults to `"
|
|
160
|
-
* the legacy global
|
|
161
|
-
* alternate value `"rrf"` invokes reciprocal-rank fusion across the
|
|
162
|
-
* lists fed via the (internal) `rankedLists` option.
|
|
163
|
+
* How to merge per-source result lists. Defaults to `"rrf"` reciprocal-rank
|
|
164
|
+
* fusion. `"similarity"` preserves the legacy global similarity sort.
|
|
163
165
|
*/
|
|
164
166
|
mergeStrategy?: UnifiedMemoryMergeStrategy;
|
|
165
167
|
/**
|
|
@@ -184,6 +186,17 @@ interface UnifiedMemorySearchInput {
|
|
|
184
186
|
* callers can pass `searchInput.factTypes ?? []` without surprises.
|
|
185
187
|
*/
|
|
186
188
|
factTypes?: FactType[];
|
|
189
|
+
/** Include pre-fusion channel candidates in the response for diagnostics. */
|
|
190
|
+
includeRetrievalDiagnostics?: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Include messages that have been soft-deprecated
|
|
193
|
+
* (`raw_messages.deprecated_at IS NOT NULL`). Default `false` keeps
|
|
194
|
+
* `current-truth` retrievals clean: a row that was marked superseded
|
|
195
|
+
* via `deprecateMessages` (or the `opencontext deprecate` CLI) is
|
|
196
|
+
* excluded from results. Set to `true` for audits and historical
|
|
197
|
+
* exploration.
|
|
198
|
+
*/
|
|
199
|
+
includeDeprecated?: boolean;
|
|
187
200
|
}
|
|
188
201
|
type UnifiedMemoryMergeStrategy = "similarity" | "rrf";
|
|
189
202
|
/**
|
|
@@ -216,6 +229,7 @@ interface UnifiedMemorySearchOutput {
|
|
|
216
229
|
results: UnifiedMemorySearchResult[];
|
|
217
230
|
count: number;
|
|
218
231
|
warnings: UnifiedMemorySearchWarning[];
|
|
232
|
+
retrievalDiagnostics?: UnifiedMemoryRetrievalDiagnostics;
|
|
219
233
|
/**
|
|
220
234
|
* Diagnostic information about reasoning and date filtering. Present
|
|
221
235
|
* when (a) a non-`"none"` reasoning strategy was requested, or (b) a
|
|
@@ -223,6 +237,39 @@ interface UnifiedMemorySearchOutput {
|
|
|
223
237
|
*/
|
|
224
238
|
reasoning?: UnifiedMemoryReasoningInfo;
|
|
225
239
|
}
|
|
240
|
+
interface UnifiedMemoryRetrievalDiagnostics {
|
|
241
|
+
mergeStrategy: UnifiedMemoryMergeStrategy;
|
|
242
|
+
candidateLimit: number;
|
|
243
|
+
backend?: string;
|
|
244
|
+
semanticDegradedReason?: string;
|
|
245
|
+
candidateCounts?: {
|
|
246
|
+
semantic: number;
|
|
247
|
+
lexical: number;
|
|
248
|
+
hybrid: number;
|
|
249
|
+
entity: number;
|
|
250
|
+
fused: number;
|
|
251
|
+
final: number;
|
|
252
|
+
};
|
|
253
|
+
channels: {
|
|
254
|
+
semantic: UnifiedMemorySearchResult[];
|
|
255
|
+
lexical: UnifiedMemorySearchResult[];
|
|
256
|
+
hybrid?: UnifiedMemorySearchResult[];
|
|
257
|
+
entity?: UnifiedMemorySearchResult[];
|
|
258
|
+
};
|
|
259
|
+
/** Results after channel/source fusion and before an optional host reranker. */
|
|
260
|
+
fusedBeforeRerank: UnifiedMemorySearchResult[];
|
|
261
|
+
reranker?: {
|
|
262
|
+
enabled: boolean;
|
|
263
|
+
provider?: string;
|
|
264
|
+
model?: string;
|
|
265
|
+
inputCount: number;
|
|
266
|
+
outputCount: number;
|
|
267
|
+
latencyMs: number;
|
|
268
|
+
orderChanged: boolean;
|
|
269
|
+
};
|
|
270
|
+
/** Final results after optional reranking and Top-K truncation. */
|
|
271
|
+
final: UnifiedMemorySearchResult[];
|
|
272
|
+
}
|
|
226
273
|
/**
|
|
227
274
|
* Cross-source retrieval surface for the unified search. Mirrors
|
|
228
275
|
* `UnifiedMemorySearchSource` but is exposed under a more discoverable
|
|
@@ -280,6 +327,17 @@ interface SearchInput {
|
|
|
280
327
|
* `includeArchivedInsights` to the read-only search.
|
|
281
328
|
*/
|
|
282
329
|
includeArchivedInsights?: boolean;
|
|
330
|
+
/** Include pre-fusion retrieval candidates; intended for evaluation/debugging. */
|
|
331
|
+
includeRetrievalDiagnostics?: boolean;
|
|
332
|
+
/**
|
|
333
|
+
* Include messages that have been soft-deprecated
|
|
334
|
+
* (`raw_messages.deprecated_at IS NOT NULL`). Default `false` keeps
|
|
335
|
+
* `current-truth` retrievals clean: a row that was marked superseded
|
|
336
|
+
* via `deprecateMessages` (or the `opencontext deprecate` CLI) is
|
|
337
|
+
* excluded from results. Set to `true` for audits and historical
|
|
338
|
+
* exploration.
|
|
339
|
+
*/
|
|
340
|
+
includeDeprecated?: boolean;
|
|
283
341
|
}
|
|
284
342
|
interface SearchEvidence {
|
|
285
343
|
id: string;
|
|
@@ -287,6 +345,12 @@ interface SearchEvidence {
|
|
|
287
345
|
snippet: string;
|
|
288
346
|
score: number;
|
|
289
347
|
timestamp?: number;
|
|
348
|
+
/**
|
|
349
|
+
* Forwarded from the underlying hit's `metadata`. Surfaces per-fact
|
|
350
|
+
* provenance (`metadata.source`, `metadata.factType`, etc.) to the
|
|
351
|
+
* synthesis prompt and the CLI's `--context-only` / `--json` output.
|
|
352
|
+
*/
|
|
353
|
+
metadata?: Record<string, unknown>;
|
|
290
354
|
}
|
|
291
355
|
interface SearchOutput {
|
|
292
356
|
query: string;
|
|
@@ -296,6 +360,7 @@ interface SearchOutput {
|
|
|
296
360
|
evidence: SearchEvidence[];
|
|
297
361
|
count: number;
|
|
298
362
|
warnings: UnifiedMemorySearchWarning[];
|
|
363
|
+
retrievalDiagnostics?: UnifiedMemoryRetrievalDiagnostics;
|
|
299
364
|
reasoning?: UnifiedMemoryReasoningInfo;
|
|
300
365
|
/** Only present when `synthesize` was truthy. */
|
|
301
366
|
answer?: string;
|
|
@@ -540,7 +605,7 @@ interface MemoryStoreDb {
|
|
|
540
605
|
*/
|
|
541
606
|
interface MemoryStoreEnv {
|
|
542
607
|
}
|
|
543
|
-
type VectorBackend = "sqlite-vec" | "chroma";
|
|
608
|
+
type VectorBackend = "sqlite-vec" | "chroma" | "lancedb" | "milvus";
|
|
544
609
|
interface MemoryStoreVectorConfig {
|
|
545
610
|
/** Active backend selector. Defaults to env-based detection. */
|
|
546
611
|
backend?: VectorBackend;
|
|
@@ -555,12 +620,30 @@ interface MemoryStoreVectorConfig {
|
|
|
555
620
|
rawMessagesCollection?: string;
|
|
556
621
|
insightsCollection?: string;
|
|
557
622
|
};
|
|
623
|
+
/** LanceDB options (used when backend === "lancedb"). */
|
|
624
|
+
lancedb?: {
|
|
625
|
+
uri: string;
|
|
626
|
+
table?: string;
|
|
627
|
+
};
|
|
628
|
+
/** Milvus options (used when backend === "milvus"). */
|
|
629
|
+
milvus?: {
|
|
630
|
+
address: string;
|
|
631
|
+
token?: string;
|
|
632
|
+
database?: string;
|
|
633
|
+
collection?: string;
|
|
634
|
+
dimension?: number;
|
|
635
|
+
};
|
|
558
636
|
}
|
|
559
637
|
type EmbedQueryFn = (input: {
|
|
560
638
|
userId: string;
|
|
561
639
|
query: string;
|
|
562
640
|
authToken?: string;
|
|
563
641
|
}) => Promise<number[]>;
|
|
642
|
+
type EmbedDocumentsFn = (input: {
|
|
643
|
+
userId: string;
|
|
644
|
+
texts: string[];
|
|
645
|
+
authToken?: string;
|
|
646
|
+
}) => Promise<number[][]>;
|
|
564
647
|
interface UnifiedSearchKnowledgeResult {
|
|
565
648
|
chunkId: string;
|
|
566
649
|
documentId: string;
|
|
@@ -601,21 +684,67 @@ interface MemorySummaryHit {
|
|
|
601
684
|
startTimestamp?: number;
|
|
602
685
|
endTimestamp?: number;
|
|
603
686
|
}
|
|
687
|
+
/**
|
|
688
|
+
* Trusted applicability fields forwarded together to retrieval providers.
|
|
689
|
+
* They are absent for legacy unscoped searches and always present together
|
|
690
|
+
* for scoped searches. Providers must enforce the canonical applicability
|
|
691
|
+
* contract at `applicabilityAt`; these values must not be derived from public
|
|
692
|
+
* request payloads.
|
|
693
|
+
*/
|
|
694
|
+
interface SearchProviderApplicabilityInput {
|
|
695
|
+
applicabilityContexts?: readonly MemoryApplicabilityContext[];
|
|
696
|
+
/** Epoch milliseconds resolved once at the `search()` boundary. */
|
|
697
|
+
applicabilityAt?: number;
|
|
698
|
+
}
|
|
604
699
|
interface UnifiedSearchDeps {
|
|
605
700
|
/** Embed a query string using the active user's provider. */
|
|
606
701
|
embedQuery?: EmbedQueryFn;
|
|
702
|
+
/** Batch document embedding used by child indexing when the provider supports it. */
|
|
703
|
+
embedDocuments?: EmbedDocumentsFn;
|
|
704
|
+
/** Safe, non-secret identity used by health checks and child-index metadata. */
|
|
705
|
+
embeddingInfo?: {
|
|
706
|
+
provider?: string;
|
|
707
|
+
model?: string;
|
|
708
|
+
dimensions?: number;
|
|
709
|
+
maxTokens?: number;
|
|
710
|
+
};
|
|
711
|
+
/** Runtime-safe retrieval readiness used by health and diagnostics. */
|
|
712
|
+
getRawMessageRetrievalStatus?: () => Promise<{
|
|
713
|
+
backend: string;
|
|
714
|
+
embeddingProvider?: string;
|
|
715
|
+
embeddingModel?: string;
|
|
716
|
+
embeddingDimensions?: number;
|
|
717
|
+
childCount: number;
|
|
718
|
+
embeddedChildCount: number;
|
|
719
|
+
indexedDimensions: number[];
|
|
720
|
+
semanticReady: boolean;
|
|
721
|
+
lexicalReady: boolean;
|
|
722
|
+
semanticDegradedReason?: string;
|
|
723
|
+
rerankerProvider?: string;
|
|
724
|
+
rerankerModel?: string;
|
|
725
|
+
rerankerReady?: boolean;
|
|
726
|
+
}>;
|
|
727
|
+
/** Optional external child-vector index used by the shared write path. */
|
|
728
|
+
rawMessageChildIndex?: {
|
|
729
|
+
replaceMessages(messages: RawMessage[], chunks: RawMessageSearchChunk[]): Promise<void>;
|
|
730
|
+
};
|
|
607
731
|
/**
|
|
608
|
-
*
|
|
609
|
-
*
|
|
610
|
-
*
|
|
611
|
-
* (with a warning) in standalone mode.
|
|
732
|
+
* Dense raw-message search supplied by the selected child-vector backend.
|
|
733
|
+
* External Postgres hosts may also provide their legacy parent-level
|
|
734
|
+
* implementation here; Postgres schema changes are outside this package.
|
|
612
735
|
*/
|
|
613
|
-
searchRawMessagesAnn?: (input: {
|
|
736
|
+
searchRawMessagesAnn?: (input: SearchProviderApplicabilityInput & {
|
|
614
737
|
userId: string;
|
|
615
738
|
queryEmbedding: number[];
|
|
616
739
|
limit: number;
|
|
617
740
|
threshold: number;
|
|
618
741
|
botId?: string;
|
|
742
|
+
/**
|
|
743
|
+
* Forward `includeDeprecated` from `UnifiedMemorySearchInput` so
|
|
744
|
+
* supersession-aware callers can opt into deprecated rows for
|
|
745
|
+
* audits. Default `false` preserves the current-truth behaviour.
|
|
746
|
+
*/
|
|
747
|
+
includeDeprecated?: boolean;
|
|
619
748
|
/** Optional peer scope resolved from `UnifiedMemorySearchInput.peerFilter`. */
|
|
620
749
|
peers?: ReadonlyArray<Peer>;
|
|
621
750
|
/** Optional `FactType` filter resolved from `UnifiedMemorySearchInput.factTypes`. */
|
|
@@ -626,8 +755,21 @@ interface UnifiedSearchDeps {
|
|
|
626
755
|
similarity: number;
|
|
627
756
|
metadata: Record<string, unknown>;
|
|
628
757
|
}>>;
|
|
758
|
+
/** Native dense+BM25 path for backends such as LanceDB and Milvus. */
|
|
759
|
+
searchRawMessagesHybrid?: (input: SearchProviderApplicabilityInput & {
|
|
760
|
+
userId: string;
|
|
761
|
+
query: string;
|
|
762
|
+
queryEmbedding: number[];
|
|
763
|
+
limit: number;
|
|
764
|
+
botId?: string;
|
|
765
|
+
}) => Promise<Array<{
|
|
766
|
+
id: string;
|
|
767
|
+
content: string;
|
|
768
|
+
similarity: number;
|
|
769
|
+
metadata: Record<string, unknown>;
|
|
770
|
+
}>>;
|
|
629
771
|
/** RAG over uploaded knowledge documents. Returns a list of chunk hits. */
|
|
630
|
-
searchKnowledge?: (input: {
|
|
772
|
+
searchKnowledge?: (input: SearchProviderApplicabilityInput & {
|
|
631
773
|
userId: string;
|
|
632
774
|
query: string;
|
|
633
775
|
options: {
|
|
@@ -640,7 +782,7 @@ interface UnifiedSearchDeps {
|
|
|
640
782
|
peers?: ReadonlyArray<Peer>;
|
|
641
783
|
}) => Promise<UnifiedSearchKnowledgeResult[]>;
|
|
642
784
|
/** Semantic search over extracted insights. */
|
|
643
|
-
searchInsights?: (input: {
|
|
785
|
+
searchInsights?: (input: SearchProviderApplicabilityInput & {
|
|
644
786
|
userId: string;
|
|
645
787
|
query: string;
|
|
646
788
|
limit: number;
|
|
@@ -657,11 +799,17 @@ interface UnifiedSearchDeps {
|
|
|
657
799
|
* dense embeddings. When absent, the unified pipeline skips the lexical
|
|
658
800
|
* path and emits a `memory_lexical_search_not_configured` warning.
|
|
659
801
|
*/
|
|
660
|
-
searchRawMessagesLexical?: (input: {
|
|
802
|
+
searchRawMessagesLexical?: (input: SearchProviderApplicabilityInput & {
|
|
661
803
|
userId: string;
|
|
662
804
|
keywords: string[];
|
|
663
805
|
limit: number;
|
|
664
806
|
botId?: string;
|
|
807
|
+
/**
|
|
808
|
+
* Forward `includeDeprecated` from `UnifiedMemorySearchInput` so
|
|
809
|
+
* supersession-aware callers can opt into deprecated rows for
|
|
810
|
+
* audits. Default `false` preserves the current-truth behaviour.
|
|
811
|
+
*/
|
|
812
|
+
includeDeprecated?: boolean;
|
|
665
813
|
/** Optional peer scope resolved from `UnifiedMemorySearchInput.peerFilter`. */
|
|
666
814
|
peers?: ReadonlyArray<Peer>;
|
|
667
815
|
/** Optional `FactType` filter resolved from `UnifiedMemorySearchInput.factTypes`. */
|
|
@@ -677,7 +825,7 @@ interface UnifiedSearchDeps {
|
|
|
677
825
|
* summary tier alongside raw messages and emits a
|
|
678
826
|
* `reflect_summaries_unavailable` warning if the call fails.
|
|
679
827
|
*/
|
|
680
|
-
searchSummaries?: (input: {
|
|
828
|
+
searchSummaries?: (input: SearchProviderApplicabilityInput & {
|
|
681
829
|
userId: string;
|
|
682
830
|
query: string;
|
|
683
831
|
keywords: string[];
|
|
@@ -702,7 +850,7 @@ interface UnifiedSearchDeps {
|
|
|
702
850
|
* own entity store (graph nodes, separate SQLite table, etc.) —
|
|
703
851
|
* the SDK never persists entity edges itself.
|
|
704
852
|
*/
|
|
705
|
-
entitySearch?: (input: {
|
|
853
|
+
entitySearch?: (input: SearchProviderApplicabilityInput & {
|
|
706
854
|
userId: string;
|
|
707
855
|
keywords: string[];
|
|
708
856
|
limit: number;
|
|
@@ -771,6 +919,13 @@ interface UnifiedSearchDeps {
|
|
|
771
919
|
* is preserved.
|
|
772
920
|
*/
|
|
773
921
|
reranker?: Reranker;
|
|
922
|
+
/** Safe, non-secret reranker identity surfaced by health and diagnostics. */
|
|
923
|
+
rerankerInfo?: {
|
|
924
|
+
provider: string;
|
|
925
|
+
model?: string;
|
|
926
|
+
maxTokens?: number;
|
|
927
|
+
ready: boolean;
|
|
928
|
+
};
|
|
774
929
|
/**
|
|
775
930
|
* Optional logger. When set (e.g. via `MemoryStoreConfig.logger`),
|
|
776
931
|
* `reflect` / `consolidate` log through it instead of `console`.
|
|
@@ -816,4 +971,4 @@ interface MemoryStoreConfig {
|
|
|
816
971
|
logger?: Pick<Console, "log" | "warn" | "error">;
|
|
817
972
|
}
|
|
818
973
|
|
|
819
|
-
export { toMemoryResult as A, type IterativeRecallExecutor as B, type IterativeRecallPlanner as C, type IterativeRecallPlannerOptions as D, type EmbedQueryFn as E, type IterativeRecallResult as F, type IterativeRecallSearchRequest as G, type HitChannel as H, type IterativeRecallCandidate as I, type IterativeRecallSearchResult as J, type IterativeRecallStats as K, type MemoryStoreDb as L, type MemoryStoreConfig as M, type QueryRewriterInput as N, type QueryRewriterOptions as O, type
|
|
974
|
+
export { createUserVoiceRewriter as $, toMemoryResult as A, type IterativeRecallExecutor as B, type IterativeRecallPlanner as C, type IterativeRecallPlannerOptions as D, type EmbedQueryFn as E, type IterativeRecallResult as F, type IterativeRecallSearchRequest as G, type HitChannel as H, type IterativeRecallCandidate as I, type IterativeRecallSearchResult as J, type IterativeRecallStats as K, type MemoryStoreDb as L, type MemoryStoreConfig as M, type QueryRewriterInput as N, type QueryRewriterOptions as O, type SearchProviderApplicabilityInput as P, type QueryRewriter as Q, type UnifiedMemoryReasoningInfo as R, type SearchTier as S, type UnifiedSearchInsightsResult as T, type UnifiedSearchDeps as U, type UnifiedSearchKnowledgeResult as V, type UnifiedSearchReasoningDeps as W, type VectorBackend as X, createIdentityIterativePlanner as Y, createIdentityRewriter as Z, createIterativeRecallPlanner as _, type MemoryStoreEnv as a, type UnifiedMemorySearchWarning as b, type SearchEvidence as c, type SearchInput as d, type SearchOutput as e, type UnifiedMemorySearchInput as f, type UnifiedMemorySearchOutput as g, type UnifiedMemorySearchResult as h, type HitSignals as i, type SearchSource as j, type UnifiedMemoryMergeStrategy as k, type UnifiedMemoryRankedList as l, type UnifiedMemoryReasoningStrategy as m, type UnifiedMemorySearchSource as n, clampUnifiedMemorySearchLimit as o, clampUnifiedMemorySearchThreshold as p, deriveLexicalKeywords as q, isRawMemorySemanticResult as r, listNameToChannel as s, materializeSignals as t, mergeUnifiedMemorySearchResults as u, mergeUnifiedMemorySearchResultsRrf as v, normalizeUnifiedMemoryMergeStrategy as w, normalizeUnifiedMemoryReasoningStrategy as x, normalizeUnifiedMemorySearchSources as y, toKnowledgeResult as z };
|
package/dist/http.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { M as MemoryStoreConfig } from './config-
|
|
1
|
+
import { M as MemoryStoreConfig } from './config-CbE2t4SW.js';
|
|
2
2
|
import '@melandlabs/memory-consolidation';
|
|
3
3
|
import '@melandlabs/contracts/peer';
|
|
4
4
|
import '@melandlabs/contracts';
|
|
5
5
|
import '@melandlabs/contracts/derived-fact';
|
|
6
6
|
import '@melandlabs/contracts/entity-edge';
|
|
7
|
+
import '@melandlabs/indexeddb';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @melandlabs/memory-store/http — HTTP server entry.
|