@anuma/sdk 6.33.2 → 6.35.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/index.cjs +1304 -300
- package/dist/expo/index.d.mts +278 -11
- package/dist/expo/index.d.ts +278 -11
- package/dist/expo/index.mjs +1297 -300
- package/dist/index.cjs +18 -6
- package/dist/index.mjs +18 -6
- package/dist/memory/context.d.mts +21 -1
- package/dist/memory/context.d.ts +21 -1
- package/dist/react/index.cjs +1385 -381
- package/dist/react/index.d.mts +311 -11
- package/dist/react/index.d.ts +311 -11
- package/dist/react/index.mjs +1378 -381
- package/dist/server/index.cjs +319 -99
- package/dist/server/index.d.mts +138 -11
- package/dist/server/index.d.ts +138 -11
- package/dist/server/index.mjs +316 -99
- package/dist/telemetry/index.d.mts +3 -4
- package/dist/telemetry/index.d.ts +3 -4
- package/dist/tools/selection/index.cjs +18 -6
- package/dist/tools/selection/index.mjs +18 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2161,7 +2161,7 @@ async function embedOne(text, options, outer) {
|
|
|
2161
2161
|
}
|
|
2162
2162
|
var DEFAULT_EMBEDDING_BATCH_SIZE = 100;
|
|
2163
2163
|
var DEFAULT_EMBEDDING_BATCH_CONCURRENCY = 3;
|
|
2164
|
-
async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage, maskInput, timeoutMs) {
|
|
2164
|
+
async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage, maskInput, timeoutMs, outer) {
|
|
2165
2165
|
const response = await withEmbeddingRetry(
|
|
2166
2166
|
() => withDeadline(
|
|
2167
2167
|
(signal) => postApiV1Embeddings({
|
|
@@ -2171,8 +2171,10 @@ async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage,
|
|
|
2171
2171
|
...signal && { signal }
|
|
2172
2172
|
}),
|
|
2173
2173
|
timeoutMs,
|
|
2174
|
-
"embedding batch request"
|
|
2175
|
-
|
|
2174
|
+
"embedding batch request",
|
|
2175
|
+
outer
|
|
2176
|
+
),
|
|
2177
|
+
outer
|
|
2176
2178
|
);
|
|
2177
2179
|
if (response.error) {
|
|
2178
2180
|
throw embeddingErrorFrom(response);
|
|
@@ -2190,6 +2192,11 @@ async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage,
|
|
|
2190
2192
|
}
|
|
2191
2193
|
async function generateEmbeddings(texts, options) {
|
|
2192
2194
|
if (texts.length === 0) return [];
|
|
2195
|
+
const total = options.totalTimeoutMs;
|
|
2196
|
+
if (total === void 0) return embedMany(texts, options, void 0);
|
|
2197
|
+
return withDeadline((signal) => embedMany(texts, options, signal), total, "embedding batch");
|
|
2198
|
+
}
|
|
2199
|
+
async function embedMany(texts, options, outer) {
|
|
2193
2200
|
const { baseUrl = BASE_URL, model, batchSize, cache } = options;
|
|
2194
2201
|
const timeoutMs = options.timeoutMs ?? DEFAULT_EMBEDDING_REQUEST_TIMEOUT_MS;
|
|
2195
2202
|
const chunkSize = batchSize ?? DEFAULT_EMBEDDING_BATCH_SIZE;
|
|
@@ -2210,7 +2217,8 @@ async function generateEmbeddings(texts, options) {
|
|
|
2210
2217
|
if (uncachedTexts.length === 0) {
|
|
2211
2218
|
return results;
|
|
2212
2219
|
}
|
|
2213
|
-
const headers = await resolveAuthHeaders(options);
|
|
2220
|
+
const headers = await resolveAuthHeaders(options, outer);
|
|
2221
|
+
if (outer?.aborted) throw outer.reason;
|
|
2214
2222
|
const embeddingModel = model ?? DEFAULT_API_EMBEDDING_MODEL;
|
|
2215
2223
|
let newEmbeddings;
|
|
2216
2224
|
if (uncachedTexts.length <= chunkSize) {
|
|
@@ -2221,7 +2229,8 @@ async function generateEmbeddings(texts, options) {
|
|
|
2221
2229
|
embeddingModel,
|
|
2222
2230
|
options.onUsage,
|
|
2223
2231
|
options.maskInput,
|
|
2224
|
-
timeoutMs
|
|
2232
|
+
timeoutMs,
|
|
2233
|
+
outer
|
|
2225
2234
|
);
|
|
2226
2235
|
} else {
|
|
2227
2236
|
const chunks = [];
|
|
@@ -2232,6 +2241,7 @@ async function generateEmbeddings(texts, options) {
|
|
|
2232
2241
|
let nextIndex = 0;
|
|
2233
2242
|
const worker = async () => {
|
|
2234
2243
|
while (nextIndex < chunks.length) {
|
|
2244
|
+
if (outer?.aborted) throw outer.reason;
|
|
2235
2245
|
const idx = nextIndex++;
|
|
2236
2246
|
allEmbeddings[idx] = await generateEmbeddingsBatch(
|
|
2237
2247
|
chunks[idx],
|
|
@@ -2240,7 +2250,8 @@ async function generateEmbeddings(texts, options) {
|
|
|
2240
2250
|
embeddingModel,
|
|
2241
2251
|
options.onUsage,
|
|
2242
2252
|
options.maskInput,
|
|
2243
|
-
timeoutMs
|
|
2253
|
+
timeoutMs,
|
|
2254
|
+
outer
|
|
2244
2255
|
);
|
|
2245
2256
|
}
|
|
2246
2257
|
};
|
|
@@ -2251,6 +2262,7 @@ async function generateEmbeddings(texts, options) {
|
|
|
2251
2262
|
await Promise.all(workers);
|
|
2252
2263
|
newEmbeddings = allEmbeddings.flat();
|
|
2253
2264
|
}
|
|
2265
|
+
if (outer?.aborted) throw outer.reason;
|
|
2254
2266
|
for (let i = 0; i < uncachedIndices.length; i++) {
|
|
2255
2267
|
const f32Embedding = Float32Array.from(newEmbeddings[i]);
|
|
2256
2268
|
results[uncachedIndices[i]] = Array.from(f32Embedding);
|
package/dist/index.mjs
CHANGED
|
@@ -1957,7 +1957,7 @@ async function embedOne(text, options, outer) {
|
|
|
1957
1957
|
}
|
|
1958
1958
|
var DEFAULT_EMBEDDING_BATCH_SIZE = 100;
|
|
1959
1959
|
var DEFAULT_EMBEDDING_BATCH_CONCURRENCY = 3;
|
|
1960
|
-
async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage, maskInput, timeoutMs) {
|
|
1960
|
+
async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage, maskInput, timeoutMs, outer) {
|
|
1961
1961
|
const response = await withEmbeddingRetry(
|
|
1962
1962
|
() => withDeadline(
|
|
1963
1963
|
(signal) => postApiV1Embeddings({
|
|
@@ -1967,8 +1967,10 @@ async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage,
|
|
|
1967
1967
|
...signal && { signal }
|
|
1968
1968
|
}),
|
|
1969
1969
|
timeoutMs,
|
|
1970
|
-
"embedding batch request"
|
|
1971
|
-
|
|
1970
|
+
"embedding batch request",
|
|
1971
|
+
outer
|
|
1972
|
+
),
|
|
1973
|
+
outer
|
|
1972
1974
|
);
|
|
1973
1975
|
if (response.error) {
|
|
1974
1976
|
throw embeddingErrorFrom(response);
|
|
@@ -1986,6 +1988,11 @@ async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage,
|
|
|
1986
1988
|
}
|
|
1987
1989
|
async function generateEmbeddings(texts, options) {
|
|
1988
1990
|
if (texts.length === 0) return [];
|
|
1991
|
+
const total = options.totalTimeoutMs;
|
|
1992
|
+
if (total === void 0) return embedMany(texts, options, void 0);
|
|
1993
|
+
return withDeadline((signal) => embedMany(texts, options, signal), total, "embedding batch");
|
|
1994
|
+
}
|
|
1995
|
+
async function embedMany(texts, options, outer) {
|
|
1989
1996
|
const { baseUrl = BASE_URL, model, batchSize, cache } = options;
|
|
1990
1997
|
const timeoutMs = options.timeoutMs ?? DEFAULT_EMBEDDING_REQUEST_TIMEOUT_MS;
|
|
1991
1998
|
const chunkSize = batchSize ?? DEFAULT_EMBEDDING_BATCH_SIZE;
|
|
@@ -2006,7 +2013,8 @@ async function generateEmbeddings(texts, options) {
|
|
|
2006
2013
|
if (uncachedTexts.length === 0) {
|
|
2007
2014
|
return results;
|
|
2008
2015
|
}
|
|
2009
|
-
const headers = await resolveAuthHeaders(options);
|
|
2016
|
+
const headers = await resolveAuthHeaders(options, outer);
|
|
2017
|
+
if (outer?.aborted) throw outer.reason;
|
|
2010
2018
|
const embeddingModel = model ?? DEFAULT_API_EMBEDDING_MODEL;
|
|
2011
2019
|
let newEmbeddings;
|
|
2012
2020
|
if (uncachedTexts.length <= chunkSize) {
|
|
@@ -2017,7 +2025,8 @@ async function generateEmbeddings(texts, options) {
|
|
|
2017
2025
|
embeddingModel,
|
|
2018
2026
|
options.onUsage,
|
|
2019
2027
|
options.maskInput,
|
|
2020
|
-
timeoutMs
|
|
2028
|
+
timeoutMs,
|
|
2029
|
+
outer
|
|
2021
2030
|
);
|
|
2022
2031
|
} else {
|
|
2023
2032
|
const chunks = [];
|
|
@@ -2028,6 +2037,7 @@ async function generateEmbeddings(texts, options) {
|
|
|
2028
2037
|
let nextIndex = 0;
|
|
2029
2038
|
const worker = async () => {
|
|
2030
2039
|
while (nextIndex < chunks.length) {
|
|
2040
|
+
if (outer?.aborted) throw outer.reason;
|
|
2031
2041
|
const idx = nextIndex++;
|
|
2032
2042
|
allEmbeddings[idx] = await generateEmbeddingsBatch(
|
|
2033
2043
|
chunks[idx],
|
|
@@ -2036,7 +2046,8 @@ async function generateEmbeddings(texts, options) {
|
|
|
2036
2046
|
embeddingModel,
|
|
2037
2047
|
options.onUsage,
|
|
2038
2048
|
options.maskInput,
|
|
2039
|
-
timeoutMs
|
|
2049
|
+
timeoutMs,
|
|
2050
|
+
outer
|
|
2040
2051
|
);
|
|
2041
2052
|
}
|
|
2042
2053
|
};
|
|
@@ -2047,6 +2058,7 @@ async function generateEmbeddings(texts, options) {
|
|
|
2047
2058
|
await Promise.all(workers);
|
|
2048
2059
|
newEmbeddings = allEmbeddings.flat();
|
|
2049
2060
|
}
|
|
2061
|
+
if (outer?.aborted) throw outer.reason;
|
|
2050
2062
|
for (let i = 0; i < uncachedIndices.length; i++) {
|
|
2051
2063
|
const f32Embedding = Float32Array.from(newEmbeddings[i]);
|
|
2052
2064
|
results[uncachedIndices[i]] = Array.from(f32Embedding);
|
|
@@ -28,6 +28,12 @@ declare class VaultMemory extends Model {
|
|
|
28
28
|
static table: string;
|
|
29
29
|
content: string;
|
|
30
30
|
scope: string;
|
|
31
|
+
/** Profile kind, or null for a free-form memory. */
|
|
32
|
+
kind: string | null;
|
|
33
|
+
/** Canonical JSON value of a kinded memory, encrypted at rest. */
|
|
34
|
+
kindValue: string | null;
|
|
35
|
+
/** private | matching | profile. */
|
|
36
|
+
level: string | null;
|
|
31
37
|
folderId: string | null;
|
|
32
38
|
userId: string | null;
|
|
33
39
|
embedding: string | null;
|
|
@@ -674,13 +680,23 @@ type FactType = (typeof FACT_TYPES)[number];
|
|
|
674
680
|
* the fail-safe direction: it un-publishes rather than exposes.
|
|
675
681
|
*/
|
|
676
682
|
type VaultMemoryVisibility = "private" | "public";
|
|
683
|
+
/** Who a memory reaches. */
|
|
684
|
+
declare const MEMORY_LEVELS: readonly ["private", "matching", "profile"];
|
|
685
|
+
/** One of {@link MEMORY_LEVELS}. */
|
|
686
|
+
type MemoryLevel = (typeof MEMORY_LEVELS)[number];
|
|
677
687
|
interface StoredVaultMemory {
|
|
678
688
|
/** WatermelonDB internal ID */
|
|
679
689
|
uniqueId: string;
|
|
680
690
|
/** Plain text memory content */
|
|
681
691
|
content: string;
|
|
682
|
-
/** Scope for partitioning memories (e.g., "private", "shared") */
|
|
692
|
+
/** Scope for partitioning memories (e.g., "private", "shared"). */
|
|
683
693
|
scope: string;
|
|
694
|
+
/** Profile kind ({@link MEMORY_KINDS}) or null for a free-form memory. */
|
|
695
|
+
kind?: string | null;
|
|
696
|
+
/** Canonical value of a kinded memory, JSON-encoded (slug, slug[], int, date, text). */
|
|
697
|
+
kindValue?: string | null;
|
|
698
|
+
/** Who this memory reaches. */
|
|
699
|
+
level?: MemoryLevel;
|
|
684
700
|
/** Folder ID for organization, null if unfiled */
|
|
685
701
|
folderId: string | null;
|
|
686
702
|
/** User ID for multi-user server-side scoping, null on client */
|
|
@@ -837,6 +853,10 @@ declare function getAllVaultMemoriesOp(ctx: VaultMemoryOperationsContext, option
|
|
|
837
853
|
* published set to diff against the server index.
|
|
838
854
|
*/
|
|
839
855
|
visibility?: VaultMemoryVisibility[];
|
|
856
|
+
/** Filter by level. */
|
|
857
|
+
levels?: MemoryLevel[];
|
|
858
|
+
/** Restrict to these profile kinds. */
|
|
859
|
+
kinds?: string[];
|
|
840
860
|
}): Promise<StoredVaultMemory[]>;
|
|
841
861
|
|
|
842
862
|
type MemoryContextLane = "profile" | "fact" | "episode" | "session";
|
package/dist/memory/context.d.ts
CHANGED
|
@@ -28,6 +28,12 @@ declare class VaultMemory extends Model {
|
|
|
28
28
|
static table: string;
|
|
29
29
|
content: string;
|
|
30
30
|
scope: string;
|
|
31
|
+
/** Profile kind, or null for a free-form memory. */
|
|
32
|
+
kind: string | null;
|
|
33
|
+
/** Canonical JSON value of a kinded memory, encrypted at rest. */
|
|
34
|
+
kindValue: string | null;
|
|
35
|
+
/** private | matching | profile. */
|
|
36
|
+
level: string | null;
|
|
31
37
|
folderId: string | null;
|
|
32
38
|
userId: string | null;
|
|
33
39
|
embedding: string | null;
|
|
@@ -674,13 +680,23 @@ type FactType = (typeof FACT_TYPES)[number];
|
|
|
674
680
|
* the fail-safe direction: it un-publishes rather than exposes.
|
|
675
681
|
*/
|
|
676
682
|
type VaultMemoryVisibility = "private" | "public";
|
|
683
|
+
/** Who a memory reaches. */
|
|
684
|
+
declare const MEMORY_LEVELS: readonly ["private", "matching", "profile"];
|
|
685
|
+
/** One of {@link MEMORY_LEVELS}. */
|
|
686
|
+
type MemoryLevel = (typeof MEMORY_LEVELS)[number];
|
|
677
687
|
interface StoredVaultMemory {
|
|
678
688
|
/** WatermelonDB internal ID */
|
|
679
689
|
uniqueId: string;
|
|
680
690
|
/** Plain text memory content */
|
|
681
691
|
content: string;
|
|
682
|
-
/** Scope for partitioning memories (e.g., "private", "shared") */
|
|
692
|
+
/** Scope for partitioning memories (e.g., "private", "shared"). */
|
|
683
693
|
scope: string;
|
|
694
|
+
/** Profile kind ({@link MEMORY_KINDS}) or null for a free-form memory. */
|
|
695
|
+
kind?: string | null;
|
|
696
|
+
/** Canonical value of a kinded memory, JSON-encoded (slug, slug[], int, date, text). */
|
|
697
|
+
kindValue?: string | null;
|
|
698
|
+
/** Who this memory reaches. */
|
|
699
|
+
level?: MemoryLevel;
|
|
684
700
|
/** Folder ID for organization, null if unfiled */
|
|
685
701
|
folderId: string | null;
|
|
686
702
|
/** User ID for multi-user server-side scoping, null on client */
|
|
@@ -837,6 +853,10 @@ declare function getAllVaultMemoriesOp(ctx: VaultMemoryOperationsContext, option
|
|
|
837
853
|
* published set to diff against the server index.
|
|
838
854
|
*/
|
|
839
855
|
visibility?: VaultMemoryVisibility[];
|
|
856
|
+
/** Filter by level. */
|
|
857
|
+
levels?: MemoryLevel[];
|
|
858
|
+
/** Restrict to these profile kinds. */
|
|
859
|
+
kinds?: string[];
|
|
840
860
|
}): Promise<StoredVaultMemory[]>;
|
|
841
861
|
|
|
842
862
|
type MemoryContextLane = "profile" | "fact" | "episode" | "session";
|