@anuma/sdk 2.6.1 → 3.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-TCRDSUC6.mjs → chunk-IY7NNIYM.mjs} +149 -42
- package/dist/expo/index.cjs +184 -43
- package/dist/expo/index.d.mts +53 -2
- package/dist/expo/index.d.ts +53 -2
- package/dist/expo/index.mjs +38 -3
- package/dist/expo/{recall-FQU3NUTL.mjs → recall-DJ5LD5WJ.mjs} +1 -1
- package/dist/index.cjs +8 -6
- package/dist/index.mjs +8 -6
- package/dist/react/{chunk-ZXS3KOY4.mjs → chunk-OSDVRDLI.mjs} +151 -44
- package/dist/react/index.cjs +210 -55
- package/dist/react/index.d.mts +53 -2
- package/dist/react/index.d.ts +53 -2
- package/dist/react/index.mjs +62 -13
- package/dist/react/{recall-PV7L3SN3.mjs → recall-3BDCIEQF.mjs} +1 -1
- package/dist/server/{chunk-Z6II54I7.mjs → chunk-QQOIC37O.mjs} +157 -26
- package/dist/server/index.cjs +202 -31
- package/dist/server/index.d.mts +92 -29
- package/dist/server/index.d.ts +92 -29
- package/dist/server/index.mjs +50 -7
- package/dist/server/{recall-CQT24XLH.mjs → recall-6QLUEYB7.mjs} +1 -1
- package/package.json +1 -1
package/dist/expo/index.cjs
CHANGED
|
@@ -2101,6 +2101,67 @@ async function messageToStored(message, walletAddress, signMessage, embeddedWall
|
|
|
2101
2101
|
}
|
|
2102
2102
|
return baseMessage;
|
|
2103
2103
|
}
|
|
2104
|
+
function rawDate(value) {
|
|
2105
|
+
return new Date(typeof value === "number" ? value : 0);
|
|
2106
|
+
}
|
|
2107
|
+
function messageRawToStoredRaw(raw, projection) {
|
|
2108
|
+
const parseJsonField = (rawValue) => {
|
|
2109
|
+
if (!rawValue) return void 0;
|
|
2110
|
+
if (typeof rawValue === "string") {
|
|
2111
|
+
if (rawValue.startsWith("enc:")) return rawValue;
|
|
2112
|
+
try {
|
|
2113
|
+
return JSON.parse(rawValue);
|
|
2114
|
+
} catch {
|
|
2115
|
+
return void 0;
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
return rawValue;
|
|
2119
|
+
};
|
|
2120
|
+
const skipEmbeddings = projection?.skipEmbeddings === true;
|
|
2121
|
+
const vectorRaw = skipEmbeddings ? null : raw.vector;
|
|
2122
|
+
const chunksRaw = skipEmbeddings ? null : raw.chunks;
|
|
2123
|
+
return {
|
|
2124
|
+
uniqueId: raw.id,
|
|
2125
|
+
messageId: raw.message_id,
|
|
2126
|
+
conversationId: raw.conversation_id ?? "",
|
|
2127
|
+
role: raw.role ?? "",
|
|
2128
|
+
content: raw.content ?? "",
|
|
2129
|
+
model: raw.model,
|
|
2130
|
+
imageModel: raw.image_model,
|
|
2131
|
+
files: parseJsonField(raw.files),
|
|
2132
|
+
fileIds: parseJsonField(raw.file_ids),
|
|
2133
|
+
createdAt: rawDate(raw.created_at),
|
|
2134
|
+
updatedAt: rawDate(raw.updated_at),
|
|
2135
|
+
vector: skipEmbeddings ? void 0 : parseJsonField(vectorRaw),
|
|
2136
|
+
embeddingModel: raw.embedding_model,
|
|
2137
|
+
chunks: skipEmbeddings ? void 0 : parseJsonField(chunksRaw),
|
|
2138
|
+
usage: parseJsonField(raw.usage),
|
|
2139
|
+
sources: parseJsonField(raw.sources),
|
|
2140
|
+
responseDuration: raw.response_duration,
|
|
2141
|
+
// `was_stopped` is an OPTIONAL boolean: an unset row sanitizes to null, and the Model path
|
|
2142
|
+
// (message.wasStopped) returns that null verbatim. Preserve it (don't collapse to false) so the
|
|
2143
|
+
// raw path is byte-identical. When set, coerce SQLite 0/1 and LokiJS true/false alike.
|
|
2144
|
+
wasStopped: raw.was_stopped === null || raw.was_stopped === void 0 ? raw.was_stopped : raw.was_stopped === true || raw.was_stopped === 1,
|
|
2145
|
+
error: raw.error,
|
|
2146
|
+
thoughtProcess: parseJsonField(raw.thought_process),
|
|
2147
|
+
thinking: raw.thinking,
|
|
2148
|
+
parentMessageId: raw.parent_message_id,
|
|
2149
|
+
feedback: raw.feedback || null,
|
|
2150
|
+
toolCallEvents: parseJsonField(raw.tool_call_events)
|
|
2151
|
+
};
|
|
2152
|
+
}
|
|
2153
|
+
async function messageRawToStored(raw, walletAddress, signMessage, embeddedWalletSigner, projection) {
|
|
2154
|
+
const baseMessage = messageRawToStoredRaw(raw, projection);
|
|
2155
|
+
if (walletAddress) {
|
|
2156
|
+
return await decryptMessageFields(
|
|
2157
|
+
baseMessage,
|
|
2158
|
+
walletAddress,
|
|
2159
|
+
signMessage,
|
|
2160
|
+
embeddedWalletSigner
|
|
2161
|
+
);
|
|
2162
|
+
}
|
|
2163
|
+
return baseMessage;
|
|
2164
|
+
}
|
|
2104
2165
|
function conversationToStoredRaw(conversation) {
|
|
2105
2166
|
return {
|
|
2106
2167
|
uniqueId: conversation.id,
|
|
@@ -2125,6 +2186,33 @@ async function conversationToStored(conversation, walletAddress, signMessage, em
|
|
|
2125
2186
|
}
|
|
2126
2187
|
return baseConversation;
|
|
2127
2188
|
}
|
|
2189
|
+
function conversationRawToStoredRaw(raw) {
|
|
2190
|
+
const pinnedAt = raw.pinned_at;
|
|
2191
|
+
return {
|
|
2192
|
+
uniqueId: raw.id,
|
|
2193
|
+
conversationId: raw.conversation_id ?? "",
|
|
2194
|
+
title: raw.title ?? "",
|
|
2195
|
+
projectId: raw.project_id,
|
|
2196
|
+
createdAt: rawDate(raw.created_at),
|
|
2197
|
+
updatedAt: rawDate(raw.updated_at),
|
|
2198
|
+
// SQLite stores booleans as 0/1, LokiJS as true/false — coerce both.
|
|
2199
|
+
isDeleted: raw.is_deleted === true || raw.is_deleted === 1,
|
|
2200
|
+
// @date maps a non-number raw column (incl. an explicit unpin null) to null; a number → Date.
|
|
2201
|
+
pinnedAt: typeof pinnedAt === "number" ? new Date(pinnedAt) : null
|
|
2202
|
+
};
|
|
2203
|
+
}
|
|
2204
|
+
async function conversationRawToStored(raw, walletAddress, signMessage, embeddedWalletSigner) {
|
|
2205
|
+
const baseConversation = conversationRawToStoredRaw(raw);
|
|
2206
|
+
if (walletAddress) {
|
|
2207
|
+
return await decryptConversationFields(
|
|
2208
|
+
baseConversation,
|
|
2209
|
+
walletAddress,
|
|
2210
|
+
signMessage,
|
|
2211
|
+
embeddedWalletSigner
|
|
2212
|
+
);
|
|
2213
|
+
}
|
|
2214
|
+
return baseConversation;
|
|
2215
|
+
}
|
|
2128
2216
|
async function createConversationOp(ctx, opts, defaultTitle = "New Conversation") {
|
|
2129
2217
|
const convId = opts?.conversationId || generateConversationId();
|
|
2130
2218
|
const title = opts?.title || defaultTitle;
|
|
@@ -2164,36 +2252,51 @@ async function getConversationOp(ctx, id) {
|
|
|
2164
2252
|
) : null;
|
|
2165
2253
|
}
|
|
2166
2254
|
async function getConversationsOp(ctx) {
|
|
2167
|
-
const results = await ctx.conversationsCollection.query(import_watermelondb.Q.where("is_deleted", false), import_watermelondb.Q.sortBy("created_at", import_watermelondb.Q.desc)).
|
|
2255
|
+
const results = await ctx.conversationsCollection.query(import_watermelondb.Q.where("is_deleted", false), import_watermelondb.Q.sortBy("created_at", import_watermelondb.Q.desc)).unsafeFetchRaw();
|
|
2168
2256
|
return Promise.all(
|
|
2169
2257
|
results.map(
|
|
2170
|
-
(
|
|
2258
|
+
(raw) => conversationRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
|
|
2171
2259
|
)
|
|
2172
2260
|
);
|
|
2173
2261
|
}
|
|
2174
|
-
function
|
|
2262
|
+
function conversationRawToLazyStored(raw) {
|
|
2263
|
+
const pinnedAt = raw.pinned_at;
|
|
2175
2264
|
return {
|
|
2176
|
-
uniqueId:
|
|
2177
|
-
conversationId:
|
|
2178
|
-
encryptedTitle:
|
|
2179
|
-
projectId:
|
|
2180
|
-
createdAt:
|
|
2181
|
-
updatedAt:
|
|
2182
|
-
isDeleted:
|
|
2183
|
-
pinnedAt:
|
|
2265
|
+
uniqueId: raw.id,
|
|
2266
|
+
conversationId: raw.conversation_id ?? "",
|
|
2267
|
+
encryptedTitle: raw.title ?? "",
|
|
2268
|
+
projectId: raw.project_id,
|
|
2269
|
+
createdAt: rawDate(raw.created_at),
|
|
2270
|
+
updatedAt: rawDate(raw.updated_at),
|
|
2271
|
+
isDeleted: raw.is_deleted === true || raw.is_deleted === 1,
|
|
2272
|
+
pinnedAt: typeof pinnedAt === "number" ? new Date(pinnedAt) : null
|
|
2184
2273
|
};
|
|
2185
2274
|
}
|
|
2186
2275
|
async function getConversationsLazyOp(ctx) {
|
|
2187
|
-
const results = await ctx.conversationsCollection.query(import_watermelondb.Q.where("is_deleted", false), import_watermelondb.Q.sortBy("created_at", import_watermelondb.Q.desc)).
|
|
2188
|
-
return results.map(
|
|
2276
|
+
const results = await ctx.conversationsCollection.query(import_watermelondb.Q.where("is_deleted", false), import_watermelondb.Q.sortBy("created_at", import_watermelondb.Q.desc)).unsafeFetchRaw();
|
|
2277
|
+
return results.map(conversationRawToLazyStored);
|
|
2278
|
+
}
|
|
2279
|
+
async function getConversationsPageOp(ctx, options) {
|
|
2280
|
+
const limit = Math.floor(options?.limit ?? 200);
|
|
2281
|
+
if (!Number.isFinite(limit) || limit < 1) return [];
|
|
2282
|
+
const exclude = new Set(options?.boundaryExcludeUniqueIds ?? []);
|
|
2283
|
+
const clauses = [import_watermelondb.Q.where("is_deleted", false)];
|
|
2284
|
+
if (options?.before !== void 0) {
|
|
2285
|
+
clauses.push(
|
|
2286
|
+
exclude.size > 0 ? import_watermelondb.Q.where("created_at", import_watermelondb.Q.lte(options.before)) : import_watermelondb.Q.where("created_at", import_watermelondb.Q.lt(options.before))
|
|
2287
|
+
);
|
|
2288
|
+
}
|
|
2289
|
+
const fetched = await ctx.conversationsCollection.query(...clauses, import_watermelondb.Q.sortBy("created_at", import_watermelondb.Q.desc), import_watermelondb.Q.take(limit + exclude.size)).unsafeFetchRaw();
|
|
2290
|
+
const results = exclude.size > 0 ? fetched.filter((raw) => !exclude.has(raw.id)) : fetched;
|
|
2291
|
+
return results.slice(0, limit).map(conversationRawToLazyStored);
|
|
2189
2292
|
}
|
|
2190
2293
|
async function getConversationsByProjectLazyOp(ctx, projectId) {
|
|
2191
2294
|
const results = await ctx.conversationsCollection.query(
|
|
2192
2295
|
import_watermelondb.Q.where("project_id", projectId === null ? "" : projectId),
|
|
2193
2296
|
import_watermelondb.Q.where("is_deleted", false),
|
|
2194
2297
|
import_watermelondb.Q.sortBy("created_at", import_watermelondb.Q.desc)
|
|
2195
|
-
).
|
|
2196
|
-
return results.map(
|
|
2298
|
+
).unsafeFetchRaw();
|
|
2299
|
+
return results.map(conversationRawToLazyStored);
|
|
2197
2300
|
}
|
|
2198
2301
|
async function updateConversationTitleOp(ctx, id, title) {
|
|
2199
2302
|
const results = await ctx.conversationsCollection.query(import_watermelondb.Q.where("conversation_id", id), import_watermelondb.Q.where("is_deleted", false)).fetch();
|
|
@@ -2239,10 +2342,10 @@ async function updateConversationPinnedOp(ctx, id, pinned) {
|
|
|
2239
2342
|
return false;
|
|
2240
2343
|
}
|
|
2241
2344
|
async function getMessagesOp(ctx, convId) {
|
|
2242
|
-
const results = await ctx.messagesCollection.query(import_watermelondb.Q.where("conversation_id", convId), import_watermelondb.Q.sortBy("message_id", import_watermelondb.Q.asc)).
|
|
2345
|
+
const results = await ctx.messagesCollection.query(import_watermelondb.Q.where("conversation_id", convId), import_watermelondb.Q.sortBy("message_id", import_watermelondb.Q.asc)).unsafeFetchRaw();
|
|
2243
2346
|
return Promise.all(
|
|
2244
2347
|
results.map(
|
|
2245
|
-
(
|
|
2348
|
+
(raw) => messageRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
|
|
2246
2349
|
)
|
|
2247
2350
|
);
|
|
2248
2351
|
}
|
|
@@ -2259,39 +2362,40 @@ async function getMessagesPageOp(ctx, convId, opts) {
|
|
|
2259
2362
|
exclude.size > 0 ? import_watermelondb.Q.where("message_id", import_watermelondb.Q.lte(opts.beforeMessageId)) : import_watermelondb.Q.where("message_id", import_watermelondb.Q.lt(opts.beforeMessageId))
|
|
2260
2363
|
);
|
|
2261
2364
|
}
|
|
2262
|
-
const fetched = await ctx.messagesCollection.query(...clauses, import_watermelondb.Q.sortBy("message_id", import_watermelondb.Q.desc), import_watermelondb.Q.take(limit + exclude.size)).
|
|
2263
|
-
const results = (exclude.size > 0 ? fetched.filter((
|
|
2365
|
+
const fetched = await ctx.messagesCollection.query(...clauses, import_watermelondb.Q.sortBy("message_id", import_watermelondb.Q.desc), import_watermelondb.Q.take(limit + exclude.size)).unsafeFetchRaw();
|
|
2366
|
+
const results = (exclude.size > 0 ? fetched.filter((raw) => !exclude.has(raw.id)) : fetched).slice(0, limit);
|
|
2264
2367
|
results.reverse();
|
|
2265
2368
|
return Promise.all(
|
|
2266
2369
|
results.map(
|
|
2267
|
-
(
|
|
2370
|
+
(raw) => messageRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner, {
|
|
2268
2371
|
skipEmbeddings: true
|
|
2269
2372
|
})
|
|
2270
2373
|
)
|
|
2271
2374
|
);
|
|
2272
2375
|
}
|
|
2273
2376
|
async function getMessageSkeletonsOp(ctx, convId) {
|
|
2274
|
-
const results = await ctx.messagesCollection.query(import_watermelondb.Q.where("conversation_id", convId), import_watermelondb.Q.sortBy("message_id", import_watermelondb.Q.asc)).
|
|
2377
|
+
const results = await ctx.messagesCollection.query(import_watermelondb.Q.where("conversation_id", convId), import_watermelondb.Q.sortBy("message_id", import_watermelondb.Q.asc)).unsafeFetchRaw();
|
|
2275
2378
|
const roleById = /* @__PURE__ */ new Map();
|
|
2276
|
-
for (const
|
|
2277
|
-
roleById.set(
|
|
2278
|
-
}
|
|
2279
|
-
const skeletons = results.map((
|
|
2280
|
-
uniqueId:
|
|
2281
|
-
messageId:
|
|
2282
|
-
conversationId:
|
|
2283
|
-
role:
|
|
2284
|
-
createdAt:
|
|
2379
|
+
for (const raw of results) {
|
|
2380
|
+
roleById.set(raw.id, raw.role);
|
|
2381
|
+
}
|
|
2382
|
+
const skeletons = results.map((raw) => ({
|
|
2383
|
+
uniqueId: raw.id,
|
|
2384
|
+
messageId: raw.message_id,
|
|
2385
|
+
conversationId: raw.conversation_id ?? "",
|
|
2386
|
+
role: raw.role ?? "",
|
|
2387
|
+
createdAt: rawDate(raw.created_at),
|
|
2285
2388
|
// WatermelonDB surfaces unset text columns as null at runtime — normalize
|
|
2286
2389
|
// to undefined so `parentMessageId ?? undefined` keying works everywhere.
|
|
2287
|
-
parentMessageId:
|
|
2288
|
-
model:
|
|
2390
|
+
parentMessageId: raw.parent_message_id ?? void 0,
|
|
2391
|
+
model: raw.model ?? void 0
|
|
2289
2392
|
}));
|
|
2290
2393
|
const artifactIndices = [];
|
|
2291
2394
|
for (let i = 0; i < results.length; i++) {
|
|
2292
|
-
const
|
|
2293
|
-
|
|
2294
|
-
if (
|
|
2395
|
+
const raw = results[i];
|
|
2396
|
+
const parentMessageId = raw.parent_message_id;
|
|
2397
|
+
if (raw.role !== "user" || !parentMessageId) continue;
|
|
2398
|
+
if (roleById.get(parentMessageId) === "user") {
|
|
2295
2399
|
artifactIndices.push(i);
|
|
2296
2400
|
}
|
|
2297
2401
|
}
|
|
@@ -2912,7 +3016,7 @@ async function generateEmbedding(text12, options) {
|
|
|
2912
3016
|
const { baseUrl = BASE_URL, getToken, apiKey, model, cache } = options;
|
|
2913
3017
|
if (cache) {
|
|
2914
3018
|
const cached = cache.get(text12);
|
|
2915
|
-
if (cached) return cached;
|
|
3019
|
+
if (cached) return Array.from(cached);
|
|
2916
3020
|
}
|
|
2917
3021
|
let headers;
|
|
2918
3022
|
if (apiKey) {
|
|
@@ -2951,10 +3055,11 @@ async function generateEmbedding(text12, options) {
|
|
|
2951
3055
|
totalTokens: response.data.usage.total_tokens ?? 0
|
|
2952
3056
|
});
|
|
2953
3057
|
}
|
|
3058
|
+
const f32Embedding = Float32Array.from(embedding);
|
|
2954
3059
|
if (cache) {
|
|
2955
|
-
cache.set(text12,
|
|
3060
|
+
cache.set(text12, f32Embedding);
|
|
2956
3061
|
}
|
|
2957
|
-
return
|
|
3062
|
+
return Array.from(f32Embedding);
|
|
2958
3063
|
}
|
|
2959
3064
|
async function generateEmbeddingsBatch(texts, headers, baseUrl, model, onUsage, maskInput) {
|
|
2960
3065
|
const response = await withEmbeddingRetry(
|
|
@@ -2990,7 +3095,7 @@ async function generateEmbeddings(texts, options) {
|
|
|
2990
3095
|
if (cache) {
|
|
2991
3096
|
const cached = cache.get(texts[i]);
|
|
2992
3097
|
if (cached) {
|
|
2993
|
-
results[i] = cached;
|
|
3098
|
+
results[i] = Array.from(cached);
|
|
2994
3099
|
continue;
|
|
2995
3100
|
}
|
|
2996
3101
|
}
|
|
@@ -3051,9 +3156,10 @@ async function generateEmbeddings(texts, options) {
|
|
|
3051
3156
|
newEmbeddings = allEmbeddings.flat();
|
|
3052
3157
|
}
|
|
3053
3158
|
for (let i = 0; i < uncachedIndices.length; i++) {
|
|
3054
|
-
|
|
3159
|
+
const f32Embedding = Float32Array.from(newEmbeddings[i]);
|
|
3160
|
+
results[uncachedIndices[i]] = Array.from(f32Embedding);
|
|
3055
3161
|
if (cache) {
|
|
3056
|
-
cache.set(uncachedTexts[i],
|
|
3162
|
+
cache.set(uncachedTexts[i], f32Embedding);
|
|
3057
3163
|
}
|
|
3058
3164
|
}
|
|
3059
3165
|
return results;
|
|
@@ -7153,6 +7259,7 @@ __export(index_exports, {
|
|
|
7153
7259
|
getConversationMemoriesOp: () => getConversationMemoriesOp,
|
|
7154
7260
|
getConversationsByProjectLazyOp: () => getConversationsByProjectLazyOp,
|
|
7155
7261
|
getConversationsLazyOp: () => getConversationsLazyOp,
|
|
7262
|
+
getConversationsPageOp: () => getConversationsPageOp,
|
|
7156
7263
|
getLogger: () => getLogger,
|
|
7157
7264
|
getMemoriesNeedingTopicExtractionOp: () => getMemoriesNeedingTopicExtractionOp,
|
|
7158
7265
|
getServerTools: () => getServerTools,
|
|
@@ -9569,6 +9676,22 @@ function linkAbortSignals(a, b) {
|
|
|
9569
9676
|
}
|
|
9570
9677
|
};
|
|
9571
9678
|
}
|
|
9679
|
+
function validateEndpointOverride(override) {
|
|
9680
|
+
const trimmed = override.trim();
|
|
9681
|
+
if (trimmed === "") {
|
|
9682
|
+
return {
|
|
9683
|
+
valid: false,
|
|
9684
|
+
message: 'endpointOverride must be a non-empty, root-relative path (e.g. "/api/v1/utility/responses"); received an empty or whitespace-only string'
|
|
9685
|
+
};
|
|
9686
|
+
}
|
|
9687
|
+
if (trimmed.startsWith("//") || trimmed.includes("://")) {
|
|
9688
|
+
return {
|
|
9689
|
+
valid: false,
|
|
9690
|
+
message: `endpointOverride must be a root-relative path (e.g. "/api/v1/utility/responses"), not a protocol-relative or absolute URL; received "${trimmed}"`
|
|
9691
|
+
};
|
|
9692
|
+
}
|
|
9693
|
+
return { valid: true, endpoint: trimmed.startsWith("/") ? trimmed : `/${trimmed}` };
|
|
9694
|
+
}
|
|
9572
9695
|
async function runToolLoop(options) {
|
|
9573
9696
|
const {
|
|
9574
9697
|
model,
|
|
@@ -9576,6 +9699,7 @@ async function runToolLoop(options) {
|
|
|
9576
9699
|
baseUrl = BASE_URL,
|
|
9577
9700
|
headers,
|
|
9578
9701
|
apiType = "auto",
|
|
9702
|
+
endpointOverride,
|
|
9579
9703
|
temperature,
|
|
9580
9704
|
maxOutputTokens,
|
|
9581
9705
|
tools,
|
|
@@ -9658,6 +9782,20 @@ async function runToolLoop(options) {
|
|
|
9658
9782
|
await fireRunError({ error: msg, stage: "model", errorObject: new Error(msg) });
|
|
9659
9783
|
return { data: null, error: msg };
|
|
9660
9784
|
}
|
|
9785
|
+
let effectiveEndpoint = strategy.endpoint;
|
|
9786
|
+
if (endpointOverride !== void 0) {
|
|
9787
|
+
const overrideValidation = validateEndpointOverride(endpointOverride);
|
|
9788
|
+
if (!overrideValidation.valid) {
|
|
9789
|
+
if (onError) onError(new Error(overrideValidation.message));
|
|
9790
|
+
await fireRunError({
|
|
9791
|
+
error: overrideValidation.message,
|
|
9792
|
+
stage: "model",
|
|
9793
|
+
errorObject: new Error(overrideValidation.message)
|
|
9794
|
+
});
|
|
9795
|
+
return { data: null, error: overrideValidation.message };
|
|
9796
|
+
}
|
|
9797
|
+
effectiveEndpoint = overrideValidation.endpoint;
|
|
9798
|
+
}
|
|
9661
9799
|
const { signal: combinedSignal, cleanup: cleanupSignalLink } = linkAbortSignals(
|
|
9662
9800
|
signal,
|
|
9663
9801
|
detachSignal
|
|
@@ -9841,7 +9979,7 @@ async function runToolLoop(options) {
|
|
|
9841
9979
|
if (onRequest) onRequest(measureRequest(0, attempt, requestBody, messages, apiTools));
|
|
9842
9980
|
const sseResult = makeStreamingRequest({
|
|
9843
9981
|
baseUrl,
|
|
9844
|
-
endpoint:
|
|
9982
|
+
endpoint: effectiveEndpoint,
|
|
9845
9983
|
body: requestBody,
|
|
9846
9984
|
token,
|
|
9847
9985
|
headers: effectiveHeaders,
|
|
@@ -10313,7 +10451,7 @@ Executing tool: ${toolInfo}
|
|
|
10313
10451
|
const continuationRound = toolIteration;
|
|
10314
10452
|
const continuationResult = makeStreamingRequest({
|
|
10315
10453
|
baseUrl,
|
|
10316
|
-
endpoint:
|
|
10454
|
+
endpoint: effectiveEndpoint,
|
|
10317
10455
|
body: continuationRequestBody,
|
|
10318
10456
|
token,
|
|
10319
10457
|
headers: effectiveHeaders,
|
|
@@ -11218,6 +11356,7 @@ function useChat(options) {
|
|
|
11218
11356
|
imageModel,
|
|
11219
11357
|
apiType: requestApiType,
|
|
11220
11358
|
conversationId,
|
|
11359
|
+
endpointOverride,
|
|
11221
11360
|
piiRedaction: requestPiiRedaction,
|
|
11222
11361
|
headers
|
|
11223
11362
|
}) => {
|
|
@@ -11283,6 +11422,7 @@ function useChat(options) {
|
|
|
11283
11422
|
token,
|
|
11284
11423
|
baseUrl,
|
|
11285
11424
|
apiType: requestApiType ?? defaultApiType,
|
|
11425
|
+
endpointOverride,
|
|
11286
11426
|
temperature,
|
|
11287
11427
|
maxOutputTokens,
|
|
11288
11428
|
tools,
|
|
@@ -18986,6 +19126,7 @@ function createNotionTools(getAccessToken, requestNotionAccess) {
|
|
|
18986
19126
|
getConversationMemoriesOp,
|
|
18987
19127
|
getConversationsByProjectLazyOp,
|
|
18988
19128
|
getConversationsLazyOp,
|
|
19129
|
+
getConversationsPageOp,
|
|
18989
19130
|
getLogger,
|
|
18990
19131
|
getMemoriesNeedingTopicExtractionOp,
|
|
18991
19132
|
getServerTools,
|
package/dist/expo/index.d.mts
CHANGED
|
@@ -1308,8 +1308,13 @@ interface EmbeddingOptions {
|
|
|
1308
1308
|
* are looked up in this map before calling the API, and new embeddings
|
|
1309
1309
|
* are stored after generation. Useful when the same texts are embedded
|
|
1310
1310
|
* repeatedly (e.g., across eval iterations or re-indexing runs).
|
|
1311
|
+
*
|
|
1312
|
+
* Values are stored as `Float32Array` (the embedding model's native
|
|
1313
|
+
* precision) rather than a float64 `number[]`, halving the resident RAM of
|
|
1314
|
+
* the cache with no precision loss. `generateEmbedding(s)` still return
|
|
1315
|
+
* `number[]` at the API boundary, so callers are unaffected.
|
|
1311
1316
|
*/
|
|
1312
|
-
cache?: Map<string,
|
|
1317
|
+
cache?: Map<string, Float32Array>;
|
|
1313
1318
|
/** Called after each embedding API call with the token usage from the response. */
|
|
1314
1319
|
onUsage?: (usage: {
|
|
1315
1320
|
promptTokens: number;
|
|
@@ -2240,6 +2245,12 @@ type BaseSendMessageArgs = ResponsesApiOptions & {
|
|
|
2240
2245
|
onData?: (chunk: string) => void;
|
|
2241
2246
|
/** Groups requests belonging to the same conversation for observability. Pass-through only — not forwarded to the LLM provider. */
|
|
2242
2247
|
conversationId?: string;
|
|
2248
|
+
/**
|
|
2249
|
+
* Per-request override for the API path. When set, this request is sent to the
|
|
2250
|
+
* given path instead of the model-resolved endpoint. The request/response
|
|
2251
|
+
* contract is unchanged — only the path differs. Omit to use the default path.
|
|
2252
|
+
*/
|
|
2253
|
+
endpointOverride?: string;
|
|
2243
2254
|
/**
|
|
2244
2255
|
* Per-request override for PII redaction. When set, takes precedence over the
|
|
2245
2256
|
* hook-level `piiRedaction` for this call only — e.g. pass `false` to disable
|
|
@@ -3278,6 +3289,32 @@ interface GetMessagesPageOptions {
|
|
|
3278
3289
|
*/
|
|
3279
3290
|
limit: number;
|
|
3280
3291
|
}
|
|
3292
|
+
/** Options for keyset-paginated conversation-list reads ({@link getConversationsPageOp}). */
|
|
3293
|
+
interface GetConversationsPageOptions {
|
|
3294
|
+
/**
|
|
3295
|
+
* Upper-bound `created_at` cursor (epoch ms). Without
|
|
3296
|
+
* `boundaryExcludeUniqueIds` it is EXCLUSIVE: only conversations with
|
|
3297
|
+
* `createdAt < before` are returned. Omit to fetch the newest page.
|
|
3298
|
+
*/
|
|
3299
|
+
before?: number;
|
|
3300
|
+
/**
|
|
3301
|
+
* uniqueIds of the rows the caller already holds AT the `before` boundary.
|
|
3302
|
+
* `created_at` is NOT unique (a bulk restore/import writes many rows with the
|
|
3303
|
+
* same timestamp) — with an exclusive cursor, an unseen row sharing the
|
|
3304
|
+
* boundary timestamp would be silently skipped by every page. When provided,
|
|
3305
|
+
* the boundary timestamp is fetched INCLUSIVELY and these known rows are
|
|
3306
|
+
* filtered out, so a boundary-timestamp row is returned exactly once. Mirrors
|
|
3307
|
+
* {@link GetMessagesPageOptions.boundaryExcludeUniqueIds}.
|
|
3308
|
+
*/
|
|
3309
|
+
boundaryExcludeUniqueIds?: string[];
|
|
3310
|
+
/**
|
|
3311
|
+
* Maximum rows to return — the NEWEST `limit` rows of the matching range.
|
|
3312
|
+
* Defaults to 200. A non-positive or non-finite value yields an EMPTY page
|
|
3313
|
+
* (never an unbounded read — SQLite treats `LIMIT -1` as "no limit");
|
|
3314
|
+
* fractional values are floored.
|
|
3315
|
+
*/
|
|
3316
|
+
limit?: number;
|
|
3317
|
+
}
|
|
3281
3318
|
/**
|
|
3282
3319
|
* Lightweight, mostly-undecrypted projection of a message row. Contains just
|
|
3283
3320
|
* enough for consumers to build the conversation's branch tree (parent/child
|
|
@@ -4214,6 +4251,20 @@ interface StorageOperationsContext {
|
|
|
4214
4251
|
* for `decryptField` is exactly zero.
|
|
4215
4252
|
*/
|
|
4216
4253
|
declare function getConversationsLazyOp(ctx: StorageOperationsContext): Promise<LazyStoredConversation[]>;
|
|
4254
|
+
/**
|
|
4255
|
+
* Keyset-paginated, lazy (no-decrypt) variant of {@link getConversationsLazyOp}.
|
|
4256
|
+
*
|
|
4257
|
+
* Returns at most `limit` conversations (newest first by `created_at`), each
|
|
4258
|
+
* with its raw stored title under `encryptedTitle` — pair with
|
|
4259
|
+
* {@link decryptConversationTitle} to decrypt on render. Page through older
|
|
4260
|
+
* threads by passing the oldest loaded `createdAt` as `before` plus the
|
|
4261
|
+
* uniqueIds held at that boundary as `boundaryExcludeUniqueIds`.
|
|
4262
|
+
*
|
|
4263
|
+
* Decrypts nothing and builds no WatermelonDB Model (the never-evicted
|
|
4264
|
+
* RecordCache stays empty — web Pile-2). Sort order, soft-delete filtering,
|
|
4265
|
+
* and the encrypted-title projection all match `getConversationsLazyOp`.
|
|
4266
|
+
*/
|
|
4267
|
+
declare function getConversationsPageOp(ctx: StorageOperationsContext, options?: GetConversationsPageOptions): Promise<LazyStoredConversation[]>;
|
|
4217
4268
|
/**
|
|
4218
4269
|
* Lazy variant of {@link getConversationsByProjectOp}.
|
|
4219
4270
|
*
|
|
@@ -7395,4 +7446,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
|
|
|
7395
7446
|
*/
|
|
7396
7447
|
declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
|
|
7397
7448
|
|
|
7398
|
-
export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FlushResult, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, supersedeVaultMemoryOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
|
7449
|
+
export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, supersedeVaultMemoryOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
package/dist/expo/index.d.ts
CHANGED
|
@@ -1308,8 +1308,13 @@ interface EmbeddingOptions {
|
|
|
1308
1308
|
* are looked up in this map before calling the API, and new embeddings
|
|
1309
1309
|
* are stored after generation. Useful when the same texts are embedded
|
|
1310
1310
|
* repeatedly (e.g., across eval iterations or re-indexing runs).
|
|
1311
|
+
*
|
|
1312
|
+
* Values are stored as `Float32Array` (the embedding model's native
|
|
1313
|
+
* precision) rather than a float64 `number[]`, halving the resident RAM of
|
|
1314
|
+
* the cache with no precision loss. `generateEmbedding(s)` still return
|
|
1315
|
+
* `number[]` at the API boundary, so callers are unaffected.
|
|
1311
1316
|
*/
|
|
1312
|
-
cache?: Map<string,
|
|
1317
|
+
cache?: Map<string, Float32Array>;
|
|
1313
1318
|
/** Called after each embedding API call with the token usage from the response. */
|
|
1314
1319
|
onUsage?: (usage: {
|
|
1315
1320
|
promptTokens: number;
|
|
@@ -2240,6 +2245,12 @@ type BaseSendMessageArgs = ResponsesApiOptions & {
|
|
|
2240
2245
|
onData?: (chunk: string) => void;
|
|
2241
2246
|
/** Groups requests belonging to the same conversation for observability. Pass-through only — not forwarded to the LLM provider. */
|
|
2242
2247
|
conversationId?: string;
|
|
2248
|
+
/**
|
|
2249
|
+
* Per-request override for the API path. When set, this request is sent to the
|
|
2250
|
+
* given path instead of the model-resolved endpoint. The request/response
|
|
2251
|
+
* contract is unchanged — only the path differs. Omit to use the default path.
|
|
2252
|
+
*/
|
|
2253
|
+
endpointOverride?: string;
|
|
2243
2254
|
/**
|
|
2244
2255
|
* Per-request override for PII redaction. When set, takes precedence over the
|
|
2245
2256
|
* hook-level `piiRedaction` for this call only — e.g. pass `false` to disable
|
|
@@ -3278,6 +3289,32 @@ interface GetMessagesPageOptions {
|
|
|
3278
3289
|
*/
|
|
3279
3290
|
limit: number;
|
|
3280
3291
|
}
|
|
3292
|
+
/** Options for keyset-paginated conversation-list reads ({@link getConversationsPageOp}). */
|
|
3293
|
+
interface GetConversationsPageOptions {
|
|
3294
|
+
/**
|
|
3295
|
+
* Upper-bound `created_at` cursor (epoch ms). Without
|
|
3296
|
+
* `boundaryExcludeUniqueIds` it is EXCLUSIVE: only conversations with
|
|
3297
|
+
* `createdAt < before` are returned. Omit to fetch the newest page.
|
|
3298
|
+
*/
|
|
3299
|
+
before?: number;
|
|
3300
|
+
/**
|
|
3301
|
+
* uniqueIds of the rows the caller already holds AT the `before` boundary.
|
|
3302
|
+
* `created_at` is NOT unique (a bulk restore/import writes many rows with the
|
|
3303
|
+
* same timestamp) — with an exclusive cursor, an unseen row sharing the
|
|
3304
|
+
* boundary timestamp would be silently skipped by every page. When provided,
|
|
3305
|
+
* the boundary timestamp is fetched INCLUSIVELY and these known rows are
|
|
3306
|
+
* filtered out, so a boundary-timestamp row is returned exactly once. Mirrors
|
|
3307
|
+
* {@link GetMessagesPageOptions.boundaryExcludeUniqueIds}.
|
|
3308
|
+
*/
|
|
3309
|
+
boundaryExcludeUniqueIds?: string[];
|
|
3310
|
+
/**
|
|
3311
|
+
* Maximum rows to return — the NEWEST `limit` rows of the matching range.
|
|
3312
|
+
* Defaults to 200. A non-positive or non-finite value yields an EMPTY page
|
|
3313
|
+
* (never an unbounded read — SQLite treats `LIMIT -1` as "no limit");
|
|
3314
|
+
* fractional values are floored.
|
|
3315
|
+
*/
|
|
3316
|
+
limit?: number;
|
|
3317
|
+
}
|
|
3281
3318
|
/**
|
|
3282
3319
|
* Lightweight, mostly-undecrypted projection of a message row. Contains just
|
|
3283
3320
|
* enough for consumers to build the conversation's branch tree (parent/child
|
|
@@ -4214,6 +4251,20 @@ interface StorageOperationsContext {
|
|
|
4214
4251
|
* for `decryptField` is exactly zero.
|
|
4215
4252
|
*/
|
|
4216
4253
|
declare function getConversationsLazyOp(ctx: StorageOperationsContext): Promise<LazyStoredConversation[]>;
|
|
4254
|
+
/**
|
|
4255
|
+
* Keyset-paginated, lazy (no-decrypt) variant of {@link getConversationsLazyOp}.
|
|
4256
|
+
*
|
|
4257
|
+
* Returns at most `limit` conversations (newest first by `created_at`), each
|
|
4258
|
+
* with its raw stored title under `encryptedTitle` — pair with
|
|
4259
|
+
* {@link decryptConversationTitle} to decrypt on render. Page through older
|
|
4260
|
+
* threads by passing the oldest loaded `createdAt` as `before` plus the
|
|
4261
|
+
* uniqueIds held at that boundary as `boundaryExcludeUniqueIds`.
|
|
4262
|
+
*
|
|
4263
|
+
* Decrypts nothing and builds no WatermelonDB Model (the never-evicted
|
|
4264
|
+
* RecordCache stays empty — web Pile-2). Sort order, soft-delete filtering,
|
|
4265
|
+
* and the encrypted-title projection all match `getConversationsLazyOp`.
|
|
4266
|
+
*/
|
|
4267
|
+
declare function getConversationsPageOp(ctx: StorageOperationsContext, options?: GetConversationsPageOptions): Promise<LazyStoredConversation[]>;
|
|
4217
4268
|
/**
|
|
4218
4269
|
* Lazy variant of {@link getConversationsByProjectOp}.
|
|
4219
4270
|
*
|
|
@@ -7395,4 +7446,4 @@ declare function refreshNotionAccessToken(params: NotionRefreshTokenParams): Pro
|
|
|
7395
7446
|
*/
|
|
7396
7447
|
declare function createNotionTools(getAccessToken: () => string | null, requestNotionAccess: () => Promise<string>): ToolConfig[];
|
|
7397
7448
|
|
|
7398
|
-
export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FlushResult, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, supersedeVaultMemoryOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|
|
7449
|
+
export { type AutoExtractMessage, type AutoExtractor, type Budget, type CachedChunkVectors, type CachedServerTools, Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ChunkVectorCache, type ChunkingOptions, type ConsolidationFallbackReason, type ConversationMemoryInput, ConversationMemory as ConversationMemoryModel, type ConversationMemoryOperationsContext, type CreateAutoExtractorOptions, type CreateConversationOptions, type CreateMessageOptions, type CreateVaultFolderOptions, type CreateVaultMemoryOptions, type CryptoPriceClassification, type CryptoPricePreProcessorOptions, DEFAULT_CACHE_EXPIRATION_MS, DEFAULT_CHUNK_CACHE_SIZE, DEFAULT_CHUNK_OVERLAP, DEFAULT_CHUNK_SIZE, DEFAULT_MIN_CHUNK_SIZE, DEFAULT_VAULT_CACHE_SIZE, DatabaseManager, type DatabaseManagerLogger, type DatabaseManagerOptions, type EmbeddedWalletSignerFn, type ExtractFactsOptions, type ExtractOutcome, type ExtractedCandidate, type ExtractedEntity, type ExtractionCursorStore, type FactType, type FileMetadata, type FlushResult, type GetConversationsPageOptions, type GetMessagesPageOptions, INFERENCE_ID_HEADER, type LazyStoredConversation, type Logger, LoggerProvider, type LoggerProviderProps, type MemoriesNeedingTopicExtraction, type EmbeddingOptions as MemoryEngineEmbeddingOptions, type MemoryEngineResult, type MemoryEngineSearchOptions, type MemoryExtractedEvent, type MemoryKind, type MemoryVaultSearchOptions, type MemoryVaultToolOptions, type MessageRedactionResult, type MessageSkeleton, NOTION_OAUTH_CONFIG, type NotionAuthUrlParams, type NotionClientRegistration, type NotionExchangeCodeParams, type NotionOAuthEndpoints, type NotionPKCEChallenge, type NotionRefreshTokenParams, type NotionTokenResponse, PII_PATTERNS, type PiiCategory, type PiiMatch, type PiiPattern, PiiRedactor, type PiiRedactorOptions, type PlatformStorage, type PortalLlmAuth, type PromptPreProcessor, type PromptPreProcessorContext, type QuantizedEmbedding, QueueManager, type QueueStatus, RECALL_MAX_LIMIT, RECALL_TOOL_NAME, type RankedMemory, type RecallContext, type RecallDegradation, type RecallDiagnostics, type RecallOptions, type RecallResult, type RecallToolCallbacks, type RecallToolOptions, type RecencyOptions, type RedactionResult, type ReflectOptions, type ReflectResult, RerankerUnavailableError, type ResumeStreamOptions, type ResumeStreamResult, type ResumeStreamWithStorageResult, type RetainAction, type RetainContext, type RetainOptions, type RetainResult, type RetainSource, SDK_SCHEMA_VERSION, STREAM_RESUMABLE_HEADER, type ScoreBreakdown, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageDetachedResult, type SendMessageWithStorageResult, type ServerToolsOptions, type ServerToolsResponse, type SignMessageFn, type StockPriceClassification, type StockPricePreProcessorOptions, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredConversationMemory, type StoredMessage, type StoredMessageWithSimilarity, type StoredVaultFolder, VaultFolder as StoredVaultFolderModel, type StoredVaultMemory, VaultMemory as StoredVaultMemoryModel, StreamExpiredError, type StreamMetaEvent, type StreamResumeHandle, TOPICS_EXTRACTION_VERSION, TOPIC_EXTRACTION_BATCH_SIZE, type TextChunk, type TopicExtractOptions, type TopicExtractionInput, type TopicExtractionRunResult, type TurnCompleteEvent, type TurnSkippedEvent, type UpdateVaultFolderOptions, type UpdateVaultMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseCreditsOptions, type UseCreditsResult, type UseModelsOptions, type UseModelsResult, type VaultEmbeddingCache, type VaultFolderOperationsContext, type VaultMemoryOperationsContext, type VaultSaveOperation, type VaultSearchResult, WalletPoller, type WeatherClassification, type WeatherPreProcessorOptions, type WebSearchClassification, type WebSearchPreProcessorOptions, addConversationMemoriesOp, buildNotionAuthUrl, chatStorageMigrations, chatStorageSchema, chunkAndEmbedAllMessages, chunkAndEmbedMessage, chunkText, classifyCryptoPrice, classifyCryptoPriceBatch, classifyStockPrice, classifyStockPriceBatch, classifyWeather, classifyWeatherBatch, classifyWebSearch, classifyWebSearchBatch, clearAllEncryptionKeys, clearAllEncryptionState, clearConversationMemoriesOp, clearEncryptionKey, clearLazyTitleCache, clearServerToolsCache, consoleLogger, conversationMemoryToStored, cosineInt8, createAutoExtractor, createChunkVectorCache, createCryptoPricePreProcessor, createMemoryEngineTool, createMemoryVaultSearchTool, createMemoryVaultTool, createNotionTools, createPlatformCursorStore, createRecallTool, createStockPricePreProcessor, createStreamingDeAnonymizer, createVaultEmbeddingCache, createVaultFolderOp, createVaultMemoriesBatchOp, createVaultMemoryOp, createWeatherPreProcessor, createWebSearchPreProcessor, decryptConversationTitle, deleteAllVaultMemoriesForUserOp, deleteVaultFolderOp, deleteVaultMemoryOp, dequantizeEmbedding, discoverNotionOAuthEndpoints, eagerEmbedContent, embedAllMessages, embedMessage, ensureDefaultFoldersOp, exchangeNotionCode, extractAndLinkEntitiesForMemoriesOp, extractAndRetain, extractEntitiesForMemories, extractFacts, generateConversationId, generateEmbedding, generateEmbeddings, generateNotionPKCE, getAllVaultFoldersOp, getAllVaultMemoriesOp, getAllVaultMemoryContentsOp, getCachedServerTools, getConversationMemoriesOp, getConversationsByProjectLazyOp, getConversationsLazyOp, getConversationsPageOp, getLogger, getMemoriesNeedingTopicExtractionOp, getServerTools, getUnfiledVaultMemoriesOp, getVaultFolderMemoryCountOp, getVaultMemoryOp, hasEncryptionKey, isPiiRedactor, isRerankerAvailable, moveMemoriesToFolderOp, noopLogger, onKeyAvailable, preEmbedVaultMemories, quantizeEmbedding, queueManager, recall, reflect, refreshNotionAccessToken, registerNotionClient, requestEncryptionKey, resolvePiiRedactor, resumeStream, retain, sdkMigrations, sdkModelClasses, sdkSchema, searchVaultMemories, setLogger, shouldChunkMessage, stampTopicsExtractedAtOp, streamCancelPath, streamReplayPath, supersedeVaultMemoryOp, updateVaultFolderContextOp, updateVaultFolderOp, updateVaultMemoryEmbeddingOp, updateVaultMemoryOp, upsertMessageOp, useChat, useChatStorage, useCredits, useEncryption, useModels, xhrTransport };
|