@anuma/sdk 4.2.0 → 5.0.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.
- package/dist/expo/{chunk-VBO6KSNQ.mjs → chunk-SIMGZQ4P.mjs} +480 -196
- package/dist/expo/index.cjs +417 -120
- package/dist/expo/index.d.mts +161 -26
- package/dist/expo/index.d.ts +161 -26
- package/dist/expo/index.mjs +22 -6
- package/dist/expo/{recall-OCQOA7M3.mjs → recall-PIDYDFIQ.mjs} +1 -1
- package/dist/index.cjs +31 -17
- package/dist/index.mjs +31 -17
- package/dist/react/{chunk-BS7C4CUW.mjs → chunk-KTBOHRRE.mjs} +480 -196
- package/dist/react/index.cjs +417 -120
- package/dist/react/index.d.mts +155 -26
- package/dist/react/index.d.ts +155 -26
- package/dist/react/index.mjs +22 -6
- package/dist/react/{recall-WXCZHXHZ.mjs → recall-DVX4W2UD.mjs} +1 -1
- package/dist/server/{chunk-WADHFDMA.mjs → chunk-FKVYUOSD.mjs} +480 -196
- package/dist/server/index.cjs +417 -120
- package/dist/server/index.d.mts +154 -25
- package/dist/server/index.d.ts +154 -25
- package/dist/server/index.mjs +22 -6
- package/dist/server/{recall-QTVT7HCZ.mjs → recall-74L75BJ3.mjs} +1 -1
- package/package.json +1 -1
package/dist/expo/index.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
EMBEDDINGS_DEGRADED_EMPTY,
|
|
9
9
|
ENTITY_FANOUT,
|
|
10
10
|
ENTITY_KINDS,
|
|
11
|
+
EncryptionKeyMissingError,
|
|
11
12
|
LRUCache,
|
|
12
13
|
MAX_HOPS,
|
|
13
14
|
NODE_BUDGET,
|
|
@@ -41,6 +42,7 @@ import {
|
|
|
41
42
|
createVaultEmbeddingCache,
|
|
42
43
|
createVaultMemoriesBatchOp,
|
|
43
44
|
createVaultMemoryOp,
|
|
45
|
+
decomposeQuery,
|
|
44
46
|
decryptField,
|
|
45
47
|
decryptJsonField,
|
|
46
48
|
deleteAllVaultMemoriesForUserOp,
|
|
@@ -92,6 +94,7 @@ import {
|
|
|
92
94
|
prepareVaultCandidates,
|
|
93
95
|
rankPreparedVaultCandidates,
|
|
94
96
|
recall,
|
|
97
|
+
refreshEncryptionKeyIfMatches,
|
|
95
98
|
relinkMemoryTopicsOp,
|
|
96
99
|
replaceMemoryEntitiesGuardedOp,
|
|
97
100
|
requestEncryptionKey,
|
|
@@ -99,6 +102,7 @@ import {
|
|
|
99
102
|
restoreVaultMemoryOp,
|
|
100
103
|
searchChunksOp,
|
|
101
104
|
searchVaultMemories,
|
|
105
|
+
seedEncryptionKeys,
|
|
102
106
|
setMemoryVisibilityOp,
|
|
103
107
|
shouldChunkMessage,
|
|
104
108
|
stampTopicsExtractedAtOp,
|
|
@@ -116,7 +120,7 @@ import {
|
|
|
116
120
|
upsertMessageOp,
|
|
117
121
|
useEncryption,
|
|
118
122
|
vaultMemoryToStored
|
|
119
|
-
} from "./chunk-
|
|
123
|
+
} from "./chunk-SIMGZQ4P.mjs";
|
|
120
124
|
import {
|
|
121
125
|
PII_PATTERNS,
|
|
122
126
|
PiiRedactor,
|
|
@@ -7811,7 +7815,7 @@ function createRecallTool(ctx, toolOptions, callbacks) {
|
|
|
7811
7815
|
type: "function",
|
|
7812
7816
|
function: {
|
|
7813
7817
|
name: RECALL_TOOL_NAME,
|
|
7814
|
-
description:
|
|
7818
|
+
description: `Search the user's memory across stored facts/preferences and past conversation excerpts. Returns a unified ranked list \u2014 facts carry an \`id\` you can reference; conversation excerpts carry a date and role. Use this whenever the user's question may relate to anything previously discussed or saved (preferences, prior decisions, past topics). Phrase the query naturally. For multi-faceted / overview questions ("tell me about the user", "what's my tech stack"), prefer several targeted searches \u2014 one facet each (e.g. name, work, hobbies) \u2014 over a single broad query; fuse the results yourself.`,
|
|
7815
7819
|
arguments: {
|
|
7816
7820
|
type: "object",
|
|
7817
7821
|
properties: {
|
|
@@ -7866,6 +7870,13 @@ function createRecallTool(ctx, toolOptions, callbacks) {
|
|
|
7866
7870
|
let surfaced = 0;
|
|
7867
7871
|
try {
|
|
7868
7872
|
let recallDegraded = [];
|
|
7873
|
+
let subQueries;
|
|
7874
|
+
if (defaultBudget === "high" && toolOptions?.decomposeOptions) {
|
|
7875
|
+
const decomp = await decomposeQuery(query, toolOptions.decomposeOptions);
|
|
7876
|
+
if (decomp.mode === "composite" && decomp.subQueries.length >= 2) {
|
|
7877
|
+
subQueries = decomp.subQueries;
|
|
7878
|
+
}
|
|
7879
|
+
}
|
|
7869
7880
|
const recallOpts = {
|
|
7870
7881
|
onDiagnostics: (d) => {
|
|
7871
7882
|
recallDegraded = d.degraded;
|
|
@@ -7879,10 +7890,12 @@ function createRecallTool(ctx, toolOptions, callbacks) {
|
|
|
7879
7890
|
...toolOptions?.excludeConversationId && {
|
|
7880
7891
|
excludeConversationId: toolOptions.excludeConversationId
|
|
7881
7892
|
},
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7893
|
+
// Do NOT forward decomposeOptions into recall() — rewrite already
|
|
7894
|
+
// ran above, and forwarding would falsely trip `decompose-moved`
|
|
7895
|
+
// on every specific-mode high-budget call. graphRefine auth can
|
|
7896
|
+
// be threaded later when the tool opts into that path.
|
|
7897
|
+
...toolOptions?.now !== void 0 && { now: toolOptions.now },
|
|
7898
|
+
...subQueries && { subQueries }
|
|
7886
7899
|
};
|
|
7887
7900
|
const result = await recall(query, ctx, recallOpts);
|
|
7888
7901
|
if (callbacks?.onChunksRetrieved) {
|
|
@@ -14232,6 +14245,7 @@ export {
|
|
|
14232
14245
|
DEFAULT_VAULT_CACHE_SIZE,
|
|
14233
14246
|
DatabaseManager,
|
|
14234
14247
|
ENTITY_FANOUT,
|
|
14248
|
+
EncryptionKeyMissingError,
|
|
14235
14249
|
HARD_DELETE_WINDOW_MS,
|
|
14236
14250
|
INFERENCE_ID_HEADER,
|
|
14237
14251
|
LoggerProvider,
|
|
@@ -14358,6 +14372,7 @@ export {
|
|
|
14358
14372
|
rankProfileCandidates,
|
|
14359
14373
|
recall,
|
|
14360
14374
|
reflect,
|
|
14375
|
+
refreshEncryptionKeyIfMatches,
|
|
14361
14376
|
refreshNotionAccessToken,
|
|
14362
14377
|
registerNotionClient,
|
|
14363
14378
|
relinkMemoryTopicsOp,
|
|
@@ -14372,6 +14387,7 @@ export {
|
|
|
14372
14387
|
sdkModelClasses,
|
|
14373
14388
|
sdkSchema,
|
|
14374
14389
|
searchVaultMemories,
|
|
14390
|
+
seedEncryptionKeys,
|
|
14375
14391
|
setLogger,
|
|
14376
14392
|
setMemoryVisibilityOp,
|
|
14377
14393
|
shouldChunkMessage,
|
package/dist/index.cjs
CHANGED
|
@@ -2830,6 +2830,16 @@ function buildSystemPrompt(ctx, options) {
|
|
|
2830
2830
|
}
|
|
2831
2831
|
|
|
2832
2832
|
// src/react/useEncryption.ts
|
|
2833
|
+
var EncryptionKeyMissingError = class extends Error {
|
|
2834
|
+
constructor(address, version) {
|
|
2835
|
+
super(
|
|
2836
|
+
`Encryption key (${version}) not found for ${address}. Please sign a message to generate your encryption key.`
|
|
2837
|
+
);
|
|
2838
|
+
this.name = "EncryptionKeyMissingError";
|
|
2839
|
+
this.address = address;
|
|
2840
|
+
this.version = version;
|
|
2841
|
+
}
|
|
2842
|
+
};
|
|
2833
2843
|
var encryptionKeyStore = /* @__PURE__ */ new Map();
|
|
2834
2844
|
var cryptoKeyCache = /* @__PURE__ */ new Map();
|
|
2835
2845
|
var clearAllEncryptionStateCallbacks = /* @__PURE__ */ new Set();
|
|
@@ -2839,14 +2849,11 @@ function onClearAllEncryptionState(callback) {
|
|
|
2839
2849
|
clearAllEncryptionStateCallbacks.delete(callback);
|
|
2840
2850
|
};
|
|
2841
2851
|
}
|
|
2842
|
-
function getStoredKey(address) {
|
|
2843
|
-
const keys = encryptionKeyStore.get(address);
|
|
2844
|
-
return keys?.current ?? null;
|
|
2845
|
-
}
|
|
2846
2852
|
function getStoredKeyByVersion(address, version) {
|
|
2847
2853
|
const keys = encryptionKeyStore.get(address);
|
|
2848
2854
|
if (!keys) return null;
|
|
2849
|
-
|
|
2855
|
+
const value = version === "v2" ? keys.legacy : keys.current;
|
|
2856
|
+
return value ?? null;
|
|
2850
2857
|
}
|
|
2851
2858
|
function hexToBytes(hex) {
|
|
2852
2859
|
const cleanHex = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
@@ -2866,9 +2873,7 @@ async function getEncryptionKey(address, version = "v3") {
|
|
|
2866
2873
|
}
|
|
2867
2874
|
const keyHex = getStoredKeyByVersion(address, version);
|
|
2868
2875
|
if (!keyHex) {
|
|
2869
|
-
throw new
|
|
2870
|
-
"Encryption key not found. Please sign a message to generate your encryption key."
|
|
2871
|
-
);
|
|
2876
|
+
throw new EncryptionKeyMissingError(address, version);
|
|
2872
2877
|
}
|
|
2873
2878
|
const keyBytes = hexToBytes(keyHex);
|
|
2874
2879
|
const cryptoKey = await crypto.subtle.importKey(
|
|
@@ -2885,8 +2890,8 @@ async function decryptData(encryptedHex, address, version = "v3") {
|
|
|
2885
2890
|
const key = await getEncryptionKey(address, version);
|
|
2886
2891
|
return decryptDataWithKey(encryptedHex, key);
|
|
2887
2892
|
}
|
|
2888
|
-
function hasEncryptionKey(address) {
|
|
2889
|
-
return
|
|
2893
|
+
function hasEncryptionKey(address, version) {
|
|
2894
|
+
return getStoredKeyByVersion(address, version ?? "v3") !== null;
|
|
2890
2895
|
}
|
|
2891
2896
|
async function decryptDataWithKey(encryptedHex, key) {
|
|
2892
2897
|
const combined = hexToBytes(encryptedHex);
|
|
@@ -2919,20 +2924,29 @@ function detectEncryptionVersion(value) {
|
|
|
2919
2924
|
}
|
|
2920
2925
|
return null;
|
|
2921
2926
|
}
|
|
2922
|
-
async function
|
|
2923
|
-
if (!value) return value;
|
|
2927
|
+
async function decryptFieldDetailed(value, address) {
|
|
2928
|
+
if (!value) return { status: "plaintext", value };
|
|
2924
2929
|
const detected = detectEncryptionVersion(value);
|
|
2925
|
-
if (!detected) return value;
|
|
2930
|
+
if (!detected) return { status: "plaintext", value };
|
|
2926
2931
|
if (detected.encryptedData.length < 56 || !/^[0-9a-f]+$/i.test(detected.encryptedData)) {
|
|
2927
|
-
return value;
|
|
2932
|
+
return { status: "invalid_payload", value, version: detected.version };
|
|
2928
2933
|
}
|
|
2929
2934
|
try {
|
|
2930
|
-
|
|
2935
|
+
const plaintext = await decryptData(detected.encryptedData, address, detected.version);
|
|
2936
|
+
return { status: "ok", value: plaintext, version: detected.version };
|
|
2931
2937
|
} catch (error) {
|
|
2932
|
-
|
|
2933
|
-
|
|
2938
|
+
if (error instanceof EncryptionKeyMissingError) {
|
|
2939
|
+
getLogger().warn("Failed to decrypt field (key missing for version):", error.message);
|
|
2940
|
+
return { status: "key_missing", value, version: detected.version };
|
|
2941
|
+
}
|
|
2942
|
+
getLogger().warn("Failed to decrypt field (auth mismatch or crypto error):", error);
|
|
2943
|
+
return { status: "auth_mismatch", value, version: detected.version };
|
|
2934
2944
|
}
|
|
2935
2945
|
}
|
|
2946
|
+
async function decryptField(value, address) {
|
|
2947
|
+
const result = await decryptFieldDetailed(value, address);
|
|
2948
|
+
return result.value;
|
|
2949
|
+
}
|
|
2936
2950
|
|
|
2937
2951
|
// src/lib/chat/useChat/strategies/types.ts
|
|
2938
2952
|
function isChatCompletionResponse(r) {
|
package/dist/index.mjs
CHANGED
|
@@ -2634,6 +2634,16 @@ function buildSystemPrompt(ctx, options) {
|
|
|
2634
2634
|
}
|
|
2635
2635
|
|
|
2636
2636
|
// src/react/useEncryption.ts
|
|
2637
|
+
var EncryptionKeyMissingError = class extends Error {
|
|
2638
|
+
constructor(address, version) {
|
|
2639
|
+
super(
|
|
2640
|
+
`Encryption key (${version}) not found for ${address}. Please sign a message to generate your encryption key.`
|
|
2641
|
+
);
|
|
2642
|
+
this.name = "EncryptionKeyMissingError";
|
|
2643
|
+
this.address = address;
|
|
2644
|
+
this.version = version;
|
|
2645
|
+
}
|
|
2646
|
+
};
|
|
2637
2647
|
var encryptionKeyStore = /* @__PURE__ */ new Map();
|
|
2638
2648
|
var cryptoKeyCache = /* @__PURE__ */ new Map();
|
|
2639
2649
|
var clearAllEncryptionStateCallbacks = /* @__PURE__ */ new Set();
|
|
@@ -2643,14 +2653,11 @@ function onClearAllEncryptionState(callback) {
|
|
|
2643
2653
|
clearAllEncryptionStateCallbacks.delete(callback);
|
|
2644
2654
|
};
|
|
2645
2655
|
}
|
|
2646
|
-
function getStoredKey(address) {
|
|
2647
|
-
const keys = encryptionKeyStore.get(address);
|
|
2648
|
-
return keys?.current ?? null;
|
|
2649
|
-
}
|
|
2650
2656
|
function getStoredKeyByVersion(address, version) {
|
|
2651
2657
|
const keys = encryptionKeyStore.get(address);
|
|
2652
2658
|
if (!keys) return null;
|
|
2653
|
-
|
|
2659
|
+
const value = version === "v2" ? keys.legacy : keys.current;
|
|
2660
|
+
return value ?? null;
|
|
2654
2661
|
}
|
|
2655
2662
|
function hexToBytes(hex) {
|
|
2656
2663
|
const cleanHex = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
@@ -2670,9 +2677,7 @@ async function getEncryptionKey(address, version = "v3") {
|
|
|
2670
2677
|
}
|
|
2671
2678
|
const keyHex = getStoredKeyByVersion(address, version);
|
|
2672
2679
|
if (!keyHex) {
|
|
2673
|
-
throw new
|
|
2674
|
-
"Encryption key not found. Please sign a message to generate your encryption key."
|
|
2675
|
-
);
|
|
2680
|
+
throw new EncryptionKeyMissingError(address, version);
|
|
2676
2681
|
}
|
|
2677
2682
|
const keyBytes = hexToBytes(keyHex);
|
|
2678
2683
|
const cryptoKey = await crypto.subtle.importKey(
|
|
@@ -2689,8 +2694,8 @@ async function decryptData(encryptedHex, address, version = "v3") {
|
|
|
2689
2694
|
const key = await getEncryptionKey(address, version);
|
|
2690
2695
|
return decryptDataWithKey(encryptedHex, key);
|
|
2691
2696
|
}
|
|
2692
|
-
function hasEncryptionKey(address) {
|
|
2693
|
-
return
|
|
2697
|
+
function hasEncryptionKey(address, version) {
|
|
2698
|
+
return getStoredKeyByVersion(address, version ?? "v3") !== null;
|
|
2694
2699
|
}
|
|
2695
2700
|
async function decryptDataWithKey(encryptedHex, key) {
|
|
2696
2701
|
const combined = hexToBytes(encryptedHex);
|
|
@@ -2723,20 +2728,29 @@ function detectEncryptionVersion(value) {
|
|
|
2723
2728
|
}
|
|
2724
2729
|
return null;
|
|
2725
2730
|
}
|
|
2726
|
-
async function
|
|
2727
|
-
if (!value) return value;
|
|
2731
|
+
async function decryptFieldDetailed(value, address) {
|
|
2732
|
+
if (!value) return { status: "plaintext", value };
|
|
2728
2733
|
const detected = detectEncryptionVersion(value);
|
|
2729
|
-
if (!detected) return value;
|
|
2734
|
+
if (!detected) return { status: "plaintext", value };
|
|
2730
2735
|
if (detected.encryptedData.length < 56 || !/^[0-9a-f]+$/i.test(detected.encryptedData)) {
|
|
2731
|
-
return value;
|
|
2736
|
+
return { status: "invalid_payload", value, version: detected.version };
|
|
2732
2737
|
}
|
|
2733
2738
|
try {
|
|
2734
|
-
|
|
2739
|
+
const plaintext = await decryptData(detected.encryptedData, address, detected.version);
|
|
2740
|
+
return { status: "ok", value: plaintext, version: detected.version };
|
|
2735
2741
|
} catch (error) {
|
|
2736
|
-
|
|
2737
|
-
|
|
2742
|
+
if (error instanceof EncryptionKeyMissingError) {
|
|
2743
|
+
getLogger().warn("Failed to decrypt field (key missing for version):", error.message);
|
|
2744
|
+
return { status: "key_missing", value, version: detected.version };
|
|
2745
|
+
}
|
|
2746
|
+
getLogger().warn("Failed to decrypt field (auth mismatch or crypto error):", error);
|
|
2747
|
+
return { status: "auth_mismatch", value, version: detected.version };
|
|
2738
2748
|
}
|
|
2739
2749
|
}
|
|
2750
|
+
async function decryptField(value, address) {
|
|
2751
|
+
const result = await decryptFieldDetailed(value, address);
|
|
2752
|
+
return result.value;
|
|
2753
|
+
}
|
|
2740
2754
|
|
|
2741
2755
|
// src/lib/chat/useChat/strategies/types.ts
|
|
2742
2756
|
function isChatCompletionResponse(r) {
|