@reverbia/sdk 1.0.0-next.20251217144159 → 1.0.0-next.20251217144909
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.
- package/dist/expo/index.cjs +240 -318
- package/dist/expo/index.d.mts +74 -432
- package/dist/expo/index.d.ts +74 -432
- package/dist/expo/index.mjs +225 -297
- package/dist/index.cjs +46 -2
- package/dist/index.d.mts +175 -2
- package/dist/index.d.ts +175 -2
- package/dist/index.mjs +41 -1
- package/dist/react/index.cjs +347 -363
- package/dist/react/index.d.mts +73 -464
- package/dist/react/index.d.ts +73 -464
- package/dist/react/index.mjs +326 -336
- package/package.json +2 -2
package/dist/react/index.d.mts
CHANGED
|
@@ -237,6 +237,10 @@ type LlmapiModel = {
|
|
|
237
237
|
* MaxOutputTokens is the maximum output tokens
|
|
238
238
|
*/
|
|
239
239
|
max_output_tokens?: number;
|
|
240
|
+
/**
|
|
241
|
+
* Modalities is a list of supported modalities (e.g., ["llm", "vision"])
|
|
242
|
+
*/
|
|
243
|
+
modalities?: Array<string>;
|
|
240
244
|
/**
|
|
241
245
|
* Name is the human-readable model name (optional)
|
|
242
246
|
*/
|
|
@@ -631,224 +635,148 @@ declare function useEncryption(signMessage: SignMessageFn): {
|
|
|
631
635
|
requestEncryptionKey: (walletAddress: string) => Promise<void>;
|
|
632
636
|
};
|
|
633
637
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
638
|
+
declare const chatStorageSchema: Readonly<{
|
|
639
|
+
version: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
640
|
+
tables: _nozbe_watermelondb_Schema.TableMap;
|
|
641
|
+
unsafeSql?: (_: string, __: _nozbe_watermelondb_Schema.AppSchemaUnsafeSqlKind) => string;
|
|
642
|
+
}>;
|
|
643
|
+
declare const chatStorageMigrations: Readonly<{
|
|
644
|
+
validated: true;
|
|
645
|
+
minVersion: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
646
|
+
maxVersion: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
647
|
+
sortedMigrations: _nozbe_watermelondb_Schema_migrations.Migration[];
|
|
648
|
+
}>;
|
|
649
|
+
|
|
637
650
|
type ChatRole = "user" | "assistant" | "system";
|
|
638
|
-
/**
|
|
639
|
-
* File metadata for attached files
|
|
640
|
-
*/
|
|
641
651
|
interface FileMetadata {
|
|
642
|
-
/** Unique file identifier */
|
|
643
652
|
id: string;
|
|
644
|
-
/** Original file name */
|
|
645
653
|
name: string;
|
|
646
|
-
/** MIME type */
|
|
647
654
|
type: string;
|
|
648
|
-
/** File size in bytes */
|
|
649
655
|
size: number;
|
|
650
|
-
/** Optional URL or data URI */
|
|
651
656
|
url?: string;
|
|
652
657
|
}
|
|
653
|
-
/**
|
|
654
|
-
* Token usage and cost information
|
|
655
|
-
*/
|
|
656
658
|
interface ChatCompletionUsage {
|
|
657
|
-
/** Number of tokens in the prompt */
|
|
658
659
|
promptTokens?: number;
|
|
659
|
-
/** Number of tokens in the completion */
|
|
660
660
|
completionTokens?: number;
|
|
661
|
-
/** Total tokens used */
|
|
662
661
|
totalTokens?: number;
|
|
663
|
-
/** Cost in micro-dollars (USD × 1,000,000) */
|
|
664
662
|
costMicroUsd?: number;
|
|
665
663
|
}
|
|
666
|
-
/**
|
|
667
|
-
* Web search source information
|
|
668
|
-
*/
|
|
669
664
|
interface SearchSource {
|
|
670
|
-
/** Source title */
|
|
671
665
|
title?: string;
|
|
672
|
-
/** Source URL */
|
|
673
666
|
url?: string;
|
|
674
|
-
/** Text snippet from the source */
|
|
675
667
|
snippet?: string;
|
|
676
|
-
/** Publication or last updated date */
|
|
677
668
|
date?: string;
|
|
678
669
|
}
|
|
679
|
-
/**
|
|
680
|
-
* Stored message record (what gets persisted to the database)
|
|
681
|
-
*/
|
|
682
670
|
interface StoredMessage {
|
|
683
|
-
/** Primary key, unique message identifier (WatermelonDB auto-generated) */
|
|
684
671
|
uniqueId: string;
|
|
685
|
-
/** Sequential message ID within conversation */
|
|
686
672
|
messageId: number;
|
|
687
|
-
/** Links message to its conversation */
|
|
688
673
|
conversationId: string;
|
|
689
|
-
/** Who sent the message */
|
|
690
674
|
role: ChatRole;
|
|
691
|
-
/** The message text */
|
|
692
675
|
content: string;
|
|
693
|
-
/** LLM model used */
|
|
694
676
|
model?: string;
|
|
695
|
-
/** Optional attached files */
|
|
696
677
|
files?: FileMetadata[];
|
|
697
|
-
/** When the message was created */
|
|
698
678
|
createdAt: Date;
|
|
699
|
-
/** When the message was last updated */
|
|
700
679
|
updatedAt: Date;
|
|
701
|
-
/** Embedding vector for semantic search */
|
|
702
680
|
vector?: number[];
|
|
703
|
-
/** Model used to generate embedding */
|
|
704
681
|
embeddingModel?: string;
|
|
705
|
-
/** Token counts and cost */
|
|
706
682
|
usage?: ChatCompletionUsage;
|
|
707
|
-
/** Web search sources */
|
|
708
683
|
sources?: SearchSource[];
|
|
709
|
-
/** Response time in seconds */
|
|
710
684
|
responseDuration?: number;
|
|
711
|
-
/** Whether the message generation was stopped by the user */
|
|
712
685
|
wasStopped?: boolean;
|
|
713
686
|
}
|
|
714
|
-
/**
|
|
715
|
-
* Stored conversation record
|
|
716
|
-
*/
|
|
717
687
|
interface StoredConversation {
|
|
718
|
-
/** Primary key (WatermelonDB auto-generated) */
|
|
719
688
|
uniqueId: string;
|
|
720
|
-
/** Unique conversation identifier */
|
|
721
689
|
conversationId: string;
|
|
722
|
-
/** Conversation title */
|
|
723
690
|
title: string;
|
|
724
|
-
/** When the conversation was created */
|
|
725
691
|
createdAt: Date;
|
|
726
|
-
/** When the conversation was last updated */
|
|
727
692
|
updatedAt: Date;
|
|
728
|
-
/** Soft delete flag */
|
|
729
693
|
isDeleted: boolean;
|
|
730
694
|
}
|
|
731
|
-
/**
|
|
732
|
-
* Stored message with similarity score (for search results)
|
|
733
|
-
*/
|
|
734
695
|
interface StoredMessageWithSimilarity extends StoredMessage {
|
|
735
|
-
/** Cosine similarity score (0 to 1) */
|
|
736
696
|
similarity: number;
|
|
737
697
|
}
|
|
738
|
-
/**
|
|
739
|
-
* Options for creating a new message
|
|
740
|
-
*/
|
|
741
698
|
interface CreateMessageOptions {
|
|
742
|
-
/** Conversation ID to add the message to */
|
|
743
699
|
conversationId: string;
|
|
744
|
-
/** Message role */
|
|
745
700
|
role: ChatRole;
|
|
746
|
-
/** Message content */
|
|
747
701
|
content: string;
|
|
748
|
-
/** LLM model used (for assistant messages) */
|
|
749
702
|
model?: string;
|
|
750
|
-
/** Attached files */
|
|
751
703
|
files?: FileMetadata[];
|
|
752
|
-
/** Token usage information */
|
|
753
704
|
usage?: ChatCompletionUsage;
|
|
754
|
-
/** Web search sources */
|
|
755
705
|
sources?: SearchSource[];
|
|
756
|
-
/** Response duration in seconds */
|
|
757
706
|
responseDuration?: number;
|
|
758
|
-
/** Embedding vector for semantic search */
|
|
759
707
|
vector?: number[];
|
|
760
|
-
/** Model used to generate the embedding */
|
|
761
708
|
embeddingModel?: string;
|
|
762
|
-
/** Whether the message generation was stopped by the user */
|
|
763
709
|
wasStopped?: boolean;
|
|
764
710
|
}
|
|
765
|
-
/**
|
|
766
|
-
* Options for creating a new conversation
|
|
767
|
-
*/
|
|
768
711
|
interface CreateConversationOptions {
|
|
769
|
-
/** Custom conversation ID (auto-generated if not provided) */
|
|
770
712
|
conversationId?: string;
|
|
771
|
-
/** Conversation title */
|
|
772
713
|
title?: string;
|
|
773
714
|
}
|
|
774
|
-
/**
|
|
775
|
-
* Base options for useChatStorage hook (shared between React and Expo)
|
|
776
|
-
*/
|
|
777
715
|
interface BaseUseChatStorageOptions {
|
|
778
|
-
/** WatermelonDB database instance */
|
|
779
716
|
database: Database;
|
|
780
|
-
/** Current conversation ID (will create new if not provided) */
|
|
781
717
|
conversationId?: string;
|
|
782
|
-
/** Auto-create conversation if it doesn't exist (default: true) */
|
|
783
718
|
autoCreateConversation?: boolean;
|
|
784
|
-
/** Default title for auto-created conversations */
|
|
785
719
|
defaultConversationTitle?: string;
|
|
786
|
-
/** Authentication token getter */
|
|
787
720
|
getToken?: () => Promise<string | null>;
|
|
788
|
-
/** Base URL for API requests */
|
|
789
721
|
baseUrl?: string;
|
|
790
|
-
/** Callback when data chunk is received */
|
|
791
722
|
onData?: (chunk: string) => void;
|
|
792
|
-
/** Callback when chat completion finishes */
|
|
793
723
|
onFinish?: (response: LlmapiChatCompletionResponse) => void;
|
|
794
|
-
/** Callback when an error occurs */
|
|
795
724
|
onError?: (error: Error) => void;
|
|
796
725
|
}
|
|
797
|
-
/**
|
|
798
|
-
* Base arguments for sendMessage with storage (shared between React and Expo)
|
|
799
|
-
*/
|
|
800
726
|
interface BaseSendMessageWithStorageArgs {
|
|
801
|
-
/** Message content to send */
|
|
802
727
|
content: string;
|
|
803
|
-
/** Model to use for the completion */
|
|
804
728
|
model?: string;
|
|
805
|
-
/** Previous messages to include (if not using stored messages) */
|
|
806
729
|
messages?: LlmapiMessage[];
|
|
807
|
-
/** Whether to include stored messages from conversation */
|
|
808
730
|
includeHistory?: boolean;
|
|
809
|
-
/** Maximum number of history messages to include (default: 50) */
|
|
810
731
|
maxHistoryMessages?: number;
|
|
811
|
-
/** Attached files */
|
|
812
732
|
files?: FileMetadata[];
|
|
813
|
-
/** Per-request data callback */
|
|
814
733
|
onData?: (chunk: string) => void;
|
|
815
|
-
/** Memory context to inject as system message (formatted memories from useMemoryStorage) */
|
|
816
734
|
memoryContext?: string;
|
|
817
735
|
}
|
|
818
|
-
/**
|
|
819
|
-
* Base result returned by useChatStorage hook (shared between React and Expo)
|
|
820
|
-
*/
|
|
821
736
|
interface BaseUseChatStorageResult {
|
|
822
|
-
/** Whether a chat request is in progress */
|
|
823
737
|
isLoading: boolean;
|
|
824
|
-
/** Stop the current request */
|
|
825
738
|
stop: () => void;
|
|
826
|
-
/** Current conversation ID */
|
|
827
739
|
conversationId: string | null;
|
|
828
|
-
/** Set the current conversation ID */
|
|
829
740
|
setConversationId: (id: string | null) => void;
|
|
830
|
-
/** Create a new conversation */
|
|
831
741
|
createConversation: (options?: CreateConversationOptions) => Promise<StoredConversation>;
|
|
832
|
-
/** Get a conversation by ID */
|
|
833
742
|
getConversation: (id: string) => Promise<StoredConversation | null>;
|
|
834
|
-
/** Get all conversations (excluding soft-deleted) */
|
|
835
743
|
getConversations: () => Promise<StoredConversation[]>;
|
|
836
|
-
/** Update conversation title. Returns true if updated, false if not found. */
|
|
837
744
|
updateConversationTitle: (id: string, title: string) => Promise<boolean>;
|
|
838
|
-
/** Soft delete a conversation. Returns true if deleted, false if not found. */
|
|
839
745
|
deleteConversation: (id: string) => Promise<boolean>;
|
|
840
|
-
/** Get messages for a conversation */
|
|
841
746
|
getMessages: (conversationId: string) => Promise<StoredMessage[]>;
|
|
842
|
-
/** Get message count for a conversation */
|
|
843
747
|
getMessageCount: (conversationId: string) => Promise<number>;
|
|
844
|
-
/** Clear all messages in a conversation */
|
|
845
748
|
clearMessages: (conversationId: string) => Promise<void>;
|
|
846
749
|
}
|
|
847
|
-
/**
|
|
848
|
-
* Generate a unique ID for conversations
|
|
849
|
-
*/
|
|
850
750
|
declare function generateConversationId(): string;
|
|
851
751
|
|
|
752
|
+
declare class Message extends Model {
|
|
753
|
+
static table: string;
|
|
754
|
+
static associations: Associations;
|
|
755
|
+
messageId: number;
|
|
756
|
+
conversationId: string;
|
|
757
|
+
role: ChatRole;
|
|
758
|
+
content: string;
|
|
759
|
+
model?: string;
|
|
760
|
+
files?: FileMetadata[];
|
|
761
|
+
createdAt: Date;
|
|
762
|
+
updatedAt: Date;
|
|
763
|
+
vector?: number[];
|
|
764
|
+
embeddingModel?: string;
|
|
765
|
+
usage?: ChatCompletionUsage;
|
|
766
|
+
sources?: SearchSource[];
|
|
767
|
+
responseDuration?: number;
|
|
768
|
+
wasStopped?: boolean;
|
|
769
|
+
}
|
|
770
|
+
declare class Conversation extends Model {
|
|
771
|
+
static table: string;
|
|
772
|
+
static associations: Associations;
|
|
773
|
+
conversationId: string;
|
|
774
|
+
title: string;
|
|
775
|
+
createdAt: Date;
|
|
776
|
+
updatedAt: Date;
|
|
777
|
+
isDeleted: boolean;
|
|
778
|
+
}
|
|
779
|
+
|
|
852
780
|
/**
|
|
853
781
|
* Options for useChatStorage hook (React version)
|
|
854
782
|
*
|
|
@@ -976,83 +904,11 @@ interface UseChatStorageResult extends BaseUseChatStorageResult {
|
|
|
976
904
|
*/
|
|
977
905
|
declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageResult;
|
|
978
906
|
|
|
979
|
-
|
|
980
|
-
* WatermelonDB schema for chat storage
|
|
981
|
-
*
|
|
982
|
-
* Defines two tables:
|
|
983
|
-
* - history: Chat messages with metadata
|
|
984
|
-
* - conversations: Conversation metadata
|
|
985
|
-
*/
|
|
986
|
-
declare const chatStorageSchema: Readonly<{
|
|
907
|
+
declare const memoryStorageSchema: Readonly<{
|
|
987
908
|
version: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
988
909
|
tables: _nozbe_watermelondb_Schema.TableMap;
|
|
989
910
|
unsafeSql?: (_: string, __: _nozbe_watermelondb_Schema.AppSchemaUnsafeSqlKind) => string;
|
|
990
911
|
}>;
|
|
991
|
-
/**
|
|
992
|
-
* Schema migrations
|
|
993
|
-
*/
|
|
994
|
-
declare const chatStorageMigrations: Readonly<{
|
|
995
|
-
validated: true;
|
|
996
|
-
minVersion: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
997
|
-
maxVersion: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
998
|
-
sortedMigrations: _nozbe_watermelondb_Schema_migrations.Migration[];
|
|
999
|
-
}>;
|
|
1000
|
-
|
|
1001
|
-
/**
|
|
1002
|
-
* Message model representing a single chat message
|
|
1003
|
-
*
|
|
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
|
|
1041
|
-
*/
|
|
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
|
-
}
|
|
1056
912
|
|
|
1057
913
|
interface MemoryItem$1 {
|
|
1058
914
|
type: "identity" | "preference" | "project" | "skill" | "constraint";
|
|
@@ -1067,13 +923,7 @@ interface MemoryExtractionResult {
|
|
|
1067
923
|
items: MemoryItem$1[];
|
|
1068
924
|
}
|
|
1069
925
|
|
|
1070
|
-
/**
|
|
1071
|
-
* Memory type classification
|
|
1072
|
-
*/
|
|
1073
926
|
type MemoryType = "identity" | "preference" | "project" | "skill" | "constraint";
|
|
1074
|
-
/**
|
|
1075
|
-
* Base memory item (matches existing MemoryItem from memory/service.ts)
|
|
1076
|
-
*/
|
|
1077
927
|
interface MemoryItem {
|
|
1078
928
|
type: MemoryType;
|
|
1079
929
|
namespace: string;
|
|
@@ -1083,137 +933,37 @@ interface MemoryItem {
|
|
|
1083
933
|
confidence: number;
|
|
1084
934
|
pii: boolean;
|
|
1085
935
|
}
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
936
|
+
interface CreateMemoryOptions extends MemoryItem {
|
|
937
|
+
embedding?: number[];
|
|
938
|
+
embeddingModel?: string;
|
|
939
|
+
}
|
|
940
|
+
type UpdateMemoryOptions = Partial<CreateMemoryOptions>;
|
|
941
|
+
interface StoredMemory extends MemoryItem {
|
|
1091
942
|
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
943
|
compositeKey: string;
|
|
1108
|
-
/** Unique key (namespace:key:value) for deduplication */
|
|
1109
944
|
uniqueKey: string;
|
|
1110
|
-
/** ISO timestamp */
|
|
1111
945
|
createdAt: Date;
|
|
1112
|
-
/** ISO timestamp */
|
|
1113
946
|
updatedAt: Date;
|
|
1114
|
-
/** Embedding vector for semantic search */
|
|
1115
947
|
embedding?: number[];
|
|
1116
|
-
/** Model used to generate embedding */
|
|
1117
948
|
embeddingModel?: string;
|
|
1118
|
-
/** Soft delete flag */
|
|
1119
949
|
isDeleted: boolean;
|
|
1120
950
|
}
|
|
1121
|
-
/**
|
|
1122
|
-
* Memory with similarity score (returned from semantic search)
|
|
1123
|
-
*/
|
|
1124
951
|
interface StoredMemoryWithSimilarity extends StoredMemory {
|
|
1125
|
-
/** Cosine similarity score (0-1) */
|
|
1126
952
|
similarity: number;
|
|
1127
953
|
}
|
|
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
954
|
interface BaseUseMemoryStorageOptions {
|
|
1178
|
-
/** WatermelonDB database instance */
|
|
1179
955
|
database: Database;
|
|
1180
|
-
/** The model to use for fact extraction (default: "openai/gpt-4o") */
|
|
1181
956
|
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
957
|
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
958
|
embeddingProvider?: "local" | "api";
|
|
1195
|
-
/** Whether to automatically generate embeddings for extracted memories (default: true) */
|
|
1196
959
|
generateEmbeddings?: boolean;
|
|
1197
|
-
/** Callback when facts are extracted */
|
|
1198
960
|
onFactsExtracted?: (facts: MemoryExtractionResult) => void;
|
|
1199
|
-
/** Custom function to get auth token for API calls */
|
|
1200
961
|
getToken?: () => Promise<string | null>;
|
|
1201
|
-
/** Optional base URL for the API requests */
|
|
1202
962
|
baseUrl?: string;
|
|
1203
963
|
}
|
|
1204
|
-
/**
|
|
1205
|
-
* Base result returned by useMemoryStorage hook (shared between React and Expo)
|
|
1206
|
-
*/
|
|
1207
964
|
interface BaseUseMemoryStorageResult {
|
|
1208
|
-
/** Current memories in state (reactive) */
|
|
1209
965
|
memories: StoredMemory[];
|
|
1210
|
-
/** Refresh memories from storage */
|
|
1211
966
|
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
967
|
extractMemoriesFromMessage: (options: {
|
|
1218
968
|
messages: Array<{
|
|
1219
969
|
role: string;
|
|
@@ -1221,89 +971,40 @@ interface BaseUseMemoryStorageResult {
|
|
|
1221
971
|
}>;
|
|
1222
972
|
model?: string;
|
|
1223
973
|
}) => 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
974
|
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
975
|
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
976
|
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
977
|
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
978
|
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
979
|
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
980
|
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
981
|
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
982
|
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
983
|
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
984
|
removeMemories: (namespace: string, key: string) => Promise<void>;
|
|
1293
|
-
/**
|
|
1294
|
-
* Clear all memories from storage
|
|
1295
|
-
*/
|
|
1296
985
|
clearMemories: () => Promise<void>;
|
|
1297
986
|
}
|
|
1298
|
-
/**
|
|
1299
|
-
* Generate composite key from namespace and key
|
|
1300
|
-
*/
|
|
1301
987
|
declare function generateCompositeKey(namespace: string, key: string): string;
|
|
1302
|
-
/**
|
|
1303
|
-
* Generate unique key from namespace, key, and value
|
|
1304
|
-
*/
|
|
1305
988
|
declare function generateUniqueKey(namespace: string, key: string, value: string): string;
|
|
1306
989
|
|
|
990
|
+
declare class Memory extends Model {
|
|
991
|
+
static table: string;
|
|
992
|
+
type: MemoryType;
|
|
993
|
+
namespace: string;
|
|
994
|
+
key: string;
|
|
995
|
+
value: string;
|
|
996
|
+
rawEvidence: string;
|
|
997
|
+
confidence: number;
|
|
998
|
+
pii: boolean;
|
|
999
|
+
compositeKey: string;
|
|
1000
|
+
uniqueKey: string;
|
|
1001
|
+
createdAt: Date;
|
|
1002
|
+
updatedAt: Date;
|
|
1003
|
+
embedding?: number[];
|
|
1004
|
+
embeddingModel?: string;
|
|
1005
|
+
isDeleted: boolean;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1307
1008
|
/**
|
|
1308
1009
|
* Options for useMemoryStorage hook (React version)
|
|
1309
1010
|
*
|
|
@@ -1363,105 +1064,39 @@ type UseMemoryStorageResult = BaseUseMemoryStorageResult;
|
|
|
1363
1064
|
*/
|
|
1364
1065
|
declare function useMemoryStorage(options: UseMemoryStorageOptions): UseMemoryStorageResult;
|
|
1365
1066
|
|
|
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<{
|
|
1067
|
+
declare const settingsStorageSchema: Readonly<{
|
|
1373
1068
|
version: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
1374
1069
|
tables: _nozbe_watermelondb_Schema.TableMap;
|
|
1375
1070
|
unsafeSql?: (_: string, __: _nozbe_watermelondb_Schema.AppSchemaUnsafeSqlKind) => string;
|
|
1376
1071
|
}>;
|
|
1377
1072
|
|
|
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 {
|
|
1073
|
+
declare class ModelPreference extends Model {
|
|
1385
1074
|
static table: string;
|
|
1386
|
-
|
|
1387
|
-
|
|
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;
|
|
1075
|
+
walletAddress: string;
|
|
1076
|
+
models?: string;
|
|
1414
1077
|
}
|
|
1415
1078
|
|
|
1416
|
-
/**
|
|
1417
|
-
* Stored model preference record (what gets persisted to the database)
|
|
1418
|
-
*/
|
|
1419
1079
|
interface StoredModelPreference {
|
|
1420
|
-
/** Primary key (WatermelonDB auto-generated) */
|
|
1421
1080
|
uniqueId: string;
|
|
1422
|
-
/** User's wallet address */
|
|
1423
1081
|
walletAddress: string;
|
|
1424
|
-
/** Preferred model identifiers */
|
|
1425
1082
|
models?: string;
|
|
1426
1083
|
}
|
|
1427
|
-
/**
|
|
1428
|
-
* Options for creating a new model preference
|
|
1429
|
-
*/
|
|
1430
1084
|
interface CreateModelPreferenceOptions {
|
|
1431
|
-
/** User's wallet address */
|
|
1432
1085
|
walletAddress: string;
|
|
1433
|
-
/** Preferred model identifiers */
|
|
1434
1086
|
models?: string;
|
|
1435
1087
|
}
|
|
1436
|
-
/**
|
|
1437
|
-
* Options for updating a model preference
|
|
1438
|
-
*/
|
|
1439
1088
|
interface UpdateModelPreferenceOptions {
|
|
1440
|
-
/** New preferred model identifiers */
|
|
1441
1089
|
models?: string;
|
|
1442
1090
|
}
|
|
1443
|
-
/**
|
|
1444
|
-
* Base options for useSettings hook
|
|
1445
|
-
*/
|
|
1446
1091
|
interface BaseUseSettingsOptions {
|
|
1447
|
-
/** WatermelonDB database instance */
|
|
1448
1092
|
database: Database;
|
|
1449
|
-
/** User's wallet address */
|
|
1450
1093
|
walletAddress?: string;
|
|
1451
1094
|
}
|
|
1452
|
-
/**
|
|
1453
|
-
* Base result returned by useSettings hook
|
|
1454
|
-
*/
|
|
1455
1095
|
interface BaseUseSettingsResult {
|
|
1456
|
-
/** Current model preference */
|
|
1457
1096
|
modelPreference: StoredModelPreference | null;
|
|
1458
|
-
/** Whether the settings are loading */
|
|
1459
1097
|
isLoading: boolean;
|
|
1460
|
-
/** Get model preference by wallet address. Throws on error. */
|
|
1461
1098
|
getModelPreference: (walletAddress: string) => Promise<StoredModelPreference | null>;
|
|
1462
|
-
/** Create or update model preference. Throws on error. */
|
|
1463
1099
|
setModelPreference: (walletAddress: string, models?: string) => Promise<StoredModelPreference | null>;
|
|
1464
|
-
/** Delete model preference. Throws on error. */
|
|
1465
1100
|
deleteModelPreference: (walletAddress: string) => Promise<boolean>;
|
|
1466
1101
|
}
|
|
1467
1102
|
|
|
@@ -1520,32 +1155,6 @@ interface UseSettingsResult extends BaseUseSettingsResult {
|
|
|
1520
1155
|
*/
|
|
1521
1156
|
declare function useSettings(options: UseSettingsOptions): UseSettingsResult;
|
|
1522
1157
|
|
|
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
1158
|
interface PdfFile {
|
|
1550
1159
|
url: string;
|
|
1551
1160
|
mediaType?: string;
|