agentfootprint 8.19.0 → 8.20.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.
Files changed (103) hide show
  1. package/bin/agentfootprint-index.mjs +28 -3
  2. package/dist/esm/lib/rag/defineRAG.d.ts +9 -6
  3. package/dist/esm/lib/rag/defineRAG.js.map +1 -1
  4. package/dist/esm/memory/retrieval/topK.d.ts +12 -6
  5. package/dist/esm/memory/retrieval/topK.js.map +1 -1
  6. package/dist/esm/memory/store/index.d.ts +1 -0
  7. package/dist/esm/memory/store/index.js +1 -0
  8. package/dist/esm/memory/store/index.js.map +1 -1
  9. package/dist/esm/memory/store/staticVectorStore.d.ts +83 -0
  10. package/dist/esm/memory/store/staticVectorStore.js +224 -0
  11. package/dist/esm/memory/store/staticVectorStore.js.map +1 -0
  12. package/dist/esm/observe.d.ts +1 -0
  13. package/dist/esm/observe.js +5 -0
  14. package/dist/esm/observe.js.map +1 -1
  15. package/dist/esm/rag/exportCorpus.d.ts +64 -0
  16. package/dist/esm/rag/exportCorpus.js +172 -0
  17. package/dist/esm/rag/exportCorpus.js.map +1 -0
  18. package/dist/esm/rag/index.d.ts +3 -1
  19. package/dist/esm/rag/index.js +8 -1
  20. package/dist/esm/rag/index.js.map +1 -1
  21. package/dist/esm/rag/splitters/byHeading.d.ts +39 -0
  22. package/dist/esm/rag/splitters/byHeading.js +133 -15
  23. package/dist/esm/rag/splitters/byHeading.js.map +1 -1
  24. package/dist/esm/rag/splitters/byParagraph.d.ts +14 -0
  25. package/dist/esm/rag/splitters/byParagraph.js +4 -2
  26. package/dist/esm/rag/splitters/byParagraph.js.map +1 -1
  27. package/dist/esm/rag/splitters/constants.d.ts +24 -1
  28. package/dist/esm/rag/splitters/constants.js +24 -1
  29. package/dist/esm/rag/splitters/constants.js.map +1 -1
  30. package/dist/esm/rag/splitters/index.d.ts +15 -1
  31. package/dist/esm/rag/splitters/index.js +15 -1
  32. package/dist/esm/rag/splitters/index.js.map +1 -1
  33. package/dist/esm/rag/splitters/shared.d.ts +32 -0
  34. package/dist/esm/rag/splitters/shared.js +77 -1
  35. package/dist/esm/rag/splitters/shared.js.map +1 -1
  36. package/dist/esm/recorders/observability/BoundaryRecorder.d.ts +24 -0
  37. package/dist/esm/recorders/observability/BoundaryRecorder.js +19 -6
  38. package/dist/esm/recorders/observability/BoundaryRecorder.js.map +1 -1
  39. package/dist/esm/recorders/observability/embeddingSummary.d.ts +56 -0
  40. package/dist/esm/recorders/observability/embeddingSummary.js +114 -0
  41. package/dist/esm/recorders/observability/embeddingSummary.js.map +1 -0
  42. package/dist/esm/recorders/observability/recordRun.d.ts +16 -0
  43. package/dist/esm/recorders/observability/recordRun.js +17 -3
  44. package/dist/esm/recorders/observability/recordRun.js.map +1 -1
  45. package/dist/lib/rag/defineRAG.js.map +1 -1
  46. package/dist/memory/retrieval/topK.js.map +1 -1
  47. package/dist/memory/store/index.js +6 -1
  48. package/dist/memory/store/index.js.map +1 -1
  49. package/dist/memory/store/staticVectorStore.js +230 -0
  50. package/dist/memory/store/staticVectorStore.js.map +1 -0
  51. package/dist/observe.js +8 -1
  52. package/dist/observe.js.map +1 -1
  53. package/dist/rag/exportCorpus.js +177 -0
  54. package/dist/rag/exportCorpus.js.map +1 -0
  55. package/dist/rag/index.js +13 -1
  56. package/dist/rag/index.js.map +1 -1
  57. package/dist/rag/splitters/byHeading.js +132 -14
  58. package/dist/rag/splitters/byHeading.js.map +1 -1
  59. package/dist/rag/splitters/byParagraph.js +3 -1
  60. package/dist/rag/splitters/byParagraph.js.map +1 -1
  61. package/dist/rag/splitters/constants.js +25 -2
  62. package/dist/rag/splitters/constants.js.map +1 -1
  63. package/dist/rag/splitters/index.js +16 -1
  64. package/dist/rag/splitters/index.js.map +1 -1
  65. package/dist/rag/splitters/shared.js +79 -1
  66. package/dist/rag/splitters/shared.js.map +1 -1
  67. package/dist/recorders/observability/BoundaryRecorder.js +19 -6
  68. package/dist/recorders/observability/BoundaryRecorder.js.map +1 -1
  69. package/dist/recorders/observability/embeddingSummary.js +119 -0
  70. package/dist/recorders/observability/embeddingSummary.js.map +1 -0
  71. package/dist/recorders/observability/recordRun.js +17 -3
  72. package/dist/recorders/observability/recordRun.js.map +1 -1
  73. package/dist/types/lib/rag/defineRAG.d.ts +9 -6
  74. package/dist/types/lib/rag/defineRAG.d.ts.map +1 -1
  75. package/dist/types/memory/retrieval/topK.d.ts +12 -6
  76. package/dist/types/memory/retrieval/topK.d.ts.map +1 -1
  77. package/dist/types/memory/store/index.d.ts +1 -0
  78. package/dist/types/memory/store/index.d.ts.map +1 -1
  79. package/dist/types/memory/store/staticVectorStore.d.ts +84 -0
  80. package/dist/types/memory/store/staticVectorStore.d.ts.map +1 -0
  81. package/dist/types/observe.d.ts +1 -0
  82. package/dist/types/observe.d.ts.map +1 -1
  83. package/dist/types/rag/exportCorpus.d.ts +65 -0
  84. package/dist/types/rag/exportCorpus.d.ts.map +1 -0
  85. package/dist/types/rag/index.d.ts +3 -1
  86. package/dist/types/rag/index.d.ts.map +1 -1
  87. package/dist/types/rag/splitters/byHeading.d.ts +39 -0
  88. package/dist/types/rag/splitters/byHeading.d.ts.map +1 -1
  89. package/dist/types/rag/splitters/byParagraph.d.ts +14 -0
  90. package/dist/types/rag/splitters/byParagraph.d.ts.map +1 -1
  91. package/dist/types/rag/splitters/constants.d.ts +24 -1
  92. package/dist/types/rag/splitters/constants.d.ts.map +1 -1
  93. package/dist/types/rag/splitters/index.d.ts +15 -1
  94. package/dist/types/rag/splitters/index.d.ts.map +1 -1
  95. package/dist/types/rag/splitters/shared.d.ts +32 -0
  96. package/dist/types/rag/splitters/shared.d.ts.map +1 -1
  97. package/dist/types/recorders/observability/BoundaryRecorder.d.ts +24 -0
  98. package/dist/types/recorders/observability/BoundaryRecorder.d.ts.map +1 -1
  99. package/dist/types/recorders/observability/embeddingSummary.d.ts +57 -0
  100. package/dist/types/recorders/observability/embeddingSummary.d.ts.map +1 -0
  101. package/dist/types/recorders/observability/recordRun.d.ts +16 -0
  102. package/dist/types/recorders/observability/recordRun.d.ts.map +1 -1
  103. package/package.json +1 -1
@@ -0,0 +1,114 @@
1
+ /**
2
+ * embeddingSummary — what a recording keeps of a vector: its shape, not its
3
+ * bytes.
4
+ *
5
+ * Pattern: pure copy-on-write projection, in the `storedPreview` family —
6
+ * "summarise structured values rather than serialize them", applied
7
+ * to the one field measured to dominate a recording's size.
8
+ * Role: recorders/observability layer. Applied at the RECORDING boundary
9
+ * (BoundaryRecorder payload capture, `recordRun` freeze), never to
10
+ * live run state — stages and stores keep their real vectors.
11
+ * Emits: N/A.
12
+ *
13
+ * ── The measurement this exists for ─────────────────────────────────────────
14
+ * A single retrieval turn's recording measured 2.76 MB in a production RAG
15
+ * deployment — about 1.1 MB of it embedding floats, because the memory-read
16
+ * subflow's boundary output carries every retrieved entry, and every entry
17
+ * carries its full vector (1,024 floats serializing at ~19 bytes each). No
18
+ * consumer of a recording reads those floats: retrieval debugging needs the
19
+ * score, the passage, the document and the rejected candidates — all of which
20
+ * live in the retrieval evidence and none of which this touches. The vector's
21
+ * only recording-worthy facts are that it existed, its dimensionality, and a
22
+ * checksum-grade magnitude. That is exactly what `{ dims, norm }` keeps.
23
+ *
24
+ * The walk is copy-on-write: a value with no embeddings anywhere is returned
25
+ * BY REFERENCE, so the common payload costs one traversal and zero
26
+ * allocation. It never mutates its input — recordings share structure with
27
+ * live run state, and live state is borrowed, not owned.
28
+ *
29
+ * Two spellings are recognised, because the memory layer writes both:
30
+ * - `embedding: number[]` — a `MemoryEntry`'s vector (read side);
31
+ * - `embeddings: number[][]` — the write pipeline's per-message batch.
32
+ *
33
+ * Idempotent by construction: a summary is not a numeric array, so a value
34
+ * that has already been summarised passes through unchanged.
35
+ */
36
+ /** Round to 4 decimals — a checksum, not an operand. */
37
+ function l2norm(vector) {
38
+ let sum = 0;
39
+ for (const v of vector)
40
+ sum += v * v;
41
+ return Math.round(Math.sqrt(sum) * 1e4) / 1e4;
42
+ }
43
+ function isNumericVector(value) {
44
+ return Array.isArray(value) && value.length > 0 && value.every((v) => typeof v === 'number');
45
+ }
46
+ /** Summarise one vector. Exported for consumers that render recordings. */
47
+ export function summarizeVector(vector) {
48
+ return { dims: vector.length, norm: l2norm(vector) };
49
+ }
50
+ /**
51
+ * Replace every `embedding` / `embeddings` field in a JSON-ish value with its
52
+ * `{ dims, norm }` summary. Copy-on-write: returns the SAME reference when
53
+ * nothing needed replacing; otherwise a structurally-shared copy. Never
54
+ * mutates the input.
55
+ *
56
+ * Shared nodes stay shared: a snapshot holds the same entry object at several
57
+ * paths (live state, stage writes, commit history), so results are memoized
58
+ * per input object — every path gets the SAME summarized copy, not one copy
59
+ * and one raw leak. Cycle-safe: an object seen again while still being walked
60
+ * resolves to its original reference (a cyclic value could not be serialized
61
+ * anyway).
62
+ */
63
+ export function summarizeEmbeddings(value) {
64
+ return walk(value, new WeakMap());
65
+ }
66
+ function walk(value, memo) {
67
+ if (value === null || typeof value !== 'object')
68
+ return value;
69
+ if (memo.has(value))
70
+ return memo.get(value);
71
+ // Placeholder for cycles: a back-edge met mid-walk resolves to the original.
72
+ memo.set(value, value);
73
+ if (Array.isArray(value)) {
74
+ let copy;
75
+ for (let i = 0; i < value.length; i++) {
76
+ const walked = walk(value[i], memo);
77
+ if (walked !== value[i]) {
78
+ copy ??= [...value];
79
+ copy[i] = walked;
80
+ }
81
+ }
82
+ const result = copy ?? value;
83
+ memo.set(value, result);
84
+ return result;
85
+ }
86
+ // Walk plain objects only. Class instances, Dates, Maps and the like are
87
+ // opaque values here — the recording layer stores POJOs, and reaching into
88
+ // somebody's live object to rewrite a field is what "never mutate" forbids.
89
+ const proto = Object.getPrototypeOf(value);
90
+ if (proto !== Object.prototype && proto !== null)
91
+ return value;
92
+ const record = value;
93
+ let copy;
94
+ for (const [key, field] of Object.entries(record)) {
95
+ let replacement = field;
96
+ if (key === 'embedding' && isNumericVector(field)) {
97
+ replacement = summarizeVector(field);
98
+ }
99
+ else if (key === 'embeddings' && Array.isArray(field) && field.some(isNumericVector)) {
100
+ replacement = field.map((v) => (isNumericVector(v) ? summarizeVector(v) : walk(v, memo)));
101
+ }
102
+ else {
103
+ replacement = walk(field, memo);
104
+ }
105
+ if (replacement !== field) {
106
+ copy ??= { ...record };
107
+ copy[key] = replacement;
108
+ }
109
+ }
110
+ const result = copy ?? value;
111
+ memo.set(value, result);
112
+ return result;
113
+ }
114
+ //# sourceMappingURL=embeddingSummary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embeddingSummary.js","sourceRoot":"","sources":["../../../../src/recorders/observability/embeddingSummary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAQH,wDAAwD;AACxD,SAAS,MAAM,CAAC,MAAyB;IACvC,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,KAAK,MAAM,CAAC,IAAI,MAAM;QAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACrC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAChD,CAAC;AAED,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;AAC/F,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,eAAe,CAAC,MAAyB;IACvD,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,IAAI,CAAC,KAAK,EAAE,IAAI,OAAO,EAAE,CAAC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AK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,IAAI,WAAW,GAAY,KAAK,CAAC;QACjC,IAAI,GAAG,KAAK,WAAW,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;YAClD,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;QACvC,CAAC;aAAM,IAAI,GAAG,KAAK,YAAY,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YACvF,WAAW,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5F,CAAC;aAAM,CAAC;YACN,WAAW,GAAG,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,WAAW,KAAK,KAAK,EAAE,CAAC;YAC1B,IAAI,KAAK,EAAE,GAAG,MAAM,EAAE,CAAC;YACvB,IAAI,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;QAC1B,CAAC;IACH,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,IAAI,KAAK,CAAC;IAC7B,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -94,6 +94,22 @@ export interface RecordRunOptions {
94
94
  * consumer reading the bundle's `meta.mode` can say so.
95
95
  */
96
96
  readonly boundaryDetail?: 'full' | 'lean';
97
+ /**
98
+ * Keep raw embedding vectors in the recording (8.20.0). Default `false`:
99
+ * every `embedding` / `embeddings` field — in boundary payloads, in the
100
+ * snapshot's subflow results, in tool results riding the event stream —
101
+ * is replaced with its `{ dims, norm }` summary when the recording is
102
+ * frozen.
103
+ *
104
+ * Field measurement behind the default: one retrieval turn's recording
105
+ * weighed 2.76 MB, ~1.1 MB of it embedding floats, because the
106
+ * memory-read subflow's boundary output carries each retrieved entry's
107
+ * full vector. Nothing that renders a recording reads those floats; the
108
+ * retrieval evidence a debugger needs (score, passage, document,
109
+ * rejected candidates) carries no vectors and is untouched. Set `true`
110
+ * only when a consumer genuinely replays raw vectors offline.
111
+ */
112
+ readonly recordEmbeddings?: boolean;
97
113
  }
98
114
  /** A recording in progress. Keep it until the run ends, then freeze it. */
99
115
  export interface RunRecorder {
@@ -58,6 +58,7 @@
58
58
  */
59
59
  import { DEFAULT_MAX_EVENTS, eventTail } from '../../events/eventTail.js';
60
60
  import { boundaryRecorder } from './BoundaryRecorder.js';
61
+ import { summarizeEmbeddings } from './embeddingSummary.js';
61
62
  /**
62
63
  * Start recording a runner. Call BEFORE `run()` — a recording is
63
64
  * collected as the run happens and cannot be reconstructed after it.
@@ -90,9 +91,11 @@ export function recordRun(runner, options = {}) {
90
91
  // to call this instead of wiring it yourself. `getCommitCount` reads
91
92
  // through the runner on every boundary, so it reports the count at
92
93
  // that moment rather than a number captured now (when it is 0).
94
+ const keepEmbeddings = options.recordEmbeddings ?? false;
93
95
  const boundary = boundaryRecorder({
94
96
  getCommitCount: () => runner.getCommitCount(),
95
97
  ...(options.boundaryDetail === 'lean' ? { snapshot: 'lean' } : {}),
98
+ ...(keepEmbeddings ? { recordEmbeddings: true } : {}),
96
99
  });
97
100
  const offAttach = runner.attach(boundary);
98
101
  const offTyped = boundary.subscribe(runner);
@@ -100,9 +103,20 @@ export function recordRun(runner, options = {}) {
100
103
  return {
101
104
  toRecording: () => ({
102
105
  // Read at freeze time. Before the run there is no snapshot; during
103
- // one it grows; after it, it is the finished run's.
104
- snapshot: runner.getLastSnapshot(),
105
- events: tail.snapshot().events,
106
+ // one it grows; after it, it is the finished run's. Unless
107
+ // `recordEmbeddings` asked for them, raw vectors are summarised to
108
+ // `{ dims, norm }` here — the snapshot's subflow results carry every
109
+ // retrieved entry's full vector otherwise, which is what made a
110
+ // single retrieval turn's recording weigh 2.76 MB in the field. The
111
+ // summarisation is copy-on-write: parts of the snapshot without
112
+ // embeddings are the runner's own objects, held by reference, as
113
+ // before — serialize to detach.
114
+ snapshot: keepEmbeddings
115
+ ? runner.getLastSnapshot()
116
+ : summarizeEmbeddings(runner.getLastSnapshot()),
117
+ events: keepEmbeddings
118
+ ? tail.snapshot().events
119
+ : summarizeEmbeddings(tail.snapshot().events),
106
120
  // The one piece a run does not leave behind — it lives on the
107
121
  // chart, which is built once and never changes.
108
122
  structure: runner.getSpec().buildTimeStructure,
@@ -1 +1 @@
1
- {"version":3,"file":"recordRun.js","sourceRoot":"","sources":["../../../../src/recorders/observability/recordRun.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAKH,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAyB,MAAM,uBAAuB,CAAC;AAqEhF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,SAAS,CAAC,MAAc,EAAE,UAA4B,EAAE;IACtE,oEAAoE;IACpE,sEAAsE;IACtE,qEAAqE;IACrE,+DAA+D;IAC/D,sEAAsE;IACtE,iDAAiD;IACjD,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,SAAS,IAAI,kBAAkB,CAAC,CAAC;IAChE,MAAM,SAAS,GAAgB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAA0B,EAAE,EAAE;QAC3E,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,uEAAuE;IACvE,wEAAwE;IACxE,sEAAsE;IACtE,mEAAmE;IACnE,MAAM,QAAQ,GAAG,gBAAgB,CAAC;QAChC,cA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AAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC;AA7CD,oBA6CC"}
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InMemoryStore = void 0;
3
+ exports.CORPUS_BUNDLE_FORMAT = exports.bundleEntryToMemoryEntry = exports.assertCorpusBundle = exports.staticVectorStore = exports.InMemoryStore = void 0;
4
4
  var InMemoryStore_js_1 = require("./InMemoryStore.js");
5
5
  Object.defineProperty(exports, "InMemoryStore", { enumerable: true, get: function () { return InMemoryStore_js_1.InMemoryStore; } });
6
+ var staticVectorStore_js_1 = require("./staticVectorStore.js");
7
+ Object.defineProperty(exports, "staticVectorStore", { enumerable: true, get: function () { return staticVectorStore_js_1.staticVectorStore; } });
8
+ Object.defineProperty(exports, "assertCorpusBundle", { enumerable: true, get: function () { return staticVectorStore_js_1.assertCorpusBundle; } });
9
+ Object.defineProperty(exports, "bundleEntryToMemoryEntry", { enumerable: true, get: function () { return staticVectorStore_js_1.bundleEntryToMemoryEntry; } });
10
+ Object.defineProperty(exports, "CORPUS_BUNDLE_FORMAT", { enumerable: true, get: function () { return staticVectorStore_js_1.CORPUS_BUNDLE_FORMAT; } });
6
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/memory/store/index.ts"],"names":[],"mappings":";;;AASA,uDAAmD;AAA1C,iHAAA,aAAa,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/memory/store/index.ts"],"names":[],"mappings":";;;AASA,uDAAmD;AAA1C,iHAAA,aAAa,OAAA;AACtB,+DAQgC;AAP9B,yHAAA,iBAAiB,OAAA;AACjB,0HAAA,kBAAkB,OAAA;AAClB,gIAAA,wBAAwB,OAAA;AACxB,4HAAA,oBAAoB,OAAA"}
@@ -0,0 +1,230 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.staticVectorStore = exports.bundleEntryToMemoryEntry = exports.assertCorpusBundle = exports.CORPUS_BUNDLE_FORMAT = void 0;
4
+ const index_js_1 = require("../identity/index.js");
5
+ const cosine_js_1 = require("../embedding/cosine.js");
6
+ /** The bundle format marker. Version the FORMAT, not the library. */
7
+ exports.CORPUS_BUNDLE_FORMAT = 'agentfootprint-corpus-v1';
8
+ /**
9
+ * Validate a value as a `CorpusBundle`, teachingly. Shared by
10
+ * `staticVectorStore` and `importCorpus`, so a truncated file or a
11
+ * hand-edited bundle fails the same way at every door.
12
+ */
13
+ function assertCorpusBundle(bundle, caller) {
14
+ const b = bundle;
15
+ if (b === null || typeof b !== 'object') {
16
+ throw new Error(`${caller}: expected a corpus bundle object, received ${b === null ? 'null' : typeof b}. ` +
17
+ `A bundle comes from exportCorpus() — typically JSON.parse of the file it was saved to.`);
18
+ }
19
+ if (b.format !== exports.CORPUS_BUNDLE_FORMAT) {
20
+ throw new Error(`${caller}: this is not a corpus bundle — \`format\` is ${JSON.stringify(b.format)}, expected '${exports.CORPUS_BUNDLE_FORMAT}'. Bundles are produced by exportCorpus(); a raw ` +
21
+ `entries array or a different artifact cannot be served as one.`);
22
+ }
23
+ const dims = b.embedder?.dimensions;
24
+ if (typeof b.embedder?.id !== 'string' || typeof dims !== 'number' || dims < 1) {
25
+ throw new Error(`${caller}: the bundle does not name its embedding space — \`embedder\` must carry a ` +
26
+ `string \`id\` and a positive \`dimensions\`. Without them nothing can refuse a wrong ` +
27
+ `embedder at load, which is the silent failure this format exists to prevent.`);
28
+ }
29
+ if (typeof b.namespace !== 'string' || b.namespace.length === 0) {
30
+ throw new Error(`${caller}: the bundle carries no \`namespace\`. Re-export with exportCorpus().`);
31
+ }
32
+ if (!Array.isArray(b.entries)) {
33
+ throw new Error(`${caller}: \`entries\` must be an array. Re-export with exportCorpus().`);
34
+ }
35
+ b.entries.forEach((entry, i) => {
36
+ const where = `entries[${i}]${entry?.id ? ` ('${entry.id}')` : ''}`;
37
+ if (!entry || typeof entry.id !== 'string' || entry.id.length === 0) {
38
+ throw new Error(`${caller}: ${where} has no \`id\`.`);
39
+ }
40
+ if (typeof entry.text !== 'string' || entry.text.trim().length === 0) {
41
+ throw new Error(`${caller}: ${where} has no passage on \`text\`. A citable id with nothing to cite is ` +
42
+ `the blank-citation bug; a bundle never carries one.`);
43
+ }
44
+ if (!Array.isArray(entry.vector) || entry.vector.length !== dims) {
45
+ throw new Error(`${caller}: ${where} carries a vector of length ` +
46
+ `${Array.isArray(entry.vector) ? entry.vector.length : 'none'}, but the bundle's ` +
47
+ `embedder declares ${dims} dimensions. The bundle is corrupt or hand-edited — ` +
48
+ `re-export it.`);
49
+ }
50
+ });
51
+ }
52
+ exports.assertCorpusBundle = assertCorpusBundle;
53
+ /**
54
+ * The `MemoryEntry` a bundle entry seeds — in the exact shape the retrieval
55
+ * formatter reads: passage on `value.content`, provenance under
56
+ * `value.metadata`. Shared with `importCorpus` so a static corpus and an
57
+ * imported one render identically.
58
+ */
59
+ function bundleEntryToMemoryEntry(entry, bundle) {
60
+ return {
61
+ id: entry.id,
62
+ value: {
63
+ id: entry.id,
64
+ content: entry.text,
65
+ ...(entry.metadata !== undefined && { metadata: { ...entry.metadata } }),
66
+ },
67
+ version: 1,
68
+ createdAt: bundle.exportedAt,
69
+ updatedAt: bundle.exportedAt,
70
+ lastAccessedAt: bundle.exportedAt,
71
+ accessCount: 0,
72
+ embedding: [...entry.vector],
73
+ embeddingModel: bundle.embedder.id,
74
+ };
75
+ }
76
+ exports.bundleEntryToMemoryEntry = bundleEntryToMemoryEntry;
77
+ const READ_ONLY_FIX = `A static corpus is a build artifact: change it by re-indexing at build time and ` +
78
+ `re-exporting (exportCorpus), or load the bundle into a writable store with ` +
79
+ `importCorpus(store, bundle). For conversation memory alongside a static corpus, ` +
80
+ `register a SEPARATE defineMemory with its own writable store.`;
81
+ function refuseWrite(method) {
82
+ throw new Error(`staticVectorStore.${method}: this store is read-only — accepting the write and losing ` +
83
+ `it with the process would be the quiet version of data loss. ${READ_ONLY_FIX}`);
84
+ }
85
+ /**
86
+ * Serve an exported corpus bundle as a read-only, vector-capable
87
+ * `MemoryStore`.
88
+ *
89
+ * @param bundle a `CorpusBundle` from `exportCorpus` (usually
90
+ * `JSON.parse` of the shipped file).
91
+ * @param embedder optional — the embedder the RUNTIME will query with (or
92
+ * just `{ id, dimensions }`). When given, a fingerprint
93
+ * mismatch is refused HERE, at load, instead of surfacing as
94
+ * an empty retrieval at the first question. Recommended.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * import { staticVectorStore } from 'agentfootprint/memory';
99
+ * import corpus from './corpus.json';
100
+ *
101
+ * const store = staticVectorStore(corpus, embedder);
102
+ * const docs = defineRAG({ id: 'docs', store, embedder });
103
+ * ```
104
+ */
105
+ function staticVectorStore(bundle, embedder) {
106
+ assertCorpusBundle(bundle, 'staticVectorStore');
107
+ if (embedder !== undefined) {
108
+ // The sqliteVectorStore rule, applied at load: dimensions ALWAYS decide;
109
+ // ids decide only when both sides named themselves.
110
+ if (embedder.dimensions !== bundle.embedder.dimensions) {
111
+ throw new Error(`staticVectorStore: this bundle was built in '${bundle.embedder.id}@` +
112
+ `${bundle.embedder.dimensions}' and the configured embedder produces ` +
113
+ `${embedder.dimensions}-dimensional vectors. Vectors of different lengths cannot ` +
114
+ `be compared at all. Re-export the corpus with the runtime's embedder, or ` +
115
+ `configure the embedder the corpus was built with.`);
116
+ }
117
+ if (embedder.id !== undefined && embedder.id !== bundle.embedder.id) {
118
+ throw new Error(`staticVectorStore: this bundle was built in '${bundle.embedder.id}@` +
119
+ `${bundle.embedder.dimensions}' and the configured embedder is '${embedder.id}'. ` +
120
+ `Cosine similarity between two embedding spaces is not a weak signal — it is not ` +
121
+ `a signal, and it comes back as a confident number in the same range as a real ` +
122
+ `one. Re-export the corpus with '${embedder.id}', or configure ` +
123
+ `'${bundle.embedder.id}'.`);
124
+ }
125
+ }
126
+ const entries = new Map();
127
+ for (const entry of bundle.entries) {
128
+ entries.set(entry.id, bundleEntryToMemoryEntry(entry, bundle));
129
+ }
130
+ const namespace = bundle.namespace;
131
+ const inNamespace = (identity) => (0, index_js_1.identityNamespace)(identity) === namespace;
132
+ return {
133
+ // Vectors in, ranked vectors out — the cosine scan below ranks the
134
+ // embeddings the bundle carries. Declared, so corpus builders can tell
135
+ // this apart from a server-side store (and refuse to INDEX into it —
136
+ // which they will anyway, at the first write).
137
+ supportsVectorSearch: true,
138
+ async get(identity, id) {
139
+ if (!inNamespace(identity))
140
+ return null;
141
+ // No access-count bump: the store is read-only, decay signals frozen
142
+ // at export.
143
+ return entries.get(id) ?? null;
144
+ },
145
+ async put() {
146
+ refuseWrite('put');
147
+ },
148
+ async putMany() {
149
+ refuseWrite('putMany');
150
+ },
151
+ async putIfVersion() {
152
+ refuseWrite('putIfVersion');
153
+ },
154
+ async delete() {
155
+ refuseWrite('delete');
156
+ },
157
+ async forget() {
158
+ refuseWrite('forget');
159
+ },
160
+ async recordSignature() {
161
+ refuseWrite('recordSignature');
162
+ },
163
+ async feedback() {
164
+ refuseWrite('feedback');
165
+ },
166
+ async list(identity, options) {
167
+ if (!inNamespace(identity))
168
+ return { entries: [] };
169
+ const limit = Math.max(1, Math.min(options?.limit ?? 100, 1000));
170
+ const all = [...entries.values()];
171
+ const offset = options?.cursor ? parseInt(options.cursor, 10) : 0;
172
+ const safeOffset = Number.isFinite(offset) && offset >= 0 ? offset : 0;
173
+ const page = all.slice(safeOffset, safeOffset + limit);
174
+ const next = safeOffset + page.length;
175
+ return {
176
+ entries: page,
177
+ ...(next < all.length && { cursor: String(next) }),
178
+ };
179
+ },
180
+ async seen() {
181
+ return false; // no signature set was exported; recognition is a write-side concern
182
+ },
183
+ async getFeedback() {
184
+ return null;
185
+ },
186
+ async search(identity, query, options) {
187
+ // A wrong-space query is refused BY NAME rather than ranked to an empty
188
+ // page — the loud version of the mismatch machinery, because on a
189
+ // static corpus "no results" reads as "the corpus has nothing to say".
190
+ if (query.length !== bundle.embedder.dimensions) {
191
+ throw new Error(`staticVectorStore.search: the query vector has ${query.length} dimensions, but ` +
192
+ `this bundle was built in '${bundle.embedder.id}@${bundle.embedder.dimensions}'. ` +
193
+ `The query was embedded with a different embedder than the corpus. Configure the ` +
194
+ `embedder the corpus was built with, or re-export the corpus.`);
195
+ }
196
+ if (options?.embedderId !== undefined && options.embedderId !== bundle.embedder.id) {
197
+ throw new Error(`staticVectorStore.search: the retriever declares embedderId '${options.embedderId}' ` +
198
+ `but this bundle was built in '${bundle.embedder.id}@` +
199
+ `${bundle.embedder.dimensions}'. Silently skipping every entry would look like an ` +
200
+ `empty corpus. Align the retriever's \`embedderId\` with the bundle, or re-export ` +
201
+ `the corpus with the new embedder.`);
202
+ }
203
+ if (!inNamespace(identity))
204
+ return [];
205
+ const k = options?.k ?? 10;
206
+ const tierFilter = options?.tiers ? new Set(options.tiers) : undefined;
207
+ const minScore = options?.minScore;
208
+ const scored = [];
209
+ for (const entry of entries.values()) {
210
+ if (tierFilter && (!entry.tier || !tierFilter.has(entry.tier)))
211
+ continue;
212
+ const emb = entry.embedding;
213
+ if (!emb || emb.length !== query.length)
214
+ continue;
215
+ const score = (0, cosine_js_1.cosineSimilarity)(emb, query);
216
+ if (minScore !== undefined && score < minScore)
217
+ continue;
218
+ scored.push({ entry: entry, score });
219
+ }
220
+ scored.sort((a, b) => {
221
+ if (b.score !== a.score)
222
+ return b.score - a.score;
223
+ return a.entry.id < b.entry.id ? -1 : a.entry.id > b.entry.id ? 1 : 0;
224
+ });
225
+ return scored.slice(0, k);
226
+ },
227
+ };
228
+ }
229
+ exports.staticVectorStore = staticVectorStore;
230
+ //# sourceMappingURL=staticVectorStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"staticVectorStore.js","sourceRoot":"","sources":["../../../src/memory/store/staticVectorStore.ts"],"names":[],"mappings":";;;AA0CA,mDAAyD;AAEzD,sDAA0D;AAU1D,qEAAqE;AACxD,QAAA,oBAAoB,GAAG,0BAAmC,CAAC;AA8CxE;;;;GAIG;AACH,SAA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7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
47
47
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
48
48
  };
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.ledgerGated = exports.ledgerEntryScorer = exports.ledgerToolGate = exports.contextLedger = exports.formatRouteHop = exports.routeRecorder = exports.toolChoiceRecorder = exports.buildChoiceContext = exports.typedEmit = exports.agentThinkingTrace = exports.toolLineageRecorder = exports.attachStatus = exports.LoggingDomains = exports.attachLogging = exports.resilienceRecorder = exports.skillRecorder = exports.permissionRecorder = exports.embeddingRecorder = exports.memoryRecorder = exports.evalRecorder = exports.contextEvaluatedRecorder = exports.toolsRecorder = exports.costRecorder = exports.LiveAgentTurnTracker = exports.LiveToolTracker = exports.LiveLLMTracker = exports.LiveStateRecorder = exports.liveStateRecorder = exports.attachLocalObservability = exports.traceToStepGraph = exports.redactContent = exports.serializeTrace = exports.recordRun = exports.buildStepGraphFromEvents = exports.buildStepGraph = exports.attachFlowchart = exports.runStepRecorder = exports.RunStepRecorder = exports.buildRunSteps = exports.BoundaryRecorder = exports.boundaryRecorder = exports.agentRecorder = exports.compositionRecorder = exports.streamRecorder = exports.ContextRecorder = void 0;
50
+ exports.ledgerGated = exports.ledgerEntryScorer = exports.ledgerToolGate = exports.contextLedger = exports.formatRouteHop = exports.routeRecorder = exports.toolChoiceRecorder = exports.buildChoiceContext = exports.typedEmit = exports.agentThinkingTrace = exports.toolLineageRecorder = exports.attachStatus = exports.LoggingDomains = exports.attachLogging = exports.resilienceRecorder = exports.skillRecorder = exports.permissionRecorder = exports.embeddingRecorder = exports.memoryRecorder = exports.evalRecorder = exports.contextEvaluatedRecorder = exports.toolsRecorder = exports.costRecorder = exports.LiveAgentTurnTracker = exports.LiveToolTracker = exports.LiveLLMTracker = exports.LiveStateRecorder = exports.liveStateRecorder = exports.attachLocalObservability = exports.traceToStepGraph = exports.redactContent = exports.serializeTrace = exports.summarizeVector = exports.summarizeEmbeddings = exports.recordRun = exports.buildStepGraphFromEvents = exports.buildStepGraph = exports.attachFlowchart = exports.runStepRecorder = exports.RunStepRecorder = exports.buildRunSteps = exports.BoundaryRecorder = exports.boundaryRecorder = exports.agentRecorder = exports.compositionRecorder = exports.streamRecorder = exports.ContextRecorder = void 0;
51
51
  // Tier 1 — context + stream
52
52
  var ContextRecorder_js_1 = require("./recorders/core/ContextRecorder.js");
53
53
  Object.defineProperty(exports, "ContextRecorder", { enumerable: true, get: function () { return ContextRecorder_js_1.ContextRecorder; } });
@@ -75,6 +75,13 @@ Object.defineProperty(exports, "buildStepGraphFromEvents", { enumerable: true, g
75
75
  // every integration used to assemble by hand, each missing a different piece.
76
76
  var recordRun_js_1 = require("./recorders/observability/recordRun.js");
77
77
  Object.defineProperty(exports, "recordRun", { enumerable: true, get: function () { return recordRun_js_1.recordRun; } });
78
+ // What a recording keeps of a vector: `{ dims, norm }`, not the bytes (8.20.0).
79
+ // Applied by BoundaryRecorder and recordRun unless `recordEmbeddings: true`;
80
+ // exported so consumers that render or post-process recordings can apply or
81
+ // recognise the same projection.
82
+ var embeddingSummary_js_1 = require("./recorders/observability/embeddingSummary.js");
83
+ Object.defineProperty(exports, "summarizeEmbeddings", { enumerable: true, get: function () { return embeddingSummary_js_1.summarizeEmbeddings; } });
84
+ Object.defineProperty(exports, "summarizeVector", { enumerable: true, get: function () { return embeddingSummary_js_1.summarizeVector; } });
78
85
  // Offline replay: freeze a live run model into a UI-free, JSON-lossless Trace
79
86
  // (redaction applied at the serialize boundary). agentfootprint-lens's <Replay>
80
87
  // rehydrates it. See docs/design/local-observability-and-pii.md.
@@ -1 +1 @@
1
- {"version":3,"file":"observe.js","sourceRoot":"","sources":["../src/observe.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;;;;;;;;;;;;;;;;AAEH,4BAA4B;AAC5B,0EAAmG;AAA1F,qHAAA,eAAe,OAAA;AACxB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