@remnic/core 9.3.709 → 9.3.711

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 (53) hide show
  1. package/dist/access-boundary.js +4 -4
  2. package/dist/access-cli.js +7 -7
  3. package/dist/access-http.js +8 -8
  4. package/dist/access-mcp.js +7 -7
  5. package/dist/access-operations-batch.js +5 -5
  6. package/dist/access-operations.js +6 -6
  7. package/dist/access-service.js +3 -3
  8. package/dist/{chunk-OK7FUX6R.js → chunk-4P5UAL3C.js} +46 -1
  9. package/dist/chunk-4P5UAL3C.js.map +1 -0
  10. package/dist/{chunk-NK3SPJLM.js → chunk-5KQCOIPW.js} +7 -7
  11. package/dist/{chunk-Y6PIFKXX.js → chunk-5QUS24F7.js} +22 -2
  12. package/dist/chunk-5QUS24F7.js.map +1 -0
  13. package/dist/{chunk-VWB3HDY6.js → chunk-A2R5NV6O.js} +4 -4
  14. package/dist/{chunk-XD33EX2F.js → chunk-AMXOCZHE.js} +3 -3
  15. package/dist/{chunk-2T4TDXPC.js → chunk-GKPIY7EQ.js} +13 -3
  16. package/dist/chunk-GKPIY7EQ.js.map +1 -0
  17. package/dist/{chunk-KOEKDZ6A.js → chunk-I3BT2IDW.js} +3 -3
  18. package/dist/{chunk-AZVHBFI3.js → chunk-OWOKOFXK.js} +9 -1
  19. package/dist/chunk-OWOKOFXK.js.map +1 -0
  20. package/dist/{chunk-EVX52NCY.js → chunk-YVWZW37D.js} +3 -3
  21. package/dist/{chunk-P6PRSI3W.js → chunk-Z3B2YW56.js} +3 -3
  22. package/dist/{chunk-JQ7XVM4V.js → chunk-ZBG4K36I.js} +2 -2
  23. package/dist/{chunk-PKE7EJMX.js → chunk-ZVDRL6SK.js} +2 -2
  24. package/dist/cli.js +11 -11
  25. package/dist/index.js +12 -12
  26. package/dist/operator-toolkit.d.ts +19 -1
  27. package/dist/operator-toolkit.js +3 -1
  28. package/dist/orchestrator.js +2 -2
  29. package/dist/recall-explain-renderer.js +2 -2
  30. package/dist/recall-xray-cli.js +3 -3
  31. package/dist/recall-xray-renderer.js +2 -2
  32. package/dist/recall-xray.d.ts +14 -0
  33. package/dist/recall-xray.js +1 -1
  34. package/dist/schemas.d.ts +22 -22
  35. package/dist/transfer/types.d.ts +12 -12
  36. package/package.json +2 -2
  37. package/src/operator-toolkit.ts +80 -0
  38. package/src/orchestrator.ts +13 -0
  39. package/src/provenance-surfaces.test.ts +254 -0
  40. package/src/recall-xray-renderer.ts +28 -0
  41. package/src/recall-xray.ts +32 -0
  42. package/dist/chunk-2T4TDXPC.js.map +0 -1
  43. package/dist/chunk-AZVHBFI3.js.map +0 -1
  44. package/dist/chunk-OK7FUX6R.js.map +0 -1
  45. package/dist/chunk-Y6PIFKXX.js.map +0 -1
  46. /package/dist/{chunk-NK3SPJLM.js.map → chunk-5KQCOIPW.js.map} +0 -0
  47. /package/dist/{chunk-VWB3HDY6.js.map → chunk-A2R5NV6O.js.map} +0 -0
  48. /package/dist/{chunk-XD33EX2F.js.map → chunk-AMXOCZHE.js.map} +0 -0
  49. /package/dist/{chunk-KOEKDZ6A.js.map → chunk-I3BT2IDW.js.map} +0 -0
  50. /package/dist/{chunk-EVX52NCY.js.map → chunk-YVWZW37D.js.map} +0 -0
  51. /package/dist/{chunk-P6PRSI3W.js.map → chunk-Z3B2YW56.js.map} +0 -0
  52. /package/dist/{chunk-JQ7XVM4V.js.map → chunk-ZBG4K36I.js.map} +0 -0
  53. /package/dist/{chunk-PKE7EJMX.js.map → chunk-ZVDRL6SK.js.map} +0 -0
@@ -14,10 +14,10 @@ import {
14
14
  } from "./chunk-NUWZFSKC.js";
15
15
  import {
16
16
  getOperation
17
- } from "./chunk-PKE7EJMX.js";
17
+ } from "./chunk-ZVDRL6SK.js";
18
18
  import {
19
19
  EngramAccessInputError
20
- } from "./chunk-EVX52NCY.js";
20
+ } from "./chunk-YVWZW37D.js";
21
21
  import {
22
22
  projectTagProjectId
23
23
  } from "./chunk-SHRRWOVY.js";
@@ -3359,4 +3359,4 @@ ${body}`;
3359
3359
  export {
3360
3360
  EngramMcpServer
3361
3361
  };
3362
- //# sourceMappingURL=chunk-KOEKDZ6A.js.map
3362
+ //# sourceMappingURL=chunk-I3BT2IDW.js.map
@@ -189,6 +189,14 @@ function cloneResult(result) {
189
189
  if (provenance !== void 0) {
190
190
  out.provenance = provenance;
191
191
  }
192
+ const ss = result.sourceSpan;
193
+ if (ss && typeof ss.quote === "string" && typeof ss.observedAt === "string" && (ss.provenance === "verified" || ss.provenance === "unverified" || ss.provenance === "none")) {
194
+ out.sourceSpan = {
195
+ quote: ss.quote,
196
+ observedAt: ss.observedAt,
197
+ provenance: ss.provenance
198
+ };
199
+ }
192
200
  return out;
193
201
  }
194
202
  function summarizeDisclosureTokens(results) {
@@ -269,4 +277,4 @@ export {
269
277
  RecallXrayBuilder,
270
278
  summarizeDisclosureTokens
271
279
  };
272
- //# sourceMappingURL=chunk-AZVHBFI3.js.map
280
+ //# sourceMappingURL=chunk-OWOKOFXK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/recall-xray.ts"],"sourcesContent":["/**\n * Recall X-ray snapshot schema (issue #570, PR 1).\n *\n * The X-ray surface is the unified, per-result attribution document that\n * merges the tier that served each memory, its score decomposition, any\n * graph path, an audit entry id, and the exact filter/eligibility ladder\n * that either admitted or rejected each candidate. This file defines the\n * schema and an in-memory builder + builder-state helper.\n *\n * Scope for PR 1 (this slice):\n * - Types only + pure builder functions (no IO, no rendering).\n * - Orchestrator plumbing captures a snapshot when the caller passes\n * `xrayCapture: true`. No behavior change when the flag is absent.\n * - NO new public surfaces here — CLI/HTTP/MCP land in later slices.\n *\n * The shared renderer lands in PR 2 at `recall-xray-renderer.ts`. Do not\n * fork formatting logic into other surfaces; extend the renderer.\n */\n\nimport { randomUUID } from \"node:crypto\";\n\nimport {\n normalizeRetrievedMemoryProvenance,\n type RetrievedMemoryProvenance,\n} from \"./memory-provenance.js\";\nimport type { RecallDisclosure, RecallTierExplain } from \"./types.js\";\nimport { isRecallDisclosure } from \"./types.js\";\n\n/**\n * Estimate token cost of a payload at the rough ~4 chars/token English\n * heuristic. Non-negative integer; returns 0 for empty / null input.\n * Used by recall surfaces to attach `estimatedTokens` to X-ray results\n * (issue #677 PR 3/4). Identical to the private heuristic in\n * `chunking.ts`; kept self-contained here so X-ray callers don't pull\n * in chunking internals.\n */\nexport function estimateRecallTokens(text: string | null | undefined): number {\n if (typeof text !== \"string\" || text.length === 0) return 0;\n return Math.ceil(text.length / 4);\n}\n\n/**\n * Aggregated per-disclosure token spend summary, computed by the\n * renderer from a snapshot's results. Non-negative integers.\n */\nexport interface RecallXrayDisclosureSummary {\n chunk: { count: number; estimatedTokens: number };\n section: { count: number; estimatedTokens: number };\n raw: { count: number; estimatedTokens: number };\n /** Number of results without a recorded disclosure level. */\n unspecified: { count: number; estimatedTokens: number };\n}\n\n/**\n * Which retrieval source produced a given result. This is the X-ray\n * tier ladder called out in issue #570 and is *distinct* from the\n * `RetrievalTier` enum (which describes issue #518's tier-explain\n * block). Keeping the sets separate lets the two observability\n * surfaces evolve without conflating their vocabularies:\n *\n * - `RetrievalTier` — direct-answer eligibility ladder.\n * - `RecallXrayServedBy` — which source materialized each result.\n */\nexport type RecallXrayServedBy =\n | \"direct-answer\"\n | \"hybrid\"\n | \"graph\"\n | \"recent-scan\"\n | \"procedural\"\n | \"review-context\"\n | \"lcm-file-parts\"\n | \"lcm-tool-parts\";\n\nexport const RECALL_XRAY_SERVED_BY_VALUES: readonly RecallXrayServedBy[] = [\n \"direct-answer\",\n \"hybrid\",\n \"graph\",\n \"recent-scan\",\n \"procedural\",\n \"review-context\",\n \"lcm-file-parts\",\n \"lcm-tool-parts\",\n] as const;\n\nexport function isRecallXrayServedBy(\n value: unknown,\n): value is RecallXrayServedBy {\n return (\n typeof value === \"string\" &&\n (RECALL_XRAY_SERVED_BY_VALUES as readonly string[]).includes(value)\n );\n}\n\n/**\n * Score decomposition for a single X-ray result.\n *\n * All fields are optional because different tiers populate different\n * terms: `hybrid` reports vector + bm25 + mmr penalty, `direct-answer`\n * reports importance + tier prior, etc. The only guaranteed field is\n * `final`, which is the post-combination score used for ordering.\n */\nexport interface RecallXrayScoreDecomposition {\n vector?: number;\n bm25?: number;\n importance?: number;\n mmrPenalty?: number;\n tierPrior?: number;\n /** Additive boost from `reinforcement_count` frontmatter (issue #687 PR 3/4). */\n reinforcementBoost?: number;\n final: number;\n}\n\n/**\n * Per-result breakdown inside an X-ray snapshot.\n */\nexport interface RecallXrayResult {\n memoryId: string;\n path: string;\n servedBy: RecallXrayServedBy;\n scoreDecomposition: RecallXrayScoreDecomposition;\n graphPath?: string[];\n /**\n * Issue #681 PR 3/3 — per-edge confidence values aligned with\n * `graphPath`. When present, `graphEdgeConfidences[i]` is the\n * confidence of the edge between `graphPath[i]` and `graphPath[i+1]`,\n * so the array length is one less than `graphPath`. Legacy edges\n * without a recorded confidence render as `1.0`. Operators use this\n * to attribute floor-pruning and PageRank ranking decisions back to\n * specific edges. The renderer drops the line when the array is\n * empty or absent so legacy snapshots round-trip cleanly.\n */\n graphEdgeConfidences?: number[];\n auditEntryId?: string;\n /** Human-readable list of filters the candidate *passed*. */\n admittedBy: string[];\n /**\n * First filter that *would have* rejected the candidate, or undefined\n * when the candidate was admitted without a rejection trace. When\n * present, `admittedBy` may still contain filters the candidate passed\n * before the rejecting gate; consumers should render both.\n */\n rejectedBy?: string;\n /**\n * Disclosure depth used to render this result's payload (issue #677\n * PR 3/4). Mirrors the per-result disclosure already exposed in the\n * recall response so X-ray consumers can attribute token spend to\n * the depth that produced it.\n */\n disclosure?: RecallDisclosure;\n /**\n * Estimated token cost of the rendered payload at the chosen\n * disclosure depth. Non-negative integer. Computed by callers via\n * `estimateRecallTokens(text)`; the renderer aggregates these into\n * a per-disclosure summary so operators can see where their budget\n * went.\n */\n estimatedTokens?: number;\n /**\n * Free-form tags from the memory's YAML frontmatter (issue #689 PR 3/3).\n * Populated by the X-ray capture path when the caller passes a `tags`\n * filter so per-result tags are available alongside the filter trace\n * in `snapshot.filters`. Also populated without a filter when the\n * orchestrator decorates results via `xrayCapture: true` so all X-ray\n * consumers can inspect memory labels without a separate storage read.\n * Absent (not `[]`) when the frontmatter has no tags or the memory\n * could not be read.\n */\n tags?: string[];\n /**\n * Per-result memory provenance and safety context. Populated by recall\n * capture when the memory frontmatter was already loaded by retrieval.\n */\n provenance?: RetrievedMemoryProvenance;\n /**\n * Claim-level provenance span (issue #1575 PR 3). The first source excerpt\n * backing this memory, surfaced so X-ray consumers can see the literal\n * utterance each fact derives from alongside retrieval provenance. Absent\n * when the memory carries no source spans (legacy or `provenance: \"none\"`).\n */\n sourceSpan?: {\n /** Verbatim quote excerpt (capped at write time by `provenance.maxQuoteChars`). */\n quote: string;\n /** ISO timestamp of the source turn. */\n observedAt: string;\n /** Coarse strength tag from the frontmatter. */\n provenance: \"verified\" | \"unverified\" | \"none\";\n };\n}\n\n/**\n * Trace entry for a filter the orchestrator evaluated during recall.\n * Captures the name of the filter, how many candidates it saw, and how\n * many it let through. Used by X-ray consumers to render the filter\n * ladder above the per-result breakdown.\n */\nexport interface RecallFilterTrace {\n name: string;\n considered: number;\n admitted: number;\n /** Optional human-readable reason for any rejections. */\n reason?: string;\n}\n\n/**\n * Peer-profile injection annotation (issue #679 completion).\n *\n * When `peerProfileRecallEnabled` is true and a peer is registered for\n * the session, the orchestrator injects a `## Peer Profile` section into\n * the recall context. This annotation records which peer was injected and\n * how many profile fields were included so operators can correlate\n * retrieval quality with peer-context enrichment.\n *\n * `null` means no peer profile was injected (peer not registered, feature\n * disabled, or peer has no profile fields).\n */\nexport interface RecallXrayPeerProfileInjection {\n /** The peer id whose profile was injected. */\n peerId: string;\n /**\n * Number of profile fields included after the `peerProfileRecallMaxFields`\n * cap was applied. Zero means the profile existed but had no fields.\n */\n fieldsInjected: number;\n}\n\n/**\n * The unified X-ray snapshot. CLI, HTTP, and MCP surfaces all render\n * this same shape through the shared renderer (CLAUDE.md rule 22).\n */\nexport interface RecallXraySnapshot {\n /** Stable v1 tag so downstream consumers can version-gate their parsers. */\n schemaVersion: \"1\";\n query: string;\n /** UUID minted per capture; unique across snapshots within a process. */\n snapshotId: string;\n /** Epoch milliseconds the snapshot was captured. */\n capturedAt: number;\n /**\n * Tier-explain block from issue #518, carried verbatim when present.\n * `null` means direct-answer tier did not run (disabled, or another\n * tier served the query).\n */\n tierExplain: RecallTierExplain | null;\n results: RecallXrayResult[];\n filters: RecallFilterTrace[];\n /**\n * Character budget accounting for the final assembled recall payload.\n * `used` is the rendered-context length; `chars` is the cap. Both are\n * non-negative integers in `[0, 2**31)`.\n */\n budget: { chars: number; used: number };\n /** Optional session-scope fields carried for downstream filtering. */\n sessionKey?: string;\n namespace?: string;\n traceId?: string;\n /**\n * Peer-profile injection metadata (issue #679 completion).\n * Non-null when `peerProfileRecallEnabled` is true and a peer profile\n * was successfully injected into this recall's context. `null` (or\n * absent) means no peer profile was injected.\n */\n peerProfileInjection?: RecallXrayPeerProfileInjection | null;\n}\n\n// ─── Builder ──────────────────────────────────────────────────────────────\n\nexport interface BuildXraySnapshotInput {\n query: string;\n tierExplain?: RecallTierExplain | null;\n results?: RecallXrayResult[];\n filters?: RecallFilterTrace[];\n budget?: { chars?: number; used?: number };\n sessionKey?: string;\n namespace?: string;\n traceId?: string;\n /** Peer-profile injection metadata (issue #679 completion). */\n peerProfileInjection?: RecallXrayPeerProfileInjection | null;\n /** Optional injected timestamp for deterministic tests. */\n now?: () => number;\n /** Optional injected id generator for deterministic tests. */\n snapshotIdGenerator?: () => string;\n}\n\n/**\n * Build a `RecallXraySnapshot` from explicit input fields. Pure\n * function; safe to call from anywhere. All array/object inputs are\n * shallow-copied so caller mutation after build cannot tear the\n * returned snapshot.\n */\nexport function buildXraySnapshot(\n input: BuildXraySnapshotInput,\n): RecallXraySnapshot {\n const now = input.now ?? Date.now;\n const snapshotIdGenerator = input.snapshotIdGenerator ?? randomUUID;\n\n const results = Array.isArray(input.results)\n ? input.results.map(cloneResult)\n : [];\n const filters = Array.isArray(input.filters)\n ? input.filters.map(cloneFilter)\n : [];\n\n const budgetChars = nonNegativeInt(input.budget?.chars);\n const budgetUsed = nonNegativeInt(input.budget?.used);\n\n const tierExplain =\n input.tierExplain && typeof input.tierExplain === \"object\"\n ? cloneTierExplain(input.tierExplain)\n : null;\n\n // Peer-profile injection annotation (issue #679 completion).\n // Deep-copy via structuredClone so the caller can't mutate the snapshot\n // after build. Accept null explicitly (no injection) or a valid object.\n let peerProfileInjection: RecallXrayPeerProfileInjection | null | undefined;\n if (input.peerProfileInjection && typeof input.peerProfileInjection === \"object\") {\n const raw = input.peerProfileInjection;\n const peerId = nonEmptyString(raw.peerId);\n if (peerId !== undefined) {\n peerProfileInjection = {\n peerId,\n fieldsInjected: nonNegativeInt(raw.fieldsInjected),\n };\n }\n } else if (input.peerProfileInjection === null) {\n peerProfileInjection = null;\n }\n\n const out: RecallXraySnapshot = {\n schemaVersion: \"1\",\n query: typeof input.query === \"string\" ? input.query : \"\",\n snapshotId: snapshotIdGenerator(),\n capturedAt: now(),\n tierExplain,\n results,\n filters,\n budget: { chars: budgetChars, used: budgetUsed },\n sessionKey: nonEmptyString(input.sessionKey),\n namespace: nonEmptyString(input.namespace),\n traceId: nonEmptyString(input.traceId),\n };\n if (peerProfileInjection !== undefined) {\n out.peerProfileInjection = peerProfileInjection;\n }\n return out;\n}\n\n/**\n * Mutable builder used by the orchestrator to accumulate X-ray fields\n * as recall progresses. Call `build()` to get the finalized\n * immutable-ish snapshot. All inputs are validated at insert time so\n * a malformed entry cannot poison the snapshot later.\n */\nexport class RecallXrayBuilder {\n private readonly query: string;\n private readonly sessionKey: string | undefined;\n private namespace: string | undefined;\n private traceId: string | undefined;\n private tierExplain: RecallTierExplain | null = null;\n private readonly results: RecallXrayResult[] = [];\n private readonly filters: RecallFilterTrace[] = [];\n private budgetChars = 0;\n private budgetUsed = 0;\n private peerProfileInjection: RecallXrayPeerProfileInjection | null | undefined;\n\n constructor(opts: {\n query: string;\n sessionKey?: string;\n namespace?: string;\n traceId?: string;\n }) {\n this.query = typeof opts.query === \"string\" ? opts.query : \"\";\n this.sessionKey = nonEmptyString(opts.sessionKey);\n this.namespace = nonEmptyString(opts.namespace);\n this.traceId = nonEmptyString(opts.traceId);\n }\n\n setNamespace(namespace: string | undefined): void {\n this.namespace = nonEmptyString(namespace);\n }\n\n setTraceId(traceId: string | undefined): void {\n this.traceId = nonEmptyString(traceId);\n }\n\n setTierExplain(tierExplain: RecallTierExplain | null | undefined): void {\n this.tierExplain =\n tierExplain && typeof tierExplain === \"object\"\n ? cloneTierExplain(tierExplain)\n : null;\n }\n\n setBudget(budget: { chars?: number; used?: number }): void {\n this.budgetChars = nonNegativeInt(budget.chars);\n this.budgetUsed = nonNegativeInt(budget.used);\n }\n\n /**\n * Record peer-profile injection metadata for this recall snapshot\n * (issue #679 completion). Pass `null` to explicitly record that no\n * injection happened (feature enabled but no peer / no profile fields).\n */\n setPeerProfileInjection(\n injection: RecallXrayPeerProfileInjection | null,\n ): void {\n this.peerProfileInjection = injection;\n }\n\n recordResult(result: RecallXrayResult): void {\n this.results.push(cloneResult(result));\n }\n\n recordFilter(filter: RecallFilterTrace): void {\n this.filters.push(cloneFilter(filter));\n }\n\n build(opts: {\n now?: () => number;\n snapshotIdGenerator?: () => string;\n } = {}): RecallXraySnapshot {\n return buildXraySnapshot({\n query: this.query,\n tierExplain: this.tierExplain,\n results: this.results,\n filters: this.filters,\n budget: { chars: this.budgetChars, used: this.budgetUsed },\n sessionKey: this.sessionKey,\n namespace: this.namespace,\n traceId: this.traceId,\n peerProfileInjection: this.peerProfileInjection,\n now: opts.now,\n snapshotIdGenerator: opts.snapshotIdGenerator,\n });\n }\n}\n\n// ─── Internals ────────────────────────────────────────────────────────────\n\nfunction cloneResult(result: RecallXrayResult): RecallXrayResult {\n if (!result || typeof result !== \"object\") {\n throw new TypeError(\"RecallXrayResult must be an object\");\n }\n if (!isRecallXrayServedBy(result.servedBy)) {\n throw new TypeError(\n `RecallXrayResult.servedBy must be one of ${RECALL_XRAY_SERVED_BY_VALUES.join(\n \", \",\n )}; got ${JSON.stringify(result.servedBy)}`,\n );\n }\n const memoryId = typeof result.memoryId === \"string\" ? result.memoryId : \"\";\n const path = typeof result.path === \"string\" ? result.path : \"\";\n const admittedBy = Array.isArray(result.admittedBy)\n ? result.admittedBy.filter((x): x is string => typeof x === \"string\")\n : [];\n const graphPath = Array.isArray(result.graphPath)\n ? result.graphPath.filter((x): x is string => typeof x === \"string\")\n : undefined;\n // Issue #681 PR 3/3 — per-edge confidences alongside graph path.\n // Each entry is clamped into [0, 1]; the array is rejected wholesale\n // when alignment cannot be verified so downstream surfaces can rely\n // on `graphEdgeConfidences[i]` describing the edge between\n // `graphPath[i]` and `graphPath[i+1]`.\n //\n // Cursor review (#735): the input array length MUST match\n // `graphPath.length - 1` *before* any per-element filtering. The\n // earlier implementation skipped non-finite entries via `continue`\n // and then length-checked the cleaned array — that would silently\n // shift surviving values to earlier positions. Example: input\n // `[0.5, NaN, 0.7]` for a 3-edge path would collapse to\n // `[0.5, 0.7]`, length-check would pass against `expected = 2`, and\n // the renderer would mis-attribute `0.7` to edge B→C when it really\n // came from edge C→D. Reject on either size mismatch or any\n // non-finite entry so misalignment is impossible.\n let graphEdgeConfidences: number[] | undefined;\n if (Array.isArray(result.graphEdgeConfidences) && graphPath && graphPath.length > 1) {\n const expected = graphPath.length - 1;\n const raw = result.graphEdgeConfidences;\n if (raw.length === expected) {\n const cleaned: number[] = [];\n let allFinite = true;\n for (const value of raw) {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n allFinite = false;\n break;\n }\n cleaned.push(Math.min(1, Math.max(0, value)));\n }\n if (allFinite) {\n graphEdgeConfidences = cleaned;\n }\n }\n }\n const auditEntryId = nonEmptyString(result.auditEntryId);\n const rejectedBy = nonEmptyString(result.rejectedBy);\n const scoreDecomposition = cloneScoreDecomposition(result.scoreDecomposition);\n const out: RecallXrayResult = {\n memoryId,\n path,\n servedBy: result.servedBy,\n scoreDecomposition,\n admittedBy,\n };\n if (graphPath !== undefined) out.graphPath = graphPath;\n if (graphEdgeConfidences !== undefined) {\n out.graphEdgeConfidences = graphEdgeConfidences;\n }\n if (auditEntryId !== undefined) out.auditEntryId = auditEntryId;\n if (rejectedBy !== undefined) out.rejectedBy = rejectedBy;\n // Disclosure + token telemetry (issue #677 PR 3/4). Only attach when\n // present and well-formed; unknown disclosure values are dropped so a\n // bad caller can't poison downstream renderers. Uses the shared\n // `isRecallDisclosure` guard so adding a fourth disclosure level\n // requires touching only `types.ts`.\n if (isRecallDisclosure(result.disclosure)) {\n out.disclosure = result.disclosure;\n }\n if (\n typeof result.estimatedTokens === \"number\" &&\n Number.isFinite(result.estimatedTokens) &&\n result.estimatedTokens >= 0\n ) {\n out.estimatedTokens = Math.floor(result.estimatedTokens);\n }\n // Tags from frontmatter (issue #689 PR 3/3). Normalize identically to\n // the recall-surface path: trim and drop empty strings so consumers can\n // compare tags directly without a secondary normalization step.\n if (Array.isArray(result.tags)) {\n const cleanedTags = result.tags\n .filter((t): t is string => typeof t === \"string\")\n .map((t) => t.trim())\n .filter((t) => t.length > 0);\n if (cleanedTags.length > 0) {\n out.tags = cleanedTags;\n }\n }\n const provenance = normalizeRetrievedMemoryProvenance(result.provenance);\n if (provenance !== undefined) {\n out.provenance = provenance;\n }\n // Claim-level provenance span (#1575 PR 3). Deep-copy the three scalar\n // fields so the snapshot returned by getLastXraySnapshot is independent\n // of the caller's object (matches the structuredClone contract).\n const ss = result.sourceSpan;\n if (\n ss &&\n typeof ss.quote === \"string\" &&\n typeof ss.observedAt === \"string\" &&\n (ss.provenance === \"verified\" ||\n ss.provenance === \"unverified\" ||\n ss.provenance === \"none\")\n ) {\n out.sourceSpan = {\n quote: ss.quote,\n observedAt: ss.observedAt,\n provenance: ss.provenance,\n };\n }\n return out;\n}\n\n/**\n * Summarize per-disclosure token spend across an X-ray snapshot's\n * results. Pure helper — used by the markdown renderer to print a\n * \"per-disclosure token spend\" line and exposed for tests / surfaces.\n */\nexport function summarizeDisclosureTokens(\n results: ReadonlyArray<RecallXrayResult>,\n): RecallXrayDisclosureSummary {\n const summary: RecallXrayDisclosureSummary = {\n chunk: { count: 0, estimatedTokens: 0 },\n section: { count: 0, estimatedTokens: 0 },\n raw: { count: 0, estimatedTokens: 0 },\n unspecified: { count: 0, estimatedTokens: 0 },\n };\n for (const result of results) {\n const tokens =\n typeof result.estimatedTokens === \"number\" &&\n Number.isFinite(result.estimatedTokens) &&\n result.estimatedTokens >= 0\n ? Math.floor(result.estimatedTokens)\n : 0;\n const bucket = isRecallDisclosure(result.disclosure)\n ? result.disclosure\n : \"unspecified\";\n summary[bucket].count += 1;\n summary[bucket].estimatedTokens += tokens;\n }\n return summary;\n}\n\nfunction cloneFilter(filter: RecallFilterTrace): RecallFilterTrace {\n if (!filter || typeof filter !== \"object\") {\n throw new TypeError(\"RecallFilterTrace must be an object\");\n }\n const out: RecallFilterTrace = {\n name: typeof filter.name === \"string\" ? filter.name : \"\",\n considered: nonNegativeInt(filter.considered),\n admitted: nonNegativeInt(filter.admitted),\n };\n const reason = nonEmptyString(filter.reason);\n if (reason !== undefined) out.reason = reason;\n return out;\n}\n\nfunction cloneScoreDecomposition(\n value: RecallXrayScoreDecomposition | undefined,\n): RecallXrayScoreDecomposition {\n if (!value || typeof value !== \"object\") {\n return { final: 0 };\n }\n const out: RecallXrayScoreDecomposition = {\n final: finiteNumber(value.final) ?? 0,\n };\n const vector = finiteNumber(value.vector);\n if (vector !== undefined) out.vector = vector;\n const bm25 = finiteNumber(value.bm25);\n if (bm25 !== undefined) out.bm25 = bm25;\n const importance = finiteNumber(value.importance);\n if (importance !== undefined) out.importance = importance;\n const mmrPenalty = finiteNumber(value.mmrPenalty);\n if (mmrPenalty !== undefined) out.mmrPenalty = mmrPenalty;\n const tierPrior = finiteNumber(value.tierPrior);\n if (tierPrior !== undefined) out.tierPrior = tierPrior;\n const reinforcementBoost = finiteNumber(value.reinforcementBoost);\n if (reinforcementBoost !== undefined && reinforcementBoost > 0) {\n out.reinforcementBoost = reinforcementBoost;\n }\n return out;\n}\n\nfunction cloneTierExplain(tierExplain: RecallTierExplain): RecallTierExplain {\n // Use structuredClone so future RecallTierExplain additions do not\n // silently share references through hand-enumerated fields. The\n // payload is JSON-shaped.\n return structuredClone(tierExplain);\n}\n\nfunction nonNegativeInt(value: unknown): number {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return 0;\n if (value <= 0) return 0;\n return Math.floor(value);\n}\n\nfunction finiteNumber(value: unknown): number | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) return undefined;\n return value;\n}\n\nfunction nonEmptyString(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n if (trimmed.length === 0) return undefined;\n return trimmed;\n}\n"],"mappings":";;;;;;;;AAmBA,SAAS,kBAAkB;AAiBpB,SAAS,qBAAqB,MAAyC;AAC5E,MAAI,OAAO,SAAS,YAAY,KAAK,WAAW,EAAG,QAAO;AAC1D,SAAO,KAAK,KAAK,KAAK,SAAS,CAAC;AAClC;AAkCO,IAAM,+BAA8D;AAAA,EACzE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,qBACd,OAC6B;AAC7B,SACE,OAAO,UAAU,YAChB,6BAAmD,SAAS,KAAK;AAEtE;AAsMO,SAAS,kBACd,OACoB;AACpB,QAAM,MAAM,MAAM,OAAO,KAAK;AAC9B,QAAM,sBAAsB,MAAM,uBAAuB;AAEzD,QAAM,UAAU,MAAM,QAAQ,MAAM,OAAO,IACvC,MAAM,QAAQ,IAAI,WAAW,IAC7B,CAAC;AACL,QAAM,UAAU,MAAM,QAAQ,MAAM,OAAO,IACvC,MAAM,QAAQ,IAAI,WAAW,IAC7B,CAAC;AAEL,QAAM,cAAc,eAAe,MAAM,QAAQ,KAAK;AACtD,QAAM,aAAa,eAAe,M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AAS,iBAAiB,aAAmD;AAI3E,SAAO,gBAAgB,WAAW;AACpC;AAEA,SAAS,eAAe,OAAwB;AAC9C,MAAI,OAAO,UAAU,YAAY,CAAC,OAAO,SAAS,KAAK,EAAG,QAAO;AACjE,MAAI,SAAS,EAAG,QAAO;AACvB,SAAO,KAAK,MAAM,KAAK;AACzB;AAEA,SAAS,aAAa,OAAoC;AACxD,MAAI,OAAO,UAAU,YAAY,CAAC,OAAO,SAAS,KAAK,EAAG,QAAO;AACjE,SAAO;AACT;AAEA,SAAS,eAAe,OAAoC;AAC1D,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,UAAU,MAAM,KAAK;AAC3B,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,SAAO;AACT;","names":[]}
@@ -22,7 +22,7 @@ import {
22
22
  } from "./chunk-H7XKCNR6.js";
23
23
  import {
24
24
  toRecallExplainJson
25
- } from "./chunk-Y6PIFKXX.js";
25
+ } from "./chunk-5QUS24F7.js";
26
26
  import {
27
27
  buildProposedActions,
28
28
  buildQualityScore,
@@ -58,7 +58,7 @@ import {
58
58
  } from "./chunk-FF4KLI5W.js";
59
59
  import {
60
60
  estimateRecallTokens
61
- } from "./chunk-AZVHBFI3.js";
61
+ } from "./chunk-OWOKOFXK.js";
62
62
  import {
63
63
  namespaceCollectionName
64
64
  } from "./chunk-K22IJO4R.js";
@@ -9701,4 +9701,4 @@ export {
9701
9701
  shapeMemorySummary,
9702
9702
  EngramAccessService
9703
9703
  };
9704
- //# sourceMappingURL=chunk-EVX52NCY.js.map
9704
+ //# sourceMappingURL=chunk-YVWZW37D.js.map
@@ -3,14 +3,14 @@ import {
3
3
  } from "./chunk-NUWZFSKC.js";
4
4
  import {
5
5
  defineOperation
6
- } from "./chunk-PKE7EJMX.js";
6
+ } from "./chunk-ZVDRL6SK.js";
7
7
  import {
8
8
  CorrectionContractError,
9
9
  DECISION_SUBCOMMANDS,
10
10
  DELTA_SUBCOMMANDS,
11
11
  EngramAccessInputError,
12
12
  isCodegraphToolName
13
- } from "./chunk-EVX52NCY.js";
13
+ } from "./chunk-YVWZW37D.js";
14
14
 
15
15
  // src/access-operations.ts
16
16
  import { z } from "zod";
@@ -459,4 +459,4 @@ export {
459
459
  codegraphIngestTracesOperation,
460
460
  REGISTERED_OPERATIONS
461
461
  };
462
- //# sourceMappingURL=chunk-P6PRSI3W.js.map
462
+ //# sourceMappingURL=chunk-Z3B2YW56.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseXrayFormat
3
- } from "./chunk-Y6PIFKXX.js";
3
+ } from "./chunk-5QUS24F7.js";
4
4
  import {
5
5
  RECALL_DISCLOSURE_LEVELS,
6
6
  isRecallDisclosure
@@ -50,4 +50,4 @@ export {
50
50
  parseXrayBudgetFlag,
51
51
  parseXrayCliOptions
52
52
  };
53
- //# sourceMappingURL=chunk-JQ7XVM4V.js.map
53
+ //# sourceMappingURL=chunk-ZBG4K36I.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  EngramAccessInputError
3
- } from "./chunk-EVX52NCY.js";
3
+ } from "./chunk-YVWZW37D.js";
4
4
  import {
5
5
  expandTildePath
6
6
  } from "./chunk-EYIEWJNI.js";
@@ -104,4 +104,4 @@ export {
104
104
  listRegisteredOperations,
105
105
  __resetRegistryForTest
106
106
  };
107
- //# sourceMappingURL=chunk-PKE7EJMX.js.map
107
+ //# sourceMappingURL=chunk-ZVDRL6SK.js.map
package/dist/cli.js CHANGED
@@ -90,7 +90,7 @@ import {
90
90
  runWorkProductStatusCliCommand,
91
91
  runWorkProjectCliCommand,
92
92
  runWorkTaskCliCommand
93
- } from "./chunk-NK3SPJLM.js";
93
+ } from "./chunk-5KQCOIPW.js";
94
94
  import "./chunk-MC4FJXPA.js";
95
95
  import "./chunk-LQHDIS7L.js";
96
96
  import "./chunk-7F7Z6MOS.js";
@@ -121,8 +121,8 @@ import "./chunk-GQL52GQ5.js";
121
121
  import "./chunk-Z56IHRVV.js";
122
122
  import "./chunk-TGQ2NTWH.js";
123
123
  import "./chunk-QXNFQKWU.js";
124
- import "./chunk-JQ7XVM4V.js";
125
- import "./chunk-OK7FUX6R.js";
124
+ import "./chunk-ZBG4K36I.js";
125
+ import "./chunk-4P5UAL3C.js";
126
126
  import "./chunk-JNOYYWCA.js";
127
127
  import "./chunk-3T74IZB3.js";
128
128
  import "./chunk-HL4DB7TO.js";
@@ -168,7 +168,7 @@ import "./chunk-Z5LAYHGJ.js";
168
168
  import "./chunk-OO42R444.js";
169
169
  import "./chunk-K6MV3TRQ.js";
170
170
  import "./chunk-OADWQ5CR.js";
171
- import "./chunk-VWB3HDY6.js";
171
+ import "./chunk-A2R5NV6O.js";
172
172
  import "./chunk-SEDEKFYQ.js";
173
173
  import "./chunk-JBPKEARU.js";
174
174
  import "./chunk-TMSXWOBZ.js";
@@ -177,14 +177,14 @@ import "./chunk-RSUYKGGZ.js";
177
177
  import "./chunk-42NQ7AVG.js";
178
178
  import "./chunk-7RXCMVFQ.js";
179
179
  import "./chunk-7WV3F5DQ.js";
180
- import "./chunk-KOEKDZ6A.js";
180
+ import "./chunk-I3BT2IDW.js";
181
181
  import "./chunk-T4WDJPEZ.js";
182
182
  import "./chunk-D24OXEPB.js";
183
- import "./chunk-P6PRSI3W.js";
184
- import "./chunk-XD33EX2F.js";
183
+ import "./chunk-Z3B2YW56.js";
184
+ import "./chunk-AMXOCZHE.js";
185
185
  import "./chunk-NUWZFSKC.js";
186
- import "./chunk-PKE7EJMX.js";
187
- import "./chunk-EVX52NCY.js";
186
+ import "./chunk-ZVDRL6SK.js";
187
+ import "./chunk-YVWZW37D.js";
188
188
  import "./chunk-GDASG7NC.js";
189
189
  import "./chunk-GDB4J2H3.js";
190
190
  import "./chunk-ARV3AUOM.js";
@@ -193,7 +193,7 @@ import "./chunk-ERA5RSMZ.js";
193
193
  import "./chunk-IQ7WCZRW.js";
194
194
  import "./chunk-BT7NVCML.js";
195
195
  import "./chunk-H7XKCNR6.js";
196
- import "./chunk-Y6PIFKXX.js";
196
+ import "./chunk-5QUS24F7.js";
197
197
  import "./chunk-SOBJ6NEY.js";
198
198
  import "./chunk-XKU4YE6Z.js";
199
199
  import "./chunk-SHRRWOVY.js";
@@ -201,7 +201,7 @@ import "./chunk-RS25QOKZ.js";
201
201
  import "./chunk-JGSKJHF7.js";
202
202
  import "./chunk-S4DDLTPX.js";
203
203
  import "./chunk-FF4KLI5W.js";
204
- import "./chunk-AZVHBFI3.js";
204
+ import "./chunk-OWOKOFXK.js";
205
205
  import "./chunk-K22IJO4R.js";
206
206
  import "./chunk-OMSTU233.js";
207
207
  import "./chunk-CYEPCZN5.js";
package/dist/index.js CHANGED
@@ -94,7 +94,7 @@ import {
94
94
  registerTrainingExportAdapter,
95
95
  runBulkImportCliCommand,
96
96
  runWearablesCliCommand
97
- } from "./chunk-NK3SPJLM.js";
97
+ } from "./chunk-5KQCOIPW.js";
98
98
  import "./chunk-MC4FJXPA.js";
99
99
  import "./chunk-LQHDIS7L.js";
100
100
  import "./chunk-7F7Z6MOS.js";
@@ -145,8 +145,8 @@ import "./chunk-QXNFQKWU.js";
145
145
  import {
146
146
  parseXrayBudgetFlag,
147
147
  parseXrayCliOptions
148
- } from "./chunk-JQ7XVM4V.js";
149
- import "./chunk-OK7FUX6R.js";
148
+ } from "./chunk-ZBG4K36I.js";
149
+ import "./chunk-4P5UAL3C.js";
150
150
  import "./chunk-JNOYYWCA.js";
151
151
  import {
152
152
  parseStrictCliDate
@@ -189,7 +189,7 @@ import {
189
189
  saveTaxonomy,
190
190
  validateSlug,
191
191
  validateTaxonomy
192
- } from "./chunk-2T4TDXPC.js";
192
+ } from "./chunk-GKPIY7EQ.js";
193
193
  import {
194
194
  WEARABLE_SOURCE_PREFIX,
195
195
  buildExtractionTurns,
@@ -483,7 +483,7 @@ import "./chunk-K6MV3TRQ.js";
483
483
  import "./chunk-OADWQ5CR.js";
484
484
  import {
485
485
  EngramAccessHttpServer
486
- } from "./chunk-VWB3HDY6.js";
486
+ } from "./chunk-A2R5NV6O.js";
487
487
  import "./chunk-SEDEKFYQ.js";
488
488
  import "./chunk-JBPKEARU.js";
489
489
  import "./chunk-TMSXWOBZ.js";
@@ -497,7 +497,7 @@ import {
497
497
  } from "./chunk-7WV3F5DQ.js";
498
498
  import {
499
499
  EngramMcpServer
500
- } from "./chunk-KOEKDZ6A.js";
500
+ } from "./chunk-I3BT2IDW.js";
501
501
  import {
502
502
  REMNIC_CHATGPT_MEMORY_INSPECTOR_CANONICAL_TOOL,
503
503
  REMNIC_CHATGPT_MEMORY_INSPECTOR_MIME_TYPE,
@@ -513,8 +513,8 @@ import {
513
513
  parseOaiMemCitation,
514
514
  sanitizeNoteForCitation
515
515
  } from "./chunk-D24OXEPB.js";
516
- import "./chunk-P6PRSI3W.js";
517
- import "./chunk-XD33EX2F.js";
516
+ import "./chunk-Z3B2YW56.js";
517
+ import "./chunk-AMXOCZHE.js";
518
518
  import {
519
519
  formatZodError,
520
520
  memoryStoreRequestSchema,
@@ -523,13 +523,13 @@ import {
523
523
  suggestionSubmitRequestSchema,
524
524
  validateRequest
525
525
  } from "./chunk-NUWZFSKC.js";
526
- import "./chunk-PKE7EJMX.js";
526
+ import "./chunk-ZVDRL6SK.js";
527
527
  import {
528
528
  EngramAccessInputError,
529
529
  EngramAccessService,
530
530
  computeProcedureStats,
531
531
  formatProcedureStatsText
532
- } from "./chunk-EVX52NCY.js";
532
+ } from "./chunk-YVWZW37D.js";
533
533
  import "./chunk-GDASG7NC.js";
534
534
  import "./chunk-GDB4J2H3.js";
535
535
  import {
@@ -550,7 +550,7 @@ import {
550
550
  renderXrayJson,
551
551
  renderXrayMarkdown,
552
552
  renderXrayText
553
- } from "./chunk-Y6PIFKXX.js";
553
+ } from "./chunk-5QUS24F7.js";
554
554
  import "./chunk-SOBJ6NEY.js";
555
555
  import "./chunk-XKU4YE6Z.js";
556
556
  import {
@@ -575,7 +575,7 @@ import {
575
575
  import {
576
576
  storagePathHash
577
577
  } from "./chunk-FF4KLI5W.js";
578
- import "./chunk-AZVHBFI3.js";
578
+ import "./chunk-OWOKOFXK.js";
579
579
  import "./chunk-K22IJO4R.js";
580
580
  import "./chunk-OMSTU233.js";
581
581
  import "./chunk-CYEPCZN5.js";
@@ -311,6 +311,24 @@ interface OperatorRepairOptions {
311
311
  }
312
312
  declare function runOperatorSetup(options: OperatorSetupOptions): Promise<OperatorSetupReport>;
313
313
  declare function runOperatorConfigReview(options: OperatorConfigReviewOptions): Promise<OperatorConfigReviewReport>;
314
+ /**
315
+ * Summarize the provenance coverage of a set of memories (issue #1575 PR 3).
316
+ * Pure function — counts the verified/unverified/none distribution so the
317
+ * doctor check and any future surface can consume it without coupling to the
318
+ * orchestrator. Legacy memories (no `provenance` field) count as `"none"`.
319
+ */
320
+ declare function summarizeProvenanceCoverage(memories: ReadonlyArray<{
321
+ frontmatter: {
322
+ provenance?: string;
323
+ };
324
+ }>): {
325
+ counts: {
326
+ verified: number;
327
+ unverified: number;
328
+ none: number;
329
+ };
330
+ total: number;
331
+ };
314
332
  declare function runOperatorDoctor(options: OperatorDoctorOptions): Promise<OperatorDoctorReport>;
315
333
  /**
316
334
  * Count memories that pre-date the Memory Worth counters introduced in issue
@@ -410,4 +428,4 @@ declare function runOperatorInventory(options: OperatorInventoryOptions): Promis
410
428
  declare function runBenchmarkRecall(options: BenchmarkRecallOptions): Promise<BenchmarkRecallReport>;
411
429
  declare function runOperatorRepair(options: OperatorRepairOptions): Promise<OperatorRepairReport>;
412
430
 
413
- export { type BenchmarkRecallOptions, type BenchmarkRecallReport, type OperatorConfigLoadResult, type OperatorConfigReviewFinding, type OperatorConfigReviewOptions, type OperatorConfigReviewReport, type OperatorDoctorCheck, type OperatorDoctorOptions, type OperatorDoctorReport, type OperatorInventoryNamespaceSummary, type OperatorInventoryOptions, type OperatorInventoryReport, type OperatorRepairOptions, type OperatorRepairReport, type OperatorSetupOptions, type OperatorSetupReport, type OperatorToolkitOrchestrator, runBenchmarkRecall, runOperatorConfigReview, runOperatorDoctor, runOperatorInventory, runOperatorRepair, runOperatorSetup, summarizeBufferSurpriseDistribution, summarizeConsolidationProvenance, summarizeDreamsPhases, summarizeMemoryWorthLegacyCounters, summarizeObservationThroughput, summarizeTierDistribution, summarizeTombstoneStatus };
431
+ export { type BenchmarkRecallOptions, type BenchmarkRecallReport, type OperatorConfigLoadResult, type OperatorConfigReviewFinding, type OperatorConfigReviewOptions, type OperatorConfigReviewReport, type OperatorDoctorCheck, type OperatorDoctorOptions, type OperatorDoctorReport, type OperatorInventoryNamespaceSummary, type OperatorInventoryOptions, type OperatorInventoryReport, type OperatorRepairOptions, type OperatorRepairReport, type OperatorSetupOptions, type OperatorSetupReport, type OperatorToolkitOrchestrator, runBenchmarkRecall, runOperatorConfigReview, runOperatorDoctor, runOperatorInventory, runOperatorRepair, runOperatorSetup, summarizeBufferSurpriseDistribution, summarizeConsolidationProvenance, summarizeDreamsPhases, summarizeMemoryWorthLegacyCounters, summarizeObservationThroughput, summarizeProvenanceCoverage, summarizeTierDistribution, summarizeTombstoneStatus };
@@ -10,9 +10,10 @@ import {
10
10
  summarizeDreamsPhases,
11
11
  summarizeMemoryWorthLegacyCounters,
12
12
  summarizeObservationThroughput,
13
+ summarizeProvenanceCoverage,
13
14
  summarizeTierDistribution,
14
15
  summarizeTombstoneStatus
15
- } from "./chunk-OK7FUX6R.js";
16
+ } from "./chunk-4P5UAL3C.js";
16
17
  import "./chunk-JNOYYWCA.js";
17
18
  import "./chunk-7XH7VJN4.js";
18
19
  import "./chunk-YBPYIAA5.js";
@@ -108,6 +109,7 @@ export {
108
109
  summarizeDreamsPhases,
109
110
  summarizeMemoryWorthLegacyCounters,
110
111
  summarizeObservationThroughput,
112
+ summarizeProvenanceCoverage,
111
113
  summarizeTierDistribution,
112
114
  summarizeTombstoneStatus
113
115
  };
@@ -28,7 +28,7 @@ import {
28
28
  sanitizeSessionKeyForFilename,
29
29
  shouldFilterLifecycleRecallCandidate,
30
30
  summarizeGraphShadowComparison
31
- } from "./chunk-2T4TDXPC.js";
31
+ } from "./chunk-GKPIY7EQ.js";
32
32
  import "./chunk-DGTDRIUO.js";
33
33
  import "./chunk-3TCRU4JA.js";
34
34
  import "./chunk-7HYPN2GC.js";
@@ -144,7 +144,7 @@ import "./chunk-RS25QOKZ.js";
144
144
  import "./chunk-JGSKJHF7.js";
145
145
  import "./chunk-S4DDLTPX.js";
146
146
  import "./chunk-FF4KLI5W.js";
147
- import "./chunk-AZVHBFI3.js";
147
+ import "./chunk-OWOKOFXK.js";
148
148
  import "./chunk-K22IJO4R.js";
149
149
  import "./chunk-OMSTU233.js";
150
150
  import "./chunk-CYEPCZN5.js";
@@ -5,9 +5,9 @@ import {
5
5
  toRecallExplainJson,
6
6
  toRecallExplainText,
7
7
  toRecallXraySnapshotFromLegacy
8
- } from "./chunk-Y6PIFKXX.js";
8
+ } from "./chunk-5QUS24F7.js";
9
9
  import "./chunk-SOBJ6NEY.js";
10
- import "./chunk-AZVHBFI3.js";
10
+ import "./chunk-OWOKOFXK.js";
11
11
  import "./chunk-BOGENF7P.js";
12
12
  import "./chunk-I4WBNM3M.js";
13
13
  import "./chunk-SOAU2OE2.js";
@@ -2,10 +2,10 @@ import {
2
2
  parseXrayBudgetFlag,
3
3
  parseXrayCliOptions,
4
4
  parseXrayDisclosureFlag
5
- } from "./chunk-JQ7XVM4V.js";
6
- import "./chunk-Y6PIFKXX.js";
5
+ } from "./chunk-ZBG4K36I.js";
6
+ import "./chunk-5QUS24F7.js";
7
7
  import "./chunk-SOBJ6NEY.js";
8
- import "./chunk-AZVHBFI3.js";
8
+ import "./chunk-OWOKOFXK.js";
9
9
  import "./chunk-BOGENF7P.js";
10
10
  import "./chunk-I4WBNM3M.js";
11
11
  import "./chunk-SOAU2OE2.js";
@@ -5,9 +5,9 @@ import {
5
5
  renderXrayJson,
6
6
  renderXrayMarkdown,
7
7
  renderXrayText
8
- } from "./chunk-Y6PIFKXX.js";
8
+ } from "./chunk-5QUS24F7.js";
9
9
  import "./chunk-SOBJ6NEY.js";
10
- import "./chunk-AZVHBFI3.js";
10
+ import "./chunk-OWOKOFXK.js";
11
11
  import "./chunk-BOGENF7P.js";
12
12
  import "./chunk-I4WBNM3M.js";
13
13
  import "./chunk-SOAU2OE2.js";
@@ -147,6 +147,20 @@ interface RecallXrayResult {
147
147
  * capture when the memory frontmatter was already loaded by retrieval.
148
148
  */
149
149
  provenance?: RetrievedMemoryProvenance;
150
+ /**
151
+ * Claim-level provenance span (issue #1575 PR 3). The first source excerpt
152
+ * backing this memory, surfaced so X-ray consumers can see the literal
153
+ * utterance each fact derives from alongside retrieval provenance. Absent
154
+ * when the memory carries no source spans (legacy or `provenance: "none"`).
155
+ */
156
+ sourceSpan?: {
157
+ /** Verbatim quote excerpt (capped at write time by `provenance.maxQuoteChars`). */
158
+ quote: string;
159
+ /** ISO timestamp of the source turn. */
160
+ observedAt: string;
161
+ /** Coarse strength tag from the frontmatter. */
162
+ provenance: "verified" | "unverified" | "none";
163
+ };
150
164
  }
151
165
  /**
152
166
  * Trace entry for a filter the orchestrator evaluated during recall.
@@ -5,7 +5,7 @@ import {
5
5
  estimateRecallTokens,
6
6
  isRecallXrayServedBy,
7
7
  summarizeDisclosureTokens
8
- } from "./chunk-AZVHBFI3.js";
8
+ } from "./chunk-OWOKOFXK.js";
9
9
  import "./chunk-BOGENF7P.js";
10
10
  import "./chunk-I4WBNM3M.js";
11
11
  import "./chunk-SOAU2OE2.js";