@anuma/sdk 6.4.0 → 6.4.2

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.
@@ -4641,6 +4641,12 @@ async function embedMessage(ctx, messageId, options) {
4641
4641
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
4642
4642
  return message;
4643
4643
  }
4644
+ if (isEncrypted(message.content)) {
4645
+ getLogger().warn(
4646
+ `memoryEngine: message ${messageId} is still encrypted (key unavailable?) \u2014 not embedded`
4647
+ );
4648
+ return message;
4649
+ }
4644
4650
  const embedding = await generateEmbedding(message.content, options);
4645
4651
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
4646
4652
  return updateMessageEmbeddingOp(ctx, messageId, embedding, embeddingModel);
@@ -4648,11 +4654,17 @@ async function embedMessage(ctx, messageId, options) {
4648
4654
  async function embedAllMessages(ctx, options, filter) {
4649
4655
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
4650
4656
  let embeddedCount = 0;
4657
+ let stillEncrypted = 0;
4658
+ let considered = 0;
4659
+ let sealedRowsSeen = 0;
4660
+ let rowsSeen = 0;
4651
4661
  const conversations = await getConversationsOp(ctx);
4652
4662
  const targetConversations = filter?.conversationId ? conversations.filter((c) => c.conversationId === filter.conversationId) : conversations;
4653
4663
  for (const conv of targetConversations) {
4654
4664
  const messages = await getMessagesOp(ctx, conv.conversationId);
4655
4665
  for (const message of messages) {
4666
+ rowsSeen++;
4667
+ if (isEncrypted(message.content)) sealedRowsSeen++;
4656
4668
  if (message.vector && message.vector.length > 0) {
4657
4669
  continue;
4658
4670
  }
@@ -4665,6 +4677,11 @@ async function embedAllMessages(ctx, options, filter) {
4665
4677
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
4666
4678
  continue;
4667
4679
  }
4680
+ considered++;
4681
+ if (isEncrypted(message.content)) {
4682
+ stillEncrypted++;
4683
+ continue;
4684
+ }
4668
4685
  const minLength = filter?.minContentLength ?? DEFAULT_MIN_CONTENT_LENGTH;
4669
4686
  if (message.content.length < minLength) {
4670
4687
  continue;
@@ -4679,6 +4696,13 @@ async function embedAllMessages(ctx, options, filter) {
4679
4696
  }
4680
4697
  }
4681
4698
  }
4699
+ if (stillEncrypted > 0 || sealedRowsSeen > 0) {
4700
+ getLogger().error(
4701
+ "memoryEngine: messages still encrypted (key unavailable?) \u2014 excluded from embedding",
4702
+ void 0,
4703
+ { stillEncrypted, considered, sealedRowsSeen, rowsSeen }
4704
+ );
4705
+ }
4682
4706
  return embeddedCount;
4683
4707
  }
4684
4708
  async function chunkAndEmbedMessage(ctx, messageId, options) {
@@ -4693,6 +4717,12 @@ async function chunkAndEmbedMessage(ctx, messageId, options) {
4693
4717
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
4694
4718
  return message;
4695
4719
  }
4720
+ if (isEncrypted(message.content)) {
4721
+ getLogger().warn(
4722
+ `memoryEngine: message ${messageId} is still encrypted (key unavailable?) \u2014 not embedded`
4723
+ );
4724
+ return message;
4725
+ }
4696
4726
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
4697
4727
  if (!shouldChunkMessage(message.content, chunkSize)) {
4698
4728
  const embedding = await generateEmbedding(message.content, options);
@@ -4717,9 +4747,15 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
4717
4747
  const targetConversations = filter?.conversationId ? conversations.filter((c) => c.conversationId === filter.conversationId) : conversations;
4718
4748
  const shortMessages = [];
4719
4749
  const longMessages = [];
4750
+ let stillEncrypted = 0;
4751
+ let considered = 0;
4752
+ let sealedRowsSeen = 0;
4753
+ let rowsSeen = 0;
4720
4754
  for (const conv of targetConversations) {
4721
4755
  const messages = await getMessagesOp(ctx, conv.conversationId);
4722
4756
  for (const message of messages) {
4757
+ rowsSeen++;
4758
+ if (isEncrypted(message.content)) sealedRowsSeen++;
4723
4759
  const isStale = message.embeddingModel !== void 0 && message.embeddingModel !== null && message.embeddingModel !== embeddingModel;
4724
4760
  if (message.chunks && message.chunks.length > 0 && !isStale) continue;
4725
4761
  const hasVector = message.vector && message.vector.length > 0;
@@ -4727,6 +4763,11 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
4727
4763
  if (filter?.roles && !filter.roles.includes(message.role)) continue;
4728
4764
  if (message.role === "system") continue;
4729
4765
  if (message.origin === NON_EMBEDDABLE_ORIGIN) continue;
4766
+ considered++;
4767
+ if (isEncrypted(message.content)) {
4768
+ stillEncrypted++;
4769
+ continue;
4770
+ }
4730
4771
  if (message.content.length < minLength) continue;
4731
4772
  if (shouldChunkMessage(message.content, chunkSize)) {
4732
4773
  longMessages.push({
@@ -4738,6 +4779,13 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
4738
4779
  }
4739
4780
  }
4740
4781
  }
4782
+ if (stillEncrypted > 0 || sealedRowsSeen > 0) {
4783
+ getLogger().error(
4784
+ "memoryEngine: messages still encrypted (key unavailable?) \u2014 excluded from embedding",
4785
+ void 0,
4786
+ { stillEncrypted, considered, sealedRowsSeen, rowsSeen }
4787
+ );
4788
+ }
4741
4789
  let embeddedCount = 0;
4742
4790
  if (shortMessages.length > 0) {
4743
4791
  try {
@@ -6518,7 +6566,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
6518
6566
  subQueries = decomp.subQueries;
6519
6567
  }
6520
6568
  }
6521
- const { recall: recall2 } = await import("./recall-UVM2366D.mjs");
6569
+ const { recall: recall2 } = await import("./recall-7FOWWX5T.mjs");
6522
6570
  let recallDegraded = [];
6523
6571
  const result = await recall2(
6524
6572
  query,
@@ -3437,6 +3437,12 @@ async function embedMessage(ctx, messageId, options) {
3437
3437
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
3438
3438
  return message;
3439
3439
  }
3440
+ if (isEncrypted(message.content)) {
3441
+ getLogger().warn(
3442
+ `memoryEngine: message ${messageId} is still encrypted (key unavailable?) \u2014 not embedded`
3443
+ );
3444
+ return message;
3445
+ }
3440
3446
  const embedding = await generateEmbedding(message.content, options);
3441
3447
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
3442
3448
  return updateMessageEmbeddingOp(ctx, messageId, embedding, embeddingModel);
@@ -3444,11 +3450,17 @@ async function embedMessage(ctx, messageId, options) {
3444
3450
  async function embedAllMessages(ctx, options, filter) {
3445
3451
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
3446
3452
  let embeddedCount = 0;
3453
+ let stillEncrypted = 0;
3454
+ let considered = 0;
3455
+ let sealedRowsSeen = 0;
3456
+ let rowsSeen = 0;
3447
3457
  const conversations = await getConversationsOp(ctx);
3448
3458
  const targetConversations = filter?.conversationId ? conversations.filter((c) => c.conversationId === filter.conversationId) : conversations;
3449
3459
  for (const conv of targetConversations) {
3450
3460
  const messages = await getMessagesOp(ctx, conv.conversationId);
3451
3461
  for (const message of messages) {
3462
+ rowsSeen++;
3463
+ if (isEncrypted(message.content)) sealedRowsSeen++;
3452
3464
  if (message.vector && message.vector.length > 0) {
3453
3465
  continue;
3454
3466
  }
@@ -3461,6 +3473,11 @@ async function embedAllMessages(ctx, options, filter) {
3461
3473
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
3462
3474
  continue;
3463
3475
  }
3476
+ considered++;
3477
+ if (isEncrypted(message.content)) {
3478
+ stillEncrypted++;
3479
+ continue;
3480
+ }
3464
3481
  const minLength = filter?.minContentLength ?? DEFAULT_MIN_CONTENT_LENGTH;
3465
3482
  if (message.content.length < minLength) {
3466
3483
  continue;
@@ -3475,6 +3492,13 @@ async function embedAllMessages(ctx, options, filter) {
3475
3492
  }
3476
3493
  }
3477
3494
  }
3495
+ if (stillEncrypted > 0 || sealedRowsSeen > 0) {
3496
+ getLogger().error(
3497
+ "memoryEngine: messages still encrypted (key unavailable?) \u2014 excluded from embedding",
3498
+ void 0,
3499
+ { stillEncrypted, considered, sealedRowsSeen, rowsSeen }
3500
+ );
3501
+ }
3478
3502
  return embeddedCount;
3479
3503
  }
3480
3504
  async function chunkAndEmbedMessage(ctx, messageId, options) {
@@ -3489,6 +3513,12 @@ async function chunkAndEmbedMessage(ctx, messageId, options) {
3489
3513
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
3490
3514
  return message;
3491
3515
  }
3516
+ if (isEncrypted(message.content)) {
3517
+ getLogger().warn(
3518
+ `memoryEngine: message ${messageId} is still encrypted (key unavailable?) \u2014 not embedded`
3519
+ );
3520
+ return message;
3521
+ }
3492
3522
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
3493
3523
  if (!shouldChunkMessage(message.content, chunkSize)) {
3494
3524
  const embedding = await generateEmbedding(message.content, options);
@@ -3513,9 +3543,15 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
3513
3543
  const targetConversations = filter?.conversationId ? conversations.filter((c) => c.conversationId === filter.conversationId) : conversations;
3514
3544
  const shortMessages = [];
3515
3545
  const longMessages = [];
3546
+ let stillEncrypted = 0;
3547
+ let considered = 0;
3548
+ let sealedRowsSeen = 0;
3549
+ let rowsSeen = 0;
3516
3550
  for (const conv of targetConversations) {
3517
3551
  const messages = await getMessagesOp(ctx, conv.conversationId);
3518
3552
  for (const message of messages) {
3553
+ rowsSeen++;
3554
+ if (isEncrypted(message.content)) sealedRowsSeen++;
3519
3555
  const isStale = message.embeddingModel !== void 0 && message.embeddingModel !== null && message.embeddingModel !== embeddingModel;
3520
3556
  if (message.chunks && message.chunks.length > 0 && !isStale) continue;
3521
3557
  const hasVector = message.vector && message.vector.length > 0;
@@ -3523,6 +3559,11 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
3523
3559
  if (filter?.roles && !filter.roles.includes(message.role)) continue;
3524
3560
  if (message.role === "system") continue;
3525
3561
  if (message.origin === NON_EMBEDDABLE_ORIGIN) continue;
3562
+ considered++;
3563
+ if (isEncrypted(message.content)) {
3564
+ stillEncrypted++;
3565
+ continue;
3566
+ }
3526
3567
  if (message.content.length < minLength) continue;
3527
3568
  if (shouldChunkMessage(message.content, chunkSize)) {
3528
3569
  longMessages.push({
@@ -3534,6 +3575,13 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
3534
3575
  }
3535
3576
  }
3536
3577
  }
3578
+ if (stillEncrypted > 0 || sealedRowsSeen > 0) {
3579
+ getLogger().error(
3580
+ "memoryEngine: messages still encrypted (key unavailable?) \u2014 excluded from embedding",
3581
+ void 0,
3582
+ { stillEncrypted, considered, sealedRowsSeen, rowsSeen }
3583
+ );
3584
+ }
3537
3585
  let embeddedCount = 0;
3538
3586
  if (shortMessages.length > 0) {
3539
3587
  try {
@@ -3584,6 +3632,7 @@ var init_embeddings = __esm({
3584
3632
  "src/lib/memoryEngine/embeddings.ts"() {
3585
3633
  "use strict";
3586
3634
  init_operations();
3635
+ init_encryption_utils();
3587
3636
  init_logger();
3588
3637
  init_chunking();
3589
3638
  init_constants();
@@ -123,7 +123,7 @@ import {
123
123
  upsertMessageOp,
124
124
  useEncryption,
125
125
  vaultMemoryToStored
126
- } from "./chunk-PBCULYOW.mjs";
126
+ } from "./chunk-WYARTNEN.mjs";
127
127
  import {
128
128
  PII_PATTERNS,
129
129
  PiiRedactor,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-PBCULYOW.mjs";
3
+ } from "./chunk-WYARTNEN.mjs";
4
4
  import "./chunk-ILAWDQDE.mjs";
5
5
  import "./chunk-GYKJOWEO.mjs";
6
6
  export {
@@ -4924,6 +4924,12 @@ async function embedMessage(ctx, messageId, options) {
4924
4924
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
4925
4925
  return message;
4926
4926
  }
4927
+ if (isEncrypted(message.content)) {
4928
+ getLogger().warn(
4929
+ `memoryEngine: message ${messageId} is still encrypted (key unavailable?) \u2014 not embedded`
4930
+ );
4931
+ return message;
4932
+ }
4927
4933
  const embedding = await generateEmbedding(message.content, options);
4928
4934
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
4929
4935
  return updateMessageEmbeddingOp(ctx, messageId, embedding, embeddingModel);
@@ -4931,11 +4937,17 @@ async function embedMessage(ctx, messageId, options) {
4931
4937
  async function embedAllMessages(ctx, options, filter) {
4932
4938
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
4933
4939
  let embeddedCount = 0;
4940
+ let stillEncrypted = 0;
4941
+ let considered = 0;
4942
+ let sealedRowsSeen = 0;
4943
+ let rowsSeen = 0;
4934
4944
  const conversations = await getConversationsOp(ctx);
4935
4945
  const targetConversations = filter?.conversationId ? conversations.filter((c) => c.conversationId === filter.conversationId) : conversations;
4936
4946
  for (const conv of targetConversations) {
4937
4947
  const messages = await getMessagesOp(ctx, conv.conversationId);
4938
4948
  for (const message of messages) {
4949
+ rowsSeen++;
4950
+ if (isEncrypted(message.content)) sealedRowsSeen++;
4939
4951
  if (message.vector && message.vector.length > 0) {
4940
4952
  continue;
4941
4953
  }
@@ -4948,6 +4960,11 @@ async function embedAllMessages(ctx, options, filter) {
4948
4960
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
4949
4961
  continue;
4950
4962
  }
4963
+ considered++;
4964
+ if (isEncrypted(message.content)) {
4965
+ stillEncrypted++;
4966
+ continue;
4967
+ }
4951
4968
  const minLength = filter?.minContentLength ?? DEFAULT_MIN_CONTENT_LENGTH;
4952
4969
  if (message.content.length < minLength) {
4953
4970
  continue;
@@ -4962,6 +4979,13 @@ async function embedAllMessages(ctx, options, filter) {
4962
4979
  }
4963
4980
  }
4964
4981
  }
4982
+ if (stillEncrypted > 0 || sealedRowsSeen > 0) {
4983
+ getLogger().error(
4984
+ "memoryEngine: messages still encrypted (key unavailable?) \u2014 excluded from embedding",
4985
+ void 0,
4986
+ { stillEncrypted, considered, sealedRowsSeen, rowsSeen }
4987
+ );
4988
+ }
4965
4989
  return embeddedCount;
4966
4990
  }
4967
4991
  async function chunkAndEmbedMessage(ctx, messageId, options) {
@@ -4976,6 +5000,12 @@ async function chunkAndEmbedMessage(ctx, messageId, options) {
4976
5000
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
4977
5001
  return message;
4978
5002
  }
5003
+ if (isEncrypted(message.content)) {
5004
+ getLogger().warn(
5005
+ `memoryEngine: message ${messageId} is still encrypted (key unavailable?) \u2014 not embedded`
5006
+ );
5007
+ return message;
5008
+ }
4979
5009
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
4980
5010
  if (!shouldChunkMessage(message.content, chunkSize)) {
4981
5011
  const embedding = await generateEmbedding(message.content, options);
@@ -5000,9 +5030,15 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
5000
5030
  const targetConversations = filter?.conversationId ? conversations.filter((c) => c.conversationId === filter.conversationId) : conversations;
5001
5031
  const shortMessages = [];
5002
5032
  const longMessages = [];
5033
+ let stillEncrypted = 0;
5034
+ let considered = 0;
5035
+ let sealedRowsSeen = 0;
5036
+ let rowsSeen = 0;
5003
5037
  for (const conv of targetConversations) {
5004
5038
  const messages = await getMessagesOp(ctx, conv.conversationId);
5005
5039
  for (const message of messages) {
5040
+ rowsSeen++;
5041
+ if (isEncrypted(message.content)) sealedRowsSeen++;
5006
5042
  const isStale = message.embeddingModel !== void 0 && message.embeddingModel !== null && message.embeddingModel !== embeddingModel;
5007
5043
  if (message.chunks && message.chunks.length > 0 && !isStale) continue;
5008
5044
  const hasVector = message.vector && message.vector.length > 0;
@@ -5010,6 +5046,11 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
5010
5046
  if (filter?.roles && !filter.roles.includes(message.role)) continue;
5011
5047
  if (message.role === "system") continue;
5012
5048
  if (message.origin === NON_EMBEDDABLE_ORIGIN) continue;
5049
+ considered++;
5050
+ if (isEncrypted(message.content)) {
5051
+ stillEncrypted++;
5052
+ continue;
5053
+ }
5013
5054
  if (message.content.length < minLength) continue;
5014
5055
  if (shouldChunkMessage(message.content, chunkSize)) {
5015
5056
  longMessages.push({
@@ -5021,6 +5062,13 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
5021
5062
  }
5022
5063
  }
5023
5064
  }
5065
+ if (stillEncrypted > 0 || sealedRowsSeen > 0) {
5066
+ getLogger().error(
5067
+ "memoryEngine: messages still encrypted (key unavailable?) \u2014 excluded from embedding",
5068
+ void 0,
5069
+ { stillEncrypted, considered, sealedRowsSeen, rowsSeen }
5070
+ );
5071
+ }
5024
5072
  let embeddedCount = 0;
5025
5073
  if (shortMessages.length > 0) {
5026
5074
  try {
@@ -6801,7 +6849,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
6801
6849
  subQueries = decomp.subQueries;
6802
6850
  }
6803
6851
  }
6804
- const { recall: recall2 } = await import("./recall-PCM7H5TA.mjs");
6852
+ const { recall: recall2 } = await import("./recall-2J2755WC.mjs");
6805
6853
  let recallDegraded = [];
6806
6854
  const result = await recall2(
6807
6855
  query,
@@ -3636,6 +3636,12 @@ async function embedMessage(ctx, messageId, options) {
3636
3636
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
3637
3637
  return message;
3638
3638
  }
3639
+ if (isEncrypted(message.content)) {
3640
+ getLogger().warn(
3641
+ `memoryEngine: message ${messageId} is still encrypted (key unavailable?) \u2014 not embedded`
3642
+ );
3643
+ return message;
3644
+ }
3639
3645
  const embedding = await generateEmbedding(message.content, options);
3640
3646
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
3641
3647
  return updateMessageEmbeddingOp(ctx, messageId, embedding, embeddingModel);
@@ -3643,11 +3649,17 @@ async function embedMessage(ctx, messageId, options) {
3643
3649
  async function embedAllMessages(ctx, options, filter) {
3644
3650
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
3645
3651
  let embeddedCount = 0;
3652
+ let stillEncrypted = 0;
3653
+ let considered = 0;
3654
+ let sealedRowsSeen = 0;
3655
+ let rowsSeen = 0;
3646
3656
  const conversations = await getConversationsOp(ctx);
3647
3657
  const targetConversations = filter?.conversationId ? conversations.filter((c) => c.conversationId === filter.conversationId) : conversations;
3648
3658
  for (const conv of targetConversations) {
3649
3659
  const messages = await getMessagesOp(ctx, conv.conversationId);
3650
3660
  for (const message of messages) {
3661
+ rowsSeen++;
3662
+ if (isEncrypted(message.content)) sealedRowsSeen++;
3651
3663
  if (message.vector && message.vector.length > 0) {
3652
3664
  continue;
3653
3665
  }
@@ -3660,6 +3672,11 @@ async function embedAllMessages(ctx, options, filter) {
3660
3672
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
3661
3673
  continue;
3662
3674
  }
3675
+ considered++;
3676
+ if (isEncrypted(message.content)) {
3677
+ stillEncrypted++;
3678
+ continue;
3679
+ }
3663
3680
  const minLength = filter?.minContentLength ?? DEFAULT_MIN_CONTENT_LENGTH;
3664
3681
  if (message.content.length < minLength) {
3665
3682
  continue;
@@ -3674,6 +3691,13 @@ async function embedAllMessages(ctx, options, filter) {
3674
3691
  }
3675
3692
  }
3676
3693
  }
3694
+ if (stillEncrypted > 0 || sealedRowsSeen > 0) {
3695
+ getLogger().error(
3696
+ "memoryEngine: messages still encrypted (key unavailable?) \u2014 excluded from embedding",
3697
+ void 0,
3698
+ { stillEncrypted, considered, sealedRowsSeen, rowsSeen }
3699
+ );
3700
+ }
3677
3701
  return embeddedCount;
3678
3702
  }
3679
3703
  async function chunkAndEmbedMessage(ctx, messageId, options) {
@@ -3688,6 +3712,12 @@ async function chunkAndEmbedMessage(ctx, messageId, options) {
3688
3712
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
3689
3713
  return message;
3690
3714
  }
3715
+ if (isEncrypted(message.content)) {
3716
+ getLogger().warn(
3717
+ `memoryEngine: message ${messageId} is still encrypted (key unavailable?) \u2014 not embedded`
3718
+ );
3719
+ return message;
3720
+ }
3691
3721
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
3692
3722
  if (!shouldChunkMessage(message.content, chunkSize)) {
3693
3723
  const embedding = await generateEmbedding(message.content, options);
@@ -3712,9 +3742,15 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
3712
3742
  const targetConversations = filter?.conversationId ? conversations.filter((c) => c.conversationId === filter.conversationId) : conversations;
3713
3743
  const shortMessages = [];
3714
3744
  const longMessages = [];
3745
+ let stillEncrypted = 0;
3746
+ let considered = 0;
3747
+ let sealedRowsSeen = 0;
3748
+ let rowsSeen = 0;
3715
3749
  for (const conv of targetConversations) {
3716
3750
  const messages = await getMessagesOp(ctx, conv.conversationId);
3717
3751
  for (const message of messages) {
3752
+ rowsSeen++;
3753
+ if (isEncrypted(message.content)) sealedRowsSeen++;
3718
3754
  const isStale = message.embeddingModel !== void 0 && message.embeddingModel !== null && message.embeddingModel !== embeddingModel;
3719
3755
  if (message.chunks && message.chunks.length > 0 && !isStale) continue;
3720
3756
  const hasVector = message.vector && message.vector.length > 0;
@@ -3722,6 +3758,11 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
3722
3758
  if (filter?.roles && !filter.roles.includes(message.role)) continue;
3723
3759
  if (message.role === "system") continue;
3724
3760
  if (message.origin === NON_EMBEDDABLE_ORIGIN) continue;
3761
+ considered++;
3762
+ if (isEncrypted(message.content)) {
3763
+ stillEncrypted++;
3764
+ continue;
3765
+ }
3725
3766
  if (message.content.length < minLength) continue;
3726
3767
  if (shouldChunkMessage(message.content, chunkSize)) {
3727
3768
  longMessages.push({
@@ -3733,6 +3774,13 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
3733
3774
  }
3734
3775
  }
3735
3776
  }
3777
+ if (stillEncrypted > 0 || sealedRowsSeen > 0) {
3778
+ getLogger().error(
3779
+ "memoryEngine: messages still encrypted (key unavailable?) \u2014 excluded from embedding",
3780
+ void 0,
3781
+ { stillEncrypted, considered, sealedRowsSeen, rowsSeen }
3782
+ );
3783
+ }
3736
3784
  let embeddedCount = 0;
3737
3785
  if (shortMessages.length > 0) {
3738
3786
  try {
@@ -3783,6 +3831,7 @@ var init_embeddings = __esm({
3783
3831
  "src/lib/memoryEngine/embeddings.ts"() {
3784
3832
  "use strict";
3785
3833
  init_operations();
3834
+ init_encryption_utils();
3786
3835
  init_logger();
3787
3836
  init_chunking();
3788
3837
  init_constants();
@@ -168,7 +168,7 @@ import {
168
168
  updateVaultMemoryOp,
169
169
  useEncryption,
170
170
  vaultMemoryToStored
171
- } from "./chunk-TI3UVQPF.mjs";
171
+ } from "./chunk-IO4ZCPK2.mjs";
172
172
  import {
173
173
  PiiRedactor,
174
174
  createStreamingDeAnonymizer,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-TI3UVQPF.mjs";
3
+ } from "./chunk-IO4ZCPK2.mjs";
4
4
  import "./chunk-ILAWDQDE.mjs";
5
5
  import "./chunk-GYKJOWEO.mjs";
6
6
  export {
@@ -18832,6 +18832,12 @@ async function embedMessage(ctx, messageId, options) {
18832
18832
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
18833
18833
  return message;
18834
18834
  }
18835
+ if (isEncrypted(message.content)) {
18836
+ getLogger().warn(
18837
+ `memoryEngine: message ${messageId} is still encrypted (key unavailable?) \u2014 not embedded`
18838
+ );
18839
+ return message;
18840
+ }
18835
18841
  const embedding = await generateEmbedding(message.content, options);
18836
18842
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
18837
18843
  return updateMessageEmbeddingOp(ctx, messageId, embedding, embeddingModel);
@@ -18839,11 +18845,17 @@ async function embedMessage(ctx, messageId, options) {
18839
18845
  async function embedAllMessages(ctx, options, filter) {
18840
18846
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
18841
18847
  let embeddedCount = 0;
18848
+ let stillEncrypted = 0;
18849
+ let considered = 0;
18850
+ let sealedRowsSeen = 0;
18851
+ let rowsSeen = 0;
18842
18852
  const conversations = await getConversationsOp(ctx);
18843
18853
  const targetConversations = filter?.conversationId ? conversations.filter((c) => c.conversationId === filter.conversationId) : conversations;
18844
18854
  for (const conv of targetConversations) {
18845
18855
  const messages = await getMessagesOp(ctx, conv.conversationId);
18846
18856
  for (const message of messages) {
18857
+ rowsSeen++;
18858
+ if (isEncrypted(message.content)) sealedRowsSeen++;
18847
18859
  if (message.vector && message.vector.length > 0) {
18848
18860
  continue;
18849
18861
  }
@@ -18856,6 +18868,11 @@ async function embedAllMessages(ctx, options, filter) {
18856
18868
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
18857
18869
  continue;
18858
18870
  }
18871
+ considered++;
18872
+ if (isEncrypted(message.content)) {
18873
+ stillEncrypted++;
18874
+ continue;
18875
+ }
18859
18876
  const minLength = filter?.minContentLength ?? DEFAULT_MIN_CONTENT_LENGTH;
18860
18877
  if (message.content.length < minLength) {
18861
18878
  continue;
@@ -18870,6 +18887,13 @@ async function embedAllMessages(ctx, options, filter) {
18870
18887
  }
18871
18888
  }
18872
18889
  }
18890
+ if (stillEncrypted > 0 || sealedRowsSeen > 0) {
18891
+ getLogger().error(
18892
+ "memoryEngine: messages still encrypted (key unavailable?) \u2014 excluded from embedding",
18893
+ void 0,
18894
+ { stillEncrypted, considered, sealedRowsSeen, rowsSeen }
18895
+ );
18896
+ }
18873
18897
  return embeddedCount;
18874
18898
  }
18875
18899
  async function chunkAndEmbedMessage(ctx, messageId, options) {
@@ -18884,6 +18908,12 @@ async function chunkAndEmbedMessage(ctx, messageId, options) {
18884
18908
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
18885
18909
  return message;
18886
18910
  }
18911
+ if (isEncrypted(message.content)) {
18912
+ getLogger().warn(
18913
+ `memoryEngine: message ${messageId} is still encrypted (key unavailable?) \u2014 not embedded`
18914
+ );
18915
+ return message;
18916
+ }
18887
18917
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
18888
18918
  if (!shouldChunkMessage(message.content, chunkSize)) {
18889
18919
  const embedding = await generateEmbedding(message.content, options);
@@ -18908,9 +18938,15 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
18908
18938
  const targetConversations = filter?.conversationId ? conversations.filter((c) => c.conversationId === filter.conversationId) : conversations;
18909
18939
  const shortMessages = [];
18910
18940
  const longMessages = [];
18941
+ let stillEncrypted = 0;
18942
+ let considered = 0;
18943
+ let sealedRowsSeen = 0;
18944
+ let rowsSeen = 0;
18911
18945
  for (const conv of targetConversations) {
18912
18946
  const messages = await getMessagesOp(ctx, conv.conversationId);
18913
18947
  for (const message of messages) {
18948
+ rowsSeen++;
18949
+ if (isEncrypted(message.content)) sealedRowsSeen++;
18914
18950
  const isStale = message.embeddingModel !== void 0 && message.embeddingModel !== null && message.embeddingModel !== embeddingModel;
18915
18951
  if (message.chunks && message.chunks.length > 0 && !isStale) continue;
18916
18952
  const hasVector = message.vector && message.vector.length > 0;
@@ -18918,6 +18954,11 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
18918
18954
  if (filter?.roles && !filter.roles.includes(message.role)) continue;
18919
18955
  if (message.role === "system") continue;
18920
18956
  if (message.origin === NON_EMBEDDABLE_ORIGIN) continue;
18957
+ considered++;
18958
+ if (isEncrypted(message.content)) {
18959
+ stillEncrypted++;
18960
+ continue;
18961
+ }
18921
18962
  if (message.content.length < minLength) continue;
18922
18963
  if (shouldChunkMessage(message.content, chunkSize)) {
18923
18964
  longMessages.push({
@@ -18929,6 +18970,13 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
18929
18970
  }
18930
18971
  }
18931
18972
  }
18973
+ if (stillEncrypted > 0 || sealedRowsSeen > 0) {
18974
+ getLogger().error(
18975
+ "memoryEngine: messages still encrypted (key unavailable?) \u2014 excluded from embedding",
18976
+ void 0,
18977
+ { stillEncrypted, considered, sealedRowsSeen, rowsSeen }
18978
+ );
18979
+ }
18932
18980
  let embeddedCount = 0;
18933
18981
  if (shortMessages.length > 0) {
18934
18982
  try {
@@ -20709,7 +20757,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
20709
20757
  subQueries = decomp.subQueries;
20710
20758
  }
20711
20759
  }
20712
- const { recall: recall2 } = await import("./recall-BQSCJBGI.mjs");
20760
+ const { recall: recall2 } = await import("./recall-IVV6EILK.mjs");
20713
20761
  let recallDegraded = [];
20714
20762
  const result = await recall2(
20715
20763
  query,
@@ -19753,6 +19753,12 @@ async function embedMessage(ctx, messageId, options) {
19753
19753
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
19754
19754
  return message;
19755
19755
  }
19756
+ if (isEncrypted(message.content)) {
19757
+ getLogger().warn(
19758
+ `memoryEngine: message ${messageId} is still encrypted (key unavailable?) \u2014 not embedded`
19759
+ );
19760
+ return message;
19761
+ }
19756
19762
  const embedding = await generateEmbedding(message.content, options);
19757
19763
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
19758
19764
  return updateMessageEmbeddingOp(ctx, messageId, embedding, embeddingModel);
@@ -19760,11 +19766,17 @@ async function embedMessage(ctx, messageId, options) {
19760
19766
  async function embedAllMessages(ctx, options, filter) {
19761
19767
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
19762
19768
  let embeddedCount = 0;
19769
+ let stillEncrypted = 0;
19770
+ let considered = 0;
19771
+ let sealedRowsSeen = 0;
19772
+ let rowsSeen = 0;
19763
19773
  const conversations = await getConversationsOp(ctx);
19764
19774
  const targetConversations = filter?.conversationId ? conversations.filter((c) => c.conversationId === filter.conversationId) : conversations;
19765
19775
  for (const conv of targetConversations) {
19766
19776
  const messages = await getMessagesOp(ctx, conv.conversationId);
19767
19777
  for (const message of messages) {
19778
+ rowsSeen++;
19779
+ if (isEncrypted(message.content)) sealedRowsSeen++;
19768
19780
  if (message.vector && message.vector.length > 0) {
19769
19781
  continue;
19770
19782
  }
@@ -19777,6 +19789,11 @@ async function embedAllMessages(ctx, options, filter) {
19777
19789
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
19778
19790
  continue;
19779
19791
  }
19792
+ considered++;
19793
+ if (isEncrypted(message.content)) {
19794
+ stillEncrypted++;
19795
+ continue;
19796
+ }
19780
19797
  const minLength = filter?.minContentLength ?? DEFAULT_MIN_CONTENT_LENGTH;
19781
19798
  if (message.content.length < minLength) {
19782
19799
  continue;
@@ -19791,6 +19808,13 @@ async function embedAllMessages(ctx, options, filter) {
19791
19808
  }
19792
19809
  }
19793
19810
  }
19811
+ if (stillEncrypted > 0 || sealedRowsSeen > 0) {
19812
+ getLogger().error(
19813
+ "memoryEngine: messages still encrypted (key unavailable?) \u2014 excluded from embedding",
19814
+ void 0,
19815
+ { stillEncrypted, considered, sealedRowsSeen, rowsSeen }
19816
+ );
19817
+ }
19794
19818
  return embeddedCount;
19795
19819
  }
19796
19820
  async function chunkAndEmbedMessage(ctx, messageId, options) {
@@ -19805,6 +19829,12 @@ async function chunkAndEmbedMessage(ctx, messageId, options) {
19805
19829
  if (message.origin === NON_EMBEDDABLE_ORIGIN) {
19806
19830
  return message;
19807
19831
  }
19832
+ if (isEncrypted(message.content)) {
19833
+ getLogger().warn(
19834
+ `memoryEngine: message ${messageId} is still encrypted (key unavailable?) \u2014 not embedded`
19835
+ );
19836
+ return message;
19837
+ }
19808
19838
  const embeddingModel = options.model ?? DEFAULT_API_EMBEDDING_MODEL;
19809
19839
  if (!shouldChunkMessage(message.content, chunkSize)) {
19810
19840
  const embedding = await generateEmbedding(message.content, options);
@@ -19829,9 +19859,15 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
19829
19859
  const targetConversations = filter?.conversationId ? conversations.filter((c) => c.conversationId === filter.conversationId) : conversations;
19830
19860
  const shortMessages = [];
19831
19861
  const longMessages = [];
19862
+ let stillEncrypted = 0;
19863
+ let considered = 0;
19864
+ let sealedRowsSeen = 0;
19865
+ let rowsSeen = 0;
19832
19866
  for (const conv of targetConversations) {
19833
19867
  const messages = await getMessagesOp(ctx, conv.conversationId);
19834
19868
  for (const message of messages) {
19869
+ rowsSeen++;
19870
+ if (isEncrypted(message.content)) sealedRowsSeen++;
19835
19871
  const isStale = message.embeddingModel !== void 0 && message.embeddingModel !== null && message.embeddingModel !== embeddingModel;
19836
19872
  if (message.chunks && message.chunks.length > 0 && !isStale) continue;
19837
19873
  const hasVector = message.vector && message.vector.length > 0;
@@ -19839,6 +19875,11 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
19839
19875
  if (filter?.roles && !filter.roles.includes(message.role)) continue;
19840
19876
  if (message.role === "system") continue;
19841
19877
  if (message.origin === NON_EMBEDDABLE_ORIGIN) continue;
19878
+ considered++;
19879
+ if (isEncrypted(message.content)) {
19880
+ stillEncrypted++;
19881
+ continue;
19882
+ }
19842
19883
  if (message.content.length < minLength) continue;
19843
19884
  if (shouldChunkMessage(message.content, chunkSize)) {
19844
19885
  longMessages.push({
@@ -19850,6 +19891,13 @@ async function chunkAndEmbedAllMessages(ctx, options, filter) {
19850
19891
  }
19851
19892
  }
19852
19893
  }
19894
+ if (stillEncrypted > 0 || sealedRowsSeen > 0) {
19895
+ getLogger().error(
19896
+ "memoryEngine: messages still encrypted (key unavailable?) \u2014 excluded from embedding",
19897
+ void 0,
19898
+ { stillEncrypted, considered, sealedRowsSeen, rowsSeen }
19899
+ );
19900
+ }
19853
19901
  let embeddedCount = 0;
19854
19902
  if (shortMessages.length > 0) {
19855
19903
  try {
@@ -19900,6 +19948,7 @@ var init_embeddings = __esm({
19900
19948
  "src/lib/memoryEngine/embeddings.ts"() {
19901
19949
  "use strict";
19902
19950
  init_operations();
19951
+ init_encryption_utils();
19903
19952
  init_logger();
19904
19953
  init_chunking();
19905
19954
  init_constants();
@@ -139,7 +139,7 @@ import {
139
139
  updateVaultMemoryOp,
140
140
  upsertMessageOp,
141
141
  vaultMemoryToStored
142
- } from "./chunk-S5WEN7TE.mjs";
142
+ } from "./chunk-EKYGWD5N.mjs";
143
143
  import {
144
144
  createStreamingDeAnonymizer,
145
145
  notifyConsolidationFallback,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-S5WEN7TE.mjs";
3
+ } from "./chunk-EKYGWD5N.mjs";
4
4
  import "./chunk-OBDRKQQI.mjs";
5
5
  import "./chunk-3RPGXXPZ.mjs";
6
6
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuma/sdk",
3
- "version": "6.4.0",
3
+ "version": "6.4.2",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -272,8 +272,8 @@
272
272
  "undici@>=7 <7.28.0": ">=7.28.0 <8.0.0",
273
273
  "vite@>=7 <7.3.5": ">=7.3.5",
274
274
  "esbuild@>=0.27.3 <0.28.1": ">=0.28.1",
275
- "js-yaml@>=4 <4.2.0": ">=4.2.0 <5.0.0",
276
- "js-yaml@>=3 <3.15.0": ">=3.15.0 <4.0.0",
275
+ "js-yaml@>=4 <4.3.1": ">=4.3.1 <5.0.0",
276
+ "js-yaml@>=3 <3.15.1": ">=3.15.1 <4.0.0",
277
277
  "markdown-it@<14.2.0": ">=14.2.0",
278
278
  "brace-expansion@1": ">=1.1.18 <2.0.0",
279
279
  "brace-expansion@2": ">=2.1.4 <3.0.0"