@anuma/sdk 2.7.0 → 3.1.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.
@@ -3,8 +3,7 @@ import {
3
3
  getLogger
4
4
  } from "./chunk-DFVCS3QQ.mjs";
5
5
  import {
6
- BASE_URL,
7
- createClientConfig
6
+ BASE_URL
8
7
  } from "./chunk-GYKJOWEO.mjs";
9
8
 
10
9
  // src/lib/db/chat/operations.ts
@@ -1098,6 +1097,67 @@ async function messageToStored(message, walletAddress, signMessage, embeddedWall
1098
1097
  }
1099
1098
  return baseMessage;
1100
1099
  }
1100
+ function rawDate(value) {
1101
+ return new Date(typeof value === "number" ? value : 0);
1102
+ }
1103
+ function messageRawToStoredRaw(raw, projection) {
1104
+ const parseJsonField = (rawValue) => {
1105
+ if (!rawValue) return void 0;
1106
+ if (typeof rawValue === "string") {
1107
+ if (rawValue.startsWith("enc:")) return rawValue;
1108
+ try {
1109
+ return JSON.parse(rawValue);
1110
+ } catch {
1111
+ return void 0;
1112
+ }
1113
+ }
1114
+ return rawValue;
1115
+ };
1116
+ const skipEmbeddings = projection?.skipEmbeddings === true;
1117
+ const vectorRaw = skipEmbeddings ? null : raw.vector;
1118
+ const chunksRaw = skipEmbeddings ? null : raw.chunks;
1119
+ return {
1120
+ uniqueId: raw.id,
1121
+ messageId: raw.message_id,
1122
+ conversationId: raw.conversation_id ?? "",
1123
+ role: raw.role ?? "",
1124
+ content: raw.content ?? "",
1125
+ model: raw.model,
1126
+ imageModel: raw.image_model,
1127
+ files: parseJsonField(raw.files),
1128
+ fileIds: parseJsonField(raw.file_ids),
1129
+ createdAt: rawDate(raw.created_at),
1130
+ updatedAt: rawDate(raw.updated_at),
1131
+ vector: skipEmbeddings ? void 0 : parseJsonField(vectorRaw),
1132
+ embeddingModel: raw.embedding_model,
1133
+ chunks: skipEmbeddings ? void 0 : parseJsonField(chunksRaw),
1134
+ usage: parseJsonField(raw.usage),
1135
+ sources: parseJsonField(raw.sources),
1136
+ responseDuration: raw.response_duration,
1137
+ // `was_stopped` is an OPTIONAL boolean: an unset row sanitizes to null, and the Model path
1138
+ // (message.wasStopped) returns that null verbatim. Preserve it (don't collapse to false) so the
1139
+ // raw path is byte-identical. When set, coerce SQLite 0/1 and LokiJS true/false alike.
1140
+ wasStopped: raw.was_stopped === null || raw.was_stopped === void 0 ? raw.was_stopped : raw.was_stopped === true || raw.was_stopped === 1,
1141
+ error: raw.error,
1142
+ thoughtProcess: parseJsonField(raw.thought_process),
1143
+ thinking: raw.thinking,
1144
+ parentMessageId: raw.parent_message_id,
1145
+ feedback: raw.feedback || null,
1146
+ toolCallEvents: parseJsonField(raw.tool_call_events)
1147
+ };
1148
+ }
1149
+ async function messageRawToStored(raw, walletAddress, signMessage, embeddedWalletSigner, projection) {
1150
+ const baseMessage = messageRawToStoredRaw(raw, projection);
1151
+ if (walletAddress) {
1152
+ return await decryptMessageFields(
1153
+ baseMessage,
1154
+ walletAddress,
1155
+ signMessage,
1156
+ embeddedWalletSigner
1157
+ );
1158
+ }
1159
+ return baseMessage;
1160
+ }
1101
1161
  function conversationToStoredRaw(conversation) {
1102
1162
  return {
1103
1163
  uniqueId: conversation.id,
@@ -1122,6 +1182,33 @@ async function conversationToStored(conversation, walletAddress, signMessage, em
1122
1182
  }
1123
1183
  return baseConversation;
1124
1184
  }
1185
+ function conversationRawToStoredRaw(raw) {
1186
+ const pinnedAt = raw.pinned_at;
1187
+ return {
1188
+ uniqueId: raw.id,
1189
+ conversationId: raw.conversation_id ?? "",
1190
+ title: raw.title ?? "",
1191
+ projectId: raw.project_id,
1192
+ createdAt: rawDate(raw.created_at),
1193
+ updatedAt: rawDate(raw.updated_at),
1194
+ // SQLite stores booleans as 0/1, LokiJS as true/false — coerce both.
1195
+ isDeleted: raw.is_deleted === true || raw.is_deleted === 1,
1196
+ // @date maps a non-number raw column (incl. an explicit unpin null) to null; a number → Date.
1197
+ pinnedAt: typeof pinnedAt === "number" ? new Date(pinnedAt) : null
1198
+ };
1199
+ }
1200
+ async function conversationRawToStored(raw, walletAddress, signMessage, embeddedWalletSigner) {
1201
+ const baseConversation = conversationRawToStoredRaw(raw);
1202
+ if (walletAddress) {
1203
+ return await decryptConversationFields(
1204
+ baseConversation,
1205
+ walletAddress,
1206
+ signMessage,
1207
+ embeddedWalletSigner
1208
+ );
1209
+ }
1210
+ return baseConversation;
1211
+ }
1125
1212
  async function createConversationOp(ctx, opts, defaultTitle = "New Conversation") {
1126
1213
  const convId = opts?.conversationId || generateConversationId();
1127
1214
  const title = opts?.title || defaultTitle;
@@ -1161,36 +1248,51 @@ async function getConversationOp(ctx, id) {
1161
1248
  ) : null;
1162
1249
  }
1163
1250
  async function getConversationsOp(ctx) {
1164
- const results = await ctx.conversationsCollection.query(Q.where("is_deleted", false), Q.sortBy("created_at", Q.desc)).fetch();
1251
+ const results = await ctx.conversationsCollection.query(Q.where("is_deleted", false), Q.sortBy("created_at", Q.desc)).unsafeFetchRaw();
1165
1252
  return Promise.all(
1166
1253
  results.map(
1167
- (conv) => conversationToStored(conv, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
1254
+ (raw) => conversationRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
1168
1255
  )
1169
1256
  );
1170
1257
  }
1171
- function conversationToLazyStored(conversation) {
1258
+ function conversationRawToLazyStored(raw) {
1259
+ const pinnedAt = raw.pinned_at;
1172
1260
  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
1261
+ uniqueId: raw.id,
1262
+ conversationId: raw.conversation_id ?? "",
1263
+ encryptedTitle: raw.title ?? "",
1264
+ projectId: raw.project_id,
1265
+ createdAt: rawDate(raw.created_at),
1266
+ updatedAt: rawDate(raw.updated_at),
1267
+ isDeleted: raw.is_deleted === true || raw.is_deleted === 1,
1268
+ pinnedAt: typeof pinnedAt === "number" ? new Date(pinnedAt) : null
1181
1269
  };
1182
1270
  }
1183
1271
  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);
1272
+ const results = await ctx.conversationsCollection.query(Q.where("is_deleted", false), Q.sortBy("created_at", Q.desc)).unsafeFetchRaw();
1273
+ return results.map(conversationRawToLazyStored);
1274
+ }
1275
+ async function getConversationsPageOp(ctx, options) {
1276
+ const limit = Math.floor(options?.limit ?? 200);
1277
+ if (!Number.isFinite(limit) || limit < 1) return [];
1278
+ const exclude = new Set(options?.boundaryExcludeUniqueIds ?? []);
1279
+ const clauses = [Q.where("is_deleted", false)];
1280
+ if (options?.before !== void 0) {
1281
+ clauses.push(
1282
+ exclude.size > 0 ? Q.where("created_at", Q.lte(options.before)) : Q.where("created_at", Q.lt(options.before))
1283
+ );
1284
+ }
1285
+ const fetched = await ctx.conversationsCollection.query(...clauses, Q.sortBy("created_at", Q.desc), Q.take(limit + exclude.size)).unsafeFetchRaw();
1286
+ const results = exclude.size > 0 ? fetched.filter((raw) => !exclude.has(raw.id)) : fetched;
1287
+ return results.slice(0, limit).map(conversationRawToLazyStored);
1186
1288
  }
1187
1289
  async function getConversationsByProjectLazyOp(ctx, projectId) {
1188
1290
  const results = await ctx.conversationsCollection.query(
1189
1291
  Q.where("project_id", projectId === null ? "" : projectId),
1190
1292
  Q.where("is_deleted", false),
1191
1293
  Q.sortBy("created_at", Q.desc)
1192
- ).fetch();
1193
- return results.map(conversationToLazyStored);
1294
+ ).unsafeFetchRaw();
1295
+ return results.map(conversationRawToLazyStored);
1194
1296
  }
1195
1297
  async function updateConversationTitleOp(ctx, id, title) {
1196
1298
  const results = await ctx.conversationsCollection.query(Q.where("conversation_id", id), Q.where("is_deleted", false)).fetch();
@@ -1252,18 +1354,18 @@ async function getConversationsByProjectOp(ctx, projectId) {
1252
1354
  Q.where("project_id", projectId === null ? "" : projectId),
1253
1355
  Q.where("is_deleted", false),
1254
1356
  Q.sortBy("created_at", Q.desc)
1255
- ).fetch();
1357
+ ).unsafeFetchRaw();
1256
1358
  return Promise.all(
1257
1359
  results.map(
1258
- (conv) => conversationToStored(conv, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
1360
+ (raw) => conversationRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
1259
1361
  )
1260
1362
  );
1261
1363
  }
1262
1364
  async function getMessagesOp(ctx, convId) {
1263
- const results = await ctx.messagesCollection.query(Q.where("conversation_id", convId), Q.sortBy("message_id", Q.asc)).fetch();
1365
+ const results = await ctx.messagesCollection.query(Q.where("conversation_id", convId), Q.sortBy("message_id", Q.asc)).unsafeFetchRaw();
1264
1366
  return Promise.all(
1265
1367
  results.map(
1266
- (msg) => messageToStored(msg, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
1368
+ (raw) => messageRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
1267
1369
  )
1268
1370
  );
1269
1371
  }
@@ -1280,39 +1382,40 @@ async function getMessagesPageOp(ctx, convId, opts) {
1280
1382
  exclude.size > 0 ? Q.where("message_id", Q.lte(opts.beforeMessageId)) : Q.where("message_id", Q.lt(opts.beforeMessageId))
1281
1383
  );
1282
1384
  }
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);
1385
+ const fetched = await ctx.messagesCollection.query(...clauses, Q.sortBy("message_id", Q.desc), Q.take(limit + exclude.size)).unsafeFetchRaw();
1386
+ const results = (exclude.size > 0 ? fetched.filter((raw) => !exclude.has(raw.id)) : fetched).slice(0, limit);
1285
1387
  results.reverse();
1286
1388
  return Promise.all(
1287
1389
  results.map(
1288
- (msg) => messageToStored(msg, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner, {
1390
+ (raw) => messageRawToStored(raw, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner, {
1289
1391
  skipEmbeddings: true
1290
1392
  })
1291
1393
  )
1292
1394
  );
1293
1395
  }
1294
1396
  async function getMessageSkeletonsOp(ctx, convId) {
1295
- const results = await ctx.messagesCollection.query(Q.where("conversation_id", convId), Q.sortBy("message_id", Q.asc)).fetch();
1397
+ const results = await ctx.messagesCollection.query(Q.where("conversation_id", convId), Q.sortBy("message_id", Q.asc)).unsafeFetchRaw();
1296
1398
  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,
1399
+ for (const raw of results) {
1400
+ roleById.set(raw.id, raw.role);
1401
+ }
1402
+ const skeletons = results.map((raw) => ({
1403
+ uniqueId: raw.id,
1404
+ messageId: raw.message_id,
1405
+ conversationId: raw.conversation_id ?? "",
1406
+ role: raw.role ?? "",
1407
+ createdAt: rawDate(raw.created_at),
1306
1408
  // WatermelonDB surfaces unset text columns as null at runtime — normalize
1307
1409
  // to undefined so `parentMessageId ?? undefined` keying works everywhere.
1308
- parentMessageId: msg.parentMessageId ?? void 0,
1309
- model: msg.model ?? void 0
1410
+ parentMessageId: raw.parent_message_id ?? void 0,
1411
+ model: raw.model ?? void 0
1310
1412
  }));
1311
1413
  const artifactIndices = [];
1312
1414
  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") {
1415
+ const raw = results[i];
1416
+ const parentMessageId = raw.parent_message_id;
1417
+ if (raw.role !== "user" || !parentMessageId) continue;
1418
+ if (roleById.get(parentMessageId) === "user") {
1316
1419
  artifactIndices.push(i);
1317
1420
  }
1318
1421
  }
@@ -2676,967 +2779,6 @@ async function updateVaultMemoryEmbeddingOp(ctx, id, embedding, embeddingModel)
2676
2779
  // src/lib/memoryEngine/constants.ts
2677
2780
  var DEFAULT_API_EMBEDDING_MODEL = "qwen/qwen3-embedding-8b";
2678
2781
 
2679
- // src/client/core/bodySerializer.gen.ts
2680
- var jsonBodySerializer = {
2681
- bodySerializer: (body) => JSON.stringify(
2682
- body,
2683
- (_key, value) => typeof value === "bigint" ? value.toString() : value
2684
- )
2685
- };
2686
-
2687
- // src/client/core/serverSentEvents.gen.ts
2688
- var createSseClient = ({
2689
- onRequest,
2690
- onSseError,
2691
- onSseEvent,
2692
- responseTransformer,
2693
- responseValidator,
2694
- sseDefaultRetryDelay,
2695
- sseMaxRetryAttempts,
2696
- sseMaxRetryDelay,
2697
- sseSleepFn,
2698
- url,
2699
- ...options
2700
- }) => {
2701
- let lastEventId;
2702
- const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
2703
- const createStream = async function* () {
2704
- let retryDelay = sseDefaultRetryDelay ?? 3e3;
2705
- let attempt = 0;
2706
- const signal = options.signal ?? new AbortController().signal;
2707
- while (true) {
2708
- if (signal.aborted) break;
2709
- attempt++;
2710
- const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
2711
- if (lastEventId !== void 0) {
2712
- headers.set("Last-Event-ID", lastEventId);
2713
- }
2714
- try {
2715
- const requestInit = {
2716
- redirect: "follow",
2717
- ...options,
2718
- body: options.serializedBody,
2719
- headers,
2720
- signal
2721
- };
2722
- let request = new Request(url, requestInit);
2723
- if (onRequest) {
2724
- request = await onRequest(url, requestInit);
2725
- }
2726
- const _fetch = options.fetch ?? globalThis.fetch;
2727
- const response = await _fetch(request);
2728
- if (!response.ok)
2729
- throw new Error(
2730
- `SSE failed: ${response.status} ${response.statusText}`
2731
- );
2732
- if (!response.body) throw new Error("No body in SSE response");
2733
- const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
2734
- let buffer = "";
2735
- const abortHandler = () => {
2736
- try {
2737
- reader.cancel();
2738
- } catch {
2739
- }
2740
- };
2741
- signal.addEventListener("abort", abortHandler);
2742
- try {
2743
- while (true) {
2744
- const { done, value } = await reader.read();
2745
- if (done) break;
2746
- buffer += value;
2747
- const chunks = buffer.split("\n\n");
2748
- buffer = chunks.pop() ?? "";
2749
- for (const chunk of chunks) {
2750
- const lines = chunk.split("\n");
2751
- const dataLines = [];
2752
- let eventName;
2753
- for (const line of lines) {
2754
- if (line.startsWith("data:")) {
2755
- dataLines.push(line.replace(/^data:\s*/, ""));
2756
- } else if (line.startsWith("event:")) {
2757
- eventName = line.replace(/^event:\s*/, "");
2758
- } else if (line.startsWith("id:")) {
2759
- lastEventId = line.replace(/^id:\s*/, "");
2760
- } else if (line.startsWith("retry:")) {
2761
- const parsed = Number.parseInt(
2762
- line.replace(/^retry:\s*/, ""),
2763
- 10
2764
- );
2765
- if (!Number.isNaN(parsed)) {
2766
- retryDelay = parsed;
2767
- }
2768
- }
2769
- }
2770
- let data;
2771
- let parsedJson = false;
2772
- if (dataLines.length) {
2773
- const rawData = dataLines.join("\n");
2774
- try {
2775
- data = JSON.parse(rawData);
2776
- parsedJson = true;
2777
- } catch {
2778
- data = rawData;
2779
- }
2780
- }
2781
- if (parsedJson) {
2782
- if (responseValidator) {
2783
- await responseValidator(data);
2784
- }
2785
- if (responseTransformer) {
2786
- data = await responseTransformer(data);
2787
- }
2788
- }
2789
- onSseEvent?.({
2790
- data,
2791
- event: eventName,
2792
- id: lastEventId,
2793
- retry: retryDelay
2794
- });
2795
- if (dataLines.length) {
2796
- yield data;
2797
- }
2798
- }
2799
- }
2800
- } finally {
2801
- signal.removeEventListener("abort", abortHandler);
2802
- reader.releaseLock();
2803
- }
2804
- break;
2805
- } catch (error) {
2806
- onSseError?.(error);
2807
- if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
2808
- break;
2809
- }
2810
- const backoff = Math.min(
2811
- retryDelay * 2 ** (attempt - 1),
2812
- sseMaxRetryDelay ?? 3e4
2813
- );
2814
- await sleep(backoff);
2815
- }
2816
- }
2817
- };
2818
- const stream = createStream();
2819
- return { stream };
2820
- };
2821
-
2822
- // src/client/core/pathSerializer.gen.ts
2823
- var separatorArrayExplode = (style) => {
2824
- switch (style) {
2825
- case "label":
2826
- return ".";
2827
- case "matrix":
2828
- return ";";
2829
- case "simple":
2830
- return ",";
2831
- default:
2832
- return "&";
2833
- }
2834
- };
2835
- var separatorArrayNoExplode = (style) => {
2836
- switch (style) {
2837
- case "form":
2838
- return ",";
2839
- case "pipeDelimited":
2840
- return "|";
2841
- case "spaceDelimited":
2842
- return "%20";
2843
- default:
2844
- return ",";
2845
- }
2846
- };
2847
- var separatorObjectExplode = (style) => {
2848
- switch (style) {
2849
- case "label":
2850
- return ".";
2851
- case "matrix":
2852
- return ";";
2853
- case "simple":
2854
- return ",";
2855
- default:
2856
- return "&";
2857
- }
2858
- };
2859
- var serializeArrayParam = ({
2860
- allowReserved,
2861
- explode,
2862
- name,
2863
- style,
2864
- value
2865
- }) => {
2866
- if (!explode) {
2867
- const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
2868
- switch (style) {
2869
- case "label":
2870
- return `.${joinedValues2}`;
2871
- case "matrix":
2872
- return `;${name}=${joinedValues2}`;
2873
- case "simple":
2874
- return joinedValues2;
2875
- default:
2876
- return `${name}=${joinedValues2}`;
2877
- }
2878
- }
2879
- const separator = separatorArrayExplode(style);
2880
- const joinedValues = value.map((v) => {
2881
- if (style === "label" || style === "simple") {
2882
- return allowReserved ? v : encodeURIComponent(v);
2883
- }
2884
- return serializePrimitiveParam({
2885
- allowReserved,
2886
- name,
2887
- value: v
2888
- });
2889
- }).join(separator);
2890
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
2891
- };
2892
- var serializePrimitiveParam = ({
2893
- allowReserved,
2894
- name,
2895
- value
2896
- }) => {
2897
- if (value === void 0 || value === null) {
2898
- return "";
2899
- }
2900
- if (typeof value === "object") {
2901
- throw new Error(
2902
- "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
2903
- );
2904
- }
2905
- return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
2906
- };
2907
- var serializeObjectParam = ({
2908
- allowReserved,
2909
- explode,
2910
- name,
2911
- style,
2912
- value,
2913
- valueOnly
2914
- }) => {
2915
- if (value instanceof Date) {
2916
- return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
2917
- }
2918
- if (style !== "deepObject" && !explode) {
2919
- let values = [];
2920
- Object.entries(value).forEach(([key, v]) => {
2921
- values = [
2922
- ...values,
2923
- key,
2924
- allowReserved ? v : encodeURIComponent(v)
2925
- ];
2926
- });
2927
- const joinedValues2 = values.join(",");
2928
- switch (style) {
2929
- case "form":
2930
- return `${name}=${joinedValues2}`;
2931
- case "label":
2932
- return `.${joinedValues2}`;
2933
- case "matrix":
2934
- return `;${name}=${joinedValues2}`;
2935
- default:
2936
- return joinedValues2;
2937
- }
2938
- }
2939
- const separator = separatorObjectExplode(style);
2940
- const joinedValues = Object.entries(value).map(
2941
- ([key, v]) => serializePrimitiveParam({
2942
- allowReserved,
2943
- name: style === "deepObject" ? `${name}[${key}]` : key,
2944
- value: v
2945
- })
2946
- ).join(separator);
2947
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
2948
- };
2949
-
2950
- // src/client/core/utils.gen.ts
2951
- function getValidRequestBody(options) {
2952
- const hasBody = options.body !== void 0;
2953
- const isSerializedBody = hasBody && options.bodySerializer;
2954
- if (isSerializedBody) {
2955
- if ("serializedBody" in options) {
2956
- const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
2957
- return hasSerializedBody ? options.serializedBody : null;
2958
- }
2959
- return options.body !== "" ? options.body : null;
2960
- }
2961
- if (hasBody) {
2962
- return options.body;
2963
- }
2964
- return void 0;
2965
- }
2966
-
2967
- // src/client/core/auth.gen.ts
2968
- var getAuthToken = async (auth, callback) => {
2969
- const token = typeof callback === "function" ? await callback(auth) : callback;
2970
- if (!token) {
2971
- return;
2972
- }
2973
- if (auth.scheme === "bearer") {
2974
- return `Bearer ${token}`;
2975
- }
2976
- if (auth.scheme === "basic") {
2977
- return `Basic ${btoa(token)}`;
2978
- }
2979
- return token;
2980
- };
2981
-
2982
- // src/client/client/utils.gen.ts
2983
- var PATH_PARAM_RE = /\{[^{}]+\}/g;
2984
- var defaultPathSerializer = ({ path, url: _url }) => {
2985
- let url = _url;
2986
- const matches = _url.match(PATH_PARAM_RE);
2987
- if (matches) {
2988
- for (const match of matches) {
2989
- let explode = false;
2990
- let name = match.substring(1, match.length - 1);
2991
- let style = "simple";
2992
- if (name.endsWith("*")) {
2993
- explode = true;
2994
- name = name.substring(0, name.length - 1);
2995
- }
2996
- if (name.startsWith(".")) {
2997
- name = name.substring(1);
2998
- style = "label";
2999
- } else if (name.startsWith(";")) {
3000
- name = name.substring(1);
3001
- style = "matrix";
3002
- }
3003
- const value = path[name];
3004
- if (value === void 0 || value === null) {
3005
- continue;
3006
- }
3007
- if (Array.isArray(value)) {
3008
- url = url.replace(
3009
- match,
3010
- serializeArrayParam({ explode, name, style, value })
3011
- );
3012
- continue;
3013
- }
3014
- if (typeof value === "object") {
3015
- url = url.replace(
3016
- match,
3017
- serializeObjectParam({
3018
- explode,
3019
- name,
3020
- style,
3021
- value,
3022
- valueOnly: true
3023
- })
3024
- );
3025
- continue;
3026
- }
3027
- if (style === "matrix") {
3028
- url = url.replace(
3029
- match,
3030
- `;${serializePrimitiveParam({
3031
- name,
3032
- value
3033
- })}`
3034
- );
3035
- continue;
3036
- }
3037
- const replaceValue = encodeURIComponent(
3038
- style === "label" ? `.${value}` : value
3039
- );
3040
- url = url.replace(match, replaceValue);
3041
- }
3042
- }
3043
- return url;
3044
- };
3045
- var createQuerySerializer = ({
3046
- parameters = {},
3047
- ...args
3048
- } = {}) => {
3049
- const querySerializer = (queryParams) => {
3050
- const search = [];
3051
- if (queryParams && typeof queryParams === "object") {
3052
- for (const name in queryParams) {
3053
- const value = queryParams[name];
3054
- if (value === void 0 || value === null) {
3055
- continue;
3056
- }
3057
- const options = parameters[name] || args;
3058
- if (Array.isArray(value)) {
3059
- const serializedArray = serializeArrayParam({
3060
- allowReserved: options.allowReserved,
3061
- explode: true,
3062
- name,
3063
- style: "form",
3064
- value,
3065
- ...options.array
3066
- });
3067
- if (serializedArray) search.push(serializedArray);
3068
- } else if (typeof value === "object") {
3069
- const serializedObject = serializeObjectParam({
3070
- allowReserved: options.allowReserved,
3071
- explode: true,
3072
- name,
3073
- style: "deepObject",
3074
- value,
3075
- ...options.object
3076
- });
3077
- if (serializedObject) search.push(serializedObject);
3078
- } else {
3079
- const serializedPrimitive = serializePrimitiveParam({
3080
- allowReserved: options.allowReserved,
3081
- name,
3082
- value
3083
- });
3084
- if (serializedPrimitive) search.push(serializedPrimitive);
3085
- }
3086
- }
3087
- }
3088
- return search.join("&");
3089
- };
3090
- return querySerializer;
3091
- };
3092
- var getParseAs = (contentType) => {
3093
- if (!contentType) {
3094
- return "stream";
3095
- }
3096
- const cleanContent = contentType.split(";")[0]?.trim();
3097
- if (!cleanContent) {
3098
- return;
3099
- }
3100
- if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
3101
- return "json";
3102
- }
3103
- if (cleanContent === "multipart/form-data") {
3104
- return "formData";
3105
- }
3106
- if (["application/", "audio/", "image/", "video/"].some(
3107
- (type) => cleanContent.startsWith(type)
3108
- )) {
3109
- return "blob";
3110
- }
3111
- if (cleanContent.startsWith("text/")) {
3112
- return "text";
3113
- }
3114
- return;
3115
- };
3116
- var checkForExistence = (options, name) => {
3117
- if (!name) {
3118
- return false;
3119
- }
3120
- if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
3121
- return true;
3122
- }
3123
- return false;
3124
- };
3125
- var setAuthParams = async ({
3126
- security,
3127
- ...options
3128
- }) => {
3129
- for (const auth of security) {
3130
- if (checkForExistence(options, auth.name)) {
3131
- continue;
3132
- }
3133
- const token = await getAuthToken(auth, options.auth);
3134
- if (!token) {
3135
- continue;
3136
- }
3137
- const name = auth.name ?? "Authorization";
3138
- switch (auth.in) {
3139
- case "query":
3140
- if (!options.query) {
3141
- options.query = {};
3142
- }
3143
- options.query[name] = token;
3144
- break;
3145
- case "cookie":
3146
- options.headers.append("Cookie", `${name}=${token}`);
3147
- break;
3148
- case "header":
3149
- default:
3150
- options.headers.set(name, token);
3151
- break;
3152
- }
3153
- }
3154
- };
3155
- var buildUrl = (options) => {
3156
- const url = getUrl({
3157
- baseUrl: options.baseUrl,
3158
- path: options.path,
3159
- query: options.query,
3160
- querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
3161
- url: options.url
3162
- });
3163
- return url;
3164
- };
3165
- var getUrl = ({
3166
- baseUrl,
3167
- path,
3168
- query,
3169
- querySerializer,
3170
- url: _url
3171
- }) => {
3172
- const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
3173
- let url = (baseUrl ?? "") + pathUrl;
3174
- if (path) {
3175
- url = defaultPathSerializer({ path, url });
3176
- }
3177
- let search = query ? querySerializer(query) : "";
3178
- if (search.startsWith("?")) {
3179
- search = search.substring(1);
3180
- }
3181
- if (search) {
3182
- url += `?${search}`;
3183
- }
3184
- return url;
3185
- };
3186
- var mergeConfigs = (a, b) => {
3187
- const config = { ...a, ...b };
3188
- if (config.baseUrl?.endsWith("/")) {
3189
- config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
3190
- }
3191
- config.headers = mergeHeaders(a.headers, b.headers);
3192
- return config;
3193
- };
3194
- var headersEntries = (headers) => {
3195
- const entries = [];
3196
- headers.forEach((value, key) => {
3197
- entries.push([key, value]);
3198
- });
3199
- return entries;
3200
- };
3201
- var mergeHeaders = (...headers) => {
3202
- const mergedHeaders = new Headers();
3203
- for (const header of headers) {
3204
- if (!header || typeof header !== "object") {
3205
- continue;
3206
- }
3207
- const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
3208
- for (const [key, value] of iterator) {
3209
- if (value === null) {
3210
- mergedHeaders.delete(key);
3211
- } else if (Array.isArray(value)) {
3212
- for (const v of value) {
3213
- mergedHeaders.append(key, v);
3214
- }
3215
- } else if (value !== void 0) {
3216
- mergedHeaders.set(
3217
- key,
3218
- typeof value === "object" ? JSON.stringify(value) : value
3219
- );
3220
- }
3221
- }
3222
- }
3223
- return mergedHeaders;
3224
- };
3225
- var Interceptors = class {
3226
- constructor() {
3227
- this.fns = [];
3228
- }
3229
- clear() {
3230
- this.fns = [];
3231
- }
3232
- eject(id) {
3233
- const index = this.getInterceptorIndex(id);
3234
- if (this.fns[index]) {
3235
- this.fns[index] = null;
3236
- }
3237
- }
3238
- exists(id) {
3239
- const index = this.getInterceptorIndex(id);
3240
- return Boolean(this.fns[index]);
3241
- }
3242
- getInterceptorIndex(id) {
3243
- if (typeof id === "number") {
3244
- return this.fns[id] ? id : -1;
3245
- }
3246
- return this.fns.indexOf(id);
3247
- }
3248
- update(id, fn) {
3249
- const index = this.getInterceptorIndex(id);
3250
- if (this.fns[index]) {
3251
- this.fns[index] = fn;
3252
- return id;
3253
- }
3254
- return false;
3255
- }
3256
- use(fn) {
3257
- this.fns.push(fn);
3258
- return this.fns.length - 1;
3259
- }
3260
- };
3261
- var createInterceptors = () => ({
3262
- error: new Interceptors(),
3263
- request: new Interceptors(),
3264
- response: new Interceptors()
3265
- });
3266
- var defaultQuerySerializer = createQuerySerializer({
3267
- allowReserved: false,
3268
- array: {
3269
- explode: true,
3270
- style: "form"
3271
- },
3272
- object: {
3273
- explode: true,
3274
- style: "deepObject"
3275
- }
3276
- });
3277
- var defaultHeaders = {
3278
- "Content-Type": "application/json"
3279
- };
3280
- var createConfig = (override = {}) => ({
3281
- ...jsonBodySerializer,
3282
- headers: defaultHeaders,
3283
- parseAs: "auto",
3284
- querySerializer: defaultQuerySerializer,
3285
- ...override
3286
- });
3287
-
3288
- // src/client/client/client.gen.ts
3289
- var createClient = (config = {}) => {
3290
- let _config = mergeConfigs(createConfig(), config);
3291
- const getConfig = () => ({ ..._config });
3292
- const setConfig = (config2) => {
3293
- _config = mergeConfigs(_config, config2);
3294
- return getConfig();
3295
- };
3296
- const interceptors = createInterceptors();
3297
- const beforeRequest = async (options) => {
3298
- const opts = {
3299
- ..._config,
3300
- ...options,
3301
- fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
3302
- headers: mergeHeaders(_config.headers, options.headers),
3303
- serializedBody: void 0
3304
- };
3305
- if (opts.security) {
3306
- await setAuthParams({
3307
- ...opts,
3308
- security: opts.security
3309
- });
3310
- }
3311
- if (opts.requestValidator) {
3312
- await opts.requestValidator(opts);
3313
- }
3314
- if (opts.body !== void 0 && opts.bodySerializer) {
3315
- opts.serializedBody = opts.bodySerializer(opts.body);
3316
- }
3317
- if (opts.body === void 0 || opts.serializedBody === "") {
3318
- opts.headers.delete("Content-Type");
3319
- }
3320
- const url = buildUrl(opts);
3321
- return { opts, url };
3322
- };
3323
- const request = async (options) => {
3324
- const { opts, url } = await beforeRequest(options);
3325
- for (const fn of interceptors.request.fns) {
3326
- if (fn) {
3327
- await fn(opts);
3328
- }
3329
- }
3330
- const _fetch = opts.fetch;
3331
- const requestInit = {
3332
- ...opts,
3333
- body: getValidRequestBody(opts)
3334
- };
3335
- let response = await _fetch(url, requestInit);
3336
- for (const fn of interceptors.response.fns) {
3337
- if (fn) {
3338
- response = await fn(response, opts);
3339
- }
3340
- }
3341
- const result = {
3342
- response
3343
- };
3344
- if (response.ok) {
3345
- const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
3346
- if (response.status === 204 || response.headers.get("Content-Length") === "0") {
3347
- let emptyData;
3348
- switch (parseAs) {
3349
- case "arrayBuffer":
3350
- case "blob":
3351
- case "text":
3352
- emptyData = await response[parseAs]();
3353
- break;
3354
- case "formData":
3355
- emptyData = new FormData();
3356
- break;
3357
- case "stream":
3358
- emptyData = response.body;
3359
- break;
3360
- case "json":
3361
- default:
3362
- emptyData = {};
3363
- break;
3364
- }
3365
- return {
3366
- data: emptyData,
3367
- ...result
3368
- };
3369
- }
3370
- let data;
3371
- switch (parseAs) {
3372
- case "arrayBuffer":
3373
- case "blob":
3374
- case "formData":
3375
- case "json":
3376
- case "text":
3377
- data = await response[parseAs]();
3378
- break;
3379
- case "stream":
3380
- return {
3381
- data: response.body,
3382
- ...result
3383
- };
3384
- }
3385
- if (parseAs === "json") {
3386
- if (opts.responseValidator) {
3387
- await opts.responseValidator(data);
3388
- }
3389
- if (opts.responseTransformer) {
3390
- data = await opts.responseTransformer(data);
3391
- }
3392
- }
3393
- return {
3394
- data,
3395
- ...result
3396
- };
3397
- }
3398
- const textError = await response.text();
3399
- let jsonError;
3400
- try {
3401
- jsonError = JSON.parse(textError);
3402
- } catch {
3403
- }
3404
- const error = jsonError ?? textError;
3405
- let finalError = error;
3406
- for (const fn of interceptors.error.fns) {
3407
- if (fn) {
3408
- finalError = await fn(error, response, opts);
3409
- }
3410
- }
3411
- finalError = finalError || {};
3412
- if (opts.throwOnError) {
3413
- throw finalError;
3414
- }
3415
- return {
3416
- error: finalError,
3417
- ...result
3418
- };
3419
- };
3420
- const makeMethodFn = (method) => (options) => request({ ...options, method });
3421
- const makeSseFn = (method) => async (options) => {
3422
- const { opts, url } = await beforeRequest(options);
3423
- return createSseClient({
3424
- ...opts,
3425
- body: opts.body,
3426
- headers: opts.headers,
3427
- method,
3428
- onRequest: async (url2, init) => {
3429
- let request2 = new Request(url2, init);
3430
- const requestInit = {
3431
- ...init,
3432
- method: init.method,
3433
- url: url2
3434
- };
3435
- for (const fn of interceptors.request.fns) {
3436
- if (fn) {
3437
- await fn(requestInit);
3438
- request2 = new Request(requestInit.url, requestInit);
3439
- }
3440
- }
3441
- return request2;
3442
- },
3443
- url
3444
- });
3445
- };
3446
- return {
3447
- buildUrl,
3448
- connect: makeMethodFn("CONNECT"),
3449
- delete: makeMethodFn("DELETE"),
3450
- get: makeMethodFn("GET"),
3451
- getConfig,
3452
- head: makeMethodFn("HEAD"),
3453
- interceptors,
3454
- options: makeMethodFn("OPTIONS"),
3455
- patch: makeMethodFn("PATCH"),
3456
- post: makeMethodFn("POST"),
3457
- put: makeMethodFn("PUT"),
3458
- request,
3459
- setConfig,
3460
- sse: {
3461
- connect: makeSseFn("CONNECT"),
3462
- delete: makeSseFn("DELETE"),
3463
- get: makeSseFn("GET"),
3464
- head: makeSseFn("HEAD"),
3465
- options: makeSseFn("OPTIONS"),
3466
- patch: makeSseFn("PATCH"),
3467
- post: makeSseFn("POST"),
3468
- put: makeSseFn("PUT"),
3469
- trace: makeSseFn("TRACE")
3470
- },
3471
- trace: makeMethodFn("TRACE")
3472
- };
3473
- };
3474
-
3475
- // src/client/client.gen.ts
3476
- var client = createClient(createClientConfig(createConfig()));
3477
-
3478
- // src/client/sdk.gen.ts
3479
- var getApiV1Config = (options) => {
3480
- return (options?.client ?? client).get({
3481
- url: "/api/v1/config",
3482
- ...options
3483
- });
3484
- };
3485
- var getApiV1CreditsBalance = (options) => {
3486
- return (options?.client ?? client).get({
3487
- url: "/api/v1/credits/balance",
3488
- ...options
3489
- });
3490
- };
3491
- var getApiV1CreditsPacks = (options) => {
3492
- return (options?.client ?? client).get({
3493
- url: "/api/v1/credits/packs",
3494
- ...options
3495
- });
3496
- };
3497
- var postApiV1CreditsPurchase = (options) => {
3498
- return (options.client ?? client).post({
3499
- url: "/api/v1/credits/purchase",
3500
- ...options,
3501
- headers: {
3502
- "Content-Type": "application/json",
3503
- ...options.headers
3504
- }
3505
- });
3506
- };
3507
- var postApiV1Embeddings = (options) => {
3508
- return (options.client ?? client).post({
3509
- url: "/api/v1/embeddings",
3510
- ...options,
3511
- headers: {
3512
- "Content-Type": "application/json",
3513
- ...options.headers
3514
- }
3515
- });
3516
- };
3517
- var getApiV1Models = (options) => {
3518
- return (options?.client ?? client).get({
3519
- url: "/api/v1/models",
3520
- ...options
3521
- });
3522
- };
3523
- var postApiV1PhoneCalls = (options) => {
3524
- return (options.client ?? client).post({
3525
- url: "/api/v1/phone-calls",
3526
- ...options,
3527
- headers: {
3528
- "Content-Type": "application/json",
3529
- ...options.headers
3530
- }
3531
- });
3532
- };
3533
- var getApiV1PhoneCallsByCallId = (options) => {
3534
- return (options.client ?? client).get({
3535
- url: "/api/v1/phone-calls/{call_id}",
3536
- ...options
3537
- });
3538
- };
3539
- var postApiV1SubscriptionsCancel = (options) => {
3540
- return (options?.client ?? client).post({
3541
- url: "/api/v1/subscriptions/cancel",
3542
- ...options,
3543
- headers: {
3544
- "Content-Type": "application/json",
3545
- ...options?.headers
3546
- }
3547
- });
3548
- };
3549
- var postApiV1SubscriptionsCreateCheckoutSession = (options) => {
3550
- return (options.client ?? client).post({
3551
- url: "/api/v1/subscriptions/create-checkout-session",
3552
- ...options,
3553
- headers: {
3554
- "Content-Type": "application/json",
3555
- ...options.headers
3556
- }
3557
- });
3558
- };
3559
- var postApiV1SubscriptionsCustomerPortal = (options) => {
3560
- return (options.client ?? client).post({
3561
- url: "/api/v1/subscriptions/customer-portal",
3562
- ...options,
3563
- headers: {
3564
- "Content-Type": "application/json",
3565
- ...options.headers
3566
- }
3567
- });
3568
- };
3569
- var postApiV1SubscriptionsRenew = (options) => {
3570
- return (options?.client ?? client).post({
3571
- url: "/api/v1/subscriptions/renew",
3572
- ...options
3573
- });
3574
- };
3575
- var getApiV1SubscriptionsStatus = (options) => {
3576
- return (options?.client ?? client).get({
3577
- url: "/api/v1/subscriptions/status",
3578
- ...options
3579
- });
3580
- };
3581
- var getApiV1WalletsBinding = (options) => {
3582
- return (options?.client ?? client).get({
3583
- url: "/api/v1/wallets/binding",
3584
- ...options
3585
- });
3586
- };
3587
- var postApiV1WalletsBinding = (options) => {
3588
- return (options.client ?? client).post({
3589
- url: "/api/v1/wallets/binding",
3590
- ...options,
3591
- headers: {
3592
- "Content-Type": "application/json",
3593
- ...options.headers
3594
- }
3595
- });
3596
- };
3597
- var postApiV1WalletsBindingNonce = (options) => {
3598
- return (options?.client ?? client).post({
3599
- url: "/api/v1/wallets/binding/nonce",
3600
- ...options
3601
- });
3602
- };
3603
- var deleteApiV1WalletsBindingByAddress = (options) => {
3604
- return (options.client ?? client).delete({
3605
- url: "/api/v1/wallets/binding/{address}",
3606
- ...options
3607
- });
3608
- };
3609
- var postAuthOauthByProviderExchange = (options) => {
3610
- return (options.client ?? client).post({
3611
- url: "/auth/oauth/{provider}/exchange",
3612
- ...options,
3613
- headers: {
3614
- "Content-Type": "application/json",
3615
- ...options.headers
3616
- }
3617
- });
3618
- };
3619
- var postAuthOauthByProviderRefresh = (options) => {
3620
- return (options.client ?? client).post({
3621
- url: "/auth/oauth/{provider}/refresh",
3622
- ...options,
3623
- headers: {
3624
- "Content-Type": "application/json",
3625
- ...options.headers
3626
- }
3627
- });
3628
- };
3629
- var postAuthOauthByProviderRevoke = (options) => {
3630
- return (options.client ?? client).post({
3631
- url: "/auth/oauth/{provider}/revoke",
3632
- ...options,
3633
- headers: {
3634
- "Content-Type": "application/json",
3635
- ...options.headers
3636
- }
3637
- });
3638
- };
3639
-
3640
2782
  // src/lib/memoryEngine/chunking.ts
3641
2783
  var DEFAULT_CHUNK_SIZE = 400;
3642
2784
  var DEFAULT_CHUNK_OVERLAP = 50;
@@ -3772,8 +2914,8 @@ function shouldChunkMessage(content, chunkSize = DEFAULT_CHUNK_SIZE) {
3772
2914
  return content.length > chunkSize;
3773
2915
  }
3774
2916
 
3775
- // src/lib/memoryEngine/embeddings.ts
3776
- var DEFAULT_MIN_CONTENT_LENGTH = 10;
2917
+ // src/lib/memoryEngine/generate.ts
2918
+ import { postApiV1Embeddings } from "@anuma/sdk";
3777
2919
  var EMBED_MAX_ATTEMPTS = 4;
3778
2920
  async function withEmbeddingRetry(call) {
3779
2921
  let last;
@@ -3817,7 +2959,7 @@ async function generateEmbedding(text, options) {
3817
2959
  const { baseUrl = BASE_URL, getToken, apiKey, model, cache } = options;
3818
2960
  if (cache) {
3819
2961
  const cached = cache.get(text);
3820
- if (cached) return cached;
2962
+ if (cached) return Array.from(cached);
3821
2963
  }
3822
2964
  let headers;
3823
2965
  if (apiKey) {
@@ -3856,10 +2998,11 @@ async function generateEmbedding(text, options) {
3856
2998
  totalTokens: response.data.usage.total_tokens ?? 0
3857
2999
  });
3858
3000
  }
3001
+ const f32Embedding = Float32Array.from(embedding);
3859
3002
  if (cache) {
3860
- cache.set(text, embedding);
3003
+ cache.set(text, f32Embedding);
3861
3004
  }
3862
- return embedding;
3005
+ return Array.from(f32Embedding);
3863
3006
  }
3864
3007
  var DEFAULT_EMBEDDING_BATCH_SIZE = 100;
3865
3008
  var DEFAULT_EMBEDDING_BATCH_CONCURRENCY = 3;
@@ -3897,7 +3040,7 @@ async function generateEmbeddings(texts, options) {
3897
3040
  if (cache) {
3898
3041
  const cached = cache.get(texts[i]);
3899
3042
  if (cached) {
3900
- results[i] = cached;
3043
+ results[i] = Array.from(cached);
3901
3044
  continue;
3902
3045
  }
3903
3046
  }
@@ -3958,13 +3101,17 @@ async function generateEmbeddings(texts, options) {
3958
3101
  newEmbeddings = allEmbeddings.flat();
3959
3102
  }
3960
3103
  for (let i = 0; i < uncachedIndices.length; i++) {
3961
- results[uncachedIndices[i]] = newEmbeddings[i];
3104
+ const f32Embedding = Float32Array.from(newEmbeddings[i]);
3105
+ results[uncachedIndices[i]] = Array.from(f32Embedding);
3962
3106
  if (cache) {
3963
- cache.set(uncachedTexts[i], newEmbeddings[i]);
3107
+ cache.set(uncachedTexts[i], f32Embedding);
3964
3108
  }
3965
3109
  }
3966
3110
  return results;
3967
3111
  }
3112
+
3113
+ // src/lib/memoryEngine/embeddings.ts
3114
+ var DEFAULT_MIN_CONTENT_LENGTH = 10;
3968
3115
  async function embedMessage(ctx, messageId, options) {
3969
3116
  let message;
3970
3117
  const conversations = await getConversationsOp(ctx);
@@ -5384,7 +4531,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
5384
4531
  legacy.map((r) => ({ id: r.uniqueId, content: r.content, score: r.similarity }))
5385
4532
  );
5386
4533
  }
5387
- const { recall: recall2 } = await import("./recall-PV7L3SN3.mjs");
4534
+ const { recall: recall2 } = await import("./recall-FPACUZGD.mjs");
5388
4535
  const result = await recall2(
5389
4536
  query,
5390
4537
  { vaultCtx, embeddingOptions, vaultCache: cache },
@@ -6004,26 +5151,6 @@ function toChunkMemory(r) {
6004
5151
  }
6005
5152
 
6006
5153
  export {
6007
- createSseClient,
6008
- getApiV1Config,
6009
- getApiV1CreditsBalance,
6010
- getApiV1CreditsPacks,
6011
- postApiV1CreditsPurchase,
6012
- getApiV1Models,
6013
- postApiV1PhoneCalls,
6014
- getApiV1PhoneCallsByCallId,
6015
- postApiV1SubscriptionsCancel,
6016
- postApiV1SubscriptionsCreateCheckoutSession,
6017
- postApiV1SubscriptionsCustomerPortal,
6018
- postApiV1SubscriptionsRenew,
6019
- getApiV1SubscriptionsStatus,
6020
- getApiV1WalletsBinding,
6021
- postApiV1WalletsBinding,
6022
- postApiV1WalletsBindingNonce,
6023
- deleteApiV1WalletsBindingByAddress,
6024
- postAuthOauthByProviderExchange,
6025
- postAuthOauthByProviderRefresh,
6026
- postAuthOauthByProviderRevoke,
6027
5154
  onClearAllEncryptionState,
6028
5155
  onKeyAvailable,
6029
5156
  clearEncryptionKey,
@@ -6068,6 +5195,7 @@ export {
6068
5195
  getConversationOp,
6069
5196
  getConversationsOp,
6070
5197
  getConversationsLazyOp,
5198
+ getConversationsPageOp,
6071
5199
  getConversationsByProjectLazyOp,
6072
5200
  updateConversationTitleOp,
6073
5201
  deleteConversationOp,
@@ -6096,9 +5224,9 @@ export {
6096
5224
  chunkText,
6097
5225
  shouldChunkMessage,
6098
5226
  DEFAULT_API_EMBEDDING_MODEL,
6099
- DEFAULT_MIN_CONTENT_LENGTH,
6100
5227
  generateEmbedding,
6101
5228
  generateEmbeddings,
5229
+ DEFAULT_MIN_CONTENT_LENGTH,
6102
5230
  embedMessage,
6103
5231
  embedAllMessages,
6104
5232
  chunkAndEmbedMessage,