@reverbia/sdk 1.0.0-next.20251217144159 → 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.
@@ -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
  /**
@@ -237,6 +238,10 @@ type LlmapiModel = {
237
238
  * MaxOutputTokens is the maximum output tokens
238
239
  */
239
240
  max_output_tokens?: number;
241
+ /**
242
+ * Modalities is a list of supported modalities (e.g., ["llm", "vision"])
243
+ */
244
+ modalities?: Array<string>;
240
245
  /**
241
246
  * Name is the human-readable model name (optional)
242
247
  */
@@ -631,224 +636,148 @@ declare function useEncryption(signMessage: SignMessageFn): {
631
636
  requestEncryptionKey: (walletAddress: string) => Promise<void>;
632
637
  };
633
638
 
634
- /**
635
- * Message role type
636
- */
639
+ declare const chatStorageSchema: Readonly<{
640
+ version: _nozbe_watermelondb_Schema.SchemaVersion;
641
+ tables: _nozbe_watermelondb_Schema.TableMap;
642
+ unsafeSql?: (_: string, __: _nozbe_watermelondb_Schema.AppSchemaUnsafeSqlKind) => string;
643
+ }>;
644
+ declare const chatStorageMigrations: Readonly<{
645
+ validated: true;
646
+ minVersion: _nozbe_watermelondb_Schema.SchemaVersion;
647
+ maxVersion: _nozbe_watermelondb_Schema.SchemaVersion;
648
+ sortedMigrations: _nozbe_watermelondb_Schema_migrations.Migration[];
649
+ }>;
650
+
637
651
  type ChatRole = "user" | "assistant" | "system";
638
- /**
639
- * File metadata for attached files
640
- */
641
652
  interface FileMetadata {
642
- /** Unique file identifier */
643
653
  id: string;
644
- /** Original file name */
645
654
  name: string;
646
- /** MIME type */
647
655
  type: string;
648
- /** File size in bytes */
649
656
  size: number;
650
- /** Optional URL or data URI */
651
657
  url?: string;
652
658
  }
653
- /**
654
- * Token usage and cost information
655
- */
656
659
  interface ChatCompletionUsage {
657
- /** Number of tokens in the prompt */
658
660
  promptTokens?: number;
659
- /** Number of tokens in the completion */
660
661
  completionTokens?: number;
661
- /** Total tokens used */
662
662
  totalTokens?: number;
663
- /** Cost in micro-dollars (USD × 1,000,000) */
664
663
  costMicroUsd?: number;
665
664
  }
666
- /**
667
- * Web search source information
668
- */
669
665
  interface SearchSource {
670
- /** Source title */
671
666
  title?: string;
672
- /** Source URL */
673
667
  url?: string;
674
- /** Text snippet from the source */
675
668
  snippet?: string;
676
- /** Publication or last updated date */
677
669
  date?: string;
678
670
  }
679
- /**
680
- * Stored message record (what gets persisted to the database)
681
- */
682
671
  interface StoredMessage {
683
- /** Primary key, unique message identifier (WatermelonDB auto-generated) */
684
672
  uniqueId: string;
685
- /** Sequential message ID within conversation */
686
673
  messageId: number;
687
- /** Links message to its conversation */
688
674
  conversationId: string;
689
- /** Who sent the message */
690
675
  role: ChatRole;
691
- /** The message text */
692
676
  content: string;
693
- /** LLM model used */
694
677
  model?: string;
695
- /** Optional attached files */
696
678
  files?: FileMetadata[];
697
- /** When the message was created */
698
679
  createdAt: Date;
699
- /** When the message was last updated */
700
680
  updatedAt: Date;
701
- /** Embedding vector for semantic search */
702
681
  vector?: number[];
703
- /** Model used to generate embedding */
704
682
  embeddingModel?: string;
705
- /** Token counts and cost */
706
683
  usage?: ChatCompletionUsage;
707
- /** Web search sources */
708
684
  sources?: SearchSource[];
709
- /** Response time in seconds */
710
685
  responseDuration?: number;
711
- /** Whether the message generation was stopped by the user */
712
686
  wasStopped?: boolean;
713
687
  }
714
- /**
715
- * Stored conversation record
716
- */
717
688
  interface StoredConversation {
718
- /** Primary key (WatermelonDB auto-generated) */
719
689
  uniqueId: string;
720
- /** Unique conversation identifier */
721
690
  conversationId: string;
722
- /** Conversation title */
723
691
  title: string;
724
- /** When the conversation was created */
725
692
  createdAt: Date;
726
- /** When the conversation was last updated */
727
693
  updatedAt: Date;
728
- /** Soft delete flag */
729
694
  isDeleted: boolean;
730
695
  }
731
- /**
732
- * Stored message with similarity score (for search results)
733
- */
734
696
  interface StoredMessageWithSimilarity extends StoredMessage {
735
- /** Cosine similarity score (0 to 1) */
736
697
  similarity: number;
737
698
  }
738
- /**
739
- * Options for creating a new message
740
- */
741
699
  interface CreateMessageOptions {
742
- /** Conversation ID to add the message to */
743
700
  conversationId: string;
744
- /** Message role */
745
701
  role: ChatRole;
746
- /** Message content */
747
702
  content: string;
748
- /** LLM model used (for assistant messages) */
749
703
  model?: string;
750
- /** Attached files */
751
704
  files?: FileMetadata[];
752
- /** Token usage information */
753
705
  usage?: ChatCompletionUsage;
754
- /** Web search sources */
755
706
  sources?: SearchSource[];
756
- /** Response duration in seconds */
757
707
  responseDuration?: number;
758
- /** Embedding vector for semantic search */
759
708
  vector?: number[];
760
- /** Model used to generate the embedding */
761
709
  embeddingModel?: string;
762
- /** Whether the message generation was stopped by the user */
763
710
  wasStopped?: boolean;
764
711
  }
765
- /**
766
- * Options for creating a new conversation
767
- */
768
712
  interface CreateConversationOptions {
769
- /** Custom conversation ID (auto-generated if not provided) */
770
713
  conversationId?: string;
771
- /** Conversation title */
772
714
  title?: string;
773
715
  }
774
- /**
775
- * Base options for useChatStorage hook (shared between React and Expo)
776
- */
777
716
  interface BaseUseChatStorageOptions {
778
- /** WatermelonDB database instance */
779
717
  database: Database;
780
- /** Current conversation ID (will create new if not provided) */
781
718
  conversationId?: string;
782
- /** Auto-create conversation if it doesn't exist (default: true) */
783
719
  autoCreateConversation?: boolean;
784
- /** Default title for auto-created conversations */
785
720
  defaultConversationTitle?: string;
786
- /** Authentication token getter */
787
721
  getToken?: () => Promise<string | null>;
788
- /** Base URL for API requests */
789
722
  baseUrl?: string;
790
- /** Callback when data chunk is received */
791
723
  onData?: (chunk: string) => void;
792
- /** Callback when chat completion finishes */
793
724
  onFinish?: (response: LlmapiChatCompletionResponse) => void;
794
- /** Callback when an error occurs */
795
725
  onError?: (error: Error) => void;
796
726
  }
797
- /**
798
- * Base arguments for sendMessage with storage (shared between React and Expo)
799
- */
800
727
  interface BaseSendMessageWithStorageArgs {
801
- /** Message content to send */
802
728
  content: string;
803
- /** Model to use for the completion */
804
729
  model?: string;
805
- /** Previous messages to include (if not using stored messages) */
806
730
  messages?: LlmapiMessage[];
807
- /** Whether to include stored messages from conversation */
808
731
  includeHistory?: boolean;
809
- /** Maximum number of history messages to include (default: 50) */
810
732
  maxHistoryMessages?: number;
811
- /** Attached files */
812
733
  files?: FileMetadata[];
813
- /** Per-request data callback */
814
734
  onData?: (chunk: string) => void;
815
- /** Memory context to inject as system message (formatted memories from useMemoryStorage) */
816
735
  memoryContext?: string;
817
736
  }
818
- /**
819
- * Base result returned by useChatStorage hook (shared between React and Expo)
820
- */
821
737
  interface BaseUseChatStorageResult {
822
- /** Whether a chat request is in progress */
823
738
  isLoading: boolean;
824
- /** Stop the current request */
825
739
  stop: () => void;
826
- /** Current conversation ID */
827
740
  conversationId: string | null;
828
- /** Set the current conversation ID */
829
741
  setConversationId: (id: string | null) => void;
830
- /** Create a new conversation */
831
742
  createConversation: (options?: CreateConversationOptions) => Promise<StoredConversation>;
832
- /** Get a conversation by ID */
833
743
  getConversation: (id: string) => Promise<StoredConversation | null>;
834
- /** Get all conversations (excluding soft-deleted) */
835
744
  getConversations: () => Promise<StoredConversation[]>;
836
- /** Update conversation title. Returns true if updated, false if not found. */
837
745
  updateConversationTitle: (id: string, title: string) => Promise<boolean>;
838
- /** Soft delete a conversation. Returns true if deleted, false if not found. */
839
746
  deleteConversation: (id: string) => Promise<boolean>;
840
- /** Get messages for a conversation */
841
747
  getMessages: (conversationId: string) => Promise<StoredMessage[]>;
842
- /** Get message count for a conversation */
843
748
  getMessageCount: (conversationId: string) => Promise<number>;
844
- /** Clear all messages in a conversation */
845
749
  clearMessages: (conversationId: string) => Promise<void>;
846
750
  }
847
- /**
848
- * Generate a unique ID for conversations
849
- */
850
751
  declare function generateConversationId(): string;
851
752
 
753
+ declare class Message extends Model {
754
+ static table: string;
755
+ static associations: Associations;
756
+ messageId: number;
757
+ conversationId: string;
758
+ role: ChatRole;
759
+ content: string;
760
+ model?: string;
761
+ files?: FileMetadata[];
762
+ createdAt: Date;
763
+ updatedAt: Date;
764
+ vector?: number[];
765
+ embeddingModel?: string;
766
+ usage?: ChatCompletionUsage;
767
+ sources?: SearchSource[];
768
+ responseDuration?: number;
769
+ wasStopped?: boolean;
770
+ }
771
+ declare class Conversation extends Model {
772
+ static table: string;
773
+ static associations: Associations;
774
+ conversationId: string;
775
+ title: string;
776
+ createdAt: Date;
777
+ updatedAt: Date;
778
+ isDeleted: boolean;
779
+ }
780
+
852
781
  /**
853
782
  * Options for useChatStorage hook (React version)
854
783
  *
@@ -977,82 +906,83 @@ interface UseChatStorageResult extends BaseUseChatStorageResult {
977
906
  declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageResult;
978
907
 
979
908
  /**
980
- * WatermelonDB schema for chat storage
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
981
916
  *
982
- * Defines two tables:
983
- * - history: Chat messages with metadata
984
- * - conversations: Conversation metadata
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
+ * ```
985
936
  */
986
- declare const chatStorageSchema: Readonly<{
937
+ declare const sdkSchema: Readonly<{
987
938
  version: _nozbe_watermelondb_Schema.SchemaVersion;
988
939
  tables: _nozbe_watermelondb_Schema.TableMap;
989
940
  unsafeSql?: (_: string, __: _nozbe_watermelondb_Schema.AppSchemaUnsafeSqlKind) => string;
990
941
  }>;
991
942
  /**
992
- * Schema migrations
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
993
955
  */
994
- declare const chatStorageMigrations: Readonly<{
956
+ declare const sdkMigrations: Readonly<{
995
957
  validated: true;
996
958
  minVersion: _nozbe_watermelondb_Schema.SchemaVersion;
997
959
  maxVersion: _nozbe_watermelondb_Schema.SchemaVersion;
998
960
  sortedMigrations: _nozbe_watermelondb_Schema_migrations.Migration[];
999
961
  }>;
1000
-
1001
962
  /**
1002
- * Message model representing a single chat message
963
+ * Model classes to register with the WatermelonDB database.
1003
964
  *
1004
- * Note: This model uses raw column accessors instead of decorators
1005
- * for better TypeScript compatibility without requiring legacy decorators.
1006
- */
1007
- declare class Message extends Model {
1008
- static table: string;
1009
- static associations: Associations;
1010
- /** Sequential message ID within conversation */
1011
- get messageId(): number;
1012
- /** Links message to its conversation */
1013
- get conversationId(): string;
1014
- /** Who sent the message: 'user' | 'assistant' | 'system' */
1015
- get role(): ChatRole;
1016
- /** The message text content */
1017
- get content(): string;
1018
- /** LLM model used (e.g., GPT-4, Claude) */
1019
- get model(): string | undefined;
1020
- /** Optional attached files */
1021
- get files(): FileMetadata[] | undefined;
1022
- /** Created timestamp */
1023
- get createdAt(): Date;
1024
- /** Updated timestamp */
1025
- get updatedAt(): Date;
1026
- /** Embedding vector for semantic search */
1027
- get vector(): number[] | undefined;
1028
- /** Model used to generate embedding */
1029
- get embeddingModel(): string | undefined;
1030
- /** Token counts and cost */
1031
- get usage(): ChatCompletionUsage | undefined;
1032
- /** Web search sources */
1033
- get sources(): SearchSource[] | undefined;
1034
- /** Response time in seconds */
1035
- get responseDuration(): number | undefined;
1036
- /** Whether the message generation was stopped by the user */
1037
- get wasStopped(): boolean;
1038
- }
1039
- /**
1040
- * Conversation model representing conversation metadata
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
+ * ```
1041
978
  */
1042
- declare class Conversation extends Model {
1043
- static table: string;
1044
- static associations: Associations;
1045
- /** Unique conversation identifier */
1046
- get conversationId(): string;
1047
- /** Conversation title */
1048
- get title(): string;
1049
- /** Created timestamp */
1050
- get createdAt(): Date;
1051
- /** Updated timestamp */
1052
- get updatedAt(): Date;
1053
- /** Soft delete flag */
1054
- get isDeleted(): boolean;
1055
- }
979
+ declare const sdkModelClasses: Class<Model$1>[];
980
+
981
+ declare const memoryStorageSchema: Readonly<{
982
+ version: _nozbe_watermelondb_Schema.SchemaVersion;
983
+ tables: _nozbe_watermelondb_Schema.TableMap;
984
+ unsafeSql?: (_: string, __: _nozbe_watermelondb_Schema.AppSchemaUnsafeSqlKind) => string;
985
+ }>;
1056
986
 
1057
987
  interface MemoryItem$1 {
1058
988
  type: "identity" | "preference" | "project" | "skill" | "constraint";
@@ -1067,13 +997,7 @@ interface MemoryExtractionResult {
1067
997
  items: MemoryItem$1[];
1068
998
  }
1069
999
 
1070
- /**
1071
- * Memory type classification
1072
- */
1073
1000
  type MemoryType = "identity" | "preference" | "project" | "skill" | "constraint";
1074
- /**
1075
- * Base memory item (matches existing MemoryItem from memory/service.ts)
1076
- */
1077
1001
  interface MemoryItem {
1078
1002
  type: MemoryType;
1079
1003
  namespace: string;
@@ -1083,137 +1007,37 @@ interface MemoryItem {
1083
1007
  confidence: number;
1084
1008
  pii: boolean;
1085
1009
  }
1086
- /**
1087
- * Stored memory record (what gets persisted to the database)
1088
- */
1089
- interface StoredMemory {
1090
- /** Primary key, unique memory identifier (WatermelonDB auto-generated) */
1010
+ interface CreateMemoryOptions extends MemoryItem {
1011
+ embedding?: number[];
1012
+ embeddingModel?: string;
1013
+ }
1014
+ type UpdateMemoryOptions = Partial<CreateMemoryOptions>;
1015
+ interface StoredMemory extends MemoryItem {
1091
1016
  uniqueId: string;
1092
- /** Memory type classification */
1093
- type: MemoryType;
1094
- /** Namespace for grouping related memories */
1095
- namespace: string;
1096
- /** Key within the namespace */
1097
- key: string;
1098
- /** The memory value/content */
1099
- value: string;
1100
- /** Raw evidence from which this memory was extracted */
1101
- rawEvidence: string;
1102
- /** Confidence score (0-1) */
1103
- confidence: number;
1104
- /** Whether this memory contains PII */
1105
- pii: boolean;
1106
- /** Composite key (namespace:key) for efficient lookups */
1107
1017
  compositeKey: string;
1108
- /** Unique key (namespace:key:value) for deduplication */
1109
1018
  uniqueKey: string;
1110
- /** ISO timestamp */
1111
1019
  createdAt: Date;
1112
- /** ISO timestamp */
1113
1020
  updatedAt: Date;
1114
- /** Embedding vector for semantic search */
1115
1021
  embedding?: number[];
1116
- /** Model used to generate embedding */
1117
1022
  embeddingModel?: string;
1118
- /** Soft delete flag */
1119
1023
  isDeleted: boolean;
1120
1024
  }
1121
- /**
1122
- * Memory with similarity score (returned from semantic search)
1123
- */
1124
1025
  interface StoredMemoryWithSimilarity extends StoredMemory {
1125
- /** Cosine similarity score (0-1) */
1126
1026
  similarity: number;
1127
1027
  }
1128
- /**
1129
- * Options for creating a new memory
1130
- */
1131
- interface CreateMemoryOptions {
1132
- /** Memory type */
1133
- type: MemoryType;
1134
- /** Namespace for grouping */
1135
- namespace: string;
1136
- /** Key within namespace */
1137
- key: string;
1138
- /** Memory value/content */
1139
- value: string;
1140
- /** Raw evidence text */
1141
- rawEvidence: string;
1142
- /** Confidence score (0-1) */
1143
- confidence: number;
1144
- /** Whether this contains PII */
1145
- pii: boolean;
1146
- /** Optional embedding vector */
1147
- embedding?: number[];
1148
- /** Optional embedding model name */
1149
- embeddingModel?: string;
1150
- }
1151
- /**
1152
- * Options for updating a memory
1153
- */
1154
- interface UpdateMemoryOptions {
1155
- /** Memory type */
1156
- type?: MemoryType;
1157
- /** Namespace for grouping */
1158
- namespace?: string;
1159
- /** Key within namespace */
1160
- key?: string;
1161
- /** Memory value/content */
1162
- value?: string;
1163
- /** Raw evidence text */
1164
- rawEvidence?: string;
1165
- /** Confidence score (0-1) */
1166
- confidence?: number;
1167
- /** Whether this contains PII */
1168
- pii?: boolean;
1169
- /** Optional embedding vector */
1170
- embedding?: number[];
1171
- /** Optional embedding model name */
1172
- embeddingModel?: string;
1173
- }
1174
- /**
1175
- * Base options for useMemoryStorage hook (shared between React and Expo)
1176
- */
1177
1028
  interface BaseUseMemoryStorageOptions {
1178
- /** WatermelonDB database instance */
1179
1029
  database: Database;
1180
- /** The model to use for fact extraction (default: "openai/gpt-4o") */
1181
1030
  completionsModel?: string;
1182
- /**
1183
- * The model to use for generating embeddings
1184
- * For local: default is "Snowflake/snowflake-arctic-embed-xs"
1185
- * For api: default is "openai/text-embedding-3-small"
1186
- * Set to null to disable embedding generation
1187
- */
1188
1031
  embeddingModel?: string | null;
1189
- /**
1190
- * The provider to use for generating embeddings (default: "local")
1191
- * "local": Uses a local HuggingFace model (in-browser)
1192
- * "api": Uses the backend API
1193
- */
1194
1032
  embeddingProvider?: "local" | "api";
1195
- /** Whether to automatically generate embeddings for extracted memories (default: true) */
1196
1033
  generateEmbeddings?: boolean;
1197
- /** Callback when facts are extracted */
1198
1034
  onFactsExtracted?: (facts: MemoryExtractionResult) => void;
1199
- /** Custom function to get auth token for API calls */
1200
1035
  getToken?: () => Promise<string | null>;
1201
- /** Optional base URL for the API requests */
1202
1036
  baseUrl?: string;
1203
1037
  }
1204
- /**
1205
- * Base result returned by useMemoryStorage hook (shared between React and Expo)
1206
- */
1207
1038
  interface BaseUseMemoryStorageResult {
1208
- /** Current memories in state (reactive) */
1209
1039
  memories: StoredMemory[];
1210
- /** Refresh memories from storage */
1211
1040
  refreshMemories: () => Promise<void>;
1212
- /**
1213
- * Extract memories from messages and store them
1214
- * @param options Messages and model to use for extraction
1215
- * @returns Extraction result or null if failed
1216
- */
1217
1041
  extractMemoriesFromMessage: (options: {
1218
1042
  messages: Array<{
1219
1043
  role: string;
@@ -1221,89 +1045,40 @@ interface BaseUseMemoryStorageResult {
1221
1045
  }>;
1222
1046
  model?: string;
1223
1047
  }) => Promise<MemoryExtractionResult | null>;
1224
- /**
1225
- * Search for similar memories using semantic search
1226
- * @param query The text query to search for
1227
- * @param limit Maximum number of results (default: 10)
1228
- * @param minSimilarity Minimum similarity threshold 0-1 (default: 0.6)
1229
- * @returns Array of memories with similarity scores, sorted by relevance
1230
- */
1231
1048
  searchMemories: (query: string, limit?: number, minSimilarity?: number) => Promise<StoredMemoryWithSimilarity[]>;
1232
- /**
1233
- * Get all memories stored in the database
1234
- * @returns Array of all stored memories
1235
- */
1236
1049
  fetchAllMemories: () => Promise<StoredMemory[]>;
1237
- /**
1238
- * Get memories filtered by namespace
1239
- * @param namespace The namespace to filter by
1240
- * @returns Array of memories in the specified namespace
1241
- */
1242
1050
  fetchMemoriesByNamespace: (namespace: string) => Promise<StoredMemory[]>;
1243
- /**
1244
- * Get memories by namespace and key
1245
- * @param namespace The namespace
1246
- * @param key The key within the namespace
1247
- * @returns Array of memories matching the namespace and key
1248
- */
1249
1051
  fetchMemoriesByKey: (namespace: string, key: string) => Promise<StoredMemory[]>;
1250
- /**
1251
- * Get a memory by its unique ID
1252
- * @param id The memory unique ID
1253
- * @returns The memory or null if not found
1254
- */
1255
1052
  getMemoryById: (id: string) => Promise<StoredMemory | null>;
1256
- /**
1257
- * Save a single memory to storage
1258
- * @param memory The memory to save
1259
- * @returns The stored memory
1260
- */
1261
1053
  saveMemory: (memory: CreateMemoryOptions) => Promise<StoredMemory>;
1262
- /**
1263
- * Save multiple memories to storage
1264
- * @param memories Array of memories to save
1265
- * @returns Array of stored memories
1266
- */
1267
1054
  saveMemories: (memories: CreateMemoryOptions[]) => Promise<StoredMemory[]>;
1268
- /**
1269
- * Update a memory by its ID
1270
- * @param id The memory ID
1271
- * @param updates Partial memory fields to update
1272
- * @returns The updated memory or null if not found
1273
- */
1274
1055
  updateMemory: (id: string, updates: UpdateMemoryOptions) => Promise<StoredMemory | null>;
1275
- /**
1276
- * Delete a specific memory by namespace, key, and value
1277
- * @param namespace The namespace
1278
- * @param key The key
1279
- * @param value The value
1280
- */
1281
1056
  removeMemory: (namespace: string, key: string, value: string) => Promise<void>;
1282
- /**
1283
- * Delete a memory by its ID (soft delete)
1284
- * @param id The memory ID
1285
- */
1286
1057
  removeMemoryById: (id: string) => Promise<void>;
1287
- /**
1288
- * Delete all memories by namespace and key
1289
- * @param namespace The namespace
1290
- * @param key The key
1291
- */
1292
1058
  removeMemories: (namespace: string, key: string) => Promise<void>;
1293
- /**
1294
- * Clear all memories from storage
1295
- */
1296
1059
  clearMemories: () => Promise<void>;
1297
1060
  }
1298
- /**
1299
- * Generate composite key from namespace and key
1300
- */
1301
1061
  declare function generateCompositeKey(namespace: string, key: string): string;
1302
- /**
1303
- * Generate unique key from namespace, key, and value
1304
- */
1305
1062
  declare function generateUniqueKey(namespace: string, key: string, value: string): string;
1306
1063
 
1064
+ declare class Memory extends Model {
1065
+ static table: string;
1066
+ type: MemoryType;
1067
+ namespace: string;
1068
+ key: string;
1069
+ value: string;
1070
+ rawEvidence: string;
1071
+ confidence: number;
1072
+ pii: boolean;
1073
+ compositeKey: string;
1074
+ uniqueKey: string;
1075
+ createdAt: Date;
1076
+ updatedAt: Date;
1077
+ embedding?: number[];
1078
+ embeddingModel?: string;
1079
+ isDeleted: boolean;
1080
+ }
1081
+
1307
1082
  /**
1308
1083
  * Options for useMemoryStorage hook (React version)
1309
1084
  *
@@ -1363,105 +1138,39 @@ type UseMemoryStorageResult = BaseUseMemoryStorageResult;
1363
1138
  */
1364
1139
  declare function useMemoryStorage(options: UseMemoryStorageOptions): UseMemoryStorageResult;
1365
1140
 
1366
- /**
1367
- * WatermelonDB schema for memory storage
1368
- *
1369
- * Defines the memories table for storing extracted user memories
1370
- * with support for vector embeddings for semantic search.
1371
- */
1372
- declare const memoryStorageSchema: Readonly<{
1141
+ declare const settingsStorageSchema: Readonly<{
1373
1142
  version: _nozbe_watermelondb_Schema.SchemaVersion;
1374
1143
  tables: _nozbe_watermelondb_Schema.TableMap;
1375
1144
  unsafeSql?: (_: string, __: _nozbe_watermelondb_Schema.AppSchemaUnsafeSqlKind) => string;
1376
1145
  }>;
1377
1146
 
1378
- /**
1379
- * Memory model representing a single extracted memory
1380
- *
1381
- * Note: This model uses raw column accessors instead of decorators
1382
- * for better TypeScript compatibility without requiring legacy decorators.
1383
- */
1384
- declare class Memory extends Model {
1147
+ declare class ModelPreference extends Model {
1385
1148
  static table: string;
1386
- /** Memory type classification */
1387
- get type(): MemoryType;
1388
- /** Namespace for grouping related memories */
1389
- get namespace(): string;
1390
- /** Key within the namespace */
1391
- get key(): string;
1392
- /** The memory value/content */
1393
- get value(): string;
1394
- /** Raw evidence from which this memory was extracted */
1395
- get rawEvidence(): string;
1396
- /** Confidence score (0-1) */
1397
- get confidence(): number;
1398
- /** Whether this memory contains PII */
1399
- get pii(): boolean;
1400
- /** Composite key (namespace:key) for efficient lookups */
1401
- get compositeKey(): string;
1402
- /** Unique key (namespace:key:value) for deduplication */
1403
- get uniqueKey(): string;
1404
- /** Created timestamp */
1405
- get createdAt(): Date;
1406
- /** Updated timestamp */
1407
- get updatedAt(): Date;
1408
- /** Embedding vector for semantic search */
1409
- get embedding(): number[] | undefined;
1410
- /** Model used to generate embedding */
1411
- get embeddingModel(): string | undefined;
1412
- /** Soft delete flag */
1413
- get isDeleted(): boolean;
1149
+ walletAddress: string;
1150
+ models?: string;
1414
1151
  }
1415
1152
 
1416
- /**
1417
- * Stored model preference record (what gets persisted to the database)
1418
- */
1419
1153
  interface StoredModelPreference {
1420
- /** Primary key (WatermelonDB auto-generated) */
1421
1154
  uniqueId: string;
1422
- /** User's wallet address */
1423
1155
  walletAddress: string;
1424
- /** Preferred model identifiers */
1425
1156
  models?: string;
1426
1157
  }
1427
- /**
1428
- * Options for creating a new model preference
1429
- */
1430
1158
  interface CreateModelPreferenceOptions {
1431
- /** User's wallet address */
1432
1159
  walletAddress: string;
1433
- /** Preferred model identifiers */
1434
1160
  models?: string;
1435
1161
  }
1436
- /**
1437
- * Options for updating a model preference
1438
- */
1439
1162
  interface UpdateModelPreferenceOptions {
1440
- /** New preferred model identifiers */
1441
1163
  models?: string;
1442
1164
  }
1443
- /**
1444
- * Base options for useSettings hook
1445
- */
1446
1165
  interface BaseUseSettingsOptions {
1447
- /** WatermelonDB database instance */
1448
1166
  database: Database;
1449
- /** User's wallet address */
1450
1167
  walletAddress?: string;
1451
1168
  }
1452
- /**
1453
- * Base result returned by useSettings hook
1454
- */
1455
1169
  interface BaseUseSettingsResult {
1456
- /** Current model preference */
1457
1170
  modelPreference: StoredModelPreference | null;
1458
- /** Whether the settings are loading */
1459
1171
  isLoading: boolean;
1460
- /** Get model preference by wallet address. Throws on error. */
1461
1172
  getModelPreference: (walletAddress: string) => Promise<StoredModelPreference | null>;
1462
- /** Create or update model preference. Throws on error. */
1463
1173
  setModelPreference: (walletAddress: string, models?: string) => Promise<StoredModelPreference | null>;
1464
- /** Delete model preference. Throws on error. */
1465
1174
  deleteModelPreference: (walletAddress: string) => Promise<boolean>;
1466
1175
  }
1467
1176
 
@@ -1520,32 +1229,6 @@ interface UseSettingsResult extends BaseUseSettingsResult {
1520
1229
  */
1521
1230
  declare function useSettings(options: UseSettingsOptions): UseSettingsResult;
1522
1231
 
1523
- /**
1524
- * WatermelonDB schema for settings storage
1525
- *
1526
- * * Defines one table::
1527
- * - modelPreferences: Model preferences metadata
1528
- */
1529
- declare const settingsStorageSchema: Readonly<{
1530
- version: _nozbe_watermelondb_Schema.SchemaVersion;
1531
- tables: _nozbe_watermelondb_Schema.TableMap;
1532
- unsafeSql?: (_: string, __: _nozbe_watermelondb_Schema.AppSchemaUnsafeSqlKind) => string;
1533
- }>;
1534
-
1535
- /**
1536
- * ModelPreference model representing user model preferences
1537
- *
1538
- * Note: This model uses raw column accessors instead of decorators
1539
- * for better TypeScript compatibility without requiring legacy decorators.
1540
- */
1541
- declare class ModelPreference extends Model {
1542
- static table: string;
1543
- /** User's wallet address */
1544
- get walletAddress(): string;
1545
- /** Preferred model identifier */
1546
- get models(): string | undefined;
1547
- }
1548
-
1549
1232
  interface PdfFile {
1550
1233
  url: string;
1551
1234
  mediaType?: string;
@@ -2106,4 +1789,4 @@ interface UseGoogleDriveBackupResult {
2106
1789
  */
2107
1790
  declare function useGoogleDriveBackup(options: UseGoogleDriveBackupOptions): UseGoogleDriveBackupResult;
2108
1791
 
2109
- 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 };