@anuma/sdk 11.3.3 → 11.3.5

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.
@@ -7348,9 +7348,9 @@ function createNearbyRequest(options, apiPath = "/api/private-memories") {
7348
7348
  };
7349
7349
  const request = async (path, init = {}, signal) => {
7350
7350
  const controller = new AbortController();
7351
- let timedOut = false;
7351
+ let timedOut2 = false;
7352
7352
  const timer = setTimeout(() => {
7353
- timedOut = true;
7353
+ timedOut2 = true;
7354
7354
  controller.abort();
7355
7355
  }, timeoutMs);
7356
7356
  const forwardAbort = () => controller.abort(signal?.reason);
@@ -7416,7 +7416,7 @@ function createNearbyRequest(options, apiPath = "/api/private-memories") {
7416
7416
  if (response.status === 204) return null;
7417
7417
  return await response.json();
7418
7418
  } catch (error) {
7419
- if (timedOut) throw new RemoteMemoryError("Nearby request timed out", 408, "timeout");
7419
+ if (timedOut2) throw new RemoteMemoryError("Nearby request timed out", 408, "timeout");
7420
7420
  throw error;
7421
7421
  } finally {
7422
7422
  clearTimeout(timer);
@@ -14249,6 +14249,7 @@ var emptyMessage = {
14249
14249
  };
14250
14250
 
14251
14251
  // src/lib/chatStore/migrateChats.ts
14252
+ var timedOut = (error) => error instanceof ChatStoreError && error.status === 408;
14252
14253
  var maxPasses = 5;
14253
14254
  var verifyBatch = 1e3;
14254
14255
  var writeBatch = 25;
@@ -14517,11 +14518,20 @@ async function migrateChatsToRemote(options) {
14517
14518
  await journal.add(upload.map((r) => key(r.record)));
14518
14519
  let sent = 0;
14519
14520
  options.onProgress?.({ imported: sent, toImport: upload.length });
14520
- for (const batch of batches(upload)) {
14521
- await store.importRecords(batch, signal);
14521
+ const send = async (batch) => {
14522
+ try {
14523
+ await store.importRecords(batch, signal);
14524
+ } catch (error) {
14525
+ if (batch.length < 2 || !timedOut(error)) throw error;
14526
+ const half = Math.ceil(batch.length / 2);
14527
+ await send(batch.slice(0, half));
14528
+ await send(batch.slice(half));
14529
+ return;
14530
+ }
14522
14531
  sent += batch.length;
14523
14532
  options.onProgress?.({ imported: sent, toImport: upload.length });
14524
- }
14533
+ };
14534
+ for (const batch of batches(upload)) await send(batch);
14525
14535
  imported += sent;
14526
14536
  }
14527
14537
  };
@@ -23501,15 +23511,16 @@ async function extractAndRetain(messages, retainCtx, options) {
23501
23511
  if (isQuarantined) {
23502
23512
  let existingId;
23503
23513
  if (memoryStore) {
23504
- auditRows ?? (auditRows = memoryStore.list({
23514
+ auditRows ?? (auditRows = await memoryStore.list({
23505
23515
  scopes: [.../* @__PURE__ */ new Set([options.scope ?? "private", "private"])],
23506
23516
  includeArchived: true,
23507
23517
  includeQuarantined: true,
23508
- includeSuperseded: true
23518
+ includeSuperseded: true,
23519
+ withEmbeddings: false
23509
23520
  }));
23510
23521
  const sourceKey = [...new Set(candidate.sourceMessageIds)].sort().join("\0");
23511
23522
  const normalize = (value) => value.normalize("NFKC").trim().replace(/\s+/g, " ").toLowerCase();
23512
- existingId = (await auditRows).find(
23523
+ existingId = auditRows.find(
23513
23524
  (row) => row.trustTier === "quarantined" && row.scope === (scope ?? "private") && [...new Set(row.sourceChunkIds ?? [])].sort().join("\0") === sourceKey && normalize(row.content) === normalize(candidate.content)
23514
23525
  )?.uniqueId ?? null;
23515
23526
  } else {
@@ -23549,7 +23560,15 @@ async function extractAndRetain(messages, retainCtx, options) {
23549
23560
  ...options.folderId !== void 0 && { folderId: options.folderId }
23550
23561
  });
23551
23562
  if (isQuarantined) {
23552
- auditRows = void 0;
23563
+ if (result.action === "create") {
23564
+ auditRows?.push({
23565
+ uniqueId: result.memoryId,
23566
+ content: candidate.content,
23567
+ sourceChunkIds: candidate.sourceMessageIds,
23568
+ scope: scope ?? "private",
23569
+ trustTier: "quarantined"
23570
+ });
23571
+ }
23553
23572
  const info = {
23554
23573
  candidate,
23555
23574
  memoryId: result.memoryId,
@@ -27050,6 +27069,12 @@ async function importBatch2(request, keyId, rows, signal) {
27050
27069
  );
27051
27070
  return;
27052
27071
  } catch (error) {
27072
+ if (error instanceof RemoteMemoryError && error.status === 408 && rows.length > 1) {
27073
+ const half = Math.ceil(rows.length / 2);
27074
+ await importBatch2(request, keyId, rows.slice(0, half), signal);
27075
+ await importBatch2(request, keyId, rows.slice(half), signal);
27076
+ return;
27077
+ }
27053
27078
  if (!(error instanceof RemoteMemoryError) || error.status !== 429 || attempt >= MAX_RATE_LIMIT_WAITS)
27054
27079
  throw error;
27055
27080
  await wait(error.retryAfterMs ?? DEFAULT_RATE_LIMIT_WAIT_MS, signal);
@@ -5676,9 +5676,9 @@ function createNearbyRequest(options, apiPath = "/api/private-memories") {
5676
5676
  };
5677
5677
  const request = async (path, init = {}, signal) => {
5678
5678
  const controller = new AbortController();
5679
- let timedOut = false;
5679
+ let timedOut2 = false;
5680
5680
  const timer = setTimeout(() => {
5681
- timedOut = true;
5681
+ timedOut2 = true;
5682
5682
  controller.abort();
5683
5683
  }, timeoutMs);
5684
5684
  const forwardAbort = () => controller.abort(signal?.reason);
@@ -5744,7 +5744,7 @@ function createNearbyRequest(options, apiPath = "/api/private-memories") {
5744
5744
  if (response.status === 204) return null;
5745
5745
  return await response.json();
5746
5746
  } catch (error) {
5747
- if (timedOut) throw new RemoteMemoryError("Nearby request timed out", 408, "timeout");
5747
+ if (timedOut2) throw new RemoteMemoryError("Nearby request timed out", 408, "timeout");
5748
5748
  throw error;
5749
5749
  } finally {
5750
5750
  clearTimeout(timer);
@@ -12561,6 +12561,7 @@ var emptyMessage = {
12561
12561
  };
12562
12562
 
12563
12563
  // src/lib/chatStore/migrateChats.ts
12564
+ var timedOut = (error) => error instanceof ChatStoreError && error.status === 408;
12564
12565
  var maxPasses = 5;
12565
12566
  var verifyBatch = 1e3;
12566
12567
  var writeBatch = 25;
@@ -12829,11 +12830,20 @@ async function migrateChatsToRemote(options) {
12829
12830
  await journal.add(upload.map((r) => key(r.record)));
12830
12831
  let sent = 0;
12831
12832
  options.onProgress?.({ imported: sent, toImport: upload.length });
12832
- for (const batch of batches(upload)) {
12833
- await store.importRecords(batch, signal);
12833
+ const send = async (batch) => {
12834
+ try {
12835
+ await store.importRecords(batch, signal);
12836
+ } catch (error) {
12837
+ if (batch.length < 2 || !timedOut(error)) throw error;
12838
+ const half = Math.ceil(batch.length / 2);
12839
+ await send(batch.slice(0, half));
12840
+ await send(batch.slice(half));
12841
+ return;
12842
+ }
12834
12843
  sent += batch.length;
12835
12844
  options.onProgress?.({ imported: sent, toImport: upload.length });
12836
- }
12845
+ };
12846
+ for (const batch of batches(upload)) await send(batch);
12837
12847
  imported += sent;
12838
12848
  }
12839
12849
  };
@@ -21791,15 +21801,16 @@ async function extractAndRetain(messages, retainCtx, options) {
21791
21801
  if (isQuarantined) {
21792
21802
  let existingId;
21793
21803
  if (memoryStore) {
21794
- auditRows ?? (auditRows = memoryStore.list({
21804
+ auditRows ?? (auditRows = await memoryStore.list({
21795
21805
  scopes: [.../* @__PURE__ */ new Set([options.scope ?? "private", "private"])],
21796
21806
  includeArchived: true,
21797
21807
  includeQuarantined: true,
21798
- includeSuperseded: true
21808
+ includeSuperseded: true,
21809
+ withEmbeddings: false
21799
21810
  }));
21800
21811
  const sourceKey = [...new Set(candidate.sourceMessageIds)].sort().join("\0");
21801
21812
  const normalize = (value) => value.normalize("NFKC").trim().replace(/\s+/g, " ").toLowerCase();
21802
- existingId = (await auditRows).find(
21813
+ existingId = auditRows.find(
21803
21814
  (row) => row.trustTier === "quarantined" && row.scope === (scope ?? "private") && [...new Set(row.sourceChunkIds ?? [])].sort().join("\0") === sourceKey && normalize(row.content) === normalize(candidate.content)
21804
21815
  )?.uniqueId ?? null;
21805
21816
  } else {
@@ -21839,7 +21850,15 @@ async function extractAndRetain(messages, retainCtx, options) {
21839
21850
  ...options.folderId !== void 0 && { folderId: options.folderId }
21840
21851
  });
21841
21852
  if (isQuarantined) {
21842
- auditRows = void 0;
21853
+ if (result.action === "create") {
21854
+ auditRows?.push({
21855
+ uniqueId: result.memoryId,
21856
+ content: candidate.content,
21857
+ sourceChunkIds: candidate.sourceMessageIds,
21858
+ scope: scope ?? "private",
21859
+ trustTier: "quarantined"
21860
+ });
21861
+ }
21843
21862
  const info = {
21844
21863
  candidate,
21845
21864
  memoryId: result.memoryId,
@@ -25315,6 +25334,12 @@ async function importBatch2(request, keyId, rows, signal) {
25315
25334
  );
25316
25335
  return;
25317
25336
  } catch (error) {
25337
+ if (error instanceof RemoteMemoryError && error.status === 408 && rows.length > 1) {
25338
+ const half = Math.ceil(rows.length / 2);
25339
+ await importBatch2(request, keyId, rows.slice(0, half), signal);
25340
+ await importBatch2(request, keyId, rows.slice(half), signal);
25341
+ return;
25342
+ }
25318
25343
  if (!(error instanceof RemoteMemoryError) || error.status !== 429 || attempt >= MAX_RATE_LIMIT_WAITS)
25319
25344
  throw error;
25320
25345
  await wait(error.retryAfterMs ?? DEFAULT_RATE_LIMIT_WAIT_MS, signal);
@@ -8135,9 +8135,9 @@ function createNearbyRequest(options, apiPath = "/api/private-memories") {
8135
8135
  };
8136
8136
  const request = async (path, init = {}, signal) => {
8137
8137
  const controller = new AbortController();
8138
- let timedOut = false;
8138
+ let timedOut2 = false;
8139
8139
  const timer = setTimeout(() => {
8140
- timedOut = true;
8140
+ timedOut2 = true;
8141
8141
  controller.abort();
8142
8142
  }, timeoutMs);
8143
8143
  const forwardAbort = () => controller.abort(signal?.reason);
@@ -8203,7 +8203,7 @@ function createNearbyRequest(options, apiPath = "/api/private-memories") {
8203
8203
  if (response.status === 204) return null;
8204
8204
  return await response.json();
8205
8205
  } catch (error) {
8206
- if (timedOut) throw new RemoteMemoryError("Nearby request timed out", 408, "timeout");
8206
+ if (timedOut2) throw new RemoteMemoryError("Nearby request timed out", 408, "timeout");
8207
8207
  throw error;
8208
8208
  } finally {
8209
8209
  clearTimeout(timer);
@@ -15003,6 +15003,7 @@ var emptyMessage = {
15003
15003
  };
15004
15004
 
15005
15005
  // src/lib/chatStore/migrateChats.ts
15006
+ var timedOut = (error) => error instanceof ChatStoreError && error.status === 408;
15006
15007
  var maxPasses = 5;
15007
15008
  var verifyBatch = 1e3;
15008
15009
  var writeBatch = 25;
@@ -15271,11 +15272,20 @@ async function migrateChatsToRemote(options) {
15271
15272
  await journal.add(upload.map((r) => key(r.record)));
15272
15273
  let sent = 0;
15273
15274
  options.onProgress?.({ imported: sent, toImport: upload.length });
15274
- for (const batch of batches(upload)) {
15275
- await store.importRecords(batch, signal);
15275
+ const send = async (batch) => {
15276
+ try {
15277
+ await store.importRecords(batch, signal);
15278
+ } catch (error) {
15279
+ if (batch.length < 2 || !timedOut(error)) throw error;
15280
+ const half = Math.ceil(batch.length / 2);
15281
+ await send(batch.slice(0, half));
15282
+ await send(batch.slice(half));
15283
+ return;
15284
+ }
15276
15285
  sent += batch.length;
15277
15286
  options.onProgress?.({ imported: sent, toImport: upload.length });
15278
- }
15287
+ };
15288
+ for (const batch of batches(upload)) await send(batch);
15279
15289
  imported += sent;
15280
15290
  }
15281
15291
  };
@@ -25792,15 +25802,16 @@ async function extractAndRetain(messages, retainCtx, options) {
25792
25802
  if (isQuarantined) {
25793
25803
  let existingId;
25794
25804
  if (memoryStore) {
25795
- auditRows ?? (auditRows = memoryStore.list({
25805
+ auditRows ?? (auditRows = await memoryStore.list({
25796
25806
  scopes: [.../* @__PURE__ */ new Set([options.scope ?? "private", "private"])],
25797
25807
  includeArchived: true,
25798
25808
  includeQuarantined: true,
25799
- includeSuperseded: true
25809
+ includeSuperseded: true,
25810
+ withEmbeddings: false
25800
25811
  }));
25801
25812
  const sourceKey = [...new Set(candidate.sourceMessageIds)].sort().join("\0");
25802
25813
  const normalize = (value) => value.normalize("NFKC").trim().replace(/\s+/g, " ").toLowerCase();
25803
- existingId = (await auditRows).find(
25814
+ existingId = auditRows.find(
25804
25815
  (row) => row.trustTier === "quarantined" && row.scope === (scope ?? "private") && [...new Set(row.sourceChunkIds ?? [])].sort().join("\0") === sourceKey && normalize(row.content) === normalize(candidate.content)
25805
25816
  )?.uniqueId ?? null;
25806
25817
  } else {
@@ -25840,7 +25851,15 @@ async function extractAndRetain(messages, retainCtx, options) {
25840
25851
  ...options.folderId !== void 0 && { folderId: options.folderId }
25841
25852
  });
25842
25853
  if (isQuarantined) {
25843
- auditRows = void 0;
25854
+ if (result.action === "create") {
25855
+ auditRows?.push({
25856
+ uniqueId: result.memoryId,
25857
+ content: candidate.content,
25858
+ sourceChunkIds: candidate.sourceMessageIds,
25859
+ scope: scope ?? "private",
25860
+ trustTier: "quarantined"
25861
+ });
25862
+ }
25844
25863
  const info = {
25845
25864
  candidate,
25846
25865
  memoryId: result.memoryId,
@@ -29367,6 +29386,12 @@ async function importBatch2(request, keyId, rows, signal) {
29367
29386
  );
29368
29387
  return;
29369
29388
  } catch (error) {
29389
+ if (error instanceof RemoteMemoryError && error.status === 408 && rows.length > 1) {
29390
+ const half = Math.ceil(rows.length / 2);
29391
+ await importBatch2(request, keyId, rows.slice(0, half), signal);
29392
+ await importBatch2(request, keyId, rows.slice(half), signal);
29393
+ return;
29394
+ }
29370
29395
  if (!(error instanceof RemoteMemoryError) || error.status !== 429 || attempt >= MAX_RATE_LIMIT_WAITS)
29371
29396
  throw error;
29372
29397
  await wait(error.retryAfterMs ?? DEFAULT_RATE_LIMIT_WAIT_MS, signal);
@@ -34581,12 +34606,12 @@ async function preprocessFiles(files, options = {}) {
34581
34606
  }
34582
34607
  } catch (error) {
34583
34608
  errorCount++;
34584
- const timedOut = error instanceof ProcessingTimeoutError;
34609
+ const timedOut2 = error instanceof ProcessingTimeoutError;
34585
34610
  fileStatuses.push({
34586
34611
  fileId: file.id,
34587
34612
  fileName: file.name,
34588
34613
  status: "failed",
34589
- reason: timedOut ? "timeout" : "error"
34614
+ reason: timedOut2 ? "timeout" : "error"
34590
34615
  });
34591
34616
  logger.error(
34592
34617
  `[preprocessFiles] Error processing file ${label} with ${processor.name}:`,
@@ -6262,9 +6262,9 @@ function createNearbyRequest(options, apiPath = "/api/private-memories") {
6262
6262
  };
6263
6263
  const request = async (path, init = {}, signal) => {
6264
6264
  const controller = new AbortController();
6265
- let timedOut = false;
6265
+ let timedOut2 = false;
6266
6266
  const timer = setTimeout(() => {
6267
- timedOut = true;
6267
+ timedOut2 = true;
6268
6268
  controller.abort();
6269
6269
  }, timeoutMs);
6270
6270
  const forwardAbort = () => controller.abort(signal?.reason);
@@ -6330,7 +6330,7 @@ function createNearbyRequest(options, apiPath = "/api/private-memories") {
6330
6330
  if (response.status === 204) return null;
6331
6331
  return await response.json();
6332
6332
  } catch (error) {
6333
- if (timedOut) throw new RemoteMemoryError("Nearby request timed out", 408, "timeout");
6333
+ if (timedOut2) throw new RemoteMemoryError("Nearby request timed out", 408, "timeout");
6334
6334
  throw error;
6335
6335
  } finally {
6336
6336
  clearTimeout(timer);
@@ -13114,6 +13114,7 @@ var emptyMessage = {
13114
13114
  };
13115
13115
 
13116
13116
  // src/lib/chatStore/migrateChats.ts
13117
+ var timedOut = (error) => error instanceof ChatStoreError && error.status === 408;
13117
13118
  var maxPasses = 5;
13118
13119
  var verifyBatch = 1e3;
13119
13120
  var writeBatch = 25;
@@ -13382,11 +13383,20 @@ async function migrateChatsToRemote(options) {
13382
13383
  await journal.add(upload.map((r) => key(r.record)));
13383
13384
  let sent = 0;
13384
13385
  options.onProgress?.({ imported: sent, toImport: upload.length });
13385
- for (const batch of batches(upload)) {
13386
- await store.importRecords(batch, signal);
13386
+ const send = async (batch) => {
13387
+ try {
13388
+ await store.importRecords(batch, signal);
13389
+ } catch (error) {
13390
+ if (batch.length < 2 || !timedOut(error)) throw error;
13391
+ const half = Math.ceil(batch.length / 2);
13392
+ await send(batch.slice(0, half));
13393
+ await send(batch.slice(half));
13394
+ return;
13395
+ }
13387
13396
  sent += batch.length;
13388
13397
  options.onProgress?.({ imported: sent, toImport: upload.length });
13389
- }
13398
+ };
13399
+ for (const batch of batches(upload)) await send(batch);
13390
13400
  imported += sent;
13391
13401
  }
13392
13402
  };
@@ -23875,15 +23885,16 @@ async function extractAndRetain(messages, retainCtx, options) {
23875
23885
  if (isQuarantined) {
23876
23886
  let existingId;
23877
23887
  if (memoryStore) {
23878
- auditRows ?? (auditRows = memoryStore.list({
23888
+ auditRows ?? (auditRows = await memoryStore.list({
23879
23889
  scopes: [.../* @__PURE__ */ new Set([options.scope ?? "private", "private"])],
23880
23890
  includeArchived: true,
23881
23891
  includeQuarantined: true,
23882
- includeSuperseded: true
23892
+ includeSuperseded: true,
23893
+ withEmbeddings: false
23883
23894
  }));
23884
23895
  const sourceKey = [...new Set(candidate.sourceMessageIds)].sort().join("\0");
23885
23896
  const normalize = (value) => value.normalize("NFKC").trim().replace(/\s+/g, " ").toLowerCase();
23886
- existingId = (await auditRows).find(
23897
+ existingId = auditRows.find(
23887
23898
  (row) => row.trustTier === "quarantined" && row.scope === (scope ?? "private") && [...new Set(row.sourceChunkIds ?? [])].sort().join("\0") === sourceKey && normalize(row.content) === normalize(candidate.content)
23888
23899
  )?.uniqueId ?? null;
23889
23900
  } else {
@@ -23923,7 +23934,15 @@ async function extractAndRetain(messages, retainCtx, options) {
23923
23934
  ...options.folderId !== void 0 && { folderId: options.folderId }
23924
23935
  });
23925
23936
  if (isQuarantined) {
23926
- auditRows = void 0;
23937
+ if (result.action === "create") {
23938
+ auditRows?.push({
23939
+ uniqueId: result.memoryId,
23940
+ content: candidate.content,
23941
+ sourceChunkIds: candidate.sourceMessageIds,
23942
+ scope: scope ?? "private",
23943
+ trustTier: "quarantined"
23944
+ });
23945
+ }
23927
23946
  const info = {
23928
23947
  candidate,
23929
23948
  memoryId: result.memoryId,
@@ -27425,6 +27444,12 @@ async function importBatch2(request, keyId, rows, signal) {
27425
27444
  );
27426
27445
  return;
27427
27446
  } catch (error) {
27447
+ if (error instanceof RemoteMemoryError && error.status === 408 && rows.length > 1) {
27448
+ const half = Math.ceil(rows.length / 2);
27449
+ await importBatch2(request, keyId, rows.slice(0, half), signal);
27450
+ await importBatch2(request, keyId, rows.slice(half), signal);
27451
+ return;
27452
+ }
27428
27453
  if (!(error instanceof RemoteMemoryError) || error.status !== 429 || attempt >= MAX_RATE_LIMIT_WAITS)
27429
27454
  throw error;
27430
27455
  await wait(error.retryAfterMs ?? DEFAULT_RATE_LIMIT_WAIT_MS, signal);
@@ -32623,12 +32648,12 @@ async function preprocessFiles(files, options = {}) {
32623
32648
  }
32624
32649
  } catch (error) {
32625
32650
  errorCount++;
32626
- const timedOut = error instanceof ProcessingTimeoutError;
32651
+ const timedOut2 = error instanceof ProcessingTimeoutError;
32627
32652
  fileStatuses.push({
32628
32653
  fileId: file.id,
32629
32654
  fileName: file.name,
32630
32655
  status: "failed",
32631
- reason: timedOut ? "timeout" : "error"
32656
+ reason: timedOut2 ? "timeout" : "error"
32632
32657
  });
32633
32658
  logger.error(
32634
32659
  `[preprocessFiles] Error processing file ${label} with ${processor.name}:`,
@@ -34250,15 +34250,16 @@ async function extractAndRetain(messages, retainCtx, options) {
34250
34250
  if (isQuarantined) {
34251
34251
  let existingId;
34252
34252
  if (memoryStore) {
34253
- auditRows ?? (auditRows = memoryStore.list({
34253
+ auditRows ?? (auditRows = await memoryStore.list({
34254
34254
  scopes: [.../* @__PURE__ */ new Set([options.scope ?? "private", "private"])],
34255
34255
  includeArchived: true,
34256
34256
  includeQuarantined: true,
34257
- includeSuperseded: true
34257
+ includeSuperseded: true,
34258
+ withEmbeddings: false
34258
34259
  }));
34259
34260
  const sourceKey = [...new Set(candidate.sourceMessageIds)].sort().join("\0");
34260
34261
  const normalize = (value) => value.normalize("NFKC").trim().replace(/\s+/g, " ").toLowerCase();
34261
- existingId = (await auditRows).find(
34262
+ existingId = auditRows.find(
34262
34263
  (row) => row.trustTier === "quarantined" && row.scope === (scope ?? "private") && [...new Set(row.sourceChunkIds ?? [])].sort().join("\0") === sourceKey && normalize(row.content) === normalize(candidate.content)
34263
34264
  )?.uniqueId ?? null;
34264
34265
  } else {
@@ -34298,7 +34299,15 @@ async function extractAndRetain(messages, retainCtx, options) {
34298
34299
  ...options.folderId !== void 0 && { folderId: options.folderId }
34299
34300
  });
34300
34301
  if (isQuarantined) {
34301
- auditRows = void 0;
34302
+ if (result.action === "create") {
34303
+ auditRows?.push({
34304
+ uniqueId: result.memoryId,
34305
+ content: candidate.content,
34306
+ sourceChunkIds: candidate.sourceMessageIds,
34307
+ scope: scope ?? "private",
34308
+ trustTier: "quarantined"
34309
+ });
34310
+ }
34302
34311
  const info = {
34303
34312
  candidate,
34304
34313
  memoryId: result.memoryId,
@@ -32486,15 +32486,16 @@ async function extractAndRetain(messages, retainCtx, options) {
32486
32486
  if (isQuarantined) {
32487
32487
  let existingId;
32488
32488
  if (memoryStore) {
32489
- auditRows ?? (auditRows = memoryStore.list({
32489
+ auditRows ?? (auditRows = await memoryStore.list({
32490
32490
  scopes: [.../* @__PURE__ */ new Set([options.scope ?? "private", "private"])],
32491
32491
  includeArchived: true,
32492
32492
  includeQuarantined: true,
32493
- includeSuperseded: true
32493
+ includeSuperseded: true,
32494
+ withEmbeddings: false
32494
32495
  }));
32495
32496
  const sourceKey = [...new Set(candidate.sourceMessageIds)].sort().join("\0");
32496
32497
  const normalize = (value) => value.normalize("NFKC").trim().replace(/\s+/g, " ").toLowerCase();
32497
- existingId = (await auditRows).find(
32498
+ existingId = auditRows.find(
32498
32499
  (row) => row.trustTier === "quarantined" && row.scope === (scope ?? "private") && [...new Set(row.sourceChunkIds ?? [])].sort().join("\0") === sourceKey && normalize(row.content) === normalize(candidate.content)
32499
32500
  )?.uniqueId ?? null;
32500
32501
  } else {
@@ -32534,7 +32535,15 @@ async function extractAndRetain(messages, retainCtx, options) {
32534
32535
  ...options.folderId !== void 0 && { folderId: options.folderId }
32535
32536
  });
32536
32537
  if (isQuarantined) {
32537
- auditRows = void 0;
32538
+ if (result.action === "create") {
32539
+ auditRows?.push({
32540
+ uniqueId: result.memoryId,
32541
+ content: candidate.content,
32542
+ sourceChunkIds: candidate.sourceMessageIds,
32543
+ scope: scope ?? "private",
32544
+ trustTier: "quarantined"
32545
+ });
32546
+ }
32538
32547
  const info = {
32539
32548
  candidate,
32540
32549
  memoryId: result.memoryId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "11.3.3",
3
+ "version": "11.3.5",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",