@remnic/core 9.30.0 → 9.30.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/dist/index.js CHANGED
@@ -111,7 +111,7 @@ import {
111
111
  watchForChanges,
112
112
  writeManifest,
113
113
  writeMeetingEpisodeMemory
114
- } from "./chunk-PUS63Q3G.js";
114
+ } from "./chunk-YNQBRLC5.js";
115
115
  import {
116
116
  WEARABLE_SOURCE_PREFIX,
117
117
  buildExtractionTurns,
@@ -41,7 +41,7 @@ import {
41
41
  throwIfRecallAborted,
42
42
  tokenizeRecallQuery,
43
43
  utcDateKeysForLocalDay
44
- } from "./chunk-PUS63Q3G.js";
44
+ } from "./chunk-YNQBRLC5.js";
45
45
  import "./chunk-UV72DEZD.js";
46
46
  import "./chunk-I74SUMNI.js";
47
47
  import "./chunk-ILNPU5W5.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/core",
3
- "version": "9.30.0",
3
+ "version": "9.30.1",
4
4
  "description": "Framework-agnostic Remnic memory engine — orchestrator, storage, extraction, search, trust zones",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -3076,7 +3076,7 @@
3076
3076
  "core"
3077
3077
  ],
3078
3078
  "peerDependencies": {
3079
- "@remnic/coding-graph": "^9.30.0"
3079
+ "@remnic/coding-graph": "^9.30.1"
3080
3080
  },
3081
3081
  "peerDependenciesMeta": {
3082
3082
  "@remnic/coding-graph": {
@@ -0,0 +1,385 @@
1
+ /**
2
+ * recall-internal-deps.ts — the `RecallInternalDeps` contract (issue #1526
3
+ * seam 18), extracted from recall-internal.ts so that file can stay under
4
+ * its frozen ratchet ceiling while recall work proceeds (#2183). Pure type
5
+ * relocation: no behavior change, no renames, no member reordering.
6
+ */
7
+
8
+ import type { BoxBuilder } from "../boxes.js";
9
+ import type { CapabilitySet, GraphConstructionCapabilitySet } from "../capabilities.js";
10
+ import type { CausalTrajectorySearchResult } from "../causal-trajectory.js";
11
+ import type { CompoundingEngine } from "../compounding/engine.js";
12
+ import type { EvalShadowRecallRecord } from "../evals.js";
13
+ import type { HarmonicRetrievalResult } from "../harmonic-retrieval.js";
14
+ import type { StorageManager } from "../index.js";
15
+ import type { LcmEngine } from "../lcm/index.js";
16
+ import type { NamespaceCatalog } from "../namespaces/catalog.js";
17
+ import type { NamespaceStorageRouter } from "../namespaces/storage.js";
18
+ import type { ObjectiveStateSearchResult } from "../objective-state.js";
19
+ import type { IntentDebugSnapshot, QmdRecallSnapshot, QueryAwarePrefilter } from "../orchestrator.js";
20
+ import type { ProfilingCollector } from "../profiling.js";
21
+ import type { GraphRecallExpandedEntry, LastRecallBudgetSummary, LastRecallStore, RecallHandleHistoryStore } from "../recall-state.js";
22
+ import type { RecallXraySnapshot } from "../recall-xray.js";
23
+ import type { RerankCache } from "../rerank.js";
24
+ import type { SearchBackend, SearchDegradation, SearchQueryOptions } from "../search/port.js";
25
+ import type { VerifiedSemanticRuleResult } from "../semantic-rule-verifier.js";
26
+ import type { SharedContextManager } from "../shared-context/manager.js";
27
+ import type { HourlySummarizer } from "../summarizer.js";
28
+ import type { isValidAsOf } from "../temporal-validity.js";
29
+ import type { TmtBuilder } from "../tmt.js";
30
+ import type { TranscriptManager } from "../transcript.js";
31
+ import type { TrustStageResultItem } from "../trust-score-stage.js";
32
+ import type { TrustZoneSearchResult } from "../trust-zones.js";
33
+ import type { CodingContext, EngramTraceEvent, IdentityInjectionMode, MemoryFile, MemoryIntent, PluginConfig, QmdSearchResult, RecallPlanMode, RecallSectionConfig } from "../types.js";
34
+ import type { VerifiedEpisodeResult } from "../verified-recall.js";
35
+ import type { WorkProductLedgerSearchResult } from "../work-product-ledger.js";
36
+ import type { GraphRecallRankedResult, GraphRecallShadowComparison } from "./graph-recall-coordinator.js";
37
+ import type { RecallSectionAppendOptions, RecallSectionBuckets } from "./recall-section-coordinator.js";
38
+
39
+ export interface RecallInternalDeps {
40
+ readonly _recallWorkspaceOverrides: Map<string, string>;
41
+ appendRecallSection(
42
+ sectionBuckets: RecallSectionBuckets,
43
+ sectionId: string,
44
+ content: string,
45
+ options?: RecallSectionAppendOptions,
46
+ ): boolean;
47
+ applyColdFallbackPipeline(options: {
48
+ prompt: string;
49
+ recallNamespaces: string[];
50
+ recallResultLimit: number;
51
+ recallMode: RecallPlanMode;
52
+ /**
53
+ * Recall-operation capability gates resolved once at recall entry (#1523).
54
+ * OPTIONAL and additive: the recall pipeline threads a resolved set, but
55
+ * callers that omit it (e.g. direct unit-test invocations) get an
56
+ * equivalent config-derived set — behavior-preserving.
57
+ */
58
+ caps?: CapabilitySet;
59
+ /** Graph-construction gates resolved at recall entry (#1566 Cluster A). */
60
+ graphCaps?: GraphConstructionCapabilitySet;
61
+ queryAwarePrefilter?: QueryAwarePrefilter;
62
+ abortSignal?: AbortSignal;
63
+ /** Backend degradation observer — cold-tier QMD must report like hot (#1536). */
64
+ onDegradation?: (degradation: SearchDegradation) => void;
65
+ /** Issue #680 — historical recall point in ms-since-epoch. */
66
+ asOfMs?: number;
67
+ /**
68
+ * Optional out-parameter that receives the pre-MMR / pre-truncation
69
+ * pool size captured inside the pipeline (issue #570 PR 1). The
70
+ * X-ray capture block in `recallInternal` passes a small sink so
71
+ * the cold-fallback branch's pre-truncation pool size can be
72
+ * attributed back to the branch when `recallSource === "cold_fallback"`.
73
+ * Unset by default so existing call sites are unaffected.
74
+ */
75
+ xrayPoolSizeSink?: { size: number };
76
+ /**
77
+ * Issue #1577 — out-parameter that receives the TrustScore stage's
78
+ * per-path trust map (admitted + quarantined) when the cold path runs
79
+ * trust scoring. Mirrors the xrayPoolSizeSink pattern so recallInternal
80
+ can propagate trust data for epistemic rendering and X-ray visibility
81
+ without changing the cold pipeline's return type.
82
+ */
83
+ trustByPathSink?: { trustByPath: Map<string, TrustStageResultItem> | null };
84
+ deadlineAtMs?: number | null;
85
+ /** Issue #681 — when true, bypass graphTraversalConfidenceFloor. */
86
+ includeLowConfidence?: boolean;
87
+ }): Promise<QmdSearchResult[]>;
88
+ applyTrustScoreToBranch(
89
+ results: QmdSearchResult[],
90
+ namespaces: string[],
91
+ caps: CapabilitySet,
92
+ label: string,
93
+ preloadedFrontmatter?: ReadonlyMap<string, MemoryFile>,
94
+ abortSignal?: AbortSignal,
95
+ ): Promise<{
96
+ results: QmdSearchResult[];
97
+ trustByPath: Map<string, TrustStageResultItem> | null;
98
+ }>;
99
+ assembleRecallSections(
100
+ sectionBuckets: RecallSectionBuckets,
101
+ budgetOverride?: number,
102
+ ): {
103
+ sections: string[];
104
+ includedIds: string[];
105
+ omittedIds: string[];
106
+ truncated: boolean;
107
+ finalChars: number;
108
+ includedMemoryIds: string[];
109
+ includedMemoryPaths: string[];
110
+ includedMemoryNamespaces: Array<string | undefined>;
111
+ omittedMemoryIds: string[];
112
+ };
113
+ boostSearchResults(
114
+ results: QmdSearchResult[],
115
+ _recallNamespaces: string[],
116
+ prompt?: string,
117
+ preloadedMemoryMap?: Map<string, MemoryFile>,
118
+ options?: {
119
+ allowLifecycleFiltered?: boolean;
120
+ allowDedicatedSurface?: boolean;
121
+ /**
122
+ * Historical recall point in ms-since-epoch (issue #680). When
123
+ * set, drops candidates that were not authoritative at this
124
+ * instant per `temporal-validity.isValidAsOf`. Caller is
125
+ * responsible for parsing/validating the user-supplied ISO
126
+ * string at the input boundary (CLI / HTTP / MCP).
127
+ */
128
+ asOfMs?: number;
129
+ },
130
+ ): Promise<QmdSearchResult[]>;
131
+ boxBuilderFor(storage: StorageManager): BoxBuilder;
132
+ buildCompressionGuidelineRecallSection(): Promise<string | null>;
133
+ buildConfiguredQmdSearchOptions(
134
+ queryText: string,
135
+ ): SearchQueryOptions | undefined;
136
+ buildGraphRecallRankedResults(
137
+ results: QmdSearchResult[],
138
+ sourceLabelResolver: (path: string) => string[],
139
+ limit?: number,
140
+ ): GraphRecallRankedResult[];
141
+ buildIdentityContinuitySection(options: {
142
+ storage: StorageManager;
143
+ recallMode: RecallPlanMode;
144
+ prompt: string;
145
+ }): Promise<{
146
+ section: string;
147
+ mode: IdentityInjectionMode;
148
+ injectedChars: number;
149
+ truncated: boolean;
150
+ } | null>;
151
+ buildLastRecallBudgetSummary(options: {
152
+ requestedTopK?: number;
153
+ recallResultLimit: number;
154
+ qmdFetchLimit: number;
155
+ qmdHybridFetchLimit: number;
156
+ finalContextChars?: number;
157
+ truncated?: boolean;
158
+ includedSections?: string[];
159
+ omittedSections?: string[];
160
+ includedMemoryIds?: string[];
161
+ includedMemoryPaths?: string[];
162
+ includedMemoryNamespaces?: Array<string | undefined>;
163
+ omittedMemoryIds?: string[];
164
+ }): LastRecallBudgetSummary;
165
+ buildQueryAwarePrefilter(
166
+ prompt: string,
167
+ recallNamespaces: string[],
168
+ ): Promise<QueryAwarePrefilter>;
169
+ collectLastRecallSources(
170
+ sectionBuckets: RecallSectionBuckets,
171
+ recallSource:
172
+ | "none"
173
+ | "hot_qmd"
174
+ | "hot_embedding"
175
+ | "cold_fallback"
176
+ | "recent_scan",
177
+ ): string[];
178
+ readonly compounding?: CompoundingEngine;
179
+ readonly config: PluginConfig;
180
+ currentPolicyVersion(): string;
181
+ diversifyAndLimitRecallResults(
182
+ sectionId: string,
183
+ results: QmdSearchResult[],
184
+ limit: number,
185
+ retrievalQuery?: string,
186
+ caps?: CapabilitySet,
187
+ ): QmdSearchResult[];
188
+ effectiveCronRecallInstructionHeavyTokenCap(): number;
189
+ emitTrace(event: EngramTraceEvent): void;
190
+ expandResultsViaGraph(options: {
191
+ memoryResults: QmdSearchResult[];
192
+ recallNamespaces: string[];
193
+ recallResultLimit: number;
194
+ deadlineAtMs?: number | null;
195
+ includeLowConfidence?: boolean;
196
+ }): Promise<{
197
+ merged: QmdSearchResult[];
198
+ seedPaths: string[];
199
+ expandedPaths: GraphRecallExpandedEntry[];
200
+ seedResults: QmdSearchResult[];
201
+ }>;
202
+ extractMemoryIdsFromResults(results: QmdSearchResult[]): string[];
203
+ readonly fastLlmForRerank: {
204
+ chatCompletion: (
205
+ messages: Array<{ role: string; content: string }>,
206
+ options?: { maxTokens?: number; temperature?: number; timeoutMs?: number; operation?: string; priority?: "recall-critical" | "background" },
207
+ ) => Promise<{ content: string } | null>;
208
+ };
209
+ fetchQmdMemoryResultsWithArtifactTopUp(
210
+ prompt: string,
211
+ qmdFetchLimit: number,
212
+ qmdHybridFetchLimit: number,
213
+ options: {
214
+ namespacesEnabled: boolean;
215
+ recallNamespaces: string[];
216
+ resolveNamespace: (path: string) => string;
217
+ collection?: string;
218
+ queryAwarePrefilter?: QueryAwarePrefilter;
219
+ searchOptions?: SearchQueryOptions;
220
+ onDebugSnapshot?: (snapshot: QmdRecallSnapshot) => Promise<void>;
221
+ /** Backend degradation observer, threaded into every QMD call (#1536). */
222
+ onDegradation?: (degradation: SearchDegradation) => void;
223
+ abortSignal?: AbortSignal;
224
+ },
225
+ ): Promise<QmdSearchResult[]>;
226
+ filterSearchResultsForRecall(
227
+ results: QmdSearchResult[],
228
+ preloadedMemoryMap?: Map<string, MemoryFile>,
229
+ options?: {
230
+ allowLifecycleFiltered?: boolean;
231
+ allowDedicatedSurface?: boolean;
232
+ asOfMs?: number;
233
+ deadlineAtMs?: number | null;
234
+ abortSignal?: AbortSignal;
235
+ dropUnresolved?: boolean;
236
+ recallNamespaces?: readonly string[];
237
+ },
238
+ ): Promise<{ results: QmdSearchResult[]; memoryByPath: Map<string, MemoryFile> }>;
239
+ formatCausalTrajectoryResults(
240
+ results: CausalTrajectorySearchResult[],
241
+ ): string;
242
+ formatConversationRecallSection(
243
+ results: Array<{ path: string; snippet: string; score: number }>,
244
+ maxChars: number,
245
+ ): string | null;
246
+ formatHarmonicRetrievalResults(
247
+ results: HarmonicRetrievalResult[],
248
+ ): string;
249
+ formatObjectiveStateResults(
250
+ results: ObjectiveStateSearchResult[],
251
+ ): string;
252
+ formatQmdResults(
253
+ title: string,
254
+ results: QmdSearchResult[],
255
+ sessionKey?: string,
256
+ trustByPath?: Map<string, TrustStageResultItem> | null,
257
+ ): string;
258
+ formatTrustZoneResults(results: TrustZoneSearchResult[]): string;
259
+ formatVerifiedEpisodeResults(
260
+ results: VerifiedEpisodeResult[],
261
+ ): string;
262
+ formatVerifiedSemanticRuleResults(
263
+ results: VerifiedSemanticRuleResult[],
264
+ ): string;
265
+ formatWorkProductResults(
266
+ results: WorkProductLedgerSearchResult[],
267
+ ): string;
268
+ getCodingContextForSession(sessionKey: string | undefined): CodingContext | null;
269
+ getPeerIdForSession(sessionKey: string | undefined): string | null;
270
+ getRecallBudgetChars(override?: number): number;
271
+ getRecallSectionEntry(
272
+ sectionId: string,
273
+ ): RecallSectionConfig | undefined;
274
+ getRecallSectionMaxChars(
275
+ sectionId: string,
276
+ ): number | null | undefined;
277
+ getRecallSectionNumber(
278
+ sectionId: string,
279
+ key: keyof RecallSectionConfig,
280
+ ): number | undefined;
281
+ getStorage(namespace?: string): Promise<StorageManager>;
282
+ readonly handleHistory: RecallHandleHistoryStore;
283
+ trackMemoryAccess(
284
+ memoryIds: string[],
285
+ memoryPaths?: string[],
286
+ memoryNamespaces?: Array<string | undefined>,
287
+ ): void;
288
+ trackRecallBackgroundWrite(promise: Promise<void>, label: string): void;
289
+ isRecallSectionEnabled(
290
+ sectionId: string,
291
+ defaultEnabled?: boolean,
292
+ ): boolean;
293
+ isSpecializedRecallSectionEnabled(
294
+ sectionId: string,
295
+ topLevelEnabled: boolean,
296
+ ): boolean;
297
+ lastQmdReprobeAtMs: number;
298
+ readonly lastRecall: LastRecallStore;
299
+ lastXraySnapshot: RecallXraySnapshot | null;
300
+ readonly lcmEngine: LcmEngine | null;
301
+ readonly namespaceCatalog: NamespaceCatalog;
302
+ namespaceFromPath(p: string): string;
303
+ readonly profiler: ProfilingCollector;
304
+ publishRecallResults(options: {
305
+ title: string;
306
+ results: QmdSearchResult[];
307
+ sectionBuckets: RecallSectionBuckets;
308
+ retrievalQuery: string;
309
+ sessionKey: string | undefined;
310
+ identityInjection?: {
311
+ mode: IdentityInjectionMode | "none";
312
+ injectedChars: number;
313
+ truncated: boolean;
314
+ };
315
+ /**
316
+ * Issue #1577 — per-recall trust map. When present, quarantined items
317
+ * are filtered from injection on EVERY recall path (hot QMD, embedding
318
+ * fallback, cold archive, recent) so a faithfulness-contradicted memory
319
+ * cannot sneak in via a branch that bypasses trust scoring (review:
320
+ * fallback paths bypass trust). The map is also threaded to
321
+ * formatQmdResults for the epistemic hedge.
322
+ */
323
+ trustByPath?: Map<string, TrustStageResultItem> | null;
324
+ }): void;
325
+ readonly qmd: SearchBackend;
326
+ queueEvalShadowRecall(
327
+ record: Omit<EvalShadowRecallRecord, "schemaVersion">,
328
+ ): void;
329
+ readAllMemoriesForNamespaces(
330
+ namespaces: string[],
331
+ ): Promise<MemoryFile[]>;
332
+ recallArtifactsAcrossNamespaces(
333
+ prompt: string,
334
+ recallNamespaces: string[],
335
+ targetCount: number,
336
+ ): Promise<MemoryFile[]>;
337
+ recallAssemblyClockMs(): number;
338
+ recordLastGraphRecallSnapshot(options: {
339
+ storage: StorageManager;
340
+ prompt: string;
341
+ recallMode: RecallPlanMode;
342
+ recallNamespaces: string[];
343
+ seedPaths: string[];
344
+ expandedPaths: GraphRecallExpandedEntry[];
345
+ status: "completed" | "skipped" | "aborted";
346
+ reason?: string;
347
+ shadowMode?: boolean;
348
+ queryIntent: MemoryIntent;
349
+ seedResults?: GraphRecallRankedResult[];
350
+ finalResults?: GraphRecallRankedResult[];
351
+ shadowComparison?: GraphRecallShadowComparison;
352
+ }): Promise<void>;
353
+ recordLastIntentSnapshot(options: {
354
+ storage: StorageManager;
355
+ snapshot: IntentDebugSnapshot;
356
+ }): Promise<void>;
357
+ recordLastIntentSnapshotForNamespace(options: {
358
+ namespace: string;
359
+ snapshot: IntentDebugSnapshot;
360
+ }): Promise<void>;
361
+ recordLastQmdRecallSnapshot(options: {
362
+ storage: StorageManager;
363
+ snapshot: QmdRecallSnapshot;
364
+ }): Promise<void>;
365
+ readonly rerankCache: RerankCache;
366
+ searchConversationRecallResults(
367
+ retrievalQuery: string,
368
+ topK: number,
369
+ ): Promise<Array<{ path: string; snippet: string; score: number }>>;
370
+ searchEmbeddingFallback(
371
+ query: string,
372
+ limit: number,
373
+ ): Promise<QmdSearchResult[]>;
374
+ readonly sharedContext?: SharedContextManager;
375
+ readonly storage: StorageManager;
376
+ readonly storageRouter: NamespaceStorageRouter;
377
+ readonly summarizer: HourlySummarizer;
378
+ readonly tmtBuilder: TmtBuilder;
379
+ readonly transcript: TranscriptManager;
380
+ truncateArtifactForRecall(text: string, maxChars?: number): string;
381
+ truncateRecallSectionToBudget(
382
+ content: string,
383
+ maxChars: number,
384
+ ): string;
385
+ }