@melandlabs/memory-store 1.3.8 → 1.4.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.
@@ -2,7 +2,7 @@ import * as _melandlabs_memory_consolidation from '@melandlabs/memory-consolidat
2
2
  import { MemoryApplicabilityContext } from '@melandlabs/memory-consolidation';
3
3
  import * as _melandlabs_contracts_peer from '@melandlabs/contracts/peer';
4
4
  import { Peer } from '@melandlabs/contracts/peer';
5
- import { m as UnifiedMemoryRrfWeights, i as SessionNeighborExpansionOptions, E as EvidenceSelector, j as UnifiedMemoryMergeStrategy, I as IterativeRecallPlanner, l as UnifiedMemoryReasoningStrategy } from './evidence-selector-uOHsxwch.js';
5
+ import { h as SearchEvidenceProvenance, j as SearchSourceState, o as UnifiedMemoryRrfWeights, k as SessionNeighborExpansionOptions, E as EvidenceSelector, l as UnifiedMemoryMergeStrategy, J as IterativeRecallPlanner, n as UnifiedMemoryReasoningStrategy } from './evidence-selector-C_ZUQsio.js';
6
6
  import { FactType } from '@melandlabs/contracts';
7
7
  import { DerivedFact } from '@melandlabs/contracts/derived-fact';
8
8
  import { EntityEdge } from '@melandlabs/contracts/entity-edge';
@@ -47,6 +47,14 @@ interface Reranker {
47
47
  rerank(input: RerankerInput): Promise<RerankerScore[]>;
48
48
  }
49
49
 
50
+ interface SearchExecutionBudget {
51
+ signal?: AbortSignal;
52
+ /** Maximum wait per external retrieval operation. Defaults to five seconds. */
53
+ sourceTimeoutMs?: number;
54
+ /** Maximum wait for the complete search, including optional ranking. */
55
+ searchTimeoutMs?: number;
56
+ }
57
+
50
58
  /**
51
59
  * Query rewriting for memory retrieval.
52
60
  *
@@ -183,12 +191,15 @@ interface UnifiedSearchKnowledgeResult {
183
191
  similarity: number;
184
192
  chunkIndex: number;
185
193
  }
186
- interface UnifiedSearchInsightsResult {
194
+ /** Text candidates shared by host-owned insight and file retrieval. */
195
+ interface UnifiedSearchTextResult {
187
196
  id: string;
188
197
  content: string;
189
198
  similarity: number;
190
199
  metadata: Record<string, unknown>;
200
+ provenance?: Partial<SearchEvidenceProvenance>;
191
201
  }
202
+ type UnifiedSearchInsightsResult = UnifiedSearchTextResult;
192
203
  interface UnifiedSearchReasoningDeps {
193
204
  /** Optional extractive context selection after ranking. Disabled unless supplied. */
194
205
  evidenceSelector?: EvidenceSelector;
@@ -233,7 +244,17 @@ interface SearchProviderApplicabilityInput {
233
244
  /** Epoch milliseconds resolved once at the `search()` boundary. */
234
245
  applicabilityAt?: number;
235
246
  }
236
- interface UnifiedSearchDeps {
247
+ interface UnifiedSearchDeps extends SearchExecutionBudget {
248
+ /** Host-owned file search; the host must enforce trusted scope before querying. */
249
+ searchWorkspace?: (input: SearchProviderApplicabilityInput & {
250
+ userId: string;
251
+ query: string;
252
+ limit: number;
253
+ }) => Promise<{
254
+ hits: UnifiedSearchTextResult[];
255
+ status: SearchSourceState["status"];
256
+ message?: string;
257
+ }>;
237
258
  /** Default rank-fusion weights; omitted channels use weight 1. */
238
259
  defaultRrfWeights?: UnifiedMemoryRrfWeights;
239
260
  /** Default reciprocal-rank damping constant. */
@@ -547,4 +568,4 @@ interface MemoryStoreConfig {
547
568
  logger?: Pick<Console, "log" | "warn" | "error">;
548
569
  }
549
570
 
550
- export { type EmbedQueryFn as E, type MemoryStoreConfig as M, type QueryRewriter as Q, type SearchProviderApplicabilityInput as S, type UnifiedSearchDeps as U, type VectorBackend as V, type MemoryStoreEnv as a, type MemoryStoreDb as b, type QueryRewriterInput as c, type QueryRewriterOptions as d, type UnifiedSearchInsightsResult as e, type UnifiedSearchKnowledgeResult as f, type UnifiedSearchReasoningDeps as g, createIdentityRewriter as h, createUserVoiceRewriter as i };
571
+ export { type EmbedQueryFn as E, type MemoryStoreConfig as M, type QueryRewriter as Q, type SearchProviderApplicabilityInput as S, type UnifiedSearchDeps as U, type VectorBackend as V, type MemoryStoreEnv as a, type MemoryStoreDb as b, type QueryRewriterInput as c, type QueryRewriterOptions as d, type UnifiedSearchInsightsResult as e, type UnifiedSearchKnowledgeResult as f, type UnifiedSearchReasoningDeps as g, type UnifiedSearchTextResult as h, createIdentityRewriter as i, createUserVoiceRewriter as j };
@@ -1,5 +1,6 @@
1
- import { FactType } from '@melandlabs/contracts';
1
+ import { Citation, FactType } from '@melandlabs/contracts';
2
2
  import { Peer } from '@melandlabs/contracts/peer';
3
+ import { MemoryApplicabilityContext } from '@melandlabs/memory-consolidation';
3
4
 
4
5
  /**
5
6
  * Iterative, LLM-driven memory retrieval.
@@ -130,7 +131,14 @@ declare function createIterativeRecallPlanner(deps: IterativeRecallPlannerDeps):
130
131
  */
131
132
  declare function createIdentityIterativePlanner(): IterativeRecallPlanner;
132
133
 
133
- type UnifiedMemorySearchSource = "memory" | "insights" | "knowledge";
134
+ type UnifiedMemorySearchSource = "memory" | "insights" | "knowledge" | "workspace";
135
+ /** Retrieval availability and candidate count before cross-source ranking and limits. */
136
+ interface SearchSourceState {
137
+ source: UnifiedMemorySearchSource;
138
+ status: "complete" | "partial" | "not_configured" | "not_ready" | "failed";
139
+ count: number;
140
+ message?: string;
141
+ }
134
142
  /**
135
143
  * A retrieval channel that contributed to a hit's final score.
136
144
  *
@@ -326,11 +334,13 @@ interface SessionNeighborExpansionOptions {
326
334
  maxNeighborSlots?: number;
327
335
  }
328
336
  interface UnifiedMemorySearchResult {
329
- type: "memory" | "insight" | "knowledge";
337
+ type: "memory" | "insight" | "knowledge" | "workspace";
330
338
  id: string;
331
339
  content: string;
332
340
  similarity: number;
333
341
  metadata: Record<string, unknown>;
342
+ /** Host-supplied evidence identity; absent fields remain explicitly unknown. */
343
+ provenance?: Partial<SearchEvidenceProvenance>;
334
344
  /**
335
345
  * Optional per-channel score breakdown. Always populated by the
336
346
  * pipeline when at least one channel contributed a non-empty list;
@@ -344,6 +354,7 @@ interface UnifiedMemorySearchOutput {
344
354
  results: UnifiedMemorySearchResult[];
345
355
  count: number;
346
356
  warnings: UnifiedMemorySearchWarning[];
357
+ sourceStates: SearchSourceState[];
347
358
  retrievalDiagnostics?: UnifiedMemoryRetrievalDiagnostics;
348
359
  /**
349
360
  * Diagnostic information about reasoning and date filtering. Present
@@ -424,7 +435,7 @@ type SearchSource = UnifiedMemorySearchSource;
424
435
  * Per-tier evidence bucket consulted by `reflect`-style synthesis.
425
436
  * Includes the `summary` tier that the read-only sources do not surface.
426
437
  */
427
- type SearchTier = "summary" | "raw" | "insight" | "knowledge";
438
+ type SearchTier = "summary" | "raw" | "insight" | "knowledge" | "workspace";
428
439
  interface SearchInput {
429
440
  userId: string;
430
441
  query: string;
@@ -488,11 +499,28 @@ interface SearchInput {
488
499
  */
489
500
  includeDeprecated?: boolean;
490
501
  }
502
+ /** Host-owned provenance. Null means unknown, never inferred from ranking or index readiness. */
503
+ interface SearchEvidenceProvenance {
504
+ citation: Citation | null;
505
+ origin: string | null;
506
+ businessReference: string | null;
507
+ version: string | number | null;
508
+ contentHash: string | null;
509
+ scope: readonly MemoryApplicabilityContext[] | null;
510
+ /** Empty means known to have no derivation; null means unknown. */
511
+ derivedFrom: readonly string[] | null;
512
+ confirmation: "confirmed" | "unconfirmed" | null;
513
+ freshness: {
514
+ sourceUpdatedAt: string | null;
515
+ indexedAt: string | null;
516
+ } | null;
517
+ }
491
518
  interface SearchEvidence {
492
519
  id: string;
493
520
  source: SearchSource | SearchTier;
494
521
  snippet: string;
495
522
  score: number;
523
+ provenance: SearchEvidenceProvenance;
496
524
  timestamp?: number;
497
525
  /**
498
526
  * Forwarded from the underlying hit's `metadata`. Surfaces per-fact
@@ -509,6 +537,7 @@ interface SearchOutput {
509
537
  evidence: SearchEvidence[];
510
538
  count: number;
511
539
  warnings: UnifiedMemorySearchWarning[];
540
+ sourceStates: SearchSourceState[];
512
541
  retrievalDiagnostics?: UnifiedMemoryRetrievalDiagnostics;
513
542
  reasoning?: UnifiedMemoryReasoningInfo;
514
543
  /** Only present when `synthesize` was truthy. */
@@ -594,4 +623,4 @@ interface EvidenceSelectorOptions {
594
623
  * changed ranking, or reranker-input changes. Disabled unless explicitly wired. */
595
624
  declare function createExtractiveEvidenceSelector(options: EvidenceSelectorOptions): EvidenceSelector;
596
625
 
597
- export { toMemoryResult as A, type EvidenceSelectorOptions as B, type IterativeRecallCandidate as C, type IterativeRecallCompletionOptions as D, type EvidenceSelector as E, type IterativeRecallExecutor as F, type IterativeRecallPlannerOptions as G, type HitChannel as H, type IterativeRecallPlanner as I, type IterativeRecallResult as J, type IterativeRecallSearchRequest as K, type IterativeRecallSearchResult as L, type IterativeRecallStats as M, type UnifiedMemoryReasoningInfo as N, createExtractiveEvidenceSelector as O, createIdentityIterativePlanner as P, createIterativeRecallPlanner as Q, type SearchTier as S, type UnifiedMemorySearchWarning as U, type SearchEvidence as a, type SearchInput as b, type SearchOutput as c, type UnifiedMemorySearchInput as d, type UnifiedMemorySearchOutput as e, type UnifiedMemorySearchResult as f, type HitSignals as g, type SearchSource as h, type SessionNeighborExpansionOptions as i, type UnifiedMemoryMergeStrategy as j, type UnifiedMemoryRankedList as k, type UnifiedMemoryReasoningStrategy as l, type UnifiedMemoryRrfWeights 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 };
626
+ export { normalizeUnifiedMemorySearchSources as A, toKnowledgeResult as B, toMemoryResult as C, type EvidenceSelectorOptions as D, type EvidenceSelector as E, type IterativeRecallCompletionOptions as F, type IterativeRecallExecutor as G, type HitChannel as H, type IterativeRecallCandidate as I, type IterativeRecallPlanner as J, type IterativeRecallPlannerOptions as K, type IterativeRecallResult as L, type IterativeRecallSearchRequest as M, type IterativeRecallSearchResult as N, type IterativeRecallStats as O, type UnifiedMemoryReasoningInfo as P, createExtractiveEvidenceSelector as Q, createIdentityIterativePlanner as R, type SearchTier as S, createIterativeRecallPlanner as T, type UnifiedMemorySearchWarning as U, type SearchEvidence as a, type SearchInput as b, type SearchOutput as c, type UnifiedMemorySearchInput as d, type UnifiedMemorySearchOutput as e, type UnifiedMemorySearchResult as f, type HitSignals as g, type SearchEvidenceProvenance as h, type SearchSource as i, type SearchSourceState as j, type SessionNeighborExpansionOptions as k, type UnifiedMemoryMergeStrategy as l, type UnifiedMemoryRankedList as m, type UnifiedMemoryReasoningStrategy as n, type UnifiedMemoryRrfWeights as o, type UnifiedMemorySearchSource as p, clampUnifiedMemorySearchLimit as q, clampUnifiedMemorySearchThreshold as r, deriveLexicalKeywords as s, isRawMemorySemanticResult as t, listNameToChannel as u, materializeSignals as v, mergeUnifiedMemorySearchResults as w, mergeUnifiedMemorySearchResultsRrf as x, normalizeUnifiedMemoryMergeStrategy as y, normalizeUnifiedMemoryReasoningStrategy as z };
package/dist/http.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { M as MemoryStoreConfig } from './config-9RzSCdXG.js';
1
+ import { M as MemoryStoreConfig } from './config-Cnk2b7fH.js';
2
2
  import '@melandlabs/memory-consolidation';
3
3
  import '@melandlabs/contracts/peer';
4
- import './evidence-selector-uOHsxwch.js';
4
+ import './evidence-selector-C_ZUQsio.js';
5
5
  import '@melandlabs/contracts';
6
6
  import '@melandlabs/contracts/derived-fact';
7
7
  import '@melandlabs/contracts/entity-edge';