@reverbia/sdk 1.0.0-next.20251217144909 → 1.0.0-next.20251218151654

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.
@@ -37,6 +37,9 @@ __export(index_exports, {
37
37
  generateConversationId: () => generateConversationId,
38
38
  generateUniqueKey: () => generateUniqueKey,
39
39
  memoryStorageSchema: () => memoryStorageSchema,
40
+ sdkMigrations: () => sdkMigrations,
41
+ sdkModelClasses: () => sdkModelClasses,
42
+ sdkSchema: () => sdkSchema,
40
43
  useChat: () => useChat,
41
44
  useChatStorage: () => useChatStorage,
42
45
  useImageGeneration: () => useImageGeneration,
@@ -2386,7 +2389,7 @@ var DEFAULT_COMPLETION_MODEL = "openai/gpt-4o";
2386
2389
 
2387
2390
  // src/expo/useMemoryStorage.ts
2388
2391
  var import_client5 = require("@reverbia/sdk");
2389
- async function generateEmbeddingForTextApi(text3, options) {
2392
+ async function generateEmbeddingForTextApi(text4, options) {
2390
2393
  const token = options.getToken ? await options.getToken() : null;
2391
2394
  if (!token) {
2392
2395
  throw new Error("No auth token available for embedding generation");
@@ -2394,7 +2397,7 @@ async function generateEmbeddingForTextApi(text3, options) {
2394
2397
  const response = await (0, import_client5.postApiV1Embeddings)({
2395
2398
  baseUrl: options.baseUrl,
2396
2399
  body: {
2397
- input: text3,
2400
+ input: text4,
2398
2401
  model: options.model
2399
2402
  },
2400
2403
  headers: {
@@ -2411,8 +2414,8 @@ async function generateEmbeddingForTextApi(text3, options) {
2411
2414
  return embedding;
2412
2415
  }
2413
2416
  async function generateEmbeddingForMemoryApi(memory, options) {
2414
- const text3 = `${memory.type}: ${memory.namespace}/${memory.key} = ${memory.value}. Evidence: ${memory.rawEvidence}`;
2415
- return generateEmbeddingForTextApi(text3, options);
2417
+ const text4 = `${memory.type}: ${memory.namespace}/${memory.key} = ${memory.value}. Evidence: ${memory.rawEvidence}`;
2418
+ return generateEmbeddingForTextApi(text4, options);
2416
2419
  }
2417
2420
  function useMemoryStorage(options) {
2418
2421
  const {
@@ -2936,6 +2939,122 @@ function useMemoryStorage(options) {
2936
2939
  clearMemories
2937
2940
  };
2938
2941
  }
2942
+
2943
+ // src/lib/db/schema.ts
2944
+ var import_watermelondb8 = require("@nozbe/watermelondb");
2945
+ var import_migrations2 = require("@nozbe/watermelondb/Schema/migrations");
2946
+
2947
+ // src/lib/db/settings/models.ts
2948
+ var import_watermelondb7 = require("@nozbe/watermelondb");
2949
+ var import_decorators3 = require("@nozbe/watermelondb/decorators");
2950
+ var ModelPreference = class extends import_watermelondb7.Model {
2951
+ };
2952
+ ModelPreference.table = "modelPreferences";
2953
+ __decorateClass([
2954
+ (0, import_decorators3.text)("wallet_address")
2955
+ ], ModelPreference.prototype, "walletAddress", 2);
2956
+ __decorateClass([
2957
+ (0, import_decorators3.text)("models")
2958
+ ], ModelPreference.prototype, "models", 2);
2959
+
2960
+ // src/lib/db/schema.ts
2961
+ var SDK_SCHEMA_VERSION = 4;
2962
+ var sdkSchema = (0, import_watermelondb8.appSchema)({
2963
+ version: SDK_SCHEMA_VERSION,
2964
+ tables: [
2965
+ // Chat storage tables
2966
+ (0, import_watermelondb8.tableSchema)({
2967
+ name: "history",
2968
+ columns: [
2969
+ { name: "message_id", type: "number" },
2970
+ { name: "conversation_id", type: "string", isIndexed: true },
2971
+ { name: "role", type: "string", isIndexed: true },
2972
+ { name: "content", type: "string" },
2973
+ { name: "model", type: "string", isOptional: true },
2974
+ { name: "files", type: "string", isOptional: true },
2975
+ { name: "created_at", type: "number", isIndexed: true },
2976
+ { name: "updated_at", type: "number" },
2977
+ { name: "vector", type: "string", isOptional: true },
2978
+ { name: "embedding_model", type: "string", isOptional: true },
2979
+ { name: "usage", type: "string", isOptional: true },
2980
+ { name: "sources", type: "string", isOptional: true },
2981
+ { name: "response_duration", type: "number", isOptional: true },
2982
+ { name: "was_stopped", type: "boolean", isOptional: true }
2983
+ ]
2984
+ }),
2985
+ (0, import_watermelondb8.tableSchema)({
2986
+ name: "conversations",
2987
+ columns: [
2988
+ { name: "conversation_id", type: "string", isIndexed: true },
2989
+ { name: "title", type: "string" },
2990
+ { name: "created_at", type: "number" },
2991
+ { name: "updated_at", type: "number" },
2992
+ { name: "is_deleted", type: "boolean", isIndexed: true }
2993
+ ]
2994
+ }),
2995
+ // Memory storage tables
2996
+ (0, import_watermelondb8.tableSchema)({
2997
+ name: "memories",
2998
+ columns: [
2999
+ { name: "type", type: "string", isIndexed: true },
3000
+ { name: "namespace", type: "string", isIndexed: true },
3001
+ { name: "key", type: "string", isIndexed: true },
3002
+ { name: "value", type: "string" },
3003
+ { name: "raw_evidence", type: "string" },
3004
+ { name: "confidence", type: "number" },
3005
+ { name: "pii", type: "boolean", isIndexed: true },
3006
+ { name: "composite_key", type: "string", isIndexed: true },
3007
+ { name: "unique_key", type: "string", isIndexed: true },
3008
+ { name: "created_at", type: "number", isIndexed: true },
3009
+ { name: "updated_at", type: "number" },
3010
+ { name: "embedding", type: "string", isOptional: true },
3011
+ { name: "embedding_model", type: "string", isOptional: true },
3012
+ { name: "is_deleted", type: "boolean", isIndexed: true }
3013
+ ]
3014
+ }),
3015
+ // Settings storage tables
3016
+ (0, import_watermelondb8.tableSchema)({
3017
+ name: "modelPreferences",
3018
+ columns: [
3019
+ { name: "wallet_address", type: "string", isIndexed: true },
3020
+ { name: "models", type: "string", isOptional: true }
3021
+ ]
3022
+ })
3023
+ ]
3024
+ });
3025
+ var sdkMigrations = (0, import_migrations2.schemaMigrations)({
3026
+ migrations: [
3027
+ // v2 -> v3: Added was_stopped column to history
3028
+ {
3029
+ toVersion: 3,
3030
+ steps: [
3031
+ (0, import_migrations2.addColumns)({
3032
+ table: "history",
3033
+ columns: [{ name: "was_stopped", type: "boolean", isOptional: true }]
3034
+ })
3035
+ ]
3036
+ },
3037
+ // v3 -> v4: Added settings storage (modelPreferences table)
3038
+ {
3039
+ toVersion: 4,
3040
+ steps: [
3041
+ (0, import_migrations2.createTable)({
3042
+ name: "modelPreferences",
3043
+ columns: [
3044
+ { name: "wallet_address", type: "string", isIndexed: true },
3045
+ { name: "models", type: "string", isOptional: true }
3046
+ ]
3047
+ })
3048
+ ]
3049
+ }
3050
+ ]
3051
+ });
3052
+ var sdkModelClasses = [
3053
+ Message,
3054
+ Conversation,
3055
+ Memory,
3056
+ ModelPreference
3057
+ ];
2939
3058
  // Annotate the CommonJS export names for ESM import in node:
2940
3059
  0 && (module.exports = {
2941
3060
  ChatConversation,
@@ -2947,6 +3066,9 @@ function useMemoryStorage(options) {
2947
3066
  generateConversationId,
2948
3067
  generateUniqueKey,
2949
3068
  memoryStorageSchema,
3069
+ sdkMigrations,
3070
+ sdkModelClasses,
3071
+ sdkSchema,
2950
3072
  useChat,
2951
3073
  useChatStorage,
2952
3074
  useImageGeneration,
@@ -1,7 +1,8 @@
1
1
  import { Database, Model } from '@nozbe/watermelondb';
2
2
  import * as _nozbe_watermelondb_Schema_migrations from '@nozbe/watermelondb/Schema/migrations';
3
3
  import * as _nozbe_watermelondb_Schema from '@nozbe/watermelondb/Schema';
4
- import { Associations } from '@nozbe/watermelondb/Model';
4
+ import Model$1, { Associations } from '@nozbe/watermelondb/Model';
5
+ import { Class } from '@nozbe/watermelondb/types';
5
6
 
6
7
  /**
7
8
  * ExtraFields contains additional metadata
@@ -868,4 +869,77 @@ type UseMemoryStorageResult = BaseUseMemoryStorageResult;
868
869
  */
869
870
  declare function useMemoryStorage(options: UseMemoryStorageOptions): UseMemoryStorageResult;
870
871
 
871
- export { Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type CreateConversationOptions, type CreateMemoryOptions, type CreateMessageOptions, type FileMetadata, type MemoryItem, type MemoryType, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredMemory, Memory as StoredMemoryModel, type StoredMemoryWithSimilarity, type StoredMessage, type StoredMessageWithSimilarity, type UpdateMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseMemoryStorageOptions, type UseMemoryStorageResult, type UseModelsOptions, type UseModelsResult, chatStorageMigrations, chatStorageSchema, generateCompositeKey, generateConversationId, generateUniqueKey, memoryStorageSchema, useChat, useChatStorage, useImageGeneration, useMemoryStorage, useModels };
872
+ /**
873
+ * Combined WatermelonDB schema for all SDK storage modules.
874
+ *
875
+ * This unified schema includes all tables needed by the SDK:
876
+ * - `history`: Chat message storage with embeddings and metadata
877
+ * - `conversations`: Conversation metadata and organization
878
+ * - `memories`: Persistent memory storage with semantic search
879
+ * - `modelPreferences`: User model preferences and settings
880
+ *
881
+ * @example
882
+ * ```typescript
883
+ * import { Database } from '@nozbe/watermelondb';
884
+ * import LokiJSAdapter from '@nozbe/watermelondb/adapters/lokijs';
885
+ * import { sdkSchema, sdkMigrations, sdkModelClasses } from '@reverbia/sdk/react';
886
+ *
887
+ * const adapter = new LokiJSAdapter({
888
+ * schema: sdkSchema,
889
+ * migrations: sdkMigrations,
890
+ * dbName: 'my-app-db',
891
+ * useWebWorker: false,
892
+ * useIncrementalIndexedDB: true,
893
+ * });
894
+ *
895
+ * const database = new Database({
896
+ * adapter,
897
+ * modelClasses: sdkModelClasses,
898
+ * });
899
+ * ```
900
+ */
901
+ declare const sdkSchema: Readonly<{
902
+ version: _nozbe_watermelondb_Schema.SchemaVersion;
903
+ tables: _nozbe_watermelondb_Schema.TableMap;
904
+ unsafeSql?: (_: string, __: _nozbe_watermelondb_Schema.AppSchemaUnsafeSqlKind) => string;
905
+ }>;
906
+ /**
907
+ * Combined migrations for all SDK storage modules.
908
+ *
909
+ * These migrations handle database schema upgrades from any previous version
910
+ * to the current version. The SDK manages all migration logic internally,
911
+ * so consumer apps don't need to handle version arithmetic or migration merging.
912
+ *
913
+ * **Minimum supported version: v2**
914
+ * Migrations from v1 are not supported. Databases at v1 require a fresh install.
915
+ *
916
+ * Migration history:
917
+ * - v2 → v3: Added `was_stopped` column to history table
918
+ * - v3 → v4: Added `modelPreferences` table for settings storage
919
+ */
920
+ declare const sdkMigrations: Readonly<{
921
+ validated: true;
922
+ minVersion: _nozbe_watermelondb_Schema.SchemaVersion;
923
+ maxVersion: _nozbe_watermelondb_Schema.SchemaVersion;
924
+ sortedMigrations: _nozbe_watermelondb_Schema_migrations.Migration[];
925
+ }>;
926
+ /**
927
+ * Model classes to register with the WatermelonDB database.
928
+ *
929
+ * Pass this array directly to the `modelClasses` option when creating
930
+ * your Database instance.
931
+ *
932
+ * @example
933
+ * ```typescript
934
+ * import { Database } from '@nozbe/watermelondb';
935
+ * import { sdkSchema, sdkMigrations, sdkModelClasses } from '@reverbia/sdk/react';
936
+ *
937
+ * const database = new Database({
938
+ * adapter,
939
+ * modelClasses: sdkModelClasses,
940
+ * });
941
+ * ```
942
+ */
943
+ declare const sdkModelClasses: Class<Model$1>[];
944
+
945
+ export { Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type CreateConversationOptions, type CreateMemoryOptions, type CreateMessageOptions, type FileMetadata, type MemoryItem, type MemoryType, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredMemory, Memory as StoredMemoryModel, type StoredMemoryWithSimilarity, type StoredMessage, type StoredMessageWithSimilarity, type UpdateMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseMemoryStorageOptions, type UseMemoryStorageResult, type UseModelsOptions, type UseModelsResult, chatStorageMigrations, chatStorageSchema, generateCompositeKey, generateConversationId, generateUniqueKey, memoryStorageSchema, sdkMigrations, sdkModelClasses, sdkSchema, useChat, useChatStorage, useImageGeneration, useMemoryStorage, useModels };
@@ -1,7 +1,8 @@
1
1
  import { Database, Model } from '@nozbe/watermelondb';
2
2
  import * as _nozbe_watermelondb_Schema_migrations from '@nozbe/watermelondb/Schema/migrations';
3
3
  import * as _nozbe_watermelondb_Schema from '@nozbe/watermelondb/Schema';
4
- import { Associations } from '@nozbe/watermelondb/Model';
4
+ import Model$1, { Associations } from '@nozbe/watermelondb/Model';
5
+ import { Class } from '@nozbe/watermelondb/types';
5
6
 
6
7
  /**
7
8
  * ExtraFields contains additional metadata
@@ -868,4 +869,77 @@ type UseMemoryStorageResult = BaseUseMemoryStorageResult;
868
869
  */
869
870
  declare function useMemoryStorage(options: UseMemoryStorageOptions): UseMemoryStorageResult;
870
871
 
871
- export { Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type CreateConversationOptions, type CreateMemoryOptions, type CreateMessageOptions, type FileMetadata, type MemoryItem, type MemoryType, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredMemory, Memory as StoredMemoryModel, type StoredMemoryWithSimilarity, type StoredMessage, type StoredMessageWithSimilarity, type UpdateMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseMemoryStorageOptions, type UseMemoryStorageResult, type UseModelsOptions, type UseModelsResult, chatStorageMigrations, chatStorageSchema, generateCompositeKey, generateConversationId, generateUniqueKey, memoryStorageSchema, useChat, useChatStorage, useImageGeneration, useMemoryStorage, useModels };
872
+ /**
873
+ * Combined WatermelonDB schema for all SDK storage modules.
874
+ *
875
+ * This unified schema includes all tables needed by the SDK:
876
+ * - `history`: Chat message storage with embeddings and metadata
877
+ * - `conversations`: Conversation metadata and organization
878
+ * - `memories`: Persistent memory storage with semantic search
879
+ * - `modelPreferences`: User model preferences and settings
880
+ *
881
+ * @example
882
+ * ```typescript
883
+ * import { Database } from '@nozbe/watermelondb';
884
+ * import LokiJSAdapter from '@nozbe/watermelondb/adapters/lokijs';
885
+ * import { sdkSchema, sdkMigrations, sdkModelClasses } from '@reverbia/sdk/react';
886
+ *
887
+ * const adapter = new LokiJSAdapter({
888
+ * schema: sdkSchema,
889
+ * migrations: sdkMigrations,
890
+ * dbName: 'my-app-db',
891
+ * useWebWorker: false,
892
+ * useIncrementalIndexedDB: true,
893
+ * });
894
+ *
895
+ * const database = new Database({
896
+ * adapter,
897
+ * modelClasses: sdkModelClasses,
898
+ * });
899
+ * ```
900
+ */
901
+ declare const sdkSchema: Readonly<{
902
+ version: _nozbe_watermelondb_Schema.SchemaVersion;
903
+ tables: _nozbe_watermelondb_Schema.TableMap;
904
+ unsafeSql?: (_: string, __: _nozbe_watermelondb_Schema.AppSchemaUnsafeSqlKind) => string;
905
+ }>;
906
+ /**
907
+ * Combined migrations for all SDK storage modules.
908
+ *
909
+ * These migrations handle database schema upgrades from any previous version
910
+ * to the current version. The SDK manages all migration logic internally,
911
+ * so consumer apps don't need to handle version arithmetic or migration merging.
912
+ *
913
+ * **Minimum supported version: v2**
914
+ * Migrations from v1 are not supported. Databases at v1 require a fresh install.
915
+ *
916
+ * Migration history:
917
+ * - v2 → v3: Added `was_stopped` column to history table
918
+ * - v3 → v4: Added `modelPreferences` table for settings storage
919
+ */
920
+ declare const sdkMigrations: Readonly<{
921
+ validated: true;
922
+ minVersion: _nozbe_watermelondb_Schema.SchemaVersion;
923
+ maxVersion: _nozbe_watermelondb_Schema.SchemaVersion;
924
+ sortedMigrations: _nozbe_watermelondb_Schema_migrations.Migration[];
925
+ }>;
926
+ /**
927
+ * Model classes to register with the WatermelonDB database.
928
+ *
929
+ * Pass this array directly to the `modelClasses` option when creating
930
+ * your Database instance.
931
+ *
932
+ * @example
933
+ * ```typescript
934
+ * import { Database } from '@nozbe/watermelondb';
935
+ * import { sdkSchema, sdkMigrations, sdkModelClasses } from '@reverbia/sdk/react';
936
+ *
937
+ * const database = new Database({
938
+ * adapter,
939
+ * modelClasses: sdkModelClasses,
940
+ * });
941
+ * ```
942
+ */
943
+ declare const sdkModelClasses: Class<Model$1>[];
944
+
945
+ export { Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type CreateConversationOptions, type CreateMemoryOptions, type CreateMessageOptions, type FileMetadata, type MemoryItem, type MemoryType, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredMemory, Memory as StoredMemoryModel, type StoredMemoryWithSimilarity, type StoredMessage, type StoredMessageWithSimilarity, type UpdateMemoryOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseMemoryStorageOptions, type UseMemoryStorageResult, type UseModelsOptions, type UseModelsResult, chatStorageMigrations, chatStorageSchema, generateCompositeKey, generateConversationId, generateUniqueKey, memoryStorageSchema, sdkMigrations, sdkModelClasses, sdkSchema, useChat, useChatStorage, useImageGeneration, useMemoryStorage, useModels };
@@ -2353,7 +2353,7 @@ var DEFAULT_COMPLETION_MODEL = "openai/gpt-4o";
2353
2353
 
2354
2354
  // src/expo/useMemoryStorage.ts
2355
2355
  import { postApiV1Embeddings } from "@reverbia/sdk";
2356
- async function generateEmbeddingForTextApi(text3, options) {
2356
+ async function generateEmbeddingForTextApi(text4, options) {
2357
2357
  const token = options.getToken ? await options.getToken() : null;
2358
2358
  if (!token) {
2359
2359
  throw new Error("No auth token available for embedding generation");
@@ -2361,7 +2361,7 @@ async function generateEmbeddingForTextApi(text3, options) {
2361
2361
  const response = await postApiV1Embeddings({
2362
2362
  baseUrl: options.baseUrl,
2363
2363
  body: {
2364
- input: text3,
2364
+ input: text4,
2365
2365
  model: options.model
2366
2366
  },
2367
2367
  headers: {
@@ -2378,8 +2378,8 @@ async function generateEmbeddingForTextApi(text3, options) {
2378
2378
  return embedding;
2379
2379
  }
2380
2380
  async function generateEmbeddingForMemoryApi(memory, options) {
2381
- const text3 = `${memory.type}: ${memory.namespace}/${memory.key} = ${memory.value}. Evidence: ${memory.rawEvidence}`;
2382
- return generateEmbeddingForTextApi(text3, options);
2381
+ const text4 = `${memory.type}: ${memory.namespace}/${memory.key} = ${memory.value}. Evidence: ${memory.rawEvidence}`;
2382
+ return generateEmbeddingForTextApi(text4, options);
2383
2383
  }
2384
2384
  function useMemoryStorage(options) {
2385
2385
  const {
@@ -2903,6 +2903,126 @@ function useMemoryStorage(options) {
2903
2903
  clearMemories
2904
2904
  };
2905
2905
  }
2906
+
2907
+ // src/lib/db/schema.ts
2908
+ import { appSchema as appSchema3, tableSchema as tableSchema3 } from "@nozbe/watermelondb";
2909
+ import {
2910
+ schemaMigrations as schemaMigrations2,
2911
+ addColumns as addColumns2,
2912
+ createTable
2913
+ } from "@nozbe/watermelondb/Schema/migrations";
2914
+
2915
+ // src/lib/db/settings/models.ts
2916
+ import { Model as Model3 } from "@nozbe/watermelondb";
2917
+ import { text as text3 } from "@nozbe/watermelondb/decorators";
2918
+ var ModelPreference = class extends Model3 {
2919
+ };
2920
+ ModelPreference.table = "modelPreferences";
2921
+ __decorateClass([
2922
+ text3("wallet_address")
2923
+ ], ModelPreference.prototype, "walletAddress", 2);
2924
+ __decorateClass([
2925
+ text3("models")
2926
+ ], ModelPreference.prototype, "models", 2);
2927
+
2928
+ // src/lib/db/schema.ts
2929
+ var SDK_SCHEMA_VERSION = 4;
2930
+ var sdkSchema = appSchema3({
2931
+ version: SDK_SCHEMA_VERSION,
2932
+ tables: [
2933
+ // Chat storage tables
2934
+ tableSchema3({
2935
+ name: "history",
2936
+ columns: [
2937
+ { name: "message_id", type: "number" },
2938
+ { name: "conversation_id", type: "string", isIndexed: true },
2939
+ { name: "role", type: "string", isIndexed: true },
2940
+ { name: "content", type: "string" },
2941
+ { name: "model", type: "string", isOptional: true },
2942
+ { name: "files", type: "string", isOptional: true },
2943
+ { name: "created_at", type: "number", isIndexed: true },
2944
+ { name: "updated_at", type: "number" },
2945
+ { name: "vector", type: "string", isOptional: true },
2946
+ { name: "embedding_model", type: "string", isOptional: true },
2947
+ { name: "usage", type: "string", isOptional: true },
2948
+ { name: "sources", type: "string", isOptional: true },
2949
+ { name: "response_duration", type: "number", isOptional: true },
2950
+ { name: "was_stopped", type: "boolean", isOptional: true }
2951
+ ]
2952
+ }),
2953
+ tableSchema3({
2954
+ name: "conversations",
2955
+ columns: [
2956
+ { name: "conversation_id", type: "string", isIndexed: true },
2957
+ { name: "title", type: "string" },
2958
+ { name: "created_at", type: "number" },
2959
+ { name: "updated_at", type: "number" },
2960
+ { name: "is_deleted", type: "boolean", isIndexed: true }
2961
+ ]
2962
+ }),
2963
+ // Memory storage tables
2964
+ tableSchema3({
2965
+ name: "memories",
2966
+ columns: [
2967
+ { name: "type", type: "string", isIndexed: true },
2968
+ { name: "namespace", type: "string", isIndexed: true },
2969
+ { name: "key", type: "string", isIndexed: true },
2970
+ { name: "value", type: "string" },
2971
+ { name: "raw_evidence", type: "string" },
2972
+ { name: "confidence", type: "number" },
2973
+ { name: "pii", type: "boolean", isIndexed: true },
2974
+ { name: "composite_key", type: "string", isIndexed: true },
2975
+ { name: "unique_key", type: "string", isIndexed: true },
2976
+ { name: "created_at", type: "number", isIndexed: true },
2977
+ { name: "updated_at", type: "number" },
2978
+ { name: "embedding", type: "string", isOptional: true },
2979
+ { name: "embedding_model", type: "string", isOptional: true },
2980
+ { name: "is_deleted", type: "boolean", isIndexed: true }
2981
+ ]
2982
+ }),
2983
+ // Settings storage tables
2984
+ tableSchema3({
2985
+ name: "modelPreferences",
2986
+ columns: [
2987
+ { name: "wallet_address", type: "string", isIndexed: true },
2988
+ { name: "models", type: "string", isOptional: true }
2989
+ ]
2990
+ })
2991
+ ]
2992
+ });
2993
+ var sdkMigrations = schemaMigrations2({
2994
+ migrations: [
2995
+ // v2 -> v3: Added was_stopped column to history
2996
+ {
2997
+ toVersion: 3,
2998
+ steps: [
2999
+ addColumns2({
3000
+ table: "history",
3001
+ columns: [{ name: "was_stopped", type: "boolean", isOptional: true }]
3002
+ })
3003
+ ]
3004
+ },
3005
+ // v3 -> v4: Added settings storage (modelPreferences table)
3006
+ {
3007
+ toVersion: 4,
3008
+ steps: [
3009
+ createTable({
3010
+ name: "modelPreferences",
3011
+ columns: [
3012
+ { name: "wallet_address", type: "string", isIndexed: true },
3013
+ { name: "models", type: "string", isOptional: true }
3014
+ ]
3015
+ })
3016
+ ]
3017
+ }
3018
+ ]
3019
+ });
3020
+ var sdkModelClasses = [
3021
+ Message,
3022
+ Conversation,
3023
+ Memory,
3024
+ ModelPreference
3025
+ ];
2906
3026
  export {
2907
3027
  Conversation as ChatConversation,
2908
3028
  Message as ChatMessage,
@@ -2913,6 +3033,9 @@ export {
2913
3033
  generateConversationId,
2914
3034
  generateUniqueKey,
2915
3035
  memoryStorageSchema,
3036
+ sdkMigrations,
3037
+ sdkModelClasses,
3038
+ sdkSchema,
2916
3039
  useChat,
2917
3040
  useChatStorage,
2918
3041
  useImageGeneration,
@@ -64,6 +64,9 @@ __export(index_exports, {
64
64
  hasEncryptionKey: () => hasEncryptionKey,
65
65
  memoryStorageSchema: () => memoryStorageSchema,
66
66
  requestEncryptionKey: () => requestEncryptionKey,
67
+ sdkMigrations: () => sdkMigrations,
68
+ sdkModelClasses: () => sdkModelClasses,
69
+ sdkSchema: () => sdkSchema,
67
70
  selectTool: () => selectTool,
68
71
  settingsStorageSchema: () => settingsStorageSchema,
69
72
  storeDropboxToken: () => storeToken,
@@ -2398,41 +2401,14 @@ function useChatStorage(options) {
2398
2401
  };
2399
2402
  }
2400
2403
 
2401
- // src/react/useMemoryStorage.ts
2402
- var import_react3 = require("react");
2403
- var import_client6 = require("@reverbia/sdk");
2404
-
2405
- // src/lib/db/memory/schema.ts
2406
- var import_watermelondb4 = require("@nozbe/watermelondb");
2407
- var memoryStorageSchema = (0, import_watermelondb4.appSchema)({
2408
- version: 1,
2409
- tables: [
2410
- (0, import_watermelondb4.tableSchema)({
2411
- name: "memories",
2412
- columns: [
2413
- { name: "type", type: "string", isIndexed: true },
2414
- { name: "namespace", type: "string", isIndexed: true },
2415
- { name: "key", type: "string", isIndexed: true },
2416
- { name: "value", type: "string" },
2417
- { name: "raw_evidence", type: "string" },
2418
- { name: "confidence", type: "number" },
2419
- { name: "pii", type: "boolean", isIndexed: true },
2420
- { name: "composite_key", type: "string", isIndexed: true },
2421
- { name: "unique_key", type: "string", isIndexed: true },
2422
- { name: "created_at", type: "number", isIndexed: true },
2423
- { name: "updated_at", type: "number" },
2424
- { name: "embedding", type: "string", isOptional: true },
2425
- { name: "embedding_model", type: "string", isOptional: true },
2426
- { name: "is_deleted", type: "boolean", isIndexed: true }
2427
- ]
2428
- })
2429
- ]
2430
- });
2404
+ // src/lib/db/schema.ts
2405
+ var import_watermelondb6 = require("@nozbe/watermelondb");
2406
+ var import_migrations2 = require("@nozbe/watermelondb/Schema/migrations");
2431
2407
 
2432
2408
  // src/lib/db/memory/models.ts
2433
- var import_watermelondb5 = require("@nozbe/watermelondb");
2409
+ var import_watermelondb4 = require("@nozbe/watermelondb");
2434
2410
  var import_decorators2 = require("@nozbe/watermelondb/decorators");
2435
- var Memory = class extends import_watermelondb5.Model {
2411
+ var Memory = class extends import_watermelondb4.Model {
2436
2412
  };
2437
2413
  Memory.table = "memories";
2438
2414
  __decorateClass([
@@ -2478,6 +2454,149 @@ __decorateClass([
2478
2454
  (0, import_decorators2.field)("is_deleted")
2479
2455
  ], Memory.prototype, "isDeleted", 2);
2480
2456
 
2457
+ // src/lib/db/settings/models.ts
2458
+ var import_watermelondb5 = require("@nozbe/watermelondb");
2459
+ var import_decorators3 = require("@nozbe/watermelondb/decorators");
2460
+ var ModelPreference = class extends import_watermelondb5.Model {
2461
+ };
2462
+ ModelPreference.table = "modelPreferences";
2463
+ __decorateClass([
2464
+ (0, import_decorators3.text)("wallet_address")
2465
+ ], ModelPreference.prototype, "walletAddress", 2);
2466
+ __decorateClass([
2467
+ (0, import_decorators3.text)("models")
2468
+ ], ModelPreference.prototype, "models", 2);
2469
+
2470
+ // src/lib/db/schema.ts
2471
+ var SDK_SCHEMA_VERSION = 4;
2472
+ var sdkSchema = (0, import_watermelondb6.appSchema)({
2473
+ version: SDK_SCHEMA_VERSION,
2474
+ tables: [
2475
+ // Chat storage tables
2476
+ (0, import_watermelondb6.tableSchema)({
2477
+ name: "history",
2478
+ columns: [
2479
+ { name: "message_id", type: "number" },
2480
+ { name: "conversation_id", type: "string", isIndexed: true },
2481
+ { name: "role", type: "string", isIndexed: true },
2482
+ { name: "content", type: "string" },
2483
+ { name: "model", type: "string", isOptional: true },
2484
+ { name: "files", type: "string", isOptional: true },
2485
+ { name: "created_at", type: "number", isIndexed: true },
2486
+ { name: "updated_at", type: "number" },
2487
+ { name: "vector", type: "string", isOptional: true },
2488
+ { name: "embedding_model", type: "string", isOptional: true },
2489
+ { name: "usage", type: "string", isOptional: true },
2490
+ { name: "sources", type: "string", isOptional: true },
2491
+ { name: "response_duration", type: "number", isOptional: true },
2492
+ { name: "was_stopped", type: "boolean", isOptional: true }
2493
+ ]
2494
+ }),
2495
+ (0, import_watermelondb6.tableSchema)({
2496
+ name: "conversations",
2497
+ columns: [
2498
+ { name: "conversation_id", type: "string", isIndexed: true },
2499
+ { name: "title", type: "string" },
2500
+ { name: "created_at", type: "number" },
2501
+ { name: "updated_at", type: "number" },
2502
+ { name: "is_deleted", type: "boolean", isIndexed: true }
2503
+ ]
2504
+ }),
2505
+ // Memory storage tables
2506
+ (0, import_watermelondb6.tableSchema)({
2507
+ name: "memories",
2508
+ columns: [
2509
+ { name: "type", type: "string", isIndexed: true },
2510
+ { name: "namespace", type: "string", isIndexed: true },
2511
+ { name: "key", type: "string", isIndexed: true },
2512
+ { name: "value", type: "string" },
2513
+ { name: "raw_evidence", type: "string" },
2514
+ { name: "confidence", type: "number" },
2515
+ { name: "pii", type: "boolean", isIndexed: true },
2516
+ { name: "composite_key", type: "string", isIndexed: true },
2517
+ { name: "unique_key", type: "string", isIndexed: true },
2518
+ { name: "created_at", type: "number", isIndexed: true },
2519
+ { name: "updated_at", type: "number" },
2520
+ { name: "embedding", type: "string", isOptional: true },
2521
+ { name: "embedding_model", type: "string", isOptional: true },
2522
+ { name: "is_deleted", type: "boolean", isIndexed: true }
2523
+ ]
2524
+ }),
2525
+ // Settings storage tables
2526
+ (0, import_watermelondb6.tableSchema)({
2527
+ name: "modelPreferences",
2528
+ columns: [
2529
+ { name: "wallet_address", type: "string", isIndexed: true },
2530
+ { name: "models", type: "string", isOptional: true }
2531
+ ]
2532
+ })
2533
+ ]
2534
+ });
2535
+ var sdkMigrations = (0, import_migrations2.schemaMigrations)({
2536
+ migrations: [
2537
+ // v2 -> v3: Added was_stopped column to history
2538
+ {
2539
+ toVersion: 3,
2540
+ steps: [
2541
+ (0, import_migrations2.addColumns)({
2542
+ table: "history",
2543
+ columns: [{ name: "was_stopped", type: "boolean", isOptional: true }]
2544
+ })
2545
+ ]
2546
+ },
2547
+ // v3 -> v4: Added settings storage (modelPreferences table)
2548
+ {
2549
+ toVersion: 4,
2550
+ steps: [
2551
+ (0, import_migrations2.createTable)({
2552
+ name: "modelPreferences",
2553
+ columns: [
2554
+ { name: "wallet_address", type: "string", isIndexed: true },
2555
+ { name: "models", type: "string", isOptional: true }
2556
+ ]
2557
+ })
2558
+ ]
2559
+ }
2560
+ ]
2561
+ });
2562
+ var sdkModelClasses = [
2563
+ Message,
2564
+ Conversation,
2565
+ Memory,
2566
+ ModelPreference
2567
+ ];
2568
+
2569
+ // src/react/useMemoryStorage.ts
2570
+ var import_react3 = require("react");
2571
+ var import_client6 = require("@reverbia/sdk");
2572
+
2573
+ // src/lib/db/memory/schema.ts
2574
+ var import_watermelondb7 = require("@nozbe/watermelondb");
2575
+ var memoryStorageSchema = (0, import_watermelondb7.appSchema)({
2576
+ version: 1,
2577
+ tables: [
2578
+ (0, import_watermelondb7.tableSchema)({
2579
+ name: "memories",
2580
+ columns: [
2581
+ { name: "type", type: "string", isIndexed: true },
2582
+ { name: "namespace", type: "string", isIndexed: true },
2583
+ { name: "key", type: "string", isIndexed: true },
2584
+ { name: "value", type: "string" },
2585
+ { name: "raw_evidence", type: "string" },
2586
+ { name: "confidence", type: "number" },
2587
+ { name: "pii", type: "boolean", isIndexed: true },
2588
+ { name: "composite_key", type: "string", isIndexed: true },
2589
+ { name: "unique_key", type: "string", isIndexed: true },
2590
+ { name: "created_at", type: "number", isIndexed: true },
2591
+ { name: "updated_at", type: "number" },
2592
+ { name: "embedding", type: "string", isOptional: true },
2593
+ { name: "embedding_model", type: "string", isOptional: true },
2594
+ { name: "is_deleted", type: "boolean", isIndexed: true }
2595
+ ]
2596
+ })
2597
+ ]
2598
+ });
2599
+
2481
2600
  // src/lib/db/memory/types.ts
2482
2601
  function generateCompositeKey(namespace, key) {
2483
2602
  return `${namespace}:${key}`;
@@ -2505,7 +2624,7 @@ function cosineSimilarity2(a, b) {
2505
2624
  }
2506
2625
 
2507
2626
  // src/lib/db/memory/operations.ts
2508
- var import_watermelondb6 = require("@nozbe/watermelondb");
2627
+ var import_watermelondb8 = require("@nozbe/watermelondb");
2509
2628
  function memoryToStored(memory) {
2510
2629
  return {
2511
2630
  uniqueId: memory.id,
@@ -2526,7 +2645,7 @@ function memoryToStored(memory) {
2526
2645
  };
2527
2646
  }
2528
2647
  async function getAllMemoriesOp(ctx) {
2529
- const results = await ctx.memoriesCollection.query(import_watermelondb6.Q.where("is_deleted", false), import_watermelondb6.Q.sortBy("created_at", import_watermelondb6.Q.desc)).fetch();
2648
+ const results = await ctx.memoriesCollection.query(import_watermelondb8.Q.where("is_deleted", false), import_watermelondb8.Q.sortBy("created_at", import_watermelondb8.Q.desc)).fetch();
2530
2649
  return results.map(memoryToStored);
2531
2650
  }
2532
2651
  async function getMemoryByIdOp(ctx, id) {
@@ -2540,18 +2659,18 @@ async function getMemoryByIdOp(ctx, id) {
2540
2659
  }
2541
2660
  async function getMemoriesByNamespaceOp(ctx, namespace) {
2542
2661
  const results = await ctx.memoriesCollection.query(
2543
- import_watermelondb6.Q.where("namespace", namespace),
2544
- import_watermelondb6.Q.where("is_deleted", false),
2545
- import_watermelondb6.Q.sortBy("created_at", import_watermelondb6.Q.desc)
2662
+ import_watermelondb8.Q.where("namespace", namespace),
2663
+ import_watermelondb8.Q.where("is_deleted", false),
2664
+ import_watermelondb8.Q.sortBy("created_at", import_watermelondb8.Q.desc)
2546
2665
  ).fetch();
2547
2666
  return results.map(memoryToStored);
2548
2667
  }
2549
2668
  async function getMemoriesByKeyOp(ctx, namespace, key) {
2550
2669
  const compositeKey = generateCompositeKey(namespace, key);
2551
2670
  const results = await ctx.memoriesCollection.query(
2552
- import_watermelondb6.Q.where("composite_key", compositeKey),
2553
- import_watermelondb6.Q.where("is_deleted", false),
2554
- import_watermelondb6.Q.sortBy("created_at", import_watermelondb6.Q.desc)
2671
+ import_watermelondb8.Q.where("composite_key", compositeKey),
2672
+ import_watermelondb8.Q.where("is_deleted", false),
2673
+ import_watermelondb8.Q.sortBy("created_at", import_watermelondb8.Q.desc)
2555
2674
  ).fetch();
2556
2675
  return results.map(memoryToStored);
2557
2676
  }
@@ -2559,7 +2678,7 @@ async function saveMemoryOp(ctx, opts) {
2559
2678
  const compositeKey = generateCompositeKey(opts.namespace, opts.key);
2560
2679
  const uniqueKey = generateUniqueKey(opts.namespace, opts.key, opts.value);
2561
2680
  const result = await ctx.database.write(async () => {
2562
- const existing = await ctx.memoriesCollection.query(import_watermelondb6.Q.where("unique_key", uniqueKey)).fetch();
2681
+ const existing = await ctx.memoriesCollection.query(import_watermelondb8.Q.where("unique_key", uniqueKey)).fetch();
2563
2682
  if (existing.length > 0) {
2564
2683
  const existingMemory = existing[0];
2565
2684
  const shouldPreserveEmbedding = existingMemory.value === opts.value && existingMemory.rawEvidence === opts.rawEvidence && existingMemory.type === opts.type && existingMemory.namespace === opts.namespace && existingMemory.key === opts.key && existingMemory.embedding !== void 0 && existingMemory.embedding.length > 0 && !opts.embedding;
@@ -2632,7 +2751,7 @@ async function updateMemoryOp(ctx, id, updates) {
2632
2751
  const newCompositeKey = generateCompositeKey(newNamespace, newKey);
2633
2752
  const newUniqueKey = generateUniqueKey(newNamespace, newKey, newValue);
2634
2753
  if (newUniqueKey !== memory.uniqueKey) {
2635
- const existing = await ctx.memoriesCollection.query(import_watermelondb6.Q.where("unique_key", newUniqueKey), import_watermelondb6.Q.where("is_deleted", false)).fetch();
2754
+ const existing = await ctx.memoriesCollection.query(import_watermelondb8.Q.where("unique_key", newUniqueKey), import_watermelondb8.Q.where("is_deleted", false)).fetch();
2636
2755
  if (existing.length > 0) {
2637
2756
  return { ok: false, reason: "conflict", conflictingKey: newUniqueKey };
2638
2757
  }
@@ -2688,7 +2807,7 @@ async function deleteMemoryByIdOp(ctx, id) {
2688
2807
  }
2689
2808
  async function deleteMemoryOp(ctx, namespace, key, value) {
2690
2809
  const uniqueKey = generateUniqueKey(namespace, key, value);
2691
- const results = await ctx.memoriesCollection.query(import_watermelondb6.Q.where("unique_key", uniqueKey)).fetch();
2810
+ const results = await ctx.memoriesCollection.query(import_watermelondb8.Q.where("unique_key", uniqueKey)).fetch();
2692
2811
  if (results.length > 0) {
2693
2812
  await ctx.database.write(async () => {
2694
2813
  await results[0].update((mem) => {
@@ -2699,7 +2818,7 @@ async function deleteMemoryOp(ctx, namespace, key, value) {
2699
2818
  }
2700
2819
  async function deleteMemoriesByKeyOp(ctx, namespace, key) {
2701
2820
  const compositeKey = generateCompositeKey(namespace, key);
2702
- const results = await ctx.memoriesCollection.query(import_watermelondb6.Q.where("composite_key", compositeKey), import_watermelondb6.Q.where("is_deleted", false)).fetch();
2821
+ const results = await ctx.memoriesCollection.query(import_watermelondb8.Q.where("composite_key", compositeKey), import_watermelondb8.Q.where("is_deleted", false)).fetch();
2703
2822
  await ctx.database.write(async () => {
2704
2823
  for (const memory of results) {
2705
2824
  await memory.update((mem) => {
@@ -2709,7 +2828,7 @@ async function deleteMemoriesByKeyOp(ctx, namespace, key) {
2709
2828
  });
2710
2829
  }
2711
2830
  async function clearAllMemoriesOp(ctx) {
2712
- const results = await ctx.memoriesCollection.query(import_watermelondb6.Q.where("is_deleted", false)).fetch();
2831
+ const results = await ctx.memoriesCollection.query(import_watermelondb8.Q.where("is_deleted", false)).fetch();
2713
2832
  await ctx.database.write(async () => {
2714
2833
  for (const memory of results) {
2715
2834
  await memory.update((mem) => {
@@ -2719,7 +2838,7 @@ async function clearAllMemoriesOp(ctx) {
2719
2838
  });
2720
2839
  }
2721
2840
  async function searchSimilarMemoriesOp(ctx, queryEmbedding, limit = 10, minSimilarity = 0.6) {
2722
- const allMemories = await ctx.memoriesCollection.query(import_watermelondb6.Q.where("is_deleted", false)).fetch();
2841
+ const allMemories = await ctx.memoriesCollection.query(import_watermelondb8.Q.where("is_deleted", false)).fetch();
2723
2842
  const memoriesWithEmbeddings = allMemories.filter(
2724
2843
  (m) => m.embedding && m.embedding.length > 0
2725
2844
  );
@@ -3539,11 +3658,11 @@ function useMemoryStorage(options) {
3539
3658
  var import_react4 = require("react");
3540
3659
 
3541
3660
  // src/lib/db/settings/schema.ts
3542
- var import_watermelondb7 = require("@nozbe/watermelondb");
3543
- var settingsStorageSchema = (0, import_watermelondb7.appSchema)({
3661
+ var import_watermelondb9 = require("@nozbe/watermelondb");
3662
+ var settingsStorageSchema = (0, import_watermelondb9.appSchema)({
3544
3663
  version: 1,
3545
3664
  tables: [
3546
- (0, import_watermelondb7.tableSchema)({
3665
+ (0, import_watermelondb9.tableSchema)({
3547
3666
  name: "modelPreferences",
3548
3667
  columns: [
3549
3668
  { name: "wallet_address", type: "string", isIndexed: true },
@@ -3553,21 +3672,8 @@ var settingsStorageSchema = (0, import_watermelondb7.appSchema)({
3553
3672
  ]
3554
3673
  });
3555
3674
 
3556
- // src/lib/db/settings/models.ts
3557
- var import_watermelondb8 = require("@nozbe/watermelondb");
3558
- var import_decorators3 = require("@nozbe/watermelondb/decorators");
3559
- var ModelPreference = class extends import_watermelondb8.Model {
3560
- };
3561
- ModelPreference.table = "modelPreferences";
3562
- __decorateClass([
3563
- (0, import_decorators3.text)("wallet_address")
3564
- ], ModelPreference.prototype, "walletAddress", 2);
3565
- __decorateClass([
3566
- (0, import_decorators3.text)("models")
3567
- ], ModelPreference.prototype, "models", 2);
3568
-
3569
3675
  // src/lib/db/settings/operations.ts
3570
- var import_watermelondb9 = require("@nozbe/watermelondb");
3676
+ var import_watermelondb10 = require("@nozbe/watermelondb");
3571
3677
  function modelPreferenceToStored(preference) {
3572
3678
  return {
3573
3679
  uniqueId: preference.id,
@@ -3576,12 +3682,12 @@ function modelPreferenceToStored(preference) {
3576
3682
  };
3577
3683
  }
3578
3684
  async function getModelPreferenceOp(ctx, walletAddress) {
3579
- const results = await ctx.modelPreferencesCollection.query(import_watermelondb9.Q.where("wallet_address", walletAddress)).fetch();
3685
+ const results = await ctx.modelPreferencesCollection.query(import_watermelondb10.Q.where("wallet_address", walletAddress)).fetch();
3580
3686
  return results.length > 0 ? modelPreferenceToStored(results[0]) : null;
3581
3687
  }
3582
3688
  async function setModelPreferenceOp(ctx, walletAddress, models) {
3583
3689
  const result = await ctx.database.write(async () => {
3584
- const results = await ctx.modelPreferencesCollection.query(import_watermelondb9.Q.where("wallet_address", walletAddress)).fetch();
3690
+ const results = await ctx.modelPreferencesCollection.query(import_watermelondb10.Q.where("wallet_address", walletAddress)).fetch();
3585
3691
  if (results.length > 0) {
3586
3692
  const preference = results[0];
3587
3693
  await preference.update((pref) => {
@@ -3599,7 +3705,7 @@ async function setModelPreferenceOp(ctx, walletAddress, models) {
3599
3705
  return modelPreferenceToStored(result);
3600
3706
  }
3601
3707
  async function deleteModelPreferenceOp(ctx, walletAddress) {
3602
- const results = await ctx.modelPreferencesCollection.query(import_watermelondb9.Q.where("wallet_address", walletAddress)).fetch();
3708
+ const results = await ctx.modelPreferencesCollection.query(import_watermelondb10.Q.where("wallet_address", walletAddress)).fetch();
3603
3709
  if (results.length === 0) return false;
3604
3710
  await ctx.database.write(async () => {
3605
3711
  await results[0].destroyPermanently();
@@ -5163,6 +5269,9 @@ function useGoogleDriveBackup(options) {
5163
5269
  hasEncryptionKey,
5164
5270
  memoryStorageSchema,
5165
5271
  requestEncryptionKey,
5272
+ sdkMigrations,
5273
+ sdkModelClasses,
5274
+ sdkSchema,
5166
5275
  selectTool,
5167
5276
  settingsStorageSchema,
5168
5277
  storeDropboxToken,
@@ -1,7 +1,8 @@
1
1
  import { Database, Model } from '@nozbe/watermelondb';
2
2
  import * as _nozbe_watermelondb_Schema_migrations from '@nozbe/watermelondb/Schema/migrations';
3
3
  import * as _nozbe_watermelondb_Schema from '@nozbe/watermelondb/Schema';
4
- import { Associations } from '@nozbe/watermelondb/Model';
4
+ import Model$1, { Associations } from '@nozbe/watermelondb/Model';
5
+ import { Class } from '@nozbe/watermelondb/types';
5
6
  import { ReactNode, JSX } from 'react';
6
7
 
7
8
  /**
@@ -904,6 +905,79 @@ interface UseChatStorageResult extends BaseUseChatStorageResult {
904
905
  */
905
906
  declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageResult;
906
907
 
908
+ /**
909
+ * Combined WatermelonDB schema for all SDK storage modules.
910
+ *
911
+ * This unified schema includes all tables needed by the SDK:
912
+ * - `history`: Chat message storage with embeddings and metadata
913
+ * - `conversations`: Conversation metadata and organization
914
+ * - `memories`: Persistent memory storage with semantic search
915
+ * - `modelPreferences`: User model preferences and settings
916
+ *
917
+ * @example
918
+ * ```typescript
919
+ * import { Database } from '@nozbe/watermelondb';
920
+ * import LokiJSAdapter from '@nozbe/watermelondb/adapters/lokijs';
921
+ * import { sdkSchema, sdkMigrations, sdkModelClasses } from '@reverbia/sdk/react';
922
+ *
923
+ * const adapter = new LokiJSAdapter({
924
+ * schema: sdkSchema,
925
+ * migrations: sdkMigrations,
926
+ * dbName: 'my-app-db',
927
+ * useWebWorker: false,
928
+ * useIncrementalIndexedDB: true,
929
+ * });
930
+ *
931
+ * const database = new Database({
932
+ * adapter,
933
+ * modelClasses: sdkModelClasses,
934
+ * });
935
+ * ```
936
+ */
937
+ declare const sdkSchema: Readonly<{
938
+ version: _nozbe_watermelondb_Schema.SchemaVersion;
939
+ tables: _nozbe_watermelondb_Schema.TableMap;
940
+ unsafeSql?: (_: string, __: _nozbe_watermelondb_Schema.AppSchemaUnsafeSqlKind) => string;
941
+ }>;
942
+ /**
943
+ * Combined migrations for all SDK storage modules.
944
+ *
945
+ * These migrations handle database schema upgrades from any previous version
946
+ * to the current version. The SDK manages all migration logic internally,
947
+ * so consumer apps don't need to handle version arithmetic or migration merging.
948
+ *
949
+ * **Minimum supported version: v2**
950
+ * Migrations from v1 are not supported. Databases at v1 require a fresh install.
951
+ *
952
+ * Migration history:
953
+ * - v2 → v3: Added `was_stopped` column to history table
954
+ * - v3 → v4: Added `modelPreferences` table for settings storage
955
+ */
956
+ declare const sdkMigrations: Readonly<{
957
+ validated: true;
958
+ minVersion: _nozbe_watermelondb_Schema.SchemaVersion;
959
+ maxVersion: _nozbe_watermelondb_Schema.SchemaVersion;
960
+ sortedMigrations: _nozbe_watermelondb_Schema_migrations.Migration[];
961
+ }>;
962
+ /**
963
+ * Model classes to register with the WatermelonDB database.
964
+ *
965
+ * Pass this array directly to the `modelClasses` option when creating
966
+ * your Database instance.
967
+ *
968
+ * @example
969
+ * ```typescript
970
+ * import { Database } from '@nozbe/watermelondb';
971
+ * import { sdkSchema, sdkMigrations, sdkModelClasses } from '@reverbia/sdk/react';
972
+ *
973
+ * const database = new Database({
974
+ * adapter,
975
+ * modelClasses: sdkModelClasses,
976
+ * });
977
+ * ```
978
+ */
979
+ declare const sdkModelClasses: Class<Model$1>[];
980
+
907
981
  declare const memoryStorageSchema: Readonly<{
908
982
  version: _nozbe_watermelondb_Schema.SchemaVersion;
909
983
  tables: _nozbe_watermelondb_Schema.TableMap;
@@ -1715,4 +1789,4 @@ interface UseGoogleDriveBackupResult {
1715
1789
  */
1716
1790
  declare function useGoogleDriveBackup(options: UseGoogleDriveBackupOptions): UseGoogleDriveBackupResult;
1717
1791
 
1718
- export { Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ClientTool, type CreateConversationOptions, type CreateMemoryOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, DEFAULT_BACKUP_FOLDER, DEFAULT_CONVERSATIONS_FOLDER as DEFAULT_DRIVE_CONVERSATIONS_FOLDER, DEFAULT_ROOT_FOLDER as DEFAULT_DRIVE_ROOT_FOLDER, DEFAULT_TOOL_SELECTOR_MODEL, type DropboxAuthContextValue, DropboxAuthProvider, type DropboxAuthProviderProps, type DropboxExportResult, type DropboxImportResult, type FileMetadata, type GoogleDriveExportResult, type GoogleDriveImportResult, type MemoryItem, type MemoryType, type OCRFile, type PdfFile, type SearchMessagesOptions, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type SignMessageFn, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredMemory, Memory as StoredMemoryModel, type StoredMemoryWithSimilarity, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, ModelPreference as StoredModelPreferenceModel, type ToolExecutionResult, type ToolParameter, type ToolSelectionResult, type UpdateMemoryOptions, type UpdateModelPreferenceOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseDropboxBackupOptions, type UseDropboxBackupResult, type UseGoogleDriveBackupOptions, type UseGoogleDriveBackupResult, type UseMemoryStorageOptions, type UseMemoryStorageResult, type UseSettingsOptions, type UseSettingsResult, chatStorageMigrations, chatStorageSchema, clearToken as clearDropboxToken, createMemoryContextSystemMessage, decryptData, decryptDataBytes, encryptData, executeTool, extractConversationContext, formatMemoriesForChat, generateCompositeKey, generateConversationId, generateUniqueKey, getStoredToken as getDropboxToken, hasEncryptionKey, memoryStorageSchema, requestEncryptionKey, selectTool, settingsStorageSchema, storeToken as storeDropboxToken, useChat, useChatStorage, useDropboxAuth, useDropboxBackup, useEncryption, useGoogleDriveBackup, useImageGeneration, useMemoryStorage, useModels, useOCR, usePdf, useSearch, useSettings };
1792
+ export { Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ClientTool, type CreateConversationOptions, type CreateMemoryOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, DEFAULT_BACKUP_FOLDER, DEFAULT_CONVERSATIONS_FOLDER as DEFAULT_DRIVE_CONVERSATIONS_FOLDER, DEFAULT_ROOT_FOLDER as DEFAULT_DRIVE_ROOT_FOLDER, DEFAULT_TOOL_SELECTOR_MODEL, type DropboxAuthContextValue, DropboxAuthProvider, type DropboxAuthProviderProps, type DropboxExportResult, type DropboxImportResult, type FileMetadata, type GoogleDriveExportResult, type GoogleDriveImportResult, type MemoryItem, type MemoryType, type OCRFile, type PdfFile, type SearchMessagesOptions, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type SignMessageFn, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredMemory, Memory as StoredMemoryModel, type StoredMemoryWithSimilarity, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, ModelPreference as StoredModelPreferenceModel, type ToolExecutionResult, type ToolParameter, type ToolSelectionResult, type UpdateMemoryOptions, type UpdateModelPreferenceOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseDropboxBackupOptions, type UseDropboxBackupResult, type UseGoogleDriveBackupOptions, type UseGoogleDriveBackupResult, type UseMemoryStorageOptions, type UseMemoryStorageResult, type UseSettingsOptions, type UseSettingsResult, chatStorageMigrations, chatStorageSchema, clearToken as clearDropboxToken, createMemoryContextSystemMessage, decryptData, decryptDataBytes, encryptData, executeTool, extractConversationContext, formatMemoriesForChat, generateCompositeKey, generateConversationId, generateUniqueKey, getStoredToken as getDropboxToken, hasEncryptionKey, memoryStorageSchema, requestEncryptionKey, sdkMigrations, sdkModelClasses, sdkSchema, selectTool, settingsStorageSchema, storeToken as storeDropboxToken, useChat, useChatStorage, useDropboxAuth, useDropboxBackup, useEncryption, useGoogleDriveBackup, useImageGeneration, useMemoryStorage, useModels, useOCR, usePdf, useSearch, useSettings };
@@ -1,7 +1,8 @@
1
1
  import { Database, Model } from '@nozbe/watermelondb';
2
2
  import * as _nozbe_watermelondb_Schema_migrations from '@nozbe/watermelondb/Schema/migrations';
3
3
  import * as _nozbe_watermelondb_Schema from '@nozbe/watermelondb/Schema';
4
- import { Associations } from '@nozbe/watermelondb/Model';
4
+ import Model$1, { Associations } from '@nozbe/watermelondb/Model';
5
+ import { Class } from '@nozbe/watermelondb/types';
5
6
  import { ReactNode, JSX } from 'react';
6
7
 
7
8
  /**
@@ -904,6 +905,79 @@ interface UseChatStorageResult extends BaseUseChatStorageResult {
904
905
  */
905
906
  declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageResult;
906
907
 
908
+ /**
909
+ * Combined WatermelonDB schema for all SDK storage modules.
910
+ *
911
+ * This unified schema includes all tables needed by the SDK:
912
+ * - `history`: Chat message storage with embeddings and metadata
913
+ * - `conversations`: Conversation metadata and organization
914
+ * - `memories`: Persistent memory storage with semantic search
915
+ * - `modelPreferences`: User model preferences and settings
916
+ *
917
+ * @example
918
+ * ```typescript
919
+ * import { Database } from '@nozbe/watermelondb';
920
+ * import LokiJSAdapter from '@nozbe/watermelondb/adapters/lokijs';
921
+ * import { sdkSchema, sdkMigrations, sdkModelClasses } from '@reverbia/sdk/react';
922
+ *
923
+ * const adapter = new LokiJSAdapter({
924
+ * schema: sdkSchema,
925
+ * migrations: sdkMigrations,
926
+ * dbName: 'my-app-db',
927
+ * useWebWorker: false,
928
+ * useIncrementalIndexedDB: true,
929
+ * });
930
+ *
931
+ * const database = new Database({
932
+ * adapter,
933
+ * modelClasses: sdkModelClasses,
934
+ * });
935
+ * ```
936
+ */
937
+ declare const sdkSchema: Readonly<{
938
+ version: _nozbe_watermelondb_Schema.SchemaVersion;
939
+ tables: _nozbe_watermelondb_Schema.TableMap;
940
+ unsafeSql?: (_: string, __: _nozbe_watermelondb_Schema.AppSchemaUnsafeSqlKind) => string;
941
+ }>;
942
+ /**
943
+ * Combined migrations for all SDK storage modules.
944
+ *
945
+ * These migrations handle database schema upgrades from any previous version
946
+ * to the current version. The SDK manages all migration logic internally,
947
+ * so consumer apps don't need to handle version arithmetic or migration merging.
948
+ *
949
+ * **Minimum supported version: v2**
950
+ * Migrations from v1 are not supported. Databases at v1 require a fresh install.
951
+ *
952
+ * Migration history:
953
+ * - v2 → v3: Added `was_stopped` column to history table
954
+ * - v3 → v4: Added `modelPreferences` table for settings storage
955
+ */
956
+ declare const sdkMigrations: Readonly<{
957
+ validated: true;
958
+ minVersion: _nozbe_watermelondb_Schema.SchemaVersion;
959
+ maxVersion: _nozbe_watermelondb_Schema.SchemaVersion;
960
+ sortedMigrations: _nozbe_watermelondb_Schema_migrations.Migration[];
961
+ }>;
962
+ /**
963
+ * Model classes to register with the WatermelonDB database.
964
+ *
965
+ * Pass this array directly to the `modelClasses` option when creating
966
+ * your Database instance.
967
+ *
968
+ * @example
969
+ * ```typescript
970
+ * import { Database } from '@nozbe/watermelondb';
971
+ * import { sdkSchema, sdkMigrations, sdkModelClasses } from '@reverbia/sdk/react';
972
+ *
973
+ * const database = new Database({
974
+ * adapter,
975
+ * modelClasses: sdkModelClasses,
976
+ * });
977
+ * ```
978
+ */
979
+ declare const sdkModelClasses: Class<Model$1>[];
980
+
907
981
  declare const memoryStorageSchema: Readonly<{
908
982
  version: _nozbe_watermelondb_Schema.SchemaVersion;
909
983
  tables: _nozbe_watermelondb_Schema.TableMap;
@@ -1715,4 +1789,4 @@ interface UseGoogleDriveBackupResult {
1715
1789
  */
1716
1790
  declare function useGoogleDriveBackup(options: UseGoogleDriveBackupOptions): UseGoogleDriveBackupResult;
1717
1791
 
1718
- export { Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ClientTool, type CreateConversationOptions, type CreateMemoryOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, DEFAULT_BACKUP_FOLDER, DEFAULT_CONVERSATIONS_FOLDER as DEFAULT_DRIVE_CONVERSATIONS_FOLDER, DEFAULT_ROOT_FOLDER as DEFAULT_DRIVE_ROOT_FOLDER, DEFAULT_TOOL_SELECTOR_MODEL, type DropboxAuthContextValue, DropboxAuthProvider, type DropboxAuthProviderProps, type DropboxExportResult, type DropboxImportResult, type FileMetadata, type GoogleDriveExportResult, type GoogleDriveImportResult, type MemoryItem, type MemoryType, type OCRFile, type PdfFile, type SearchMessagesOptions, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type SignMessageFn, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredMemory, Memory as StoredMemoryModel, type StoredMemoryWithSimilarity, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, ModelPreference as StoredModelPreferenceModel, type ToolExecutionResult, type ToolParameter, type ToolSelectionResult, type UpdateMemoryOptions, type UpdateModelPreferenceOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseDropboxBackupOptions, type UseDropboxBackupResult, type UseGoogleDriveBackupOptions, type UseGoogleDriveBackupResult, type UseMemoryStorageOptions, type UseMemoryStorageResult, type UseSettingsOptions, type UseSettingsResult, chatStorageMigrations, chatStorageSchema, clearToken as clearDropboxToken, createMemoryContextSystemMessage, decryptData, decryptDataBytes, encryptData, executeTool, extractConversationContext, formatMemoriesForChat, generateCompositeKey, generateConversationId, generateUniqueKey, getStoredToken as getDropboxToken, hasEncryptionKey, memoryStorageSchema, requestEncryptionKey, selectTool, settingsStorageSchema, storeToken as storeDropboxToken, useChat, useChatStorage, useDropboxAuth, useDropboxBackup, useEncryption, useGoogleDriveBackup, useImageGeneration, useMemoryStorage, useModels, useOCR, usePdf, useSearch, useSettings };
1792
+ export { Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ClientTool, type CreateConversationOptions, type CreateMemoryOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, DEFAULT_BACKUP_FOLDER, DEFAULT_CONVERSATIONS_FOLDER as DEFAULT_DRIVE_CONVERSATIONS_FOLDER, DEFAULT_ROOT_FOLDER as DEFAULT_DRIVE_ROOT_FOLDER, DEFAULT_TOOL_SELECTOR_MODEL, type DropboxAuthContextValue, DropboxAuthProvider, type DropboxAuthProviderProps, type DropboxExportResult, type DropboxImportResult, type FileMetadata, type GoogleDriveExportResult, type GoogleDriveImportResult, type MemoryItem, type MemoryType, type OCRFile, type PdfFile, type SearchMessagesOptions, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type SignMessageFn, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredMemory, Memory as StoredMemoryModel, type StoredMemoryWithSimilarity, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, ModelPreference as StoredModelPreferenceModel, type ToolExecutionResult, type ToolParameter, type ToolSelectionResult, type UpdateMemoryOptions, type UpdateModelPreferenceOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseDropboxBackupOptions, type UseDropboxBackupResult, type UseGoogleDriveBackupOptions, type UseGoogleDriveBackupResult, type UseMemoryStorageOptions, type UseMemoryStorageResult, type UseSettingsOptions, type UseSettingsResult, chatStorageMigrations, chatStorageSchema, clearToken as clearDropboxToken, createMemoryContextSystemMessage, decryptData, decryptDataBytes, encryptData, executeTool, extractConversationContext, formatMemoriesForChat, generateCompositeKey, generateConversationId, generateUniqueKey, getStoredToken as getDropboxToken, hasEncryptionKey, memoryStorageSchema, requestEncryptionKey, sdkMigrations, sdkModelClasses, sdkSchema, selectTool, settingsStorageSchema, storeToken as storeDropboxToken, useChat, useChatStorage, useDropboxAuth, useDropboxBackup, useEncryption, useGoogleDriveBackup, useImageGeneration, useMemoryStorage, useModels, useOCR, usePdf, useSearch, useSettings };
@@ -2327,36 +2327,13 @@ function useChatStorage(options) {
2327
2327
  };
2328
2328
  }
2329
2329
 
2330
- // src/react/useMemoryStorage.ts
2331
- import { useCallback as useCallback3, useState as useState3, useMemo as useMemo2, useRef as useRef2 } from "react";
2332
- import { postApiV1ChatCompletions } from "@reverbia/sdk";
2333
-
2334
- // src/lib/db/memory/schema.ts
2330
+ // src/lib/db/schema.ts
2335
2331
  import { appSchema as appSchema2, tableSchema as tableSchema2 } from "@nozbe/watermelondb";
2336
- var memoryStorageSchema = appSchema2({
2337
- version: 1,
2338
- tables: [
2339
- tableSchema2({
2340
- name: "memories",
2341
- columns: [
2342
- { name: "type", type: "string", isIndexed: true },
2343
- { name: "namespace", type: "string", isIndexed: true },
2344
- { name: "key", type: "string", isIndexed: true },
2345
- { name: "value", type: "string" },
2346
- { name: "raw_evidence", type: "string" },
2347
- { name: "confidence", type: "number" },
2348
- { name: "pii", type: "boolean", isIndexed: true },
2349
- { name: "composite_key", type: "string", isIndexed: true },
2350
- { name: "unique_key", type: "string", isIndexed: true },
2351
- { name: "created_at", type: "number", isIndexed: true },
2352
- { name: "updated_at", type: "number" },
2353
- { name: "embedding", type: "string", isOptional: true },
2354
- { name: "embedding_model", type: "string", isOptional: true },
2355
- { name: "is_deleted", type: "boolean", isIndexed: true }
2356
- ]
2357
- })
2358
- ]
2359
- });
2332
+ import {
2333
+ schemaMigrations as schemaMigrations2,
2334
+ addColumns as addColumns2,
2335
+ createTable
2336
+ } from "@nozbe/watermelondb/Schema/migrations";
2360
2337
 
2361
2338
  // src/lib/db/memory/models.ts
2362
2339
  import { Model as Model2 } from "@nozbe/watermelondb";
@@ -2407,6 +2384,149 @@ __decorateClass([
2407
2384
  field2("is_deleted")
2408
2385
  ], Memory.prototype, "isDeleted", 2);
2409
2386
 
2387
+ // src/lib/db/settings/models.ts
2388
+ import { Model as Model3 } from "@nozbe/watermelondb";
2389
+ import { text as text3 } from "@nozbe/watermelondb/decorators";
2390
+ var ModelPreference = class extends Model3 {
2391
+ };
2392
+ ModelPreference.table = "modelPreferences";
2393
+ __decorateClass([
2394
+ text3("wallet_address")
2395
+ ], ModelPreference.prototype, "walletAddress", 2);
2396
+ __decorateClass([
2397
+ text3("models")
2398
+ ], ModelPreference.prototype, "models", 2);
2399
+
2400
+ // src/lib/db/schema.ts
2401
+ var SDK_SCHEMA_VERSION = 4;
2402
+ var sdkSchema = appSchema2({
2403
+ version: SDK_SCHEMA_VERSION,
2404
+ tables: [
2405
+ // Chat storage tables
2406
+ tableSchema2({
2407
+ name: "history",
2408
+ columns: [
2409
+ { name: "message_id", type: "number" },
2410
+ { name: "conversation_id", type: "string", isIndexed: true },
2411
+ { name: "role", type: "string", isIndexed: true },
2412
+ { name: "content", type: "string" },
2413
+ { name: "model", type: "string", isOptional: true },
2414
+ { name: "files", type: "string", isOptional: true },
2415
+ { name: "created_at", type: "number", isIndexed: true },
2416
+ { name: "updated_at", type: "number" },
2417
+ { name: "vector", type: "string", isOptional: true },
2418
+ { name: "embedding_model", type: "string", isOptional: true },
2419
+ { name: "usage", type: "string", isOptional: true },
2420
+ { name: "sources", type: "string", isOptional: true },
2421
+ { name: "response_duration", type: "number", isOptional: true },
2422
+ { name: "was_stopped", type: "boolean", isOptional: true }
2423
+ ]
2424
+ }),
2425
+ tableSchema2({
2426
+ name: "conversations",
2427
+ columns: [
2428
+ { name: "conversation_id", type: "string", isIndexed: true },
2429
+ { name: "title", type: "string" },
2430
+ { name: "created_at", type: "number" },
2431
+ { name: "updated_at", type: "number" },
2432
+ { name: "is_deleted", type: "boolean", isIndexed: true }
2433
+ ]
2434
+ }),
2435
+ // Memory storage tables
2436
+ tableSchema2({
2437
+ name: "memories",
2438
+ columns: [
2439
+ { name: "type", type: "string", isIndexed: true },
2440
+ { name: "namespace", type: "string", isIndexed: true },
2441
+ { name: "key", type: "string", isIndexed: true },
2442
+ { name: "value", type: "string" },
2443
+ { name: "raw_evidence", type: "string" },
2444
+ { name: "confidence", type: "number" },
2445
+ { name: "pii", type: "boolean", isIndexed: true },
2446
+ { name: "composite_key", type: "string", isIndexed: true },
2447
+ { name: "unique_key", type: "string", isIndexed: true },
2448
+ { name: "created_at", type: "number", isIndexed: true },
2449
+ { name: "updated_at", type: "number" },
2450
+ { name: "embedding", type: "string", isOptional: true },
2451
+ { name: "embedding_model", type: "string", isOptional: true },
2452
+ { name: "is_deleted", type: "boolean", isIndexed: true }
2453
+ ]
2454
+ }),
2455
+ // Settings storage tables
2456
+ tableSchema2({
2457
+ name: "modelPreferences",
2458
+ columns: [
2459
+ { name: "wallet_address", type: "string", isIndexed: true },
2460
+ { name: "models", type: "string", isOptional: true }
2461
+ ]
2462
+ })
2463
+ ]
2464
+ });
2465
+ var sdkMigrations = schemaMigrations2({
2466
+ migrations: [
2467
+ // v2 -> v3: Added was_stopped column to history
2468
+ {
2469
+ toVersion: 3,
2470
+ steps: [
2471
+ addColumns2({
2472
+ table: "history",
2473
+ columns: [{ name: "was_stopped", type: "boolean", isOptional: true }]
2474
+ })
2475
+ ]
2476
+ },
2477
+ // v3 -> v4: Added settings storage (modelPreferences table)
2478
+ {
2479
+ toVersion: 4,
2480
+ steps: [
2481
+ createTable({
2482
+ name: "modelPreferences",
2483
+ columns: [
2484
+ { name: "wallet_address", type: "string", isIndexed: true },
2485
+ { name: "models", type: "string", isOptional: true }
2486
+ ]
2487
+ })
2488
+ ]
2489
+ }
2490
+ ]
2491
+ });
2492
+ var sdkModelClasses = [
2493
+ Message,
2494
+ Conversation,
2495
+ Memory,
2496
+ ModelPreference
2497
+ ];
2498
+
2499
+ // src/react/useMemoryStorage.ts
2500
+ import { useCallback as useCallback3, useState as useState3, useMemo as useMemo2, useRef as useRef2 } from "react";
2501
+ import { postApiV1ChatCompletions } from "@reverbia/sdk";
2502
+
2503
+ // src/lib/db/memory/schema.ts
2504
+ import { appSchema as appSchema3, tableSchema as tableSchema3 } from "@nozbe/watermelondb";
2505
+ var memoryStorageSchema = appSchema3({
2506
+ version: 1,
2507
+ tables: [
2508
+ tableSchema3({
2509
+ name: "memories",
2510
+ columns: [
2511
+ { name: "type", type: "string", isIndexed: true },
2512
+ { name: "namespace", type: "string", isIndexed: true },
2513
+ { name: "key", type: "string", isIndexed: true },
2514
+ { name: "value", type: "string" },
2515
+ { name: "raw_evidence", type: "string" },
2516
+ { name: "confidence", type: "number" },
2517
+ { name: "pii", type: "boolean", isIndexed: true },
2518
+ { name: "composite_key", type: "string", isIndexed: true },
2519
+ { name: "unique_key", type: "string", isIndexed: true },
2520
+ { name: "created_at", type: "number", isIndexed: true },
2521
+ { name: "updated_at", type: "number" },
2522
+ { name: "embedding", type: "string", isOptional: true },
2523
+ { name: "embedding_model", type: "string", isOptional: true },
2524
+ { name: "is_deleted", type: "boolean", isIndexed: true }
2525
+ ]
2526
+ })
2527
+ ]
2528
+ });
2529
+
2410
2530
  // src/lib/db/memory/types.ts
2411
2531
  function generateCompositeKey(namespace, key) {
2412
2532
  return `${namespace}:${key}`;
@@ -3468,11 +3588,11 @@ function useMemoryStorage(options) {
3468
3588
  import { useCallback as useCallback4, useState as useState4, useMemo as useMemo3, useEffect as useEffect2 } from "react";
3469
3589
 
3470
3590
  // src/lib/db/settings/schema.ts
3471
- import { appSchema as appSchema3, tableSchema as tableSchema3 } from "@nozbe/watermelondb";
3472
- var settingsStorageSchema = appSchema3({
3591
+ import { appSchema as appSchema4, tableSchema as tableSchema4 } from "@nozbe/watermelondb";
3592
+ var settingsStorageSchema = appSchema4({
3473
3593
  version: 1,
3474
3594
  tables: [
3475
- tableSchema3({
3595
+ tableSchema4({
3476
3596
  name: "modelPreferences",
3477
3597
  columns: [
3478
3598
  { name: "wallet_address", type: "string", isIndexed: true },
@@ -3482,19 +3602,6 @@ var settingsStorageSchema = appSchema3({
3482
3602
  ]
3483
3603
  });
3484
3604
 
3485
- // src/lib/db/settings/models.ts
3486
- import { Model as Model3 } from "@nozbe/watermelondb";
3487
- import { text as text3 } from "@nozbe/watermelondb/decorators";
3488
- var ModelPreference = class extends Model3 {
3489
- };
3490
- ModelPreference.table = "modelPreferences";
3491
- __decorateClass([
3492
- text3("wallet_address")
3493
- ], ModelPreference.prototype, "walletAddress", 2);
3494
- __decorateClass([
3495
- text3("models")
3496
- ], ModelPreference.prototype, "models", 2);
3497
-
3498
3605
  // src/lib/db/settings/operations.ts
3499
3606
  import { Q as Q3 } from "@nozbe/watermelondb";
3500
3607
  function modelPreferenceToStored(preference) {
@@ -5098,6 +5205,9 @@ export {
5098
5205
  hasEncryptionKey,
5099
5206
  memoryStorageSchema,
5100
5207
  requestEncryptionKey,
5208
+ sdkMigrations,
5209
+ sdkModelClasses,
5210
+ sdkSchema,
5101
5211
  selectTool,
5102
5212
  settingsStorageSchema,
5103
5213
  storeToken as storeDropboxToken,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reverbia/sdk",
3
- "version": "1.0.0-next.20251217144909",
3
+ "version": "1.0.0-next.20251218151654",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",