@reverbia/sdk 1.0.0-next.20251217144909 → 1.0.0-next.20251218162622
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 +126 -4
- package/dist/expo/index.d.mts +78 -2
- package/dist/expo/index.d.ts +78 -2
- package/dist/expo/index.mjs +127 -4
- package/dist/react/index.cjs +218 -79
- package/dist/react/index.d.mts +83 -2
- package/dist/react/index.d.ts +83 -2
- package/dist/react/index.mjs +198 -58
- package/package.json +1 -1
package/dist/expo/index.cjs
CHANGED
|
@@ -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(
|
|
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:
|
|
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
|
|
2415
|
-
return generateEmbeddingForTextApi(
|
|
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,
|
package/dist/expo/index.d.mts
CHANGED
|
@@ -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
|
|
@@ -505,6 +506,8 @@ interface BaseSendMessageWithStorageArgs {
|
|
|
505
506
|
files?: FileMetadata[];
|
|
506
507
|
onData?: (chunk: string) => void;
|
|
507
508
|
memoryContext?: string;
|
|
509
|
+
searchContext?: string;
|
|
510
|
+
sources?: SearchSource[];
|
|
508
511
|
}
|
|
509
512
|
interface BaseSendMessageSuccessResult {
|
|
510
513
|
data: LlmapiChatCompletionResponse;
|
|
@@ -868,4 +871,77 @@ type UseMemoryStorageResult = BaseUseMemoryStorageResult;
|
|
|
868
871
|
*/
|
|
869
872
|
declare function useMemoryStorage(options: UseMemoryStorageOptions): UseMemoryStorageResult;
|
|
870
873
|
|
|
871
|
-
|
|
874
|
+
/**
|
|
875
|
+
* Combined WatermelonDB schema for all SDK storage modules.
|
|
876
|
+
*
|
|
877
|
+
* This unified schema includes all tables needed by the SDK:
|
|
878
|
+
* - `history`: Chat message storage with embeddings and metadata
|
|
879
|
+
* - `conversations`: Conversation metadata and organization
|
|
880
|
+
* - `memories`: Persistent memory storage with semantic search
|
|
881
|
+
* - `modelPreferences`: User model preferences and settings
|
|
882
|
+
*
|
|
883
|
+
* @example
|
|
884
|
+
* ```typescript
|
|
885
|
+
* import { Database } from '@nozbe/watermelondb';
|
|
886
|
+
* import LokiJSAdapter from '@nozbe/watermelondb/adapters/lokijs';
|
|
887
|
+
* import { sdkSchema, sdkMigrations, sdkModelClasses } from '@reverbia/sdk/react';
|
|
888
|
+
*
|
|
889
|
+
* const adapter = new LokiJSAdapter({
|
|
890
|
+
* schema: sdkSchema,
|
|
891
|
+
* migrations: sdkMigrations,
|
|
892
|
+
* dbName: 'my-app-db',
|
|
893
|
+
* useWebWorker: false,
|
|
894
|
+
* useIncrementalIndexedDB: true,
|
|
895
|
+
* });
|
|
896
|
+
*
|
|
897
|
+
* const database = new Database({
|
|
898
|
+
* adapter,
|
|
899
|
+
* modelClasses: sdkModelClasses,
|
|
900
|
+
* });
|
|
901
|
+
* ```
|
|
902
|
+
*/
|
|
903
|
+
declare const sdkSchema: Readonly<{
|
|
904
|
+
version: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
905
|
+
tables: _nozbe_watermelondb_Schema.TableMap;
|
|
906
|
+
unsafeSql?: (_: string, __: _nozbe_watermelondb_Schema.AppSchemaUnsafeSqlKind) => string;
|
|
907
|
+
}>;
|
|
908
|
+
/**
|
|
909
|
+
* Combined migrations for all SDK storage modules.
|
|
910
|
+
*
|
|
911
|
+
* These migrations handle database schema upgrades from any previous version
|
|
912
|
+
* to the current version. The SDK manages all migration logic internally,
|
|
913
|
+
* so consumer apps don't need to handle version arithmetic or migration merging.
|
|
914
|
+
*
|
|
915
|
+
* **Minimum supported version: v2**
|
|
916
|
+
* Migrations from v1 are not supported. Databases at v1 require a fresh install.
|
|
917
|
+
*
|
|
918
|
+
* Migration history:
|
|
919
|
+
* - v2 → v3: Added `was_stopped` column to history table
|
|
920
|
+
* - v3 → v4: Added `modelPreferences` table for settings storage
|
|
921
|
+
*/
|
|
922
|
+
declare const sdkMigrations: Readonly<{
|
|
923
|
+
validated: true;
|
|
924
|
+
minVersion: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
925
|
+
maxVersion: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
926
|
+
sortedMigrations: _nozbe_watermelondb_Schema_migrations.Migration[];
|
|
927
|
+
}>;
|
|
928
|
+
/**
|
|
929
|
+
* Model classes to register with the WatermelonDB database.
|
|
930
|
+
*
|
|
931
|
+
* Pass this array directly to the `modelClasses` option when creating
|
|
932
|
+
* your Database instance.
|
|
933
|
+
*
|
|
934
|
+
* @example
|
|
935
|
+
* ```typescript
|
|
936
|
+
* import { Database } from '@nozbe/watermelondb';
|
|
937
|
+
* import { sdkSchema, sdkMigrations, sdkModelClasses } from '@reverbia/sdk/react';
|
|
938
|
+
*
|
|
939
|
+
* const database = new Database({
|
|
940
|
+
* adapter,
|
|
941
|
+
* modelClasses: sdkModelClasses,
|
|
942
|
+
* });
|
|
943
|
+
* ```
|
|
944
|
+
*/
|
|
945
|
+
declare const sdkModelClasses: Class<Model$1>[];
|
|
946
|
+
|
|
947
|
+
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 };
|
package/dist/expo/index.d.ts
CHANGED
|
@@ -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
|
|
@@ -505,6 +506,8 @@ interface BaseSendMessageWithStorageArgs {
|
|
|
505
506
|
files?: FileMetadata[];
|
|
506
507
|
onData?: (chunk: string) => void;
|
|
507
508
|
memoryContext?: string;
|
|
509
|
+
searchContext?: string;
|
|
510
|
+
sources?: SearchSource[];
|
|
508
511
|
}
|
|
509
512
|
interface BaseSendMessageSuccessResult {
|
|
510
513
|
data: LlmapiChatCompletionResponse;
|
|
@@ -868,4 +871,77 @@ type UseMemoryStorageResult = BaseUseMemoryStorageResult;
|
|
|
868
871
|
*/
|
|
869
872
|
declare function useMemoryStorage(options: UseMemoryStorageOptions): UseMemoryStorageResult;
|
|
870
873
|
|
|
871
|
-
|
|
874
|
+
/**
|
|
875
|
+
* Combined WatermelonDB schema for all SDK storage modules.
|
|
876
|
+
*
|
|
877
|
+
* This unified schema includes all tables needed by the SDK:
|
|
878
|
+
* - `history`: Chat message storage with embeddings and metadata
|
|
879
|
+
* - `conversations`: Conversation metadata and organization
|
|
880
|
+
* - `memories`: Persistent memory storage with semantic search
|
|
881
|
+
* - `modelPreferences`: User model preferences and settings
|
|
882
|
+
*
|
|
883
|
+
* @example
|
|
884
|
+
* ```typescript
|
|
885
|
+
* import { Database } from '@nozbe/watermelondb';
|
|
886
|
+
* import LokiJSAdapter from '@nozbe/watermelondb/adapters/lokijs';
|
|
887
|
+
* import { sdkSchema, sdkMigrations, sdkModelClasses } from '@reverbia/sdk/react';
|
|
888
|
+
*
|
|
889
|
+
* const adapter = new LokiJSAdapter({
|
|
890
|
+
* schema: sdkSchema,
|
|
891
|
+
* migrations: sdkMigrations,
|
|
892
|
+
* dbName: 'my-app-db',
|
|
893
|
+
* useWebWorker: false,
|
|
894
|
+
* useIncrementalIndexedDB: true,
|
|
895
|
+
* });
|
|
896
|
+
*
|
|
897
|
+
* const database = new Database({
|
|
898
|
+
* adapter,
|
|
899
|
+
* modelClasses: sdkModelClasses,
|
|
900
|
+
* });
|
|
901
|
+
* ```
|
|
902
|
+
*/
|
|
903
|
+
declare const sdkSchema: Readonly<{
|
|
904
|
+
version: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
905
|
+
tables: _nozbe_watermelondb_Schema.TableMap;
|
|
906
|
+
unsafeSql?: (_: string, __: _nozbe_watermelondb_Schema.AppSchemaUnsafeSqlKind) => string;
|
|
907
|
+
}>;
|
|
908
|
+
/**
|
|
909
|
+
* Combined migrations for all SDK storage modules.
|
|
910
|
+
*
|
|
911
|
+
* These migrations handle database schema upgrades from any previous version
|
|
912
|
+
* to the current version. The SDK manages all migration logic internally,
|
|
913
|
+
* so consumer apps don't need to handle version arithmetic or migration merging.
|
|
914
|
+
*
|
|
915
|
+
* **Minimum supported version: v2**
|
|
916
|
+
* Migrations from v1 are not supported. Databases at v1 require a fresh install.
|
|
917
|
+
*
|
|
918
|
+
* Migration history:
|
|
919
|
+
* - v2 → v3: Added `was_stopped` column to history table
|
|
920
|
+
* - v3 → v4: Added `modelPreferences` table for settings storage
|
|
921
|
+
*/
|
|
922
|
+
declare const sdkMigrations: Readonly<{
|
|
923
|
+
validated: true;
|
|
924
|
+
minVersion: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
925
|
+
maxVersion: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
926
|
+
sortedMigrations: _nozbe_watermelondb_Schema_migrations.Migration[];
|
|
927
|
+
}>;
|
|
928
|
+
/**
|
|
929
|
+
* Model classes to register with the WatermelonDB database.
|
|
930
|
+
*
|
|
931
|
+
* Pass this array directly to the `modelClasses` option when creating
|
|
932
|
+
* your Database instance.
|
|
933
|
+
*
|
|
934
|
+
* @example
|
|
935
|
+
* ```typescript
|
|
936
|
+
* import { Database } from '@nozbe/watermelondb';
|
|
937
|
+
* import { sdkSchema, sdkMigrations, sdkModelClasses } from '@reverbia/sdk/react';
|
|
938
|
+
*
|
|
939
|
+
* const database = new Database({
|
|
940
|
+
* adapter,
|
|
941
|
+
* modelClasses: sdkModelClasses,
|
|
942
|
+
* });
|
|
943
|
+
* ```
|
|
944
|
+
*/
|
|
945
|
+
declare const sdkModelClasses: Class<Model$1>[];
|
|
946
|
+
|
|
947
|
+
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 };
|
package/dist/expo/index.mjs
CHANGED
|
@@ -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(
|
|
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:
|
|
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
|
|
2382
|
-
return generateEmbeddingForTextApi(
|
|
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,
|