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