@reverbia/sdk 1.0.0-next.20251217123222 → 1.0.0-next.20251217134403

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.
@@ -34,6 +34,8 @@ __export(index_exports, {
34
34
  ChatMessage: () => Message,
35
35
  DEFAULT_TOOL_SELECTOR_MODEL: () => DEFAULT_TOOL_SELECTOR_MODEL,
36
36
  StoredMemoryModel: () => Memory,
37
+ StoredModelPreferenceModel: () => ModelPreference,
38
+ chatStorageMigrations: () => chatStorageMigrations,
37
39
  chatStorageSchema: () => chatStorageSchema,
38
40
  createMemoryContextSystemMessage: () => createMemoryContextSystemMessage,
39
41
  decryptData: () => decryptData,
@@ -49,6 +51,7 @@ __export(index_exports, {
49
51
  memoryStorageSchema: () => memoryStorageSchema,
50
52
  requestEncryptionKey: () => requestEncryptionKey,
51
53
  selectTool: () => selectTool,
54
+ settingsStorageSchema: () => settingsStorageSchema,
52
55
  useChat: () => useChat,
53
56
  useChatStorage: () => useChatStorage,
54
57
  useEncryption: () => useEncryption,
@@ -57,7 +60,8 @@ __export(index_exports, {
57
60
  useModels: () => useModels,
58
61
  useOCR: () => useOCR,
59
62
  usePdf: () => usePdf,
60
- useSearch: () => useSearch
63
+ useSearch: () => useSearch,
64
+ useSettings: () => useSettings
61
65
  });
62
66
  module.exports = __toCommonJS(index_exports);
63
67
 
@@ -1503,20 +1507,42 @@ Please inform the user about this issue and try to help them alternatively.`
1503
1507
  }
1504
1508
  });
1505
1509
  const accumulator = createStreamAccumulator();
1506
- for await (const chunk of sseResult.stream) {
1507
- if (isDoneMarker(chunk)) {
1508
- continue;
1509
- }
1510
- if (chunk && typeof chunk === "object") {
1511
- const contentDelta = processStreamingChunk(
1512
- chunk,
1513
- accumulator
1514
- );
1515
- if (contentDelta) {
1516
- if (onData) onData(contentDelta);
1517
- if (globalOnData) globalOnData(contentDelta);
1510
+ try {
1511
+ for await (const chunk of sseResult.stream) {
1512
+ if (isDoneMarker(chunk)) {
1513
+ continue;
1514
+ }
1515
+ if (chunk && typeof chunk === "object") {
1516
+ const contentDelta = processStreamingChunk(
1517
+ chunk,
1518
+ accumulator
1519
+ );
1520
+ if (contentDelta) {
1521
+ if (onData) onData(contentDelta);
1522
+ if (globalOnData) globalOnData(contentDelta);
1523
+ }
1518
1524
  }
1519
1525
  }
1526
+ } catch (streamErr) {
1527
+ if (isAbortError(streamErr) || abortController.signal.aborted) {
1528
+ setIsLoading(false);
1529
+ const partialCompletion = buildCompletionResponse(accumulator);
1530
+ return {
1531
+ data: partialCompletion,
1532
+ error: "Request aborted",
1533
+ toolExecution: toolExecutionResult
1534
+ };
1535
+ }
1536
+ throw streamErr;
1537
+ }
1538
+ if (abortController.signal.aborted) {
1539
+ setIsLoading(false);
1540
+ const partialCompletion = buildCompletionResponse(accumulator);
1541
+ return {
1542
+ data: partialCompletion,
1543
+ error: "Request aborted",
1544
+ toolExecution: toolExecutionResult
1545
+ };
1520
1546
  }
1521
1547
  if (sseError) {
1522
1548
  throw sseError;
@@ -1741,7 +1767,8 @@ function messageToStored(message) {
1741
1767
  embeddingModel: message.embeddingModel,
1742
1768
  usage: message.usage,
1743
1769
  sources: message.sources,
1744
- responseDuration: message.responseDuration
1770
+ responseDuration: message.responseDuration,
1771
+ wasStopped: message.wasStopped
1745
1772
  };
1746
1773
  }
1747
1774
  function conversationToStored(conversation) {
@@ -1830,6 +1857,7 @@ async function createMessageOp(ctx, opts) {
1830
1857
  msg._setRaw("response_duration", opts.responseDuration);
1831
1858
  if (opts.vector) msg._setRaw("vector", JSON.stringify(opts.vector));
1832
1859
  if (opts.embeddingModel) msg._setRaw("embedding_model", opts.embeddingModel);
1860
+ if (opts.wasStopped) msg._setRaw("was_stopped", opts.wasStopped);
1833
1861
  });
1834
1862
  });
1835
1863
  return messageToStored(created);
@@ -2120,6 +2148,45 @@ function useChatStorage(options) {
2120
2148
  });
2121
2149
  const responseDuration = (Date.now() - startTime) / 1e3;
2122
2150
  if (result.error || !result.data) {
2151
+ const abortedResult = result;
2152
+ if (abortedResult.error === "Request aborted") {
2153
+ const assistantContent2 = abortedResult.data?.choices?.[0]?.message?.content?.map((part) => part.text || "").join("") || "";
2154
+ const responseModel = abortedResult.data?.model || model || "";
2155
+ let storedAssistantMessage2;
2156
+ try {
2157
+ storedAssistantMessage2 = await createMessageOp(storageCtx, {
2158
+ conversationId: convId,
2159
+ role: "assistant",
2160
+ content: assistantContent2,
2161
+ model: responseModel,
2162
+ usage: convertUsageToStored(abortedResult.data?.usage),
2163
+ responseDuration,
2164
+ wasStopped: true
2165
+ });
2166
+ const completionData = abortedResult.data || {
2167
+ id: `aborted-${Date.now()}`,
2168
+ model: responseModel,
2169
+ choices: [{
2170
+ index: 0,
2171
+ message: {
2172
+ role: "assistant",
2173
+ content: [{ type: "text", text: assistantContent2 }]
2174
+ },
2175
+ finish_reason: "stop"
2176
+ }],
2177
+ usage: void 0
2178
+ };
2179
+ return {
2180
+ data: completionData,
2181
+ error: null,
2182
+ // Treat as success to the caller
2183
+ toolExecution: abortedResult.toolExecution,
2184
+ userMessage: storedUserMessage,
2185
+ assistantMessage: storedAssistantMessage2
2186
+ };
2187
+ } catch (err) {
2188
+ }
2189
+ }
2123
2190
  return {
2124
2191
  data: null,
2125
2192
  error: result.error || "No response data received",
@@ -2191,8 +2258,9 @@ function useChatStorage(options) {
2191
2258
 
2192
2259
  // src/lib/chatStorage/schema.ts
2193
2260
  var import_watermelondb2 = require("@nozbe/watermelondb");
2261
+ var import_migrations = require("@nozbe/watermelondb/Schema/migrations");
2194
2262
  var chatStorageSchema = (0, import_watermelondb2.appSchema)({
2195
- version: 1,
2263
+ version: 2,
2196
2264
  tables: [
2197
2265
  (0, import_watermelondb2.tableSchema)({
2198
2266
  name: "history",
@@ -2215,7 +2283,8 @@ var chatStorageSchema = (0, import_watermelondb2.appSchema)({
2215
2283
  // JSON stringified ChatCompletionUsage
2216
2284
  { name: "sources", type: "string", isOptional: true },
2217
2285
  // JSON stringified SearchSource[]
2218
- { name: "response_duration", type: "number", isOptional: true }
2286
+ { name: "response_duration", type: "number", isOptional: true },
2287
+ { name: "was_stopped", type: "boolean", isOptional: true }
2219
2288
  ]
2220
2289
  }),
2221
2290
  (0, import_watermelondb2.tableSchema)({
@@ -2230,6 +2299,21 @@ var chatStorageSchema = (0, import_watermelondb2.appSchema)({
2230
2299
  })
2231
2300
  ]
2232
2301
  });
2302
+ var chatStorageMigrations = (0, import_migrations.schemaMigrations)({
2303
+ migrations: [
2304
+ {
2305
+ toVersion: 2,
2306
+ steps: [
2307
+ (0, import_migrations.addColumns)({
2308
+ table: "history",
2309
+ columns: [
2310
+ { name: "was_stopped", type: "boolean", isOptional: true }
2311
+ ]
2312
+ })
2313
+ ]
2314
+ }
2315
+ ]
2316
+ });
2233
2317
 
2234
2318
  // src/lib/chatStorage/models.ts
2235
2319
  var import_watermelondb3 = require("@nozbe/watermelondb");
@@ -2313,6 +2397,10 @@ var Message = class extends import_watermelondb3.Model {
2313
2397
  const value = this._getRaw("response_duration");
2314
2398
  return value !== null && value !== void 0 ? value : void 0;
2315
2399
  }
2400
+ /** Whether the message generation was stopped by the user */
2401
+ get wasStopped() {
2402
+ return this._getRaw("was_stopped");
2403
+ }
2316
2404
  };
2317
2405
  Message.table = "history";
2318
2406
  Message.associations = {
@@ -3515,9 +3603,181 @@ var Memory = class extends import_watermelondb6.Model {
3515
3603
  };
3516
3604
  Memory.table = "memories";
3517
3605
 
3518
- // src/react/usePdf.ts
3606
+ // src/react/useSettings.ts
3519
3607
  var import_react4 = require("react");
3520
3608
 
3609
+ // src/lib/settingsStorage/operations.ts
3610
+ var import_watermelondb7 = require("@nozbe/watermelondb");
3611
+ function modelPreferenceToStored(preference) {
3612
+ return {
3613
+ uniqueId: preference.id,
3614
+ walletAddress: preference.walletAddress,
3615
+ models: preference.models
3616
+ };
3617
+ }
3618
+ async function getModelPreferenceOp(ctx, walletAddress) {
3619
+ const results = await ctx.modelPreferencesCollection.query(import_watermelondb7.Q.where("wallet_address", walletAddress)).fetch();
3620
+ return results.length > 0 ? modelPreferenceToStored(results[0]) : null;
3621
+ }
3622
+ async function setModelPreferenceOp(ctx, walletAddress, models) {
3623
+ const result = await ctx.database.write(async () => {
3624
+ const results = await ctx.modelPreferencesCollection.query(import_watermelondb7.Q.where("wallet_address", walletAddress)).fetch();
3625
+ if (results.length > 0) {
3626
+ const preference = results[0];
3627
+ await preference.update((pref) => {
3628
+ if (models !== void 0) {
3629
+ pref._setRaw("models", models || null);
3630
+ }
3631
+ });
3632
+ return preference;
3633
+ }
3634
+ return await ctx.modelPreferencesCollection.create((pref) => {
3635
+ pref._setRaw("wallet_address", walletAddress);
3636
+ if (models) pref._setRaw("models", models);
3637
+ });
3638
+ });
3639
+ return modelPreferenceToStored(result);
3640
+ }
3641
+ async function deleteModelPreferenceOp(ctx, walletAddress) {
3642
+ const results = await ctx.modelPreferencesCollection.query(import_watermelondb7.Q.where("wallet_address", walletAddress)).fetch();
3643
+ if (results.length === 0) return false;
3644
+ await ctx.database.write(async () => {
3645
+ await results[0].destroyPermanently();
3646
+ });
3647
+ return true;
3648
+ }
3649
+
3650
+ // src/react/useSettings.ts
3651
+ function useSettings(options) {
3652
+ const { database, walletAddress } = options;
3653
+ const [modelPreference, setModelPreferenceState] = (0, import_react4.useState)(null);
3654
+ const [isLoading, setIsLoading] = (0, import_react4.useState)(false);
3655
+ const modelPreferencesCollection = (0, import_react4.useMemo)(
3656
+ () => database.get("modelPreferences"),
3657
+ [database]
3658
+ );
3659
+ const storageCtx = (0, import_react4.useMemo)(
3660
+ () => ({
3661
+ database,
3662
+ modelPreferencesCollection
3663
+ }),
3664
+ [database, modelPreferencesCollection]
3665
+ );
3666
+ const getModelPreference = (0, import_react4.useCallback)(
3667
+ async (address) => {
3668
+ try {
3669
+ if (!address) throw new Error("Wallet address is required");
3670
+ const result = await getModelPreferenceOp(storageCtx, address);
3671
+ return result;
3672
+ } catch (error) {
3673
+ throw new Error(
3674
+ error instanceof Error ? error.message : "An unknown error occurred"
3675
+ );
3676
+ }
3677
+ },
3678
+ [storageCtx]
3679
+ );
3680
+ const setModelPreference = (0, import_react4.useCallback)(
3681
+ async (address, models) => {
3682
+ try {
3683
+ if (!address) throw new Error("Wallet address is required");
3684
+ const result = await setModelPreferenceOp(storageCtx, address, models);
3685
+ if (walletAddress && address === walletAddress) {
3686
+ setModelPreferenceState(result);
3687
+ }
3688
+ return result;
3689
+ } catch (error) {
3690
+ throw new Error(
3691
+ error instanceof Error ? error.message : "An unknown error occurred"
3692
+ );
3693
+ }
3694
+ },
3695
+ [storageCtx, walletAddress]
3696
+ );
3697
+ const deleteModelPreference = (0, import_react4.useCallback)(
3698
+ async (address) => {
3699
+ try {
3700
+ if (!address) throw new Error("Wallet address is required");
3701
+ const deleted = await deleteModelPreferenceOp(storageCtx, address);
3702
+ if (deleted && walletAddress && address === walletAddress) {
3703
+ setModelPreferenceState(null);
3704
+ }
3705
+ return deleted;
3706
+ } catch (error) {
3707
+ throw new Error(
3708
+ error instanceof Error ? error.message : "An unknown error occurred"
3709
+ );
3710
+ }
3711
+ },
3712
+ [storageCtx, walletAddress]
3713
+ );
3714
+ (0, import_react4.useEffect)(() => {
3715
+ if (!walletAddress) {
3716
+ setModelPreferenceState(null);
3717
+ return;
3718
+ }
3719
+ let cancelled = false;
3720
+ const loadPreference = async () => {
3721
+ setIsLoading(true);
3722
+ try {
3723
+ const preference = await getModelPreference(walletAddress);
3724
+ if (!cancelled) {
3725
+ setModelPreferenceState(preference);
3726
+ }
3727
+ } finally {
3728
+ if (!cancelled) {
3729
+ setIsLoading(false);
3730
+ }
3731
+ }
3732
+ };
3733
+ loadPreference();
3734
+ return () => {
3735
+ cancelled = true;
3736
+ };
3737
+ }, [walletAddress, getModelPreference]);
3738
+ return {
3739
+ modelPreference,
3740
+ isLoading,
3741
+ getModelPreference,
3742
+ setModelPreference,
3743
+ deleteModelPreference
3744
+ };
3745
+ }
3746
+
3747
+ // src/lib/settingsStorage/schema.ts
3748
+ var import_watermelondb8 = require("@nozbe/watermelondb");
3749
+ var settingsStorageSchema = (0, import_watermelondb8.appSchema)({
3750
+ version: 1,
3751
+ tables: [
3752
+ (0, import_watermelondb8.tableSchema)({
3753
+ name: "modelPreferences",
3754
+ columns: [
3755
+ { name: "wallet_address", type: "string", isIndexed: true },
3756
+ { name: "models", type: "string", isOptional: true }
3757
+ // stored as JSON stringified ModelPreference[]
3758
+ ]
3759
+ })
3760
+ ]
3761
+ });
3762
+
3763
+ // src/lib/settingsStorage/models.ts
3764
+ var import_watermelondb9 = require("@nozbe/watermelondb");
3765
+ var ModelPreference = class extends import_watermelondb9.Model {
3766
+ /** User's wallet address */
3767
+ get walletAddress() {
3768
+ return this._getRaw("wallet_address");
3769
+ }
3770
+ /** Preferred model identifier */
3771
+ get models() {
3772
+ const value = this._getRaw("models");
3773
+ return value ? value : void 0;
3774
+ }
3775
+ };
3776
+ ModelPreference.table = "modelPreferences";
3777
+
3778
+ // src/react/usePdf.ts
3779
+ var import_react5 = require("react");
3780
+
3521
3781
  // src/lib/pdf.ts
3522
3782
  var pdfjs = __toESM(require("pdfjs-dist"));
3523
3783
  pdfjs.GlobalWorkerOptions.workerSrc = `https://unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
@@ -3569,9 +3829,9 @@ async function convertPdfToImages(pdfDataUrl) {
3569
3829
  // src/react/usePdf.ts
3570
3830
  var PDF_MIME_TYPE = "application/pdf";
3571
3831
  function usePdf() {
3572
- const [isProcessing, setIsProcessing] = (0, import_react4.useState)(false);
3573
- const [error, setError] = (0, import_react4.useState)(null);
3574
- const extractPdfContext = (0, import_react4.useCallback)(
3832
+ const [isProcessing, setIsProcessing] = (0, import_react5.useState)(false);
3833
+ const [error, setError] = (0, import_react5.useState)(null);
3834
+ const extractPdfContext = (0, import_react5.useCallback)(
3575
3835
  async (files) => {
3576
3836
  setIsProcessing(true);
3577
3837
  setError(null);
@@ -3618,12 +3878,12 @@ ${text}`;
3618
3878
  }
3619
3879
 
3620
3880
  // src/react/useOCR.ts
3621
- var import_react5 = require("react");
3881
+ var import_react6 = require("react");
3622
3882
  var import_tesseract = __toESM(require("tesseract.js"));
3623
3883
  function useOCR() {
3624
- const [isProcessing, setIsProcessing] = (0, import_react5.useState)(false);
3625
- const [error, setError] = (0, import_react5.useState)(null);
3626
- const extractOCRContext = (0, import_react5.useCallback)(
3884
+ const [isProcessing, setIsProcessing] = (0, import_react6.useState)(false);
3885
+ const [error, setError] = (0, import_react6.useState)(null);
3886
+ const extractOCRContext = (0, import_react6.useCallback)(
3627
3887
  async (files) => {
3628
3888
  setIsProcessing(true);
3629
3889
  setError(null);
@@ -3709,22 +3969,22 @@ ${text}`;
3709
3969
  }
3710
3970
 
3711
3971
  // src/react/useModels.ts
3712
- var import_react6 = require("react");
3972
+ var import_react7 = require("react");
3713
3973
  function useModels(options = {}) {
3714
3974
  const { getToken, baseUrl = BASE_URL, provider, autoFetch = true } = options;
3715
- const [models, setModels] = (0, import_react6.useState)([]);
3716
- const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
3717
- const [error, setError] = (0, import_react6.useState)(null);
3718
- const getTokenRef = (0, import_react6.useRef)(getToken);
3719
- const baseUrlRef = (0, import_react6.useRef)(baseUrl);
3720
- const providerRef = (0, import_react6.useRef)(provider);
3721
- const abortControllerRef = (0, import_react6.useRef)(null);
3722
- (0, import_react6.useEffect)(() => {
3975
+ const [models, setModels] = (0, import_react7.useState)([]);
3976
+ const [isLoading, setIsLoading] = (0, import_react7.useState)(false);
3977
+ const [error, setError] = (0, import_react7.useState)(null);
3978
+ const getTokenRef = (0, import_react7.useRef)(getToken);
3979
+ const baseUrlRef = (0, import_react7.useRef)(baseUrl);
3980
+ const providerRef = (0, import_react7.useRef)(provider);
3981
+ const abortControllerRef = (0, import_react7.useRef)(null);
3982
+ (0, import_react7.useEffect)(() => {
3723
3983
  getTokenRef.current = getToken;
3724
3984
  baseUrlRef.current = baseUrl;
3725
3985
  providerRef.current = provider;
3726
3986
  });
3727
- (0, import_react6.useEffect)(() => {
3987
+ (0, import_react7.useEffect)(() => {
3728
3988
  return () => {
3729
3989
  if (abortControllerRef.current) {
3730
3990
  abortControllerRef.current.abort();
@@ -3732,7 +3992,7 @@ function useModels(options = {}) {
3732
3992
  }
3733
3993
  };
3734
3994
  }, []);
3735
- const fetchModels = (0, import_react6.useCallback)(async () => {
3995
+ const fetchModels = (0, import_react7.useCallback)(async () => {
3736
3996
  if (abortControllerRef.current) {
3737
3997
  abortControllerRef.current.abort();
3738
3998
  }
@@ -3790,12 +4050,12 @@ function useModels(options = {}) {
3790
4050
  }
3791
4051
  }
3792
4052
  }, []);
3793
- const refetch = (0, import_react6.useCallback)(async () => {
4053
+ const refetch = (0, import_react7.useCallback)(async () => {
3794
4054
  setModels([]);
3795
4055
  await fetchModels();
3796
4056
  }, [fetchModels]);
3797
- const hasFetchedRef = (0, import_react6.useRef)(false);
3798
- (0, import_react6.useEffect)(() => {
4057
+ const hasFetchedRef = (0, import_react7.useRef)(false);
4058
+ (0, import_react7.useEffect)(() => {
3799
4059
  if (autoFetch && !hasFetchedRef.current) {
3800
4060
  hasFetchedRef.current = true;
3801
4061
  fetchModels();
@@ -3813,15 +4073,15 @@ function useModels(options = {}) {
3813
4073
  }
3814
4074
 
3815
4075
  // src/react/useSearch.ts
3816
- var import_react7 = require("react");
4076
+ var import_react8 = require("react");
3817
4077
  function useSearch(options = {}) {
3818
4078
  const { getToken, baseUrl = BASE_URL, onError } = options;
3819
- const [isLoading, setIsLoading] = (0, import_react7.useState)(false);
3820
- const [results, setResults] = (0, import_react7.useState)(null);
3821
- const [response, setResponse] = (0, import_react7.useState)(null);
3822
- const [error, setError] = (0, import_react7.useState)(null);
3823
- const abortControllerRef = (0, import_react7.useRef)(null);
3824
- (0, import_react7.useEffect)(() => {
4079
+ const [isLoading, setIsLoading] = (0, import_react8.useState)(false);
4080
+ const [results, setResults] = (0, import_react8.useState)(null);
4081
+ const [response, setResponse] = (0, import_react8.useState)(null);
4082
+ const [error, setError] = (0, import_react8.useState)(null);
4083
+ const abortControllerRef = (0, import_react8.useRef)(null);
4084
+ (0, import_react8.useEffect)(() => {
3825
4085
  return () => {
3826
4086
  if (abortControllerRef.current) {
3827
4087
  abortControllerRef.current.abort();
@@ -3829,7 +4089,7 @@ function useSearch(options = {}) {
3829
4089
  }
3830
4090
  };
3831
4091
  }, []);
3832
- const search = (0, import_react7.useCallback)(
4092
+ const search = (0, import_react8.useCallback)(
3833
4093
  async (query, searchOptions = {}) => {
3834
4094
  if (abortControllerRef.current) {
3835
4095
  abortControllerRef.current.abort();
@@ -3897,12 +4157,12 @@ function useSearch(options = {}) {
3897
4157
  }
3898
4158
 
3899
4159
  // src/react/useImageGeneration.ts
3900
- var import_react8 = require("react");
4160
+ var import_react9 = require("react");
3901
4161
  function useImageGeneration(options = {}) {
3902
4162
  const { getToken, baseUrl = BASE_URL, onFinish, onError } = options;
3903
- const [isLoading, setIsLoading] = (0, import_react8.useState)(false);
3904
- const abortControllerRef = (0, import_react8.useRef)(null);
3905
- (0, import_react8.useEffect)(() => {
4163
+ const [isLoading, setIsLoading] = (0, import_react9.useState)(false);
4164
+ const abortControllerRef = (0, import_react9.useRef)(null);
4165
+ (0, import_react9.useEffect)(() => {
3906
4166
  return () => {
3907
4167
  if (abortControllerRef.current) {
3908
4168
  abortControllerRef.current.abort();
@@ -3910,13 +4170,13 @@ function useImageGeneration(options = {}) {
3910
4170
  }
3911
4171
  };
3912
4172
  }, []);
3913
- const stop = (0, import_react8.useCallback)(() => {
4173
+ const stop = (0, import_react9.useCallback)(() => {
3914
4174
  if (abortControllerRef.current) {
3915
4175
  abortControllerRef.current.abort();
3916
4176
  abortControllerRef.current = null;
3917
4177
  }
3918
4178
  }, []);
3919
- const generateImage = (0, import_react8.useCallback)(
4179
+ const generateImage = (0, import_react9.useCallback)(
3920
4180
  async (args) => {
3921
4181
  if (abortControllerRef.current) {
3922
4182
  abortControllerRef.current.abort();
@@ -4038,6 +4298,8 @@ var extractConversationContext = (messages, maxMessages = 3) => {
4038
4298
  ChatMessage,
4039
4299
  DEFAULT_TOOL_SELECTOR_MODEL,
4040
4300
  StoredMemoryModel,
4301
+ StoredModelPreferenceModel,
4302
+ chatStorageMigrations,
4041
4303
  chatStorageSchema,
4042
4304
  createMemoryContextSystemMessage,
4043
4305
  decryptData,
@@ -4053,6 +4315,7 @@ var extractConversationContext = (messages, maxMessages = 3) => {
4053
4315
  memoryStorageSchema,
4054
4316
  requestEncryptionKey,
4055
4317
  selectTool,
4318
+ settingsStorageSchema,
4056
4319
  useChat,
4057
4320
  useChatStorage,
4058
4321
  useEncryption,
@@ -4061,5 +4324,6 @@ var extractConversationContext = (messages, maxMessages = 3) => {
4061
4324
  useModels,
4062
4325
  useOCR,
4063
4326
  usePdf,
4064
- useSearch
4327
+ useSearch,
4328
+ useSettings
4065
4329
  });