agentfootprint 9.2.0 → 9.3.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 (91) hide show
  1. package/dist/adapters/memory/pgVector.js +731 -0
  2. package/dist/adapters/memory/pgVector.js.map +1 -0
  3. package/dist/adapters/memory/s3Vectors.js +628 -0
  4. package/dist/adapters/memory/s3Vectors.js.map +1 -0
  5. package/dist/adapters/memory/sqliteVector.js +16 -79
  6. package/dist/adapters/memory/sqliteVector.js.map +1 -1
  7. package/dist/embedders/index.js +240 -76
  8. package/dist/embedders/index.js.map +1 -1
  9. package/dist/esm/adapters/memory/pgVector.d.ts +243 -0
  10. package/dist/esm/adapters/memory/pgVector.js +726 -0
  11. package/dist/esm/adapters/memory/pgVector.js.map +1 -0
  12. package/dist/esm/adapters/memory/s3Vectors.d.ts +208 -0
  13. package/dist/esm/adapters/memory/s3Vectors.js +624 -0
  14. package/dist/esm/adapters/memory/s3Vectors.js.map +1 -0
  15. package/dist/esm/adapters/memory/sqliteVector.d.ts +5 -27
  16. package/dist/esm/adapters/memory/sqliteVector.js +10 -73
  17. package/dist/esm/adapters/memory/sqliteVector.js.map +1 -1
  18. package/dist/esm/embedders/index.d.ts +99 -19
  19. package/dist/esm/embedders/index.js +240 -76
  20. package/dist/esm/embedders/index.js.map +1 -1
  21. package/dist/esm/lib/embedderMismatch.d.ts +67 -0
  22. package/dist/esm/lib/embedderMismatch.js +96 -0
  23. package/dist/esm/lib/embedderMismatch.js.map +1 -0
  24. package/dist/esm/lib/rag/defineRAG.d.ts +28 -6
  25. package/dist/esm/lib/rag/defineRAG.js +39 -5
  26. package/dist/esm/lib/rag/defineRAG.js.map +1 -1
  27. package/dist/esm/memory/define.js +31 -1
  28. package/dist/esm/memory/define.js.map +1 -1
  29. package/dist/esm/memory/define.types.d.ts +13 -2
  30. package/dist/esm/memory/define.types.js.map +1 -1
  31. package/dist/esm/memory/embedding/loadRelevant.d.ts +10 -2
  32. package/dist/esm/memory/embedding/loadRelevant.js +36 -18
  33. package/dist/esm/memory/embedding/loadRelevant.js.map +1 -1
  34. package/dist/esm/memory/pipeline/semantic.d.ts +13 -2
  35. package/dist/esm/memory/pipeline/semantic.js +11 -5
  36. package/dist/esm/memory/pipeline/semantic.js.map +1 -1
  37. package/dist/esm/memory/store/capability.d.ts +25 -6
  38. package/dist/esm/memory/store/capability.js +68 -3
  39. package/dist/esm/memory/store/capability.js.map +1 -1
  40. package/dist/esm/memory/store/index.d.ts +1 -0
  41. package/dist/esm/memory/store/index.js +4 -0
  42. package/dist/esm/memory/store/index.js.map +1 -1
  43. package/dist/esm/memory/store/types.d.ts +40 -0
  44. package/dist/esm/memory-providers.d.ts +7 -4
  45. package/dist/esm/memory-providers.js +18 -4
  46. package/dist/esm/memory-providers.js.map +1 -1
  47. package/dist/lib/embedderMismatch.js +103 -0
  48. package/dist/lib/embedderMismatch.js.map +1 -0
  49. package/dist/lib/rag/defineRAG.js +39 -5
  50. package/dist/lib/rag/defineRAG.js.map +1 -1
  51. package/dist/memory/define.js +31 -1
  52. package/dist/memory/define.js.map +1 -1
  53. package/dist/memory/define.types.js.map +1 -1
  54. package/dist/memory/embedding/loadRelevant.js +36 -18
  55. package/dist/memory/embedding/loadRelevant.js.map +1 -1
  56. package/dist/memory/pipeline/semantic.js +11 -5
  57. package/dist/memory/pipeline/semantic.js.map +1 -1
  58. package/dist/memory/store/capability.js +70 -4
  59. package/dist/memory/store/capability.js.map +1 -1
  60. package/dist/memory/store/index.js +7 -1
  61. package/dist/memory/store/index.js.map +1 -1
  62. package/dist/memory-providers.js +22 -5
  63. package/dist/memory-providers.js.map +1 -1
  64. package/dist/types/adapters/memory/pgVector.d.ts +244 -0
  65. package/dist/types/adapters/memory/pgVector.d.ts.map +1 -0
  66. package/dist/types/adapters/memory/s3Vectors.d.ts +209 -0
  67. package/dist/types/adapters/memory/s3Vectors.d.ts.map +1 -0
  68. package/dist/types/adapters/memory/sqliteVector.d.ts +5 -27
  69. package/dist/types/adapters/memory/sqliteVector.d.ts.map +1 -1
  70. package/dist/types/embedders/index.d.ts +99 -19
  71. package/dist/types/embedders/index.d.ts.map +1 -1
  72. package/dist/types/lib/embedderMismatch.d.ts +68 -0
  73. package/dist/types/lib/embedderMismatch.d.ts.map +1 -0
  74. package/dist/types/lib/rag/defineRAG.d.ts +28 -6
  75. package/dist/types/lib/rag/defineRAG.d.ts.map +1 -1
  76. package/dist/types/memory/define.d.ts.map +1 -1
  77. package/dist/types/memory/define.types.d.ts +13 -2
  78. package/dist/types/memory/define.types.d.ts.map +1 -1
  79. package/dist/types/memory/embedding/loadRelevant.d.ts +10 -2
  80. package/dist/types/memory/embedding/loadRelevant.d.ts.map +1 -1
  81. package/dist/types/memory/pipeline/semantic.d.ts +13 -2
  82. package/dist/types/memory/pipeline/semantic.d.ts.map +1 -1
  83. package/dist/types/memory/store/capability.d.ts +25 -6
  84. package/dist/types/memory/store/capability.d.ts.map +1 -1
  85. package/dist/types/memory/store/index.d.ts +1 -0
  86. package/dist/types/memory/store/index.d.ts.map +1 -1
  87. package/dist/types/memory/store/types.d.ts +40 -0
  88. package/dist/types/memory/store/types.d.ts.map +1 -1
  89. package/dist/types/memory-providers.d.ts +7 -4
  90. package/dist/types/memory-providers.d.ts.map +1 -1
  91. package/package.json +9 -1
@@ -0,0 +1,628 @@
1
+ "use strict";
2
+ /**
3
+ * adapters/memory/s3Vectors — the corpus outlives the runtime, and can still
4
+ * be updated without one.
5
+ *
6
+ * `sqliteVectorStore` (8.9.0) made a corpus survive a restart by putting it in
7
+ * a file, and `staticVectorStore` (8.20.0) made it survive a runtime with no
8
+ * disk at all by shipping it as a build artifact. Both leave the same gap, and
9
+ * a production field report named it: **a bundle can only change when you
10
+ * redeploy.** Add three documents on a Tuesday and the answer arrives with the
11
+ * next release train. That is a fine trade for product documentation and a bad
12
+ * one for anything a human edits during the day.
13
+ *
14
+ * Amazon S3 Vectors closes it. It is object storage with a native vector index
15
+ * and a query API: durable, serverless, nothing to run, priced like storage
16
+ * rather than like a database cluster. This adapter is the `MemoryStore` port
17
+ * over it, and the two halves that matter are:
18
+ *
19
+ * - `search()` maps 1:1 onto **QueryVectors** — the vector goes as
20
+ * `queryVector.float32`, `k` becomes `topK`, tiers become a metadata
21
+ * `filter`, and the returned `distance` becomes the port's score.
22
+ * - `put()` / `putMany()` map onto **PutVectors** — so `indexCorpus`,
23
+ * `indexFolder` and `indexDocuments` run against it unchanged. **That is
24
+ * the point of writing it rather than only reading it:** a corpus you can
25
+ * add to from a cron job at 14:00 is a different product from one you can
26
+ * add to at the next deploy.
27
+ *
28
+ * ── What it is NOT ──────────────────────────────────────────────────────────
29
+ * A vector index is not a key-value store, and this adapter refuses the
30
+ * operations that would need one rather than faking them:
31
+ *
32
+ * - `putIfVersion` — PutVectors is last-write-wins; there is no
33
+ * compare-and-set. A read-then-write here would be a compare-and-set that
34
+ * another writer can walk through the middle of, which is worse than none.
35
+ * - `recordSignature` / `feedback` — a set of strings and a running average
36
+ * are not vectors. `seen()` answers `false` and `getFeedback()` `null`,
37
+ * which are both TRUE (nothing can be recorded, so nothing has been); the
38
+ * WRITE halves refuse by name.
39
+ *
40
+ * Pair it with a second store for conversation memory — `defineRAG` for the
41
+ * corpus, `defineMemory` for the chat, each with the backend it suits. That is
42
+ * the same shape `staticVectorStore` documents.
43
+ *
44
+ * ── The index you must create first, and why this does not create it ────────
45
+ * A vector index has a DIMENSION and a DISTANCE METRIC fixed at creation, and
46
+ * both are decisions about your embedder that this library must not make on
47
+ * your behalf — creating one silently would pick a size and a metric your
48
+ * corpus then lives with. Create it once, with your infrastructure:
49
+ *
50
+ * ```bash
51
+ * aws s3vectors create-vector-bucket --vector-bucket-name my-corpus
52
+ * aws s3vectors create-index \
53
+ * --vector-bucket-name my-corpus \
54
+ * --index-name docs \
55
+ * --data-type float32 \
56
+ * --dimension 1024 \
57
+ * --distance-metric cosine \
58
+ * --metadata-configuration '{"nonFilterableMetadataKeys":["af"]}'
59
+ * ```
60
+ *
61
+ * `nonFilterableMetadataKeys: ["af"]` is load-bearing, not decoration. This
62
+ * adapter stores the whole entry — the passage the model will read, its
63
+ * provenance, its timestamps — as JSON under the metadata key `af`. Filterable
64
+ * metadata has a small per-vector budget; non-filterable metadata has the large
65
+ * one. Declare `af` non-filterable and a full passage fits; leave it filterable
66
+ * and PutVectors starts refusing your longer chunks partway through an
67
+ * indexing run.
68
+ *
69
+ * Only `ns` (the identity namespace) and `tier` are ever filtered on, and both
70
+ * are short strings.
71
+ *
72
+ * ── Cosine only, said out loud ──────────────────────────────────────────────
73
+ * The port's score is a cosine similarity, and every threshold in this library
74
+ * — starting with `defineRAG`'s 0.7 default — is calibrated on that range. A
75
+ * cosine distance converts exactly (`score = 1 - distance`). A EUCLIDEAN
76
+ * distance does not: any mapping into [-1, 1] produces a number that READS like
77
+ * a cosine and is not one, which is the same class of confident-and-meaningless
78
+ * value the embedder-mismatch refusal exists to stop. So a euclidean index is
79
+ * refused at construction, by name.
80
+ *
81
+ * ── The fingerprint guarantee, stated exactly ───────────────────────────────
82
+ * `sqliteVectorStore` owns its file and can keep a fingerprint row in it. This
83
+ * store owns nothing but vectors, so the guarantee is assembled from what the
84
+ * service actually provides, and it is smaller — so it is spelled out rather
85
+ * than implied:
86
+ *
87
+ * - **Dimensions** are enforced by S3 Vectors itself. The index declares one;
88
+ * a vector of another length is rejected by the service, loudly, at the
89
+ * call. Nothing here can be sloppier than that.
90
+ * - **The model id** is stamped into every vector's metadata (`fp`) and
91
+ * checked in two places: against the fingerprint this process has already
92
+ * seen for the namespace (at write and at search), and against the
93
+ * fingerprint carried by the HITS that come back (at search). The second
94
+ * one is what survives a restart: the first query after an embedder swap
95
+ * sees documents stamped by the old embedder and refuses by name, instead
96
+ * of returning a confident ranking of two incompatible spaces.
97
+ * - What is NOT caught: the first WRITE of a fresh process into a namespace
98
+ * another embedder built. There is no cheap read that would catch it, and a
99
+ * full index scan on every boot is not one either. It is caught at the next
100
+ * search, before a single wrong answer is returned.
101
+ *
102
+ * ── Lazy peer dependency ────────────────────────────────────────────────────
103
+ * `@aws-sdk/client-s3vectors` is an OPTIONAL peer dependency, required at
104
+ * construction time. Importing `agentfootprint/memory` costs nothing for
105
+ * consumers who never build one of these. Pass `client` to share the SDK
106
+ * configuration your app already has.
107
+ */
108
+ Object.defineProperty(exports, "__esModule", { value: true });
109
+ exports.s3VectorsStore = void 0;
110
+ const index_js_1 = require("../../memory/identity/index.js");
111
+ const lazyRequire_js_1 = require("../../lib/lazyRequire.js");
112
+ const embedderMismatch_js_1 = require("../../lib/embedderMismatch.js");
113
+ // ─── Metadata layout ─────────────────────────────────────────────────
114
+ /** The identity namespace, filtered on at query time. Short, so filterable. */
115
+ const NS_KEY = 'ns';
116
+ /** The tier, filtered on when the caller asks for one. Short, so filterable. */
117
+ const TIER_KEY = 'tier';
118
+ /** The embedder fingerprint, `'<id>@<dims>'`. Short, so filterable. */
119
+ const FP_KEY = 'fp';
120
+ /**
121
+ * Everything else — the passage, provenance, versions, timestamps — as one
122
+ * JSON string. Declared NON-filterable at index creation so it gets the large
123
+ * metadata budget; see the header.
124
+ */
125
+ const PAYLOAD_KEY = 'af';
126
+ /**
127
+ * Open a `MemoryStore` over an existing S3 Vectors index.
128
+ *
129
+ * @throws when `@aws-sdk/client-s3vectors` is absent and no `client` was passed.
130
+ * @throws when `distanceMetric` is anything but `'cosine'`.
131
+ * @throws EmbedderMismatchError from `put`/`putMany`/`search` when a vector
132
+ * meets a namespace built by a different embedder.
133
+ *
134
+ * @example A corpus you can add to without a redeploy
135
+ * ```ts
136
+ * import { defineRAG, indexDocuments } from 'agentfootprint';
137
+ * import { s3VectorsStore } from 'agentfootprint/memory';
138
+ * import { bedrockEmbedder } from 'agentfootprint/providers';
139
+ *
140
+ * const store = s3VectorsStore({ bucket: 'my-corpus', index: 'docs', region: 'us-east-1' });
141
+ * const embedder = bedrockEmbedder({ region: 'us-east-1' });
142
+ *
143
+ * // Run this from a cron job. No deploy, no restart — the agent sees it next turn.
144
+ * await indexDocuments(store, embedder, newDocs, { embedderId: embedder.id });
145
+ *
146
+ * const agent = Agent.create({ provider })
147
+ * .rag(defineRAG({ id: 'docs', store, embedder, embedderId: embedder.id }))
148
+ * .build();
149
+ * ```
150
+ */
151
+ function s3VectorsStore(options) {
152
+ const { bucket, index } = options;
153
+ if (!bucket || bucket.trim() === '' || !index || index.trim() === '') {
154
+ throw new TypeError(`s3VectorsStore: both \`bucket\` and \`index\` are required and must be non-empty — ` +
155
+ `received bucket='${String(bucket)}', index='${String(index)}'. This store never ` +
156
+ `creates either: an index's dimension and distance metric are decisions about your ` +
157
+ `embedder, and picking them for you would be picking them forever.`);
158
+ }
159
+ const metric = options.distanceMetric ?? 'cosine';
160
+ if (metric !== 'cosine') {
161
+ throw new TypeError(`s3VectorsStore: distanceMetric '${String(metric)}' is not supported — this store ` +
162
+ `reports COSINE similarity, and every threshold in this library (starting with ` +
163
+ `defineRAG's 0.7 default) is calibrated on that range.\n` +
164
+ ` A cosine distance converts exactly (score = 1 - distance). A euclidean one does ` +
165
+ `not: mapping it into [-1, 1] would produce a number that reads like a cosine and ` +
166
+ `is not one, which no threshold can separate from a real score.\n` +
167
+ ` Fix: create the index with --distance-metric cosine, or rank euclidean results ` +
168
+ `in your own adapter where the units are yours to interpret.`);
169
+ }
170
+ const batchSize = Math.max(1, Math.floor(options.batchSize ?? 100));
171
+ let connection;
172
+ /**
173
+ * Resolve the client + command constructors, once, on first call.
174
+ *
175
+ * Three ways in, and the first is what keeps the tests free of AWS:
176
+ * `_client` — test injection. The SDK is never required, and each command
177
+ * is a plain object stamped with its own name, so a double
178
+ * sees exactly which call was made and with what.
179
+ * `client` — your own pre-built client; config and credentials stay yours.
180
+ * neither — this factory builds one from `region`.
181
+ */
182
+ const connect = () => {
183
+ if (connection)
184
+ return connection;
185
+ if (options._client) {
186
+ const sdk = options._sdk;
187
+ connection = {
188
+ client: options._client,
189
+ Put: sdk?.PutVectorsCommand ?? shimCommand('PutVectors'),
190
+ Query: sdk?.QueryVectorsCommand ?? shimCommand('QueryVectors'),
191
+ Get: sdk?.GetVectorsCommand ?? shimCommand('GetVectors'),
192
+ List: sdk?.ListVectorsCommand ?? shimCommand('ListVectors'),
193
+ Delete: sdk?.DeleteVectorsCommand ?? shimCommand('DeleteVectors'),
194
+ owned: false,
195
+ };
196
+ return connection;
197
+ }
198
+ const sdk = options._sdk ?? loadS3VectorsSdk();
199
+ const missing = [
200
+ 'PutVectorsCommand',
201
+ 'QueryVectorsCommand',
202
+ 'GetVectorsCommand',
203
+ 'ListVectorsCommand',
204
+ 'DeleteVectorsCommand',
205
+ ].filter((name) => typeof sdk[name] !== 'function');
206
+ if (missing.length > 0) {
207
+ throw new Error(`s3VectorsStore: \`@aws-sdk/client-s3vectors\` is installed but ${missing.join(', ')} ` +
208
+ `${missing.length === 1 ? 'was' : 'were'} not found. Update the SDK.`);
209
+ }
210
+ if (!options.client && typeof sdk.S3VectorsClient !== 'function') {
211
+ throw new Error('s3VectorsStore: `@aws-sdk/client-s3vectors` is installed but `S3VectorsClient` was ' +
212
+ 'not found. Update the SDK, or pass `client` with a pre-built one.');
213
+ }
214
+ const owned = !options.client;
215
+ connection = {
216
+ client: options.client ??
217
+ // Checked directly above.
218
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
219
+ new sdk.S3VectorsClient({ ...(options.region && { region: options.region }) }),
220
+ // All five checked directly above.
221
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
222
+ Put: sdk.PutVectorsCommand,
223
+ Query: sdk.QueryVectorsCommand,
224
+ Get: sdk.GetVectorsCommand,
225
+ List: sdk.ListVectorsCommand,
226
+ Delete: sdk.DeleteVectorsCommand,
227
+ /* eslint-enable @typescript-eslint/no-non-null-assertion */
228
+ owned,
229
+ };
230
+ return connection;
231
+ };
232
+ const call = async (build, signal) => {
233
+ const conn = connect();
234
+ const command = build(conn);
235
+ return signal ? conn.client.send(command, { abortSignal: signal }) : conn.client.send(command);
236
+ };
237
+ const scope = { vectorBucketName: bucket, indexName: index };
238
+ /** Fingerprints this process has seen, one per namespace. */
239
+ const fingerprints = new Map();
240
+ let closed = false;
241
+ const open = (verb) => {
242
+ if (closed) {
243
+ throw new Error(`[memory] the s3VectorsStore for '${bucket}/${index}' is closed, so it cannot ` +
244
+ `${verb}. close() is final by design — reopening the client behind you would hide ` +
245
+ `a shutdown-ordering bug rather than surface it. Build a new store if you need one ` +
246
+ `after closing this.`);
247
+ }
248
+ };
249
+ /**
250
+ * Compare an arriving fingerprint against the one this process holds, refuse
251
+ * a real conflict, and adopt the arriving one when it is the first or the
252
+ * more specific of the two. The same rule `sqliteVectorStore` applies — over
253
+ * a smaller record, which the header states precisely.
254
+ */
255
+ const reconcile = (ns, incoming, operation) => {
256
+ const storedText = fingerprints.get(ns);
257
+ if (storedText === undefined) {
258
+ fingerprints.set(ns, (0, embedderMismatch_js_1.fingerprintText)(incoming));
259
+ return;
260
+ }
261
+ const conflict = (0, embedderMismatch_js_1.fingerprintConflict)((0, embedderMismatch_js_1.parseFingerprint)(storedText), incoming);
262
+ if (conflict !== null) {
263
+ throw new embedderMismatch_js_1.EmbedderMismatchError(ns, storedText, (0, embedderMismatch_js_1.fingerprintText)(incoming), conflict, operation, 'point this store at a different index');
264
+ }
265
+ if ((0, embedderMismatch_js_1.parseFingerprint)(storedText).id === undefined && incoming.id !== undefined) {
266
+ fingerprints.set(ns, (0, embedderMismatch_js_1.fingerprintText)(incoming));
267
+ }
268
+ };
269
+ const store = {
270
+ bucket,
271
+ index,
272
+ // Vectors in, ranked vectors out — QueryVectors ranks the embeddings this
273
+ // store was handed, so the corpus builders may write into it.
274
+ supportsVectorSearch: true,
275
+ ranksBy: 'vector',
276
+ fingerprintOf(identity) {
277
+ return fingerprints.get((0, index_js_1.identityNamespace)(identity));
278
+ },
279
+ async get(identity, id) {
280
+ open('read an entry');
281
+ const ns = (0, index_js_1.identityNamespace)(identity);
282
+ const out = (await call((c) => new c.Get({ ...scope, keys: [vectorKey(ns, id)] })));
283
+ const row = out?.vectors?.[0];
284
+ if (!row)
285
+ return null;
286
+ const entry = vectorToEntry(row);
287
+ // Expired reads as absent, the same as every other store. No access
288
+ // counters: S3 Vectors has no in-place metadata update, so bumping one
289
+ // would mean rewriting the vector on every read.
290
+ if (!entry || isExpired(entry.ttl))
291
+ return null;
292
+ return entry;
293
+ },
294
+ async put(identity, entry) {
295
+ await this.putMany(identity, [entry]);
296
+ },
297
+ async putMany(identity, entries) {
298
+ open('write entries');
299
+ // The port requires an empty batch to be a no-op — callers rely on it to
300
+ // skip a round-trip on a turn that produced nothing.
301
+ if (entries.length === 0)
302
+ return;
303
+ const ns = (0, index_js_1.identityNamespace)(identity);
304
+ const vectors = entries.map((entry) => {
305
+ const embedding = entry.embedding;
306
+ if (!embedding || embedding.length === 0) {
307
+ throw new Error(`s3VectorsStore.putMany: entry '${entry.id}' carries no \`embedding\`, and a vector ` +
308
+ `index has nowhere to put an entry without one.\n` +
309
+ ` Every write here must arrive already embedded — which is what indexDocuments, ` +
310
+ `indexCorpus and indexFolder do. A conversation-memory pipeline over an ` +
311
+ `un-embedded turn belongs in a store built for key-value writes (RedisStore, ` +
312
+ `AgentCoreStore), registered separately with defineMemory.`);
313
+ }
314
+ const fp = {
315
+ ...(entry.embeddingModel !== undefined && { id: entry.embeddingModel }),
316
+ dims: embedding.length,
317
+ };
318
+ reconcile(ns, fp, 'write to');
319
+ return {
320
+ key: vectorKey(ns, entry.id),
321
+ data: { float32: [...embedding] },
322
+ metadata: {
323
+ [NS_KEY]: ns,
324
+ ...(entry.tier !== undefined && { [TIER_KEY]: entry.tier }),
325
+ [FP_KEY]: (0, embedderMismatch_js_1.fingerprintText)(fp),
326
+ [PAYLOAD_KEY]: JSON.stringify(payloadOf(entry)),
327
+ },
328
+ };
329
+ });
330
+ // Chunked well under the service limit. PutVectors is not transactional
331
+ // across chunks and this does not pretend otherwise: a failure part-way
332
+ // throws with the chunks before it already written, which is exactly what
333
+ // the port says about batches. The corpus builders are id-deterministic,
334
+ // so re-running the same index call converges.
335
+ for (let i = 0; i < vectors.length; i += batchSize) {
336
+ const chunk = vectors.slice(i, i + batchSize);
337
+ await call((c) => new c.Put({ ...scope, vectors: chunk }));
338
+ }
339
+ },
340
+ async putIfVersion() {
341
+ return refuse('putIfVersion', 'PutVectors is last-write-wins; S3 Vectors has no compare-and-set', 'a read-then-write here would be a compare-and-set another writer can walk through ' +
342
+ 'the middle of, which is worse than not offering one', 'use put()/putMany() when you are the only writer, or keep the version-critical ' +
343
+ 'entries in a store with real conditional writes (RedisStore) and the corpus here');
344
+ },
345
+ async list(identity, listOptions) {
346
+ open('list entries');
347
+ const ns = (0, index_js_1.identityNamespace)(identity);
348
+ const prefix = `${ns}#`;
349
+ const limit = Math.max(1, Math.floor(listOptions?.limit ?? 100));
350
+ const tierFilter = listOptions?.tiers ? new Set(listOptions.tiers) : undefined;
351
+ const page = [];
352
+ // ListVectors has no key-prefix filter, so a namespace is selected HERE,
353
+ // over pages of the whole index. That is honest but not free: on an index
354
+ // holding many namespaces this reads more than it returns. One index per
355
+ // corpus is the shape this store is for, and `search()` — the hot path —
356
+ // filters server-side on `ns` and never does this.
357
+ let token = listOptions?.cursor;
358
+ do {
359
+ const out = (await call((c) => new c.List({
360
+ ...scope,
361
+ maxResults: Math.min(500, Math.max(limit, 100)),
362
+ returnMetadata: true,
363
+ returnData: true,
364
+ ...(token !== undefined && { nextToken: token }),
365
+ })));
366
+ token = out?.nextToken;
367
+ for (const row of out?.vectors ?? []) {
368
+ if (typeof row.key !== 'string' || !row.key.startsWith(prefix))
369
+ continue;
370
+ const entry = vectorToEntry(row);
371
+ if (!entry || isExpired(entry.ttl))
372
+ continue;
373
+ if (tierFilter && (entry.tier === undefined || !tierFilter.has(entry.tier)))
374
+ continue;
375
+ page.push(entry);
376
+ if (page.length === limit)
377
+ break;
378
+ }
379
+ } while (page.length < limit && token !== undefined);
380
+ // The cursor is the service's own continuation token, so a caller pages
381
+ // through the INDEX rather than through our filtered view — which is why
382
+ // it is only returned when the service says there is more.
383
+ return { entries: page, ...(token !== undefined && { cursor: token }) };
384
+ },
385
+ async delete(identity, id) {
386
+ open('delete an entry');
387
+ const ns = (0, index_js_1.identityNamespace)(identity);
388
+ await call((c) => new c.Delete({ ...scope, keys: [vectorKey(ns, id)] }));
389
+ },
390
+ async seen() {
391
+ // TRUE, not a stub: nothing can be recorded here (see `recordSignature`),
392
+ // so nothing has been.
393
+ return false;
394
+ },
395
+ async recordSignature() {
396
+ return refuse('recordSignature', 'a recognition set is a set of strings, and this index stores vectors', 'accepting the signature and dropping it would make seen() answer false forever ' +
397
+ 'while looking like a working dedup', 'give the write pipeline a store with a set primitive (RedisStore) and keep the ' +
398
+ 'corpus here — a corpus registered through defineRAG is read-only and never ' +
399
+ 'records signatures at all');
400
+ },
401
+ async feedback() {
402
+ return refuse('feedback', 'a running usefulness average needs a read-modify-write this index cannot do', 'silently dropping the signal would leave getFeedback() answering null forever ' +
403
+ 'while the calls that fed it looked successful', 'record usefulness in a store built for counters (RedisStore), or collect it in ' +
404
+ 'your own telemetry from the agentfootprint.memory.retrieved events');
405
+ },
406
+ async getFeedback() {
407
+ // TRUE, not a stub: no feedback can be recorded here, so none has been.
408
+ return null;
409
+ },
410
+ async forget(identity) {
411
+ open('forget a namespace');
412
+ const ns = (0, index_js_1.identityNamespace)(identity);
413
+ const prefix = `${ns}#`;
414
+ let token;
415
+ do {
416
+ const out = (await call((c) => new c.List({
417
+ ...scope,
418
+ maxResults: 500,
419
+ ...(token !== undefined && { nextToken: token }),
420
+ })));
421
+ token = out?.nextToken;
422
+ const keys = (out?.vectors ?? [])
423
+ .map((v) => v.key)
424
+ .filter((k) => typeof k === 'string' && k.startsWith(prefix));
425
+ // Deleted page by page rather than collected and deleted at the end: a
426
+ // GDPR erasure that fails half way should have erased half, not
427
+ // nothing.
428
+ for (let i = 0; i < keys.length; i += batchSize) {
429
+ await call((c) => new c.Delete({ ...scope, keys: keys.slice(i, i + batchSize) }));
430
+ }
431
+ } while (token !== undefined);
432
+ fingerprints.delete(ns);
433
+ },
434
+ async search(identity, query, searchOptions) {
435
+ open('search');
436
+ const ns = (0, index_js_1.identityNamespace)(identity);
437
+ const k = Math.max(1, Math.floor(searchOptions?.k ?? 10));
438
+ if (query.length === 0)
439
+ return [];
440
+ // Refused BEFORE the call, against what this process has seen — and
441
+ // again below, against what actually comes back.
442
+ reconcile(ns, {
443
+ ...(searchOptions?.embedderId !== undefined && { id: searchOptions.embedderId }),
444
+ dims: query.length,
445
+ }, 'search');
446
+ const tiers = searchOptions?.tiers;
447
+ const nsClause = { [NS_KEY]: { $eq: ns } };
448
+ const filter = tiers && tiers.length > 0
449
+ ? { $and: [nsClause, { [TIER_KEY]: { $in: [...tiers] } }] }
450
+ : nsClause;
451
+ const out = (await call((c) => new c.Query({
452
+ ...scope,
453
+ queryVector: { float32: [...query] },
454
+ topK: k,
455
+ filter,
456
+ returnMetadata: true,
457
+ returnDistance: true,
458
+ })));
459
+ const incoming = {
460
+ ...(searchOptions?.embedderId !== undefined && { id: searchOptions.embedderId }),
461
+ dims: query.length,
462
+ };
463
+ const now = Date.now();
464
+ const minScore = searchOptions?.minScore;
465
+ const scored = [];
466
+ for (const row of out?.vectors ?? []) {
467
+ // The restart-surviving half of the fingerprint check: these documents
468
+ // carry the fingerprint they were written with, and a swap shows up
469
+ // here, on the first query, before a single ranking is returned.
470
+ const storedFp = readMetaString(row, FP_KEY);
471
+ if (storedFp !== undefined) {
472
+ const conflict = (0, embedderMismatch_js_1.fingerprintConflict)((0, embedderMismatch_js_1.parseFingerprint)(storedFp), incoming);
473
+ if (conflict !== null) {
474
+ throw new embedderMismatch_js_1.EmbedderMismatchError(ns, storedFp, (0, embedderMismatch_js_1.fingerprintText)(incoming), conflict, 'search', 'point this store at a different index');
475
+ }
476
+ }
477
+ const entry = vectorToEntry(row);
478
+ if (!entry)
479
+ continue;
480
+ if (entry.ttl !== undefined && entry.ttl <= now)
481
+ continue;
482
+ // Cosine distance to cosine similarity. Exact, not a rescaling — which
483
+ // is why a euclidean index is refused at construction rather than
484
+ // approximated here.
485
+ const distance = typeof row.distance === 'number' ? row.distance : undefined;
486
+ if (distance === undefined)
487
+ continue;
488
+ const score = 1 - distance;
489
+ if (minScore !== undefined && score < minScore)
490
+ continue;
491
+ scored.push({ entry, score });
492
+ }
493
+ // S3 Vectors returns its own ranking; re-sort anyway so the port's
494
+ // "descending by score" holds even if a future API version reorders.
495
+ scored.sort((a, b) => {
496
+ if (b.score !== a.score)
497
+ return b.score - a.score;
498
+ return a.entry.id < b.entry.id ? -1 : a.entry.id > b.entry.id ? 1 : 0;
499
+ });
500
+ return scored.slice(0, k);
501
+ },
502
+ close() {
503
+ if (closed)
504
+ return;
505
+ closed = true;
506
+ if (connection?.owned)
507
+ connection.client.destroy?.();
508
+ },
509
+ };
510
+ return store;
511
+ }
512
+ exports.s3VectorsStore = s3VectorsStore;
513
+ // ─── Refusals ────────────────────────────────────────────────────────
514
+ /** One shape for every "a vector index cannot do this" refusal. */
515
+ function refuse(method, because, why, fix) {
516
+ throw new Error(`s3VectorsStore.${method}: not supported — ${because}.\n` +
517
+ ` This refuses rather than accepting the call: ${why}.\n` +
518
+ ` Fix: ${fix}.`);
519
+ }
520
+ // ─── Keys, payloads, rows ────────────────────────────────────────────
521
+ /**
522
+ * `'<namespace>#<id>'`.
523
+ *
524
+ * The namespace is in the KEY as well as in the metadata, and the redundancy is
525
+ * deliberate: `search` filters server-side on the metadata, while `list` and
526
+ * `forget` need to select a namespace out of a page of keys, which ListVectors
527
+ * gives no filter for.
528
+ */
529
+ function vectorKey(namespace, id) {
530
+ return `${namespace}#${id}`;
531
+ }
532
+ /** The entry id back out of a key. Ids may contain `#` (`'refunds.md#3'`); namespaces may not. */
533
+ function idFromKey(key, prefixLength) {
534
+ return key.slice(prefixLength);
535
+ }
536
+ function payloadOf(entry) {
537
+ // The embedding is deliberately NOT in here: it is the vector itself, and
538
+ // storing it twice would double the metadata budget for nothing.
539
+ return {
540
+ id: entry.id,
541
+ value: entry.value ?? null,
542
+ ...(entry.metadata !== undefined && { metadata: { ...entry.metadata } }),
543
+ version: entry.version,
544
+ createdAt: entry.createdAt,
545
+ updatedAt: entry.updatedAt,
546
+ lastAccessedAt: entry.lastAccessedAt,
547
+ accessCount: entry.accessCount,
548
+ ...(entry.ttl !== undefined && { ttl: entry.ttl }),
549
+ ...(entry.tier !== undefined && { tier: entry.tier }),
550
+ ...(entry.source !== undefined && { source: entry.source }),
551
+ ...(entry.embeddingModel !== undefined && { embeddingModel: entry.embeddingModel }),
552
+ };
553
+ }
554
+ function readMetaString(row, key) {
555
+ const value = row.metadata?.[key];
556
+ return typeof value === 'string' ? value : undefined;
557
+ }
558
+ /**
559
+ * A returned vector back into a `MemoryEntry`, or `undefined` when the row
560
+ * carries no payload this store wrote.
561
+ *
562
+ * A row without `af` is not corruption to shout about — it is somebody else's
563
+ * vector in a shared index — so it is skipped rather than thrown on. A row
564
+ * whose `af` will not parse is the same fact one level down.
565
+ */
566
+ function vectorToEntry(row) {
567
+ const raw = readMetaString(row, PAYLOAD_KEY);
568
+ if (raw === undefined)
569
+ return undefined;
570
+ let payload;
571
+ try {
572
+ payload = JSON.parse(raw);
573
+ }
574
+ catch {
575
+ return undefined;
576
+ }
577
+ const ns = readMetaString(row, NS_KEY);
578
+ const id = typeof payload.id === 'string' && payload.id.length > 0
579
+ ? payload.id
580
+ : typeof row.key === 'string' && ns !== undefined
581
+ ? idFromKey(row.key, ns.length + 1)
582
+ : undefined;
583
+ if (id === undefined)
584
+ return undefined;
585
+ const vector = Array.isArray(row.data) ? row.data : row.data?.float32;
586
+ return {
587
+ id,
588
+ value: payload.value,
589
+ ...(payload.metadata !== undefined && { metadata: payload.metadata }),
590
+ version: payload.version ?? 1,
591
+ createdAt: payload.createdAt ?? 0,
592
+ updatedAt: payload.updatedAt ?? 0,
593
+ lastAccessedAt: payload.lastAccessedAt ?? 0,
594
+ accessCount: payload.accessCount ?? 0,
595
+ ...(payload.ttl !== undefined && { ttl: payload.ttl }),
596
+ ...(payload.tier !== undefined && { tier: payload.tier }),
597
+ ...(payload.source !== undefined && { source: payload.source }),
598
+ ...(payload.embeddingModel !== undefined && { embeddingModel: payload.embeddingModel }),
599
+ ...(Array.isArray(vector) && vector.length > 0 && { embedding: [...vector] }),
600
+ };
601
+ }
602
+ function isExpired(ttl) {
603
+ return ttl !== undefined && ttl <= Date.now();
604
+ }
605
+ // ─── SDK loading ─────────────────────────────────────────────────────
606
+ /** A no-op command shim: an injected `_client` receives the input, stamped with its name. */
607
+ function shimCommand(name) {
608
+ return class {
609
+ __command = name;
610
+ constructor(input) {
611
+ Object.assign(this, input);
612
+ }
613
+ };
614
+ }
615
+ function loadS3VectorsSdk() {
616
+ try {
617
+ return (0, lazyRequire_js_1.lazyRequire)('@aws-sdk/client-s3vectors');
618
+ }
619
+ catch {
620
+ throw new Error('s3VectorsStore requires the `@aws-sdk/client-s3vectors` peer dependency.\n' +
621
+ ' Install: npm install @aws-sdk/client-s3vectors\n' +
622
+ ' Or pass `client` with a pre-built S3 Vectors client.\n' +
623
+ ' There is deliberately no fallback to an in-memory index: a corpus that forgot ' +
624
+ 'every document on restart looks, from the outside, exactly like one that was ' +
625
+ 'never built.');
626
+ }
627
+ }
628
+ //# sourceMappingURL=s3Vectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"s3Vectors.js","sourceRoot":"","sources":["../../../src/adapters/memory/s3Vectors.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;;;AAEH,6DAAmE;AACnE,6DAAuD;AACvD,uEAMuC;AA0FvC,wEAAwE;AAExE,+EAA+E;AAC/E,MAAM,MAAM,GAAG,IAAI,CAAC;AACpB,gFAAgF;AAChF,MAAM,QAAQ,GAAG,MAAM,CAAC;AACxB,uEAAuE;AACvE,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