@anuma/sdk 9.1.6 → 9.1.8

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.
package/dist/index.mjs CHANGED
@@ -511,7 +511,7 @@ var mergeHeaders = (...headers) => {
511
511
  if (!header || typeof header !== "object") {
512
512
  continue;
513
513
  }
514
- const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
514
+ const iterator = Array.isArray(header) || header instanceof Headers ? headersEntries(new Headers(header)) : Object.entries(header);
515
515
  for (const [key, value] of iterator) {
516
516
  if (value === null) {
517
517
  mergedHeaders.delete(key);
@@ -786,6 +786,18 @@ var createClient = (config = {}) => {
786
786
  // src/client/client.gen.ts
787
787
  var client = createClient(createClientConfig(createConfig()));
788
788
 
789
+ // src/clientHeaders.ts
790
+ function normalizeHeaders(headers) {
791
+ if (headers instanceof Headers || Array.isArray(headers)) {
792
+ const normalized = /* @__PURE__ */ Object.create(null);
793
+ new Headers(headers).forEach((value, name) => {
794
+ normalized[name] = value;
795
+ });
796
+ return normalized;
797
+ }
798
+ return headers;
799
+ }
800
+
789
801
  // src/client/sdk.gen.ts
790
802
  var deleteApiV1Account = (options) => (options?.client ?? client).delete({ url: "/api/v1/account", ...options });
791
803
  var postApiV1AdminAddCredits = (options) => (options.client ?? client).post({
@@ -793,7 +805,7 @@ var postApiV1AdminAddCredits = (options) => (options.client ?? client).post({
793
805
  ...options,
794
806
  headers: {
795
807
  "Content-Type": "application/json",
796
- ...options.headers
808
+ ...normalizeHeaders(options.headers)
797
809
  }
798
810
  });
799
811
  var postApiV1AdminAgents = (options) => (options.client ?? client).post({
@@ -801,7 +813,7 @@ var postApiV1AdminAgents = (options) => (options.client ?? client).post({
801
813
  ...options,
802
814
  headers: {
803
815
  "Content-Type": "application/json",
804
- ...options.headers
816
+ ...normalizeHeaders(options.headers)
805
817
  }
806
818
  });
807
819
  var deleteApiV1AdminAgentsById = (options) => (options.client ?? client).delete({ url: "/api/v1/admin/agents/{id}", ...options });
@@ -810,7 +822,7 @@ var putApiV1AdminAgentsById = (options) => (options.client ?? client).put({
810
822
  ...options,
811
823
  headers: {
812
824
  "Content-Type": "application/json",
813
- ...options.headers
825
+ ...normalizeHeaders(options.headers)
814
826
  }
815
827
  });
816
828
  var getApiV1AdminApps = (options) => (options.client ?? client).get({ url: "/api/v1/admin/apps", ...options });
@@ -819,7 +831,7 @@ var postApiV1AdminApps = (options) => (options.client ?? client).post({
819
831
  ...options,
820
832
  headers: {
821
833
  "Content-Type": "application/json",
822
- ...options.headers
834
+ ...normalizeHeaders(options.headers)
823
835
  }
824
836
  });
825
837
  var getApiV1AdminAppsByAppIdApiKeys = (options) => (options.client ?? client).get({ url: "/api/v1/admin/apps/{app_id}/api-keys", ...options });
@@ -828,7 +840,7 @@ var postApiV1AdminAppsByAppIdApiKeys = (options) => (options.client ?? client).p
828
840
  ...options,
829
841
  headers: {
830
842
  "Content-Type": "application/json",
831
- ...options.headers
843
+ ...normalizeHeaders(options.headers)
832
844
  }
833
845
  });
834
846
  var deleteApiV1AdminAppsByAppIdApiKeysById = (options) => (options.client ?? client).delete({ url: "/api/v1/admin/apps/{app_id}/api-keys/{id}", ...options });
@@ -838,7 +850,7 @@ var putApiV1AdminAppsByAppIdApiKeysById = (options) => (options.client ?? client
838
850
  ...options,
839
851
  headers: {
840
852
  "Content-Type": "application/json",
841
- ...options.headers
853
+ ...normalizeHeaders(options.headers)
842
854
  }
843
855
  });
844
856
  var deleteApiV1AdminAppsById = (options) => (options.client ?? client).delete({ url: "/api/v1/admin/apps/{id}", ...options });
@@ -848,7 +860,7 @@ var putApiV1AdminAppsById = (options) => (options.client ?? client).put({
848
860
  ...options,
849
861
  headers: {
850
862
  "Content-Type": "application/json",
851
- ...options.headers
863
+ ...normalizeHeaders(options.headers)
852
864
  }
853
865
  });
854
866
  var postApiV1AdminPersonas = (options) => (options.client ?? client).post({
@@ -856,7 +868,7 @@ var postApiV1AdminPersonas = (options) => (options.client ?? client).post({
856
868
  ...options,
857
869
  headers: {
858
870
  "Content-Type": "application/json",
859
- ...options.headers
871
+ ...normalizeHeaders(options.headers)
860
872
  }
861
873
  });
862
874
  var deleteApiV1AdminPersonasById = (options) => (options.client ?? client).delete({ url: "/api/v1/admin/personas/{id}", ...options });
@@ -865,7 +877,7 @@ var putApiV1AdminPersonasById = (options) => (options.client ?? client).put({
865
877
  ...options,
866
878
  headers: {
867
879
  "Content-Type": "application/json",
868
- ...options.headers
880
+ ...normalizeHeaders(options.headers)
869
881
  }
870
882
  });
871
883
  var postApiV1AdminSeedApps = (options) => (options.client ?? client).post({
@@ -873,7 +885,7 @@ var postApiV1AdminSeedApps = (options) => (options.client ?? client).post({
873
885
  ...options,
874
886
  headers: {
875
887
  "Content-Type": "application/json",
876
- ...options.headers
888
+ ...normalizeHeaders(options.headers)
877
889
  }
878
890
  });
879
891
  var postApiV1AdminSubscriptionTier = (options) => (options.client ?? client).post({
@@ -881,7 +893,7 @@ var postApiV1AdminSubscriptionTier = (options) => (options.client ?? client).pos
881
893
  ...options,
882
894
  headers: {
883
895
  "Content-Type": "application/json",
884
- ...options.headers
896
+ ...normalizeHeaders(options.headers)
885
897
  }
886
898
  });
887
899
  var deleteApiV1AdminTextReset = (options) => (options.client ?? client).delete({ url: "/api/v1/admin/text/reset", ...options });
@@ -894,7 +906,7 @@ var putApiV1AgentsByIdPreference = (options) => (options.client ?? client).put({
894
906
  ...options,
895
907
  headers: {
896
908
  "Content-Type": "application/json",
897
- ...options.headers
909
+ ...normalizeHeaders(options.headers)
898
910
  }
899
911
  });
900
912
  var postApiV1ChatCompletions = (options) => (options.client ?? client).post({
@@ -902,7 +914,7 @@ var postApiV1ChatCompletions = (options) => (options.client ?? client).post({
902
914
  ...options,
903
915
  headers: {
904
916
  "Content-Type": "application/json",
905
- ...options.headers
917
+ ...normalizeHeaders(options.headers)
906
918
  }
907
919
  });
908
920
  var getApiV1Config = (options) => (options?.client ?? client).get({ url: "/api/v1/config", ...options });
@@ -913,7 +925,7 @@ var postApiV1CreditsPurchase = (options) => (options.client ?? client).post({
913
925
  ...options,
914
926
  headers: {
915
927
  "Content-Type": "application/json",
916
- ...options.headers
928
+ ...normalizeHeaders(options.headers)
917
929
  }
918
930
  });
919
931
  var postApiV1CreditsRedeemTokens = (options) => (options.client ?? client).post({
@@ -921,7 +933,7 @@ var postApiV1CreditsRedeemTokens = (options) => (options.client ?? client).post(
921
933
  ...options,
922
934
  headers: {
923
935
  "Content-Type": "application/json",
924
- ...options.headers
936
+ ...normalizeHeaders(options.headers)
925
937
  }
926
938
  });
927
939
  var getApiV1DeveloperApps = (options) => (options?.client ?? client).get({ url: "/api/v1/developer/apps", ...options });
@@ -930,7 +942,7 @@ var postApiV1DeveloperApps = (options) => (options.client ?? client).post({
930
942
  ...options,
931
943
  headers: {
932
944
  "Content-Type": "application/json",
933
- ...options.headers
945
+ ...normalizeHeaders(options.headers)
934
946
  }
935
947
  });
936
948
  var deleteApiV1DeveloperAppsByAppUuid = (options) => (options.client ?? client).delete({ url: "/api/v1/developer/apps/{app_uuid}", ...options });
@@ -940,7 +952,7 @@ var patchApiV1DeveloperAppsByAppUuid = (options) => (options.client ?? client).p
940
952
  ...options,
941
953
  headers: {
942
954
  "Content-Type": "application/json",
943
- ...options.headers
955
+ ...normalizeHeaders(options.headers)
944
956
  }
945
957
  });
946
958
  var getApiV1DeveloperAppsByAppUuidApiKeys = (options) => (options.client ?? client).get({ url: "/api/v1/developer/apps/{app_uuid}/api-keys", ...options });
@@ -949,7 +961,7 @@ var postApiV1DeveloperAppsByAppUuidApiKeys = (options) => (options.client ?? cli
949
961
  ...options,
950
962
  headers: {
951
963
  "Content-Type": "application/json",
952
- ...options.headers
964
+ ...normalizeHeaders(options.headers)
953
965
  }
954
966
  });
955
967
  var deleteApiV1DeveloperAppsByAppUuidApiKeysByKeyId = (options) => (options.client ?? client).delete({ url: "/api/v1/developer/apps/{app_uuid}/api-keys/{key_id}", ...options });
@@ -958,7 +970,7 @@ var postApiV1DeveloperAppsByAppUuidFund = (options) => (options.client ?? client
958
970
  ...options,
959
971
  headers: {
960
972
  "Content-Type": "application/json",
961
- ...options.headers
973
+ ...normalizeHeaders(options.headers)
962
974
  }
963
975
  });
964
976
  var deleteApiV1DeveloperAppsByAppUuidPrivy = (options) => (options.client ?? client).delete({ url: "/api/v1/developer/apps/{app_uuid}/privy", ...options });
@@ -967,7 +979,7 @@ var postApiV1DeveloperAppsByAppUuidPrivy = (options) => (options.client ?? clien
967
979
  ...options,
968
980
  headers: {
969
981
  "Content-Type": "application/json",
970
- ...options.headers
982
+ ...normalizeHeaders(options.headers)
971
983
  }
972
984
  });
973
985
  var getApiV1DeveloperAppsByAppUuidUsage = (options) => (options.client ?? client).get({ url: "/api/v1/developer/apps/{app_uuid}/usage", ...options });
@@ -979,7 +991,7 @@ var patchApiV1DeveloperAppsByAppUuidUsersByAddress = (options) => (options.clien
979
991
  ...options,
980
992
  headers: {
981
993
  "Content-Type": "application/json",
982
- ...options.headers
994
+ ...normalizeHeaders(options.headers)
983
995
  }
984
996
  });
985
997
  var postApiV1DeveloperAppsByAppUuidUsersByAddressTopUp = (options) => (options.client ?? client).post({
@@ -987,7 +999,7 @@ var postApiV1DeveloperAppsByAppUuidUsersByAddressTopUp = (options) => (options.c
987
999
  ...options,
988
1000
  headers: {
989
1001
  "Content-Type": "application/json",
990
- ...options.headers
1002
+ ...normalizeHeaders(options.headers)
991
1003
  }
992
1004
  });
993
1005
  var getApiV1DeveloperBilling = (options) => (options?.client ?? client).get({ url: "/api/v1/developer/billing", ...options });
@@ -997,7 +1009,7 @@ var postApiV1Embeddings = (options) => (options.client ?? client).post({
997
1009
  ...options,
998
1010
  headers: {
999
1011
  "Content-Type": "application/json",
1000
- ...options.headers
1012
+ ...normalizeHeaders(options.headers)
1001
1013
  }
1002
1014
  });
1003
1015
  var getApiV1Models = (options) => (options?.client ?? client).get({ url: "/api/v1/models", ...options });
@@ -1008,7 +1020,7 @@ var postApiV1PhoneCalls = (options) => (options.client ?? client).post({
1008
1020
  ...options,
1009
1021
  headers: {
1010
1022
  "Content-Type": "application/json",
1011
- ...options.headers
1023
+ ...normalizeHeaders(options.headers)
1012
1024
  }
1013
1025
  });
1014
1026
  var getApiV1PhoneCallsByCallId = (options) => (options.client ?? client).get({ url: "/api/v1/phone-calls/{call_id}", ...options });
@@ -1017,7 +1029,7 @@ var postApiV1Responses = (options) => (options.client ?? client).post({
1017
1029
  ...options,
1018
1030
  headers: {
1019
1031
  "Content-Type": "application/json",
1020
- ...options.headers
1032
+ ...normalizeHeaders(options.headers)
1021
1033
  }
1022
1034
  });
1023
1035
  var postApiV1SubscriptionsCancel = (options) => (options?.client ?? client).post({
@@ -1025,7 +1037,7 @@ var postApiV1SubscriptionsCancel = (options) => (options?.client ?? client).post
1025
1037
  ...options,
1026
1038
  headers: {
1027
1039
  "Content-Type": "application/json",
1028
- ...options?.headers
1040
+ ...normalizeHeaders(options?.headers)
1029
1041
  }
1030
1042
  });
1031
1043
  var postApiV1SubscriptionsCancelScheduledDowngrade = (options) => (options?.client ?? client).post({ url: "/api/v1/subscriptions/cancel-scheduled-downgrade", ...options });
@@ -1034,7 +1046,7 @@ var postApiV1SubscriptionsCreateCheckoutSession = (options) => (options.client ?
1034
1046
  ...options,
1035
1047
  headers: {
1036
1048
  "Content-Type": "application/json",
1037
- ...options.headers
1049
+ ...normalizeHeaders(options.headers)
1038
1050
  }
1039
1051
  });
1040
1052
  var postApiV1SubscriptionsCustomerPortal = (options) => (options.client ?? client).post({
@@ -1042,7 +1054,7 @@ var postApiV1SubscriptionsCustomerPortal = (options) => (options.client ?? clien
1042
1054
  ...options,
1043
1055
  headers: {
1044
1056
  "Content-Type": "application/json",
1045
- ...options.headers
1057
+ ...normalizeHeaders(options.headers)
1046
1058
  }
1047
1059
  });
1048
1060
  var getApiV1SubscriptionsPlans = (options) => (options?.client ?? client).get({ url: "/api/v1/subscriptions/plans", ...options });
@@ -1052,7 +1064,7 @@ var postApiV1SubscriptionsScheduleDowngrade = (options) => (options.client ?? cl
1052
1064
  ...options,
1053
1065
  headers: {
1054
1066
  "Content-Type": "application/json",
1055
- ...options.headers
1067
+ ...normalizeHeaders(options.headers)
1056
1068
  }
1057
1069
  });
1058
1070
  var getApiV1SubscriptionsStatus = (options) => (options?.client ?? client).get({ url: "/api/v1/subscriptions/status", ...options });
@@ -1061,7 +1073,7 @@ var postApiV1SubscriptionsUpgrade = (options) => (options.client ?? client).post
1061
1073
  ...options,
1062
1074
  headers: {
1063
1075
  "Content-Type": "application/json",
1064
- ...options.headers
1076
+ ...normalizeHeaders(options.headers)
1065
1077
  }
1066
1078
  });
1067
1079
  var postApiV1SubscriptionsWebhook = (options) => (options.client ?? client).post({
@@ -1069,7 +1081,7 @@ var postApiV1SubscriptionsWebhook = (options) => (options.client ?? client).post
1069
1081
  ...options,
1070
1082
  headers: {
1071
1083
  "Content-Type": "application/json",
1072
- ...options.headers
1084
+ ...normalizeHeaders(options.headers)
1073
1085
  }
1074
1086
  });
1075
1087
  var getApiV1Tools = (options) => (options?.client ?? client).get({ url: "/api/v1/tools", ...options });
@@ -1081,7 +1093,7 @@ var postApiV1UserApiKeys = (options) => (options.client ?? client).post({
1081
1093
  ...options,
1082
1094
  headers: {
1083
1095
  "Content-Type": "application/json",
1084
- ...options.headers
1096
+ ...normalizeHeaders(options.headers)
1085
1097
  }
1086
1098
  });
1087
1099
  var deleteApiV1UserApiKeysByKeyId = (options) => (options.client ?? client).delete({ url: "/api/v1/user/api-keys/{key_id}", ...options });
@@ -1091,7 +1103,7 @@ var postApiV1WalletsBinding = (options) => (options.client ?? client).post({
1091
1103
  ...options,
1092
1104
  headers: {
1093
1105
  "Content-Type": "application/json",
1094
- ...options.headers
1106
+ ...normalizeHeaders(options.headers)
1095
1107
  }
1096
1108
  });
1097
1109
  var postApiV1WalletsBindingNonce = (options) => (options?.client ?? client).post({ url: "/api/v1/wallets/binding/nonce", ...options });
@@ -1101,7 +1113,7 @@ var postApiV1WebhooksRevenuecat = (options) => (options?.client ?? client).post(
1101
1113
  ...options,
1102
1114
  headers: {
1103
1115
  "Content-Type": "application/json",
1104
- ...options?.headers
1116
+ ...normalizeHeaders(options?.headers)
1105
1117
  }
1106
1118
  });
1107
1119
  var getApiV1ZetaCreditRate = (options) => (options?.client ?? client).get({ url: "/api/v1/zeta/credit-rate", ...options });
@@ -3575,7 +3575,14 @@ function cosineSimilarity(a, b) {
3575
3575
 
3576
3576
  // src/lib/processors/encoding.ts
3577
3577
  var B64_ENCODE_CHUNK = 32768 * 3;
3578
+ function assertFileUrlAllowed(dataUrl) {
3579
+ const isNode = typeof process !== "undefined" && Boolean(process.versions?.node);
3580
+ if (isNode && !dataUrl.startsWith("data:") && !dataUrl.startsWith("blob:")) {
3581
+ throw new Error("Server file preprocessing requires a data URL or blob URL.");
3582
+ }
3583
+ }
3578
3584
  async function dataUrlToArrayBuffer(dataUrl) {
3585
+ assertFileUrlAllowed(dataUrl);
3579
3586
  if (dataUrl.startsWith("blob:") || dataUrl.startsWith("http://") || dataUrl.startsWith("https://")) {
3580
3587
  const response = await fetch(dataUrl);
3581
3588
  return response.arrayBuffer();
@@ -6237,7 +6244,7 @@ var mergeHeaders = (...headers) => {
6237
6244
  if (!header || typeof header !== "object") {
6238
6245
  continue;
6239
6246
  }
6240
- const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
6247
+ const iterator = Array.isArray(header) || header instanceof Headers ? headersEntries(new Headers(header)) : Object.entries(header);
6241
6248
  for (const [key, value] of iterator) {
6242
6249
  if (value === null) {
6243
6250
  mergedHeaders.delete(key);
@@ -6513,6 +6520,18 @@ var createClient = (config = {}) => {
6513
6520
  init_clientConfig();
6514
6521
  var client = createClient(createClientConfig(createConfig()));
6515
6522
 
6523
+ // src/clientHeaders.ts
6524
+ function normalizeHeaders(headers) {
6525
+ if (headers instanceof Headers || Array.isArray(headers)) {
6526
+ const normalized = /* @__PURE__ */ Object.create(null);
6527
+ new Headers(headers).forEach((value, name) => {
6528
+ normalized[name] = value;
6529
+ });
6530
+ return normalized;
6531
+ }
6532
+ return headers;
6533
+ }
6534
+
6516
6535
  // src/client/sdk.gen.ts
6517
6536
  var getApiV1Config = (options) => (options?.client ?? client).get({ url: "/api/v1/config", ...options });
6518
6537
  var getApiV1CreditsBalance = (options) => (options?.client ?? client).get({ url: "/api/v1/credits/balance", ...options });
@@ -6522,7 +6541,7 @@ var postApiV1CreditsPurchase = (options) => (options.client ?? client).post({
6522
6541
  ...options,
6523
6542
  headers: {
6524
6543
  "Content-Type": "application/json",
6525
- ...options.headers
6544
+ ...normalizeHeaders(options.headers)
6526
6545
  }
6527
6546
  });
6528
6547
  var postApiV1Embeddings = (options) => (options.client ?? client).post({
@@ -6530,7 +6549,7 @@ var postApiV1Embeddings = (options) => (options.client ?? client).post({
6530
6549
  ...options,
6531
6550
  headers: {
6532
6551
  "Content-Type": "application/json",
6533
- ...options.headers
6552
+ ...normalizeHeaders(options.headers)
6534
6553
  }
6535
6554
  });
6536
6555
  var getApiV1Models = (options) => (options?.client ?? client).get({ url: "/api/v1/models", ...options });
@@ -6539,7 +6558,7 @@ var postApiV1PhoneCalls = (options) => (options.client ?? client).post({
6539
6558
  ...options,
6540
6559
  headers: {
6541
6560
  "Content-Type": "application/json",
6542
- ...options.headers
6561
+ ...normalizeHeaders(options.headers)
6543
6562
  }
6544
6563
  });
6545
6564
  var getApiV1PhoneCallsByCallId = (options) => (options.client ?? client).get({ url: "/api/v1/phone-calls/{call_id}", ...options });
@@ -6548,7 +6567,7 @@ var postApiV1SubscriptionsCancel = (options) => (options?.client ?? client).post
6548
6567
  ...options,
6549
6568
  headers: {
6550
6569
  "Content-Type": "application/json",
6551
- ...options?.headers
6570
+ ...normalizeHeaders(options?.headers)
6552
6571
  }
6553
6572
  });
6554
6573
  var postApiV1SubscriptionsCreateCheckoutSession = (options) => (options.client ?? client).post({
@@ -6556,7 +6575,7 @@ var postApiV1SubscriptionsCreateCheckoutSession = (options) => (options.client ?
6556
6575
  ...options,
6557
6576
  headers: {
6558
6577
  "Content-Type": "application/json",
6559
- ...options.headers
6578
+ ...normalizeHeaders(options.headers)
6560
6579
  }
6561
6580
  });
6562
6581
  var postApiV1SubscriptionsCustomerPortal = (options) => (options.client ?? client).post({
@@ -6564,7 +6583,7 @@ var postApiV1SubscriptionsCustomerPortal = (options) => (options.client ?? clien
6564
6583
  ...options,
6565
6584
  headers: {
6566
6585
  "Content-Type": "application/json",
6567
- ...options.headers
6586
+ ...normalizeHeaders(options.headers)
6568
6587
  }
6569
6588
  });
6570
6589
  var postApiV1SubscriptionsRenew = (options) => (options?.client ?? client).post({ url: "/api/v1/subscriptions/renew", ...options });
@@ -6575,7 +6594,7 @@ var postApiV1WalletsBinding = (options) => (options.client ?? client).post({
6575
6594
  ...options,
6576
6595
  headers: {
6577
6596
  "Content-Type": "application/json",
6578
- ...options.headers
6597
+ ...normalizeHeaders(options.headers)
6579
6598
  }
6580
6599
  });
6581
6600
  var postApiV1WalletsBindingNonce = (options) => (options?.client ?? client).post({ url: "/api/v1/wallets/binding/nonce", ...options });
@@ -16668,10 +16687,10 @@ async function getVaultRankingProjectionsOp(ctx, options) {
16668
16687
  function baseVaultSql(ctx, options) {
16669
16688
  const clauses = [
16670
16689
  `"_status" is not 'deleted'`,
16671
- '"is_deleted" = 0',
16690
+ ...options?.includeDeleted ? [] : ['"is_deleted" = 0'],
16672
16691
  ...options?.includeArchived ? [] : ['"archived_at" is null'],
16673
16692
  ...options?.includeQuarantined ? [] : [`"trust_tier" is not 'quarantined'`],
16674
- '"superseded_by" is null'
16693
+ ...options?.includeSuperseded ? [] : ['"superseded_by" is null']
16675
16694
  ];
16676
16695
  const args = [];
16677
16696
  if (ctx.userId !== void 0) {
@@ -16680,6 +16699,38 @@ function baseVaultSql(ctx, options) {
16680
16699
  }
16681
16700
  return { sql: clauses.join(" and "), args };
16682
16701
  }
16702
+ async function getVaultProfileMetadataOp(ctx, options) {
16703
+ const mapRaw = (raw) => ({
16704
+ uniqueId: raw.id,
16705
+ scope: raw.scope ?? "",
16706
+ createdAt: new Date(raw.created_at),
16707
+ updatedAt: new Date(raw.updated_at),
16708
+ lastObservedAt: raw.last_observed_at ?? null,
16709
+ supersededAt: raw.superseded_at ?? null,
16710
+ supersededBy: raw.superseded_by ?? null,
16711
+ isDeleted: raw.is_deleted === true || raw.is_deleted === 1,
16712
+ proofCount: raw.proof_count ?? null
16713
+ });
16714
+ const listOptions = { ...options, includeDeleted: true, includeSuperseded: true };
16715
+ let rows;
16716
+ try {
16717
+ const base = baseVaultSql(ctx, listOptions);
16718
+ const clauses = [base.sql, `"_status" != 'deleted'`];
16719
+ const args = [...base.args];
16720
+ if (options?.scopes?.length) {
16721
+ clauses.push(`"scope" in (${options.scopes.map(() => "?").join(",")})`);
16722
+ args.push(...options.scopes);
16723
+ }
16724
+ const sql = `select "id", "scope", "created_at", "updated_at", "last_observed_at", "superseded_at", "superseded_by", "is_deleted", "proof_count" from "memory_vault" where ${clauses.join(" and ")}`;
16725
+ rows = await ctx.vaultMemoryCollection.query(import_watermelondb24.Q.unsafeSqlQuery(sql, args)).unsafeFetchRaw();
16726
+ } catch (err) {
16727
+ getLogger().debug(
16728
+ "memoryVault: getVaultProfileMetadataOp uses the query fallback: " + (err instanceof Error ? err.message : String(err))
16729
+ );
16730
+ rows = await ctx.vaultMemoryCollection.query(...vaultListConditions(ctx, listOptions)).unsafeFetchRaw();
16731
+ }
16732
+ return rows.map(mapRaw);
16733
+ }
16683
16734
  async function getVaultCandidateKeysOp(ctx, options) {
16684
16735
  const mapRaw = (raw) => ({
16685
16736
  uniqueId: raw.id,
@@ -26892,7 +26943,7 @@ async function synthesizeProfile(ctx, options = {}) {
26892
26943
  };
26893
26944
  const previous = options.previous && options.previous.version === PROFILE_DOC_VERSION && configMatches(options.previous.config, config) ? options.previous : void 0;
26894
26945
  const listOptions = { scopes, includeDeleted: true, includeSuperseded: true };
26895
- const [memories, projections] = store ? await Promise.all([store.list(listOptions), store.listProjections(listOptions)]) : [await getAllVaultMemoriesOp(vaultCtx, listOptions), []];
26946
+ const [memories, projections] = store ? await Promise.all([store.list(listOptions), store.listProjections(listOptions)]) : [await getVaultProfileMetadataOp(vaultCtx, { scopes }), []];
26896
26947
  const watermark = computeVaultWatermark(memories);
26897
26948
  const observationTrends = summarizeObservationTrends(
26898
26949
  memories.filter((m) => !m.isDeleted && m.supersededBy === null).map((m) => ({
@@ -26928,7 +26979,8 @@ async function synthesizeProfile(ctx, options = {}) {
26928
26979
  previous,
26929
26980
  watermark,
26930
26981
  options.reviewedMemoryIds,
26931
- previousUnreadable
26982
+ previousUnreadable,
26983
+ store ? void 0 : (ids) => getVaultEmbeddingsByIdsOp(vaultCtx, ids)
26932
26984
  );
26933
26985
  const memoriesById = new Map(memories.map((memory) => [memory.uniqueId, memory]));
26934
26986
  const fallbackPriors = /* @__PURE__ */ new Map();
@@ -27015,7 +27067,7 @@ function computeVaultWatermark(memories) {
27015
27067
  }
27016
27068
  return max;
27017
27069
  }
27018
- async function computeStaleFacetKeys(ctx, memories, facets, previous, watermark, reviewedMemoryIds, previouslyUnreadable) {
27070
+ async function computeStaleFacetKeys(ctx, memories, facets, previous, watermark, reviewedMemoryIds, previouslyUnreadable, loadEmbeddings) {
27019
27071
  const allKeys = new Set(facets.map((f) => f.key));
27020
27072
  if (previous && watermark < previous.vaultWatermark) return allKeys;
27021
27073
  if (!previous) return allKeys;
@@ -27048,7 +27100,9 @@ async function computeStaleFacetKeys(ctx, memories, facets, previous, watermark,
27048
27100
  toAttribute = toAttribute.filter((m) => allowed.has(m.uniqueId));
27049
27101
  }
27050
27102
  if (toAttribute.length > 0) {
27051
- const attributed = await attributeFacts(ctx, toAttribute, facets);
27103
+ const candidates = loadEmbeddings ? await loadEmbeddings(toAttribute.map((m) => m.uniqueId)) : toAttribute;
27104
+ if (candidates.length !== toAttribute.length) return allKeys;
27105
+ const attributed = await attributeFacts(ctx, candidates, facets);
27052
27106
  if (attributed === null) return allKeys;
27053
27107
  for (const k of attributed) stale.add(k);
27054
27108
  }
@@ -29619,6 +29673,7 @@ async function getPdfjs() {
29619
29673
  return pdfjsModule;
29620
29674
  }
29621
29675
  async function withPdfDocument(pdfDataUrl, fn) {
29676
+ assertFileUrlAllowed(pdfDataUrl);
29622
29677
  const pdfjs = await getPdfjs();
29623
29678
  const loadingTask = pdfjs.getDocument(pdfDataUrl);
29624
29679
  let pdf;
@@ -30421,6 +30476,7 @@ async function preprocessFiles(files, options = {}) {
30421
30476
  skip("no_data");
30422
30477
  continue;
30423
30478
  }
30479
+ assertFileUrlAllowed(file.url);
30424
30480
  const fileWithData = {
30425
30481
  ...file,
30426
30482
  dataUrl: file.url