@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.
@@ -51,6 +51,7 @@ import {
51
51
  getConversationsByProjectLazyOp,
52
52
  getConversationsLazyOp,
53
53
  getConversationsOp,
54
+ getConversationsPageOp,
54
55
  getImageModel,
55
56
  getMemoriesNeedingTopicExtractionOp,
56
57
  getMessageCountOp,
@@ -89,7 +90,7 @@ import {
89
90
  upsertMessageOp,
90
91
  useEncryption,
91
92
  vaultMemoryToStored
92
- } from "./chunk-TCRDSUC6.mjs";
93
+ } from "./chunk-IY7NNIYM.mjs";
93
94
  import {
94
95
  PII_PATTERNS,
95
96
  PiiRedactor,
@@ -2454,6 +2455,22 @@ function linkAbortSignals(a, b) {
2454
2455
  }
2455
2456
  };
2456
2457
  }
2458
+ function validateEndpointOverride(override) {
2459
+ const trimmed = override.trim();
2460
+ if (trimmed === "") {
2461
+ return {
2462
+ valid: false,
2463
+ message: 'endpointOverride must be a non-empty, root-relative path (e.g. "/api/v1/utility/responses"); received an empty or whitespace-only string'
2464
+ };
2465
+ }
2466
+ if (trimmed.startsWith("//") || trimmed.includes("://")) {
2467
+ return {
2468
+ valid: false,
2469
+ message: `endpointOverride must be a root-relative path (e.g. "/api/v1/utility/responses"), not a protocol-relative or absolute URL; received "${trimmed}"`
2470
+ };
2471
+ }
2472
+ return { valid: true, endpoint: trimmed.startsWith("/") ? trimmed : `/${trimmed}` };
2473
+ }
2457
2474
  async function runToolLoop(options) {
2458
2475
  const {
2459
2476
  model,
@@ -2461,6 +2478,7 @@ async function runToolLoop(options) {
2461
2478
  baseUrl = BASE_URL,
2462
2479
  headers,
2463
2480
  apiType = "auto",
2481
+ endpointOverride,
2464
2482
  temperature,
2465
2483
  maxOutputTokens,
2466
2484
  tools,
@@ -2543,6 +2561,20 @@ async function runToolLoop(options) {
2543
2561
  await fireRunError({ error: msg, stage: "model", errorObject: new Error(msg) });
2544
2562
  return { data: null, error: msg };
2545
2563
  }
2564
+ let effectiveEndpoint = strategy.endpoint;
2565
+ if (endpointOverride !== void 0) {
2566
+ const overrideValidation = validateEndpointOverride(endpointOverride);
2567
+ if (!overrideValidation.valid) {
2568
+ if (onError) onError(new Error(overrideValidation.message));
2569
+ await fireRunError({
2570
+ error: overrideValidation.message,
2571
+ stage: "model",
2572
+ errorObject: new Error(overrideValidation.message)
2573
+ });
2574
+ return { data: null, error: overrideValidation.message };
2575
+ }
2576
+ effectiveEndpoint = overrideValidation.endpoint;
2577
+ }
2546
2578
  const { signal: combinedSignal, cleanup: cleanupSignalLink } = linkAbortSignals(
2547
2579
  signal,
2548
2580
  detachSignal
@@ -2726,7 +2758,7 @@ async function runToolLoop(options) {
2726
2758
  if (onRequest) onRequest(measureRequest(0, attempt, requestBody, messages, apiTools));
2727
2759
  const sseResult = makeStreamingRequest({
2728
2760
  baseUrl,
2729
- endpoint: strategy.endpoint,
2761
+ endpoint: effectiveEndpoint,
2730
2762
  body: requestBody,
2731
2763
  token,
2732
2764
  headers: effectiveHeaders,
@@ -3198,7 +3230,7 @@ Executing tool: ${toolInfo}
3198
3230
  const continuationRound = toolIteration;
3199
3231
  const continuationResult = makeStreamingRequest({
3200
3232
  baseUrl,
3201
- endpoint: strategy.endpoint,
3233
+ endpoint: effectiveEndpoint,
3202
3234
  body: continuationRequestBody,
3203
3235
  token,
3204
3236
  headers: effectiveHeaders,
@@ -4095,6 +4127,7 @@ function useChat(options) {
4095
4127
  imageModel,
4096
4128
  apiType: requestApiType,
4097
4129
  conversationId,
4130
+ endpointOverride,
4098
4131
  piiRedaction: requestPiiRedaction,
4099
4132
  headers
4100
4133
  }) => {
@@ -4160,6 +4193,7 @@ function useChat(options) {
4160
4193
  token,
4161
4194
  baseUrl,
4162
4195
  apiType: requestApiType ?? defaultApiType,
4196
+ endpointOverride,
4163
4197
  temperature,
4164
4198
  maxOutputTokens,
4165
4199
  tools,
@@ -11783,6 +11817,7 @@ export {
11783
11817
  getConversationMemoriesOp,
11784
11818
  getConversationsByProjectLazyOp,
11785
11819
  getConversationsLazyOp,
11820
+ getConversationsPageOp,
11786
11821
  getLogger,
11787
11822
  getMemoriesNeedingTopicExtractionOp,
11788
11823
  getServerTools,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  recall
3
- } from "./chunk-TCRDSUC6.mjs";
3
+ } from "./chunk-IY7NNIYM.mjs";
4
4
  import "./chunk-DFVCS3QQ.mjs";
5
5
  import "./chunk-GYKJOWEO.mjs";
6
6
  export {
package/dist/index.cjs CHANGED
@@ -2115,7 +2115,7 @@ async function generateEmbedding(text, options) {
2115
2115
  const { baseUrl = BASE_URL, getToken, apiKey, model, cache } = options;
2116
2116
  if (cache) {
2117
2117
  const cached = cache.get(text);
2118
- if (cached) return cached;
2118
+ if (cached) return Array.from(cached);
2119
2119
  }
2120
2120
  let headers;
2121
2121
  if (apiKey) {
@@ -2154,10 +2154,11 @@ async function generateEmbedding(text, options) {
2154
2154
  totalTokens: response.data.usage.total_tokens ?? 0
2155
2155
  });
2156
2156
  }
2157
+ const f32Embedding = Float32Array.from(embedding);
2157
2158
  if (cache) {
2158
- cache.set(text, embedding);
2159
+ cache.set(text, f32Embedding);
2159
2160
  }
2160
- return embedding;
2161
+ return Array.from(f32Embedding);
2161
2162
  }
2162
2163
  var DEFAULT_EMBEDDING_BATCH_SIZE = 100;
2163
2164
  var DEFAULT_EMBEDDING_BATCH_CONCURRENCY = 3;
@@ -2195,7 +2196,7 @@ async function generateEmbeddings(texts, options) {
2195
2196
  if (cache) {
2196
2197
  const cached = cache.get(texts[i]);
2197
2198
  if (cached) {
2198
- results[i] = cached;
2199
+ results[i] = Array.from(cached);
2199
2200
  continue;
2200
2201
  }
2201
2202
  }
@@ -2256,9 +2257,10 @@ async function generateEmbeddings(texts, options) {
2256
2257
  newEmbeddings = allEmbeddings.flat();
2257
2258
  }
2258
2259
  for (let i = 0; i < uncachedIndices.length; i++) {
2259
- results[uncachedIndices[i]] = newEmbeddings[i];
2260
+ const f32Embedding = Float32Array.from(newEmbeddings[i]);
2261
+ results[uncachedIndices[i]] = Array.from(f32Embedding);
2260
2262
  if (cache) {
2261
- cache.set(uncachedTexts[i], newEmbeddings[i]);
2263
+ cache.set(uncachedTexts[i], f32Embedding);
2262
2264
  }
2263
2265
  }
2264
2266
  return results;
package/dist/index.mjs CHANGED
@@ -1919,7 +1919,7 @@ async function generateEmbedding(text, options) {
1919
1919
  const { baseUrl = BASE_URL, getToken, apiKey, model, cache } = options;
1920
1920
  if (cache) {
1921
1921
  const cached = cache.get(text);
1922
- if (cached) return cached;
1922
+ if (cached) return Array.from(cached);
1923
1923
  }
1924
1924
  let headers;
1925
1925
  if (apiKey) {
@@ -1958,10 +1958,11 @@ async function generateEmbedding(text, options) {
1958
1958
  totalTokens: response.data.usage.total_tokens ?? 0
1959
1959
  });
1960
1960
  }
1961
+ const f32Embedding = Float32Array.from(embedding);
1961
1962
  if (cache) {
1962
- cache.set(text, embedding);
1963
+ cache.set(text, f32Embedding);
1963
1964
  }
1964
- return embedding;
1965
+ return Array.from(f32Embedding);
1965
1966
  }
1966
1967
  var DEFAULT_EMBEDDING_BATCH_SIZE = 100;
1967
1968
  var DEFAULT_EMBEDDING_BATCH_CONCURRENCY = 3;
@@ -1999,7 +2000,7 @@ async function generateEmbeddings(texts, options) {
1999
2000
  if (cache) {
2000
2001
  const cached = cache.get(texts[i]);
2001
2002
  if (cached) {
2002
- results[i] = cached;
2003
+ results[i] = Array.from(cached);
2003
2004
  continue;
2004
2005
  }
2005
2006
  }
@@ -2060,9 +2061,10 @@ async function generateEmbeddings(texts, options) {
2060
2061
  newEmbeddings = allEmbeddings.flat();
2061
2062
  }
2062
2063
  for (let i = 0; i < uncachedIndices.length; i++) {
2063
- results[uncachedIndices[i]] = newEmbeddings[i];
2064
+ const f32Embedding = Float32Array.from(newEmbeddings[i]);
2065
+ results[uncachedIndices[i]] = Array.from(f32Embedding);
2064
2066
  if (cache) {
2065
- cache.set(uncachedTexts[i], newEmbeddings[i]);
2067
+ cache.set(uncachedTexts[i], f32Embedding);
2066
2068
  }
2067
2069
  }
2068
2070
  return results;
@@ -1098,6 +1098,67 @@ async function messageToStored(message, walletAddress, signMessage, embeddedWall
1098
1098
  }
1099
1099
  return baseMessage;
1100
1100
  }
1101
+ function rawDate(value) {
1102
+ return new Date(typeof value === "number" ? value : 0);
1103
+ }
1104
+ function messageRawToStoredRaw(raw, projection) {
1105
+ const parseJsonField = (rawValue) => {
1106
+ if (!rawValue) return void 0;
1107
+ if (typeof rawValue === "string") {
1108
+ if (rawValue.startsWith("enc:")) return rawValue;
1109
+ try {
1110
+ return JSON.parse(rawValue);
1111
+ } catch {
1112
+ return void 0;
1113
+ }
1114
+ }
1115
+ return rawValue;
1116
+ };
1117
+ const skipEmbeddings = projection?.skipEmbeddings === true;
1118
+ const vectorRaw = skipEmbeddings ? null : raw.vector;
1119
+ const chunksRaw = skipEmbeddings ? null : raw.chunks;
1120
+ return {
1121
+ uniqueId: raw.id,
1122
+ messageId: raw.message_id,
1123
+ conversationId: raw.conversation_id ?? "",
1124
+ role: raw.role ?? "",
1125
+ content: raw.content ?? "",
1126
+ model: raw.model,
1127
+ imageModel: raw.image_model,
1128
+ files: parseJsonField(raw.files),
1129
+ fileIds: parseJsonField(raw.file_ids),
1130
+ createdAt: rawDate(raw.created_at),
1131
+ updatedAt: rawDate(raw.updated_at),
1132
+ vector: skipEmbeddings ? void 0 : parseJsonField(vectorRaw),
1133
+ embeddingModel: raw.embedding_model,
1134
+ chunks: skipEmbeddings ? void 0 : parseJsonField(chunksRaw),
1135
+ usage: parseJsonField(raw.usage),
1136
+ sources: parseJsonField(raw.sources),
1137
+ responseDuration: raw.response_duration,
1138
+ // `was_stopped` is an OPTIONAL boolean: an unset row sanitizes to null, and the Model path
1139
+ // (message.wasStopped) returns that null verbatim. Preserve it (don't collapse to false) so the
1140
+ // raw path is byte-identical. When set, coerce SQLite 0/1 and LokiJS true/false alike.
1141
+ wasStopped: raw.was_stopped === null || raw.was_stopped === void 0 ? raw.was_stopped : raw.was_stopped === true || raw.was_stopped === 1,
1142
+ error: raw.error,
1143
+ thoughtProcess: parseJsonField(raw.thought_process),
1144
+ thinking: raw.thinking,
1145
+ parentMessageId: raw.parent_message_id,
1146
+ feedback: raw.feedback || null,
1147
+ toolCallEvents: parseJsonField(raw.tool_call_events)
1148
+ };
1149
+ }
1150
+ async function messageRawToStored(raw, walletAddress, signMessage, embeddedWalletSigner, projection) {
1151
+ const baseMessage = messageRawToStoredRaw(raw, projection);
1152
+ if (walletAddress) {
1153
+ return await decryptMessageFields(
1154
+ baseMessage,
1155
+ walletAddress,
1156
+ signMessage,
1157
+ embeddedWalletSigner
1158
+ );
1159
+ }
1160
+ return baseMessage;
1161
+ }
1101
1162
  function conversationToStoredRaw(conversation) {
1102
1163
  return {
1103
1164
  uniqueId: conversation.id,
@@ -1122,6 +1183,33 @@ async function conversationToStored(conversation, walletAddress, signMessage, em
1122
1183
  }
1123
1184
  return baseConversation;
1124
1185
  }
1186
+ function conversationRawToStoredRaw(raw) {
1187
+ const pinnedAt = raw.pinned_at;
1188
+ return {
1189
+ uniqueId: raw.id,
1190
+ conversationId: raw.conversation_id ?? "",
1191
+ title: raw.title ?? "",
1192
+ projectId: raw.project_id,
1193
+ createdAt: rawDate(raw.created_at),
1194
+ updatedAt: rawDate(raw.updated_at),
1195
+ // SQLite stores booleans as 0/1, LokiJS as true/false — coerce both.
1196
+ isDeleted: raw.is_deleted === true || raw.is_deleted === 1,
1197
+ // @date maps a non-number raw column (incl. an explicit unpin null) to null; a number → Date.
1198
+ pinnedAt: typeof pinnedAt === "number" ? new Date(pinnedAt) : null
1199
+ };
1200
+ }
1201
+ async function conversationRawToStored(raw, walletAddress, signMessage, embeddedWalletSigner) {
1202
+ const baseConversation = conversationRawToStoredRaw(raw);
1203
+ if (walletAddress) {
1204
+ return await decryptConversationFields(
1205
+ baseConversation,
1206
+ walletAddress,
1207
+ signMessage,
1208
+ embeddedWalletSigner
1209
+ );
1210
+ }
1211
+ return baseConversation;
1212
+ }
1125
1213
  async function createConversationOp(ctx, opts, defaultTitle = "New Conversation") {
1126
1214
  const convId = opts?.conversationId || generateConversationId();
1127
1215
  const title = opts?.title || defaultTitle;
@@ -1161,36 +1249,51 @@ async function getConversationOp(ctx, id) {
1161
1249
  ) : null;
1162
1250
  }
1163
1251
  async function getConversationsOp(ctx) {
1164
- const results = await ctx.conversationsCollection.query(Q.where("is_deleted", false), Q.sortBy("created_at", Q.desc)).fetch();
1252
+ const results = await ctx.conversationsCollection.query(Q.where("is_deleted", false), Q.sortBy("created_at", Q.desc)).unsafeFetchRaw();
1165
1253
  return Promise.all(
1166
1254
  results.map(
1167
- (conv) => conversationToStored(conv, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
1255
+ (raw) => conversationRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
1168
1256
  )
1169
1257
  );
1170
1258
  }
1171
- function conversationToLazyStored(conversation) {
1259
+ function conversationRawToLazyStored(raw) {
1260
+ const pinnedAt = raw.pinned_at;
1172
1261
  return {
1173
- uniqueId: conversation.id,
1174
- conversationId: conversation.conversationId,
1175
- encryptedTitle: conversation.title,
1176
- projectId: conversation.projectId,
1177
- createdAt: conversation.createdAt,
1178
- updatedAt: conversation.updatedAt,
1179
- isDeleted: conversation.isDeleted,
1180
- pinnedAt: conversation.pinnedAt
1262
+ uniqueId: raw.id,
1263
+ conversationId: raw.conversation_id ?? "",
1264
+ encryptedTitle: raw.title ?? "",
1265
+ projectId: raw.project_id,
1266
+ createdAt: rawDate(raw.created_at),
1267
+ updatedAt: rawDate(raw.updated_at),
1268
+ isDeleted: raw.is_deleted === true || raw.is_deleted === 1,
1269
+ pinnedAt: typeof pinnedAt === "number" ? new Date(pinnedAt) : null
1181
1270
  };
1182
1271
  }
1183
1272
  async function getConversationsLazyOp(ctx) {
1184
- const results = await ctx.conversationsCollection.query(Q.where("is_deleted", false), Q.sortBy("created_at", Q.desc)).fetch();
1185
- return results.map(conversationToLazyStored);
1273
+ const results = await ctx.conversationsCollection.query(Q.where("is_deleted", false), Q.sortBy("created_at", Q.desc)).unsafeFetchRaw();
1274
+ return results.map(conversationRawToLazyStored);
1275
+ }
1276
+ async function getConversationsPageOp(ctx, options) {
1277
+ const limit = Math.floor(options?.limit ?? 200);
1278
+ if (!Number.isFinite(limit) || limit < 1) return [];
1279
+ const exclude = new Set(options?.boundaryExcludeUniqueIds ?? []);
1280
+ const clauses = [Q.where("is_deleted", false)];
1281
+ if (options?.before !== void 0) {
1282
+ clauses.push(
1283
+ exclude.size > 0 ? Q.where("created_at", Q.lte(options.before)) : Q.where("created_at", Q.lt(options.before))
1284
+ );
1285
+ }
1286
+ const fetched = await ctx.conversationsCollection.query(...clauses, Q.sortBy("created_at", Q.desc), Q.take(limit + exclude.size)).unsafeFetchRaw();
1287
+ const results = exclude.size > 0 ? fetched.filter((raw) => !exclude.has(raw.id)) : fetched;
1288
+ return results.slice(0, limit).map(conversationRawToLazyStored);
1186
1289
  }
1187
1290
  async function getConversationsByProjectLazyOp(ctx, projectId) {
1188
1291
  const results = await ctx.conversationsCollection.query(
1189
1292
  Q.where("project_id", projectId === null ? "" : projectId),
1190
1293
  Q.where("is_deleted", false),
1191
1294
  Q.sortBy("created_at", Q.desc)
1192
- ).fetch();
1193
- return results.map(conversationToLazyStored);
1295
+ ).unsafeFetchRaw();
1296
+ return results.map(conversationRawToLazyStored);
1194
1297
  }
1195
1298
  async function updateConversationTitleOp(ctx, id, title) {
1196
1299
  const results = await ctx.conversationsCollection.query(Q.where("conversation_id", id), Q.where("is_deleted", false)).fetch();
@@ -1252,18 +1355,18 @@ async function getConversationsByProjectOp(ctx, projectId) {
1252
1355
  Q.where("project_id", projectId === null ? "" : projectId),
1253
1356
  Q.where("is_deleted", false),
1254
1357
  Q.sortBy("created_at", Q.desc)
1255
- ).fetch();
1358
+ ).unsafeFetchRaw();
1256
1359
  return Promise.all(
1257
1360
  results.map(
1258
- (conv) => conversationToStored(conv, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
1361
+ (raw) => conversationRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
1259
1362
  )
1260
1363
  );
1261
1364
  }
1262
1365
  async function getMessagesOp(ctx, convId) {
1263
- const results = await ctx.messagesCollection.query(Q.where("conversation_id", convId), Q.sortBy("message_id", Q.asc)).fetch();
1366
+ const results = await ctx.messagesCollection.query(Q.where("conversation_id", convId), Q.sortBy("message_id", Q.asc)).unsafeFetchRaw();
1264
1367
  return Promise.all(
1265
1368
  results.map(
1266
- (msg) => messageToStored(msg, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
1369
+ (raw) => messageRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
1267
1370
  )
1268
1371
  );
1269
1372
  }
@@ -1280,39 +1383,40 @@ async function getMessagesPageOp(ctx, convId, opts) {
1280
1383
  exclude.size > 0 ? Q.where("message_id", Q.lte(opts.beforeMessageId)) : Q.where("message_id", Q.lt(opts.beforeMessageId))
1281
1384
  );
1282
1385
  }
1283
- const fetched = await ctx.messagesCollection.query(...clauses, Q.sortBy("message_id", Q.desc), Q.take(limit + exclude.size)).fetch();
1284
- const results = (exclude.size > 0 ? fetched.filter((msg) => !exclude.has(msg.id)) : fetched).slice(0, limit);
1386
+ const fetched = await ctx.messagesCollection.query(...clauses, Q.sortBy("message_id", Q.desc), Q.take(limit + exclude.size)).unsafeFetchRaw();
1387
+ const results = (exclude.size > 0 ? fetched.filter((raw) => !exclude.has(raw.id)) : fetched).slice(0, limit);
1285
1388
  results.reverse();
1286
1389
  return Promise.all(
1287
1390
  results.map(
1288
- (msg) => messageToStored(msg, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner, {
1391
+ (raw) => messageRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner, {
1289
1392
  skipEmbeddings: true
1290
1393
  })
1291
1394
  )
1292
1395
  );
1293
1396
  }
1294
1397
  async function getMessageSkeletonsOp(ctx, convId) {
1295
- const results = await ctx.messagesCollection.query(Q.where("conversation_id", convId), Q.sortBy("message_id", Q.asc)).fetch();
1398
+ const results = await ctx.messagesCollection.query(Q.where("conversation_id", convId), Q.sortBy("message_id", Q.asc)).unsafeFetchRaw();
1296
1399
  const roleById = /* @__PURE__ */ new Map();
1297
- for (const msg of results) {
1298
- roleById.set(msg.id, msg.role);
1299
- }
1300
- const skeletons = results.map((msg) => ({
1301
- uniqueId: msg.id,
1302
- messageId: msg.messageId,
1303
- conversationId: String(msg._getRaw("conversation_id")),
1304
- role: msg.role,
1305
- createdAt: msg.createdAt,
1400
+ for (const raw of results) {
1401
+ roleById.set(raw.id, raw.role);
1402
+ }
1403
+ const skeletons = results.map((raw) => ({
1404
+ uniqueId: raw.id,
1405
+ messageId: raw.message_id,
1406
+ conversationId: raw.conversation_id ?? "",
1407
+ role: raw.role ?? "",
1408
+ createdAt: rawDate(raw.created_at),
1306
1409
  // WatermelonDB surfaces unset text columns as null at runtime — normalize
1307
1410
  // to undefined so `parentMessageId ?? undefined` keying works everywhere.
1308
- parentMessageId: msg.parentMessageId ?? void 0,
1309
- model: msg.model ?? void 0
1411
+ parentMessageId: raw.parent_message_id ?? void 0,
1412
+ model: raw.model ?? void 0
1310
1413
  }));
1311
1414
  const artifactIndices = [];
1312
1415
  for (let i = 0; i < results.length; i++) {
1313
- const msg = results[i];
1314
- if (msg.role !== "user" || !msg.parentMessageId) continue;
1315
- if (roleById.get(msg.parentMessageId) === "user") {
1416
+ const raw = results[i];
1417
+ const parentMessageId = raw.parent_message_id;
1418
+ if (raw.role !== "user" || !parentMessageId) continue;
1419
+ if (roleById.get(parentMessageId) === "user") {
1316
1420
  artifactIndices.push(i);
1317
1421
  }
1318
1422
  }
@@ -3817,7 +3921,7 @@ async function generateEmbedding(text, options) {
3817
3921
  const { baseUrl = BASE_URL, getToken, apiKey, model, cache } = options;
3818
3922
  if (cache) {
3819
3923
  const cached = cache.get(text);
3820
- if (cached) return cached;
3924
+ if (cached) return Array.from(cached);
3821
3925
  }
3822
3926
  let headers;
3823
3927
  if (apiKey) {
@@ -3856,10 +3960,11 @@ async function generateEmbedding(text, options) {
3856
3960
  totalTokens: response.data.usage.total_tokens ?? 0
3857
3961
  });
3858
3962
  }
3963
+ const f32Embedding = Float32Array.from(embedding);
3859
3964
  if (cache) {
3860
- cache.set(text, embedding);
3965
+ cache.set(text, f32Embedding);
3861
3966
  }
3862
- return embedding;
3967
+ return Array.from(f32Embedding);
3863
3968
  }
3864
3969
  var DEFAULT_EMBEDDING_BATCH_SIZE = 100;
3865
3970
  var DEFAULT_EMBEDDING_BATCH_CONCURRENCY = 3;
@@ -3897,7 +4002,7 @@ async function generateEmbeddings(texts, options) {
3897
4002
  if (cache) {
3898
4003
  const cached = cache.get(texts[i]);
3899
4004
  if (cached) {
3900
- results[i] = cached;
4005
+ results[i] = Array.from(cached);
3901
4006
  continue;
3902
4007
  }
3903
4008
  }
@@ -3958,9 +4063,10 @@ async function generateEmbeddings(texts, options) {
3958
4063
  newEmbeddings = allEmbeddings.flat();
3959
4064
  }
3960
4065
  for (let i = 0; i < uncachedIndices.length; i++) {
3961
- results[uncachedIndices[i]] = newEmbeddings[i];
4066
+ const f32Embedding = Float32Array.from(newEmbeddings[i]);
4067
+ results[uncachedIndices[i]] = Array.from(f32Embedding);
3962
4068
  if (cache) {
3963
- cache.set(uncachedTexts[i], newEmbeddings[i]);
4069
+ cache.set(uncachedTexts[i], f32Embedding);
3964
4070
  }
3965
4071
  }
3966
4072
  return results;
@@ -5384,7 +5490,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
5384
5490
  legacy.map((r) => ({ id: r.uniqueId, content: r.content, score: r.similarity }))
5385
5491
  );
5386
5492
  }
5387
- const { recall: recall2 } = await import("./recall-PV7L3SN3.mjs");
5493
+ const { recall: recall2 } = await import("./recall-3BDCIEQF.mjs");
5388
5494
  const result = await recall2(
5389
5495
  query,
5390
5496
  { vaultCtx, embeddingOptions, vaultCache: cache },
@@ -6068,6 +6174,7 @@ export {
6068
6174
  getConversationOp,
6069
6175
  getConversationsOp,
6070
6176
  getConversationsLazyOp,
6177
+ getConversationsPageOp,
6071
6178
  getConversationsByProjectLazyOp,
6072
6179
  updateConversationTitleOp,
6073
6180
  deleteConversationOp,