@remnic/core 9.9.3 → 9.9.4

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.
Files changed (31) hide show
  1. package/dist/access-admin-ops-surface.js +1 -1
  2. package/dist/access-boundary.js +1 -1
  3. package/dist/access-cli.js +5 -5
  4. package/dist/access-http.js +3 -3
  5. package/dist/access-identity-continuity-surface.js +1 -1
  6. package/dist/access-lcm-surface.js +1 -1
  7. package/dist/access-mcp.js +2 -2
  8. package/dist/access-observe-write-surface.js +1 -1
  9. package/dist/access-operations-batch.js +1 -1
  10. package/dist/access-operations.js +2 -2
  11. package/dist/access-recall-concurrency.js +1 -1
  12. package/dist/access-recall-response.js +1 -1
  13. package/dist/access-recall-surface.js +1 -1
  14. package/dist/access-service.js +1 -1
  15. package/dist/{chunk-SOTYFJOA.js → chunk-226RNKRU.js} +3 -3
  16. package/dist/{chunk-KQILYXND.js → chunk-3HYWNJDA.js} +31 -2
  17. package/dist/{chunk-KQILYXND.js.map → chunk-3HYWNJDA.js.map} +1 -1
  18. package/dist/{chunk-XPR7572Y.js → chunk-7PY55HMI.js} +2 -2
  19. package/dist/{chunk-B4C3JSJT.js → chunk-I4NJ2CDY.js} +2 -2
  20. package/dist/{chunk-DZQZHQQ4.js → chunk-UDIJMITR.js} +3 -3
  21. package/dist/cli.js +4 -4
  22. package/dist/index.js +5 -5
  23. package/dist/orchestrator.js +5 -5
  24. package/package.json +2 -2
  25. package/src/access-recall-response.ts +11 -2
  26. package/src/orchestration/recall-result-formatter-display-safe.test.ts +51 -0
  27. package/src/orchestration/recall-result-formatter.ts +59 -0
  28. /package/dist/{chunk-SOTYFJOA.js.map → chunk-226RNKRU.js.map} +0 -0
  29. /package/dist/{chunk-XPR7572Y.js.map → chunk-7PY55HMI.js.map} +0 -0
  30. /package/dist/{chunk-B4C3JSJT.js.map → chunk-I4NJ2CDY.js.map} +0 -0
  31. /package/dist/{chunk-DZQZHQQ4.js.map → chunk-UDIJMITR.js.map} +0 -0
@@ -329,7 +329,7 @@ import {
329
329
  clusterByKey,
330
330
  createCorrectionService,
331
331
  detectPassiveCorrections
332
- } from "./chunk-KQILYXND.js";
332
+ } from "./chunk-3HYWNJDA.js";
333
333
  import {
334
334
  importCapsule
335
335
  } from "./chunk-ALSGMEJR.js";
@@ -24004,4 +24004,4 @@ export {
24004
24004
  blendGraphExpandedRecallScore,
24005
24005
  Orchestrator
24006
24006
  };
24007
- //# sourceMappingURL=chunk-XPR7572Y.js.map
24007
+ //# sourceMappingURL=chunk-7PY55HMI.js.map
@@ -9,7 +9,7 @@ import {
9
9
  DECISION_SUBCOMMANDS,
10
10
  DELTA_SUBCOMMANDS,
11
11
  isCodegraphToolName
12
- } from "./chunk-KQILYXND.js";
12
+ } from "./chunk-3HYWNJDA.js";
13
13
  import {
14
14
  serializeMutations,
15
15
  withHeldFileLock
@@ -1807,4 +1807,4 @@ export {
1807
1807
  codegraphIngestTracesOperation,
1808
1808
  REGISTERED_OPERATIONS
1809
1809
  };
1810
- //# sourceMappingURL=chunk-B4C3JSJT.js.map
1810
+ //# sourceMappingURL=chunk-I4NJ2CDY.js.map
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-XRNU7OEQ.js";
20
20
  import {
21
21
  RelayMissionStoreError
22
- } from "./chunk-B4C3JSJT.js";
22
+ } from "./chunk-I4NJ2CDY.js";
23
23
  import {
24
24
  executeResolution,
25
25
  isValidResolutionVerb
@@ -37,7 +37,7 @@ import {
37
37
  } from "./chunk-KF5EUVKQ.js";
38
38
  import {
39
39
  CorrectionContractError
40
- } from "./chunk-KQILYXND.js";
40
+ } from "./chunk-3HYWNJDA.js";
41
41
  import {
42
42
  isTrustZoneName
43
43
  } from "./chunk-JGSKJHF7.js";
@@ -3132,4 +3132,4 @@ function positiveIntQueryParam(value, label) {
3132
3132
  export {
3133
3133
  EngramAccessHttpServer
3134
3134
  };
3135
- //# sourceMappingURL=chunk-DZQZHQQ4.js.map
3135
+ //# sourceMappingURL=chunk-UDIJMITR.js.map
package/dist/cli.js CHANGED
@@ -90,7 +90,7 @@ import {
90
90
  runWorkProductStatusCliCommand,
91
91
  runWorkProjectCliCommand,
92
92
  runWorkTaskCliCommand
93
- } from "./chunk-SOTYFJOA.js";
93
+ } from "./chunk-226RNKRU.js";
94
94
  import "./chunk-MMACM5G2.js";
95
95
  import "./chunk-54BGIBCR.js";
96
96
  import "./chunk-H4CKS5B2.js";
@@ -170,7 +170,7 @@ import "./chunk-K6MV3TRQ.js";
170
170
  import "./chunk-PIG4WJFQ.js";
171
171
  import "./chunk-KFZY2OFH.js";
172
172
  import "./chunk-LBJBNWS2.js";
173
- import "./chunk-DZQZHQQ4.js";
173
+ import "./chunk-UDIJMITR.js";
174
174
  import "./chunk-V7IZKJI3.js";
175
175
  import "./chunk-MKQBXQKU.js";
176
176
  import "./chunk-SEDEKFYQ.js";
@@ -183,7 +183,7 @@ import "./chunk-7RXCMVFQ.js";
183
183
  import "./chunk-XRNU7OEQ.js";
184
184
  import "./chunk-IC2TCZJ2.js";
185
185
  import "./chunk-D24OXEPB.js";
186
- import "./chunk-B4C3JSJT.js";
186
+ import "./chunk-I4NJ2CDY.js";
187
187
  import "./chunk-YO3ZB3PJ.js";
188
188
  import "./chunk-HNZKVLAN.js";
189
189
  import "./chunk-EQWEIIKQ.js";
@@ -196,7 +196,7 @@ import "./chunk-TC5HBIIT.js";
196
196
  import "./chunk-5RUE3GHQ.js";
197
197
  import "./chunk-OADWQ5CR.js";
198
198
  import "./chunk-KF5EUVKQ.js";
199
- import "./chunk-KQILYXND.js";
199
+ import "./chunk-3HYWNJDA.js";
200
200
  import "./chunk-GDASG7NC.js";
201
201
  import "./chunk-GDB4J2H3.js";
202
202
  import "./chunk-ALSGMEJR.js";
package/dist/index.js CHANGED
@@ -96,7 +96,7 @@ import {
96
96
  validateTaxonomy,
97
97
  watchForChanges,
98
98
  writeManifest
99
- } from "./chunk-XPR7572Y.js";
99
+ } from "./chunk-7PY55HMI.js";
100
100
  import {
101
101
  WEARABLE_SOURCE_PREFIX,
102
102
  buildExtractionTurns,
@@ -350,7 +350,7 @@ import {
350
350
  registerTrainingExportAdapter,
351
351
  runBulkImportCliCommand,
352
352
  runWearablesCliCommand
353
- } from "./chunk-SOTYFJOA.js";
353
+ } from "./chunk-226RNKRU.js";
354
354
  import "./chunk-MMACM5G2.js";
355
355
  import "./chunk-54BGIBCR.js";
356
356
  import "./chunk-H4CKS5B2.js";
@@ -554,7 +554,7 @@ import {
554
554
  import "./chunk-H3FZVNRN.js";
555
555
  import {
556
556
  EngramAccessHttpServer
557
- } from "./chunk-DZQZHQQ4.js";
557
+ } from "./chunk-UDIJMITR.js";
558
558
  import {
559
559
  WearablesInputError,
560
560
  describeErrorForOperator
@@ -598,7 +598,7 @@ import {
598
598
  relayMissionAppendOperation,
599
599
  relayMissionReadOperation,
600
600
  relayMissionReceiptDigest
601
- } from "./chunk-B4C3JSJT.js";
601
+ } from "./chunk-I4NJ2CDY.js";
602
602
  import "./chunk-YO3ZB3PJ.js";
603
603
  import "./chunk-HNZKVLAN.js";
604
604
  import "./chunk-EQWEIIKQ.js";
@@ -647,7 +647,7 @@ import {
647
647
  EngramAccessService,
648
648
  computeProcedureStats,
649
649
  formatProcedureStatsText
650
- } from "./chunk-KQILYXND.js";
650
+ } from "./chunk-3HYWNJDA.js";
651
651
  import "./chunk-GDASG7NC.js";
652
652
  import "./chunk-GDB4J2H3.js";
653
653
  import "./chunk-ALSGMEJR.js";
@@ -41,7 +41,7 @@ import {
41
41
  throwIfRecallAborted,
42
42
  tokenizeRecallQuery,
43
43
  utcDateKeysForLocalDay
44
- } from "./chunk-XPR7572Y.js";
44
+ } from "./chunk-7PY55HMI.js";
45
45
  import "./chunk-5SB7SC2G.js";
46
46
  import "./chunk-3332THSR.js";
47
47
  import "./chunk-I74SUMNI.js";
@@ -125,7 +125,7 @@ import "./chunk-Q6IP2ARR.js";
125
125
  import "./chunk-6HEM6HTQ.js";
126
126
  import "./chunk-6QYST5XN.js";
127
127
  import "./chunk-YUQOAKPX.js";
128
- import "./chunk-SOTYFJOA.js";
128
+ import "./chunk-226RNKRU.js";
129
129
  import "./chunk-MMACM5G2.js";
130
130
  import "./chunk-54BGIBCR.js";
131
131
  import "./chunk-H4CKS5B2.js";
@@ -218,7 +218,7 @@ import "./chunk-LBJBNWS2.js";
218
218
  import "./chunk-KD3QD3A5.js";
219
219
  import "./chunk-MYVPLJOO.js";
220
220
  import "./chunk-H3FZVNRN.js";
221
- import "./chunk-DZQZHQQ4.js";
221
+ import "./chunk-UDIJMITR.js";
222
222
  import "./chunk-V7IZKJI3.js";
223
223
  import "./chunk-MKQBXQKU.js";
224
224
  import "./chunk-SEDEKFYQ.js";
@@ -231,7 +231,7 @@ import "./chunk-7RXCMVFQ.js";
231
231
  import "./chunk-XRNU7OEQ.js";
232
232
  import "./chunk-IC2TCZJ2.js";
233
233
  import "./chunk-D24OXEPB.js";
234
- import "./chunk-B4C3JSJT.js";
234
+ import "./chunk-I4NJ2CDY.js";
235
235
  import "./chunk-YO3ZB3PJ.js";
236
236
  import "./chunk-HNZKVLAN.js";
237
237
  import "./chunk-EQWEIIKQ.js";
@@ -247,7 +247,7 @@ import "./chunk-KF5EUVKQ.js";
247
247
  import {
248
248
  hasIdentityRecoveryIntent,
249
249
  resolveEffectiveIdentityInjectionMode
250
- } from "./chunk-KQILYXND.js";
250
+ } from "./chunk-3HYWNJDA.js";
251
251
  import "./chunk-GDASG7NC.js";
252
252
  import "./chunk-GDB4J2H3.js";
253
253
  import "./chunk-ALSGMEJR.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/core",
3
- "version": "9.9.3",
3
+ "version": "9.9.4",
4
4
  "description": "Framework-agnostic Remnic memory engine — orchestrator, storage, extraction, search, trust zones",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -3045,7 +3045,7 @@
3045
3045
  "core"
3046
3046
  ],
3047
3047
  "peerDependencies": {
3048
- "@remnic/coding-graph": "^9.9.3"
3048
+ "@remnic/coding-graph": "^9.9.4"
3049
3049
  },
3050
3050
  "peerDependenciesMeta": {
3051
3051
  "@remnic/coding-graph": {
@@ -15,7 +15,7 @@ import { type BudgetDecision, toBudgetWarning } from "./cross-namespace-budget.j
15
15
  import { decideDisclosureEscalation } from "./recall-disclosure-escalation.js";
16
16
  import { type TagMatchMode, applyTagFilter, normalizeTags, parseTagMatch } from "./recall-tag-filter.js";
17
17
  import type { RecallDisclosure, RecallPlanMode } from "./types.js";
18
- import { displaySafeBudgetsApplied } from "./orchestration/recall-result-formatter.js";
18
+ import { displaySafeBudgetsApplied, displaySafeRecallSnapshot } from "./orchestration/recall-result-formatter.js";
19
19
 
20
20
  /**
21
21
  * Build the recall response from the completed pipeline (issue #1906 review
@@ -238,6 +238,15 @@ export async function assembleRecallResponse(
238
238
  request.includeDebug === true,
239
239
  request.sessionKey,
240
240
  );
241
+ // Relativize the debug snapshot's absolute internal paths (#2077). The
242
+ // snapshot returned by buildRecallDebug is the LIVE cached object (kept
243
+ // absolute for tracking/x-ray), so build a display-safe COPY rather than
244
+ // mutating it — mirroring the top-level `budgetsApplied` relativization.
245
+ const debugSnapshot = debug?.snapshot;
246
+ const safeDebug =
247
+ debug && debugSnapshot
248
+ ? { ...debug, snapshot: displaySafeRecallSnapshot(debugSnapshot, deps.orchestrator.config.memoryDir) }
249
+ : debug;
241
250
 
242
251
  // Fire-and-forget audit recording. Must never block or crash recall.
243
252
  let auditAnomalies: AccessAuditResult["anomalies"] | undefined;
@@ -295,7 +304,7 @@ export async function assembleRecallResponse(
295
304
  auditAnomalies,
296
305
  budgetWarning: toBudgetWarning(budgetDecision),
297
306
  latencyMs: snapshot?.latencyMs ?? (Date.now() - startedAt),
298
- debug,
307
+ debug: safeDebug,
299
308
  },
300
309
  // Non-null when this recall reserved a cross-namespace budget event at
301
310
  // admission (#1906). Single-flight followers use it to record their OWN
@@ -0,0 +1,51 @@
1
+ import test from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { displaySafeRecallSnapshot } from "./recall-result-formatter.js";
4
+
5
+ test("displaySafeRecallSnapshot relativizes result, budget, and tier-anchor paths without mutating input (#2077)", () => {
6
+ const memoryDir = "/srv/memory";
7
+ const flatAbs = `${memoryDir}/facts/2026-07-19/b.md`;
8
+ const nsResultAbs = `${memoryDir}/namespaces/tok-team/facts/2026-07-19/r.md`;
9
+ // An anchor that is NOT among the returned results — no authoritative owner.
10
+ const unmatchedAnchorAbs = `${memoryDir}/namespaces/ns-616c706861/facts/2026-07-19/a.md`;
11
+ const snapshot = {
12
+ resultPaths: [flatAbs, nsResultAbs],
13
+ resultNamespaces: [undefined, "team-alpha"],
14
+ budgetsApplied: {
15
+ includedMemoryPaths: [flatAbs, nsResultAbs],
16
+ includedMemoryNamespaces: [undefined, "team-alpha"],
17
+ },
18
+ tierExplain: {
19
+ tier: "direct-answer",
20
+ tierReason: "single high-confidence hit",
21
+ filteredBy: [],
22
+ candidatesConsidered: 2,
23
+ latencyMs: 1,
24
+ sourceAnchors: [
25
+ { path: nsResultAbs, lineRange: [1, 2] as [number, number] },
26
+ { path: unmatchedAnchorAbs },
27
+ { path: flatAbs },
28
+ ],
29
+ },
30
+ };
31
+
32
+ const safe = displaySafeRecallSnapshot(snapshot, memoryDir);
33
+
34
+ assert.deepEqual(safe.resultPaths, ["facts/2026-07-19/b.md", "team-alpha/facts/2026-07-19/r.md"]);
35
+ assert.deepEqual(safe.budgetsApplied.includedMemoryPaths, [
36
+ "facts/2026-07-19/b.md",
37
+ "team-alpha/facts/2026-07-19/r.md",
38
+ ]);
39
+ assert.deepEqual(safe.tierExplain.sourceAnchors, [
40
+ // Anchor coincides with a namespaced result → reuses its authoritative namespace.
41
+ { path: "team-alpha/facts/2026-07-19/r.md", lineRange: [1, 2] },
42
+ // Anchor not among the results → truthful storage-relative segment, never a decode.
43
+ { path: "namespaces/ns-616c706861/facts/2026-07-19/a.md" },
44
+ // Anchor coincides with a default-namespace result → memoryDir-relative.
45
+ { path: "facts/2026-07-19/b.md" },
46
+ ]);
47
+
48
+ // The input snapshot must not be mutated — the live cache keeps absolute paths.
49
+ assert.equal(snapshot.tierExplain.sourceAnchors[0].path, nsResultAbs);
50
+ assert.equal(snapshot.resultPaths[1], nsResultAbs);
51
+ });
@@ -114,6 +114,65 @@ export function displaySafeBudgetsApplied<
114
114
  };
115
115
  }
116
116
 
117
+ /**
118
+ * Return a display-safe copy of a recall snapshot for the `includeDebug=true`
119
+ * surface (#2077). `resultPaths` and `budgetsApplied.includedMemoryPaths` are
120
+ * rendered namespace-relative from their aligned namespace metadata; a
121
+ * `tierExplain.sourceAnchors[]` entry reuses that SAME authoritative metadata
122
+ * when its absolute path matches a result/included path, and otherwise falls
123
+ * back to the memoryDir-relative on-disk form. Either way the debug flag never
124
+ * leaks absolute operator paths, and an anchor is never attributed to a decoded
125
+ * (guessed) namespace — an anchor carries no owner of its own. Returns a
126
+ * shallow copy; the input snapshot is never mutated.
127
+ */
128
+ export function displaySafeRecallSnapshot<
129
+ T extends {
130
+ resultPaths?: string[];
131
+ resultNamespaces?: Array<string | undefined>;
132
+ budgetsApplied?: {
133
+ includedMemoryPaths?: string[];
134
+ includedMemoryNamespaces?: Array<string | undefined>;
135
+ };
136
+ tierExplain?: {
137
+ sourceAnchors?: Array<{ path: string; lineRange?: [number, number] }>;
138
+ };
139
+ },
140
+ >(snapshot: T, memoryDir: string): T {
141
+ const resultPaths = snapshot.resultPaths?.map((p, i) =>
142
+ displayResultPath(p, memoryDir, snapshot.resultNamespaces?.[i]),
143
+ );
144
+ // Authoritative absolute-path -> namespace map recorded at capture time, so a
145
+ // tier anchor that coincides with a returned result renders under the SAME
146
+ // namespace as that result instead of the raw storage segment (#2077).
147
+ const namespaceByPath = new Map<string, string | undefined>();
148
+ snapshot.resultPaths?.forEach((p, i) => {
149
+ if (!namespaceByPath.has(p)) namespaceByPath.set(p, snapshot.resultNamespaces?.[i]);
150
+ });
151
+ snapshot.budgetsApplied?.includedMemoryPaths?.forEach((p, i) => {
152
+ if (!namespaceByPath.has(p)) {
153
+ namespaceByPath.set(p, snapshot.budgetsApplied?.includedMemoryNamespaces?.[i]);
154
+ }
155
+ });
156
+ const tierExplain =
157
+ snapshot.tierExplain?.sourceAnchors
158
+ ? {
159
+ ...snapshot.tierExplain,
160
+ sourceAnchors: snapshot.tierExplain.sourceAnchors.map((anchor) => ({
161
+ ...anchor,
162
+ path: displayResultPath(anchor.path, memoryDir, namespaceByPath.get(anchor.path)),
163
+ })),
164
+ }
165
+ : undefined;
166
+ return {
167
+ ...snapshot,
168
+ ...(resultPaths ? { resultPaths } : {}),
169
+ ...(snapshot.budgetsApplied
170
+ ? { budgetsApplied: displaySafeBudgetsApplied(snapshot.budgetsApplied, memoryDir) }
171
+ : {}),
172
+ ...(tierExplain ? { tierExplain } : {}),
173
+ };
174
+ }
175
+
117
176
  // ---------------------------------------------------------------------------
118
177
  // Coordinator
119
178
  // ---------------------------------------------------------------------------