@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/react/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
|
import { ReactNode, JSX } from 'react';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -475,6 +476,11 @@ type SendMessageArgs = BaseSendMessageArgs & {
|
|
|
475
476
|
* This is typically formatted memories from useMemoryStorage.
|
|
476
477
|
*/
|
|
477
478
|
memoryContext?: string;
|
|
479
|
+
/**
|
|
480
|
+
* Search context to inject as a system message.
|
|
481
|
+
* This is typically formatted search results from useSearch.
|
|
482
|
+
*/
|
|
483
|
+
searchContext?: string;
|
|
478
484
|
};
|
|
479
485
|
type SendMessageResult = {
|
|
480
486
|
data: LlmapiChatCompletionResponse;
|
|
@@ -732,6 +738,8 @@ interface BaseSendMessageWithStorageArgs {
|
|
|
732
738
|
files?: FileMetadata[];
|
|
733
739
|
onData?: (chunk: string) => void;
|
|
734
740
|
memoryContext?: string;
|
|
741
|
+
searchContext?: string;
|
|
742
|
+
sources?: SearchSource[];
|
|
735
743
|
}
|
|
736
744
|
interface BaseUseChatStorageResult {
|
|
737
745
|
isLoading: boolean;
|
|
@@ -904,6 +912,79 @@ interface UseChatStorageResult extends BaseUseChatStorageResult {
|
|
|
904
912
|
*/
|
|
905
913
|
declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageResult;
|
|
906
914
|
|
|
915
|
+
/**
|
|
916
|
+
* Combined WatermelonDB schema for all SDK storage modules.
|
|
917
|
+
*
|
|
918
|
+
* This unified schema includes all tables needed by the SDK:
|
|
919
|
+
* - `history`: Chat message storage with embeddings and metadata
|
|
920
|
+
* - `conversations`: Conversation metadata and organization
|
|
921
|
+
* - `memories`: Persistent memory storage with semantic search
|
|
922
|
+
* - `modelPreferences`: User model preferences and settings
|
|
923
|
+
*
|
|
924
|
+
* @example
|
|
925
|
+
* ```typescript
|
|
926
|
+
* import { Database } from '@nozbe/watermelondb';
|
|
927
|
+
* import LokiJSAdapter from '@nozbe/watermelondb/adapters/lokijs';
|
|
928
|
+
* import { sdkSchema, sdkMigrations, sdkModelClasses } from '@reverbia/sdk/react';
|
|
929
|
+
*
|
|
930
|
+
* const adapter = new LokiJSAdapter({
|
|
931
|
+
* schema: sdkSchema,
|
|
932
|
+
* migrations: sdkMigrations,
|
|
933
|
+
* dbName: 'my-app-db',
|
|
934
|
+
* useWebWorker: false,
|
|
935
|
+
* useIncrementalIndexedDB: true,
|
|
936
|
+
* });
|
|
937
|
+
*
|
|
938
|
+
* const database = new Database({
|
|
939
|
+
* adapter,
|
|
940
|
+
* modelClasses: sdkModelClasses,
|
|
941
|
+
* });
|
|
942
|
+
* ```
|
|
943
|
+
*/
|
|
944
|
+
declare const sdkSchema: Readonly<{
|
|
945
|
+
version: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
946
|
+
tables: _nozbe_watermelondb_Schema.TableMap;
|
|
947
|
+
unsafeSql?: (_: string, __: _nozbe_watermelondb_Schema.AppSchemaUnsafeSqlKind) => string;
|
|
948
|
+
}>;
|
|
949
|
+
/**
|
|
950
|
+
* Combined migrations for all SDK storage modules.
|
|
951
|
+
*
|
|
952
|
+
* These migrations handle database schema upgrades from any previous version
|
|
953
|
+
* to the current version. The SDK manages all migration logic internally,
|
|
954
|
+
* so consumer apps don't need to handle version arithmetic or migration merging.
|
|
955
|
+
*
|
|
956
|
+
* **Minimum supported version: v2**
|
|
957
|
+
* Migrations from v1 are not supported. Databases at v1 require a fresh install.
|
|
958
|
+
*
|
|
959
|
+
* Migration history:
|
|
960
|
+
* - v2 → v3: Added `was_stopped` column to history table
|
|
961
|
+
* - v3 → v4: Added `modelPreferences` table for settings storage
|
|
962
|
+
*/
|
|
963
|
+
declare const sdkMigrations: Readonly<{
|
|
964
|
+
validated: true;
|
|
965
|
+
minVersion: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
966
|
+
maxVersion: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
967
|
+
sortedMigrations: _nozbe_watermelondb_Schema_migrations.Migration[];
|
|
968
|
+
}>;
|
|
969
|
+
/**
|
|
970
|
+
* Model classes to register with the WatermelonDB database.
|
|
971
|
+
*
|
|
972
|
+
* Pass this array directly to the `modelClasses` option when creating
|
|
973
|
+
* your Database instance.
|
|
974
|
+
*
|
|
975
|
+
* @example
|
|
976
|
+
* ```typescript
|
|
977
|
+
* import { Database } from '@nozbe/watermelondb';
|
|
978
|
+
* import { sdkSchema, sdkMigrations, sdkModelClasses } from '@reverbia/sdk/react';
|
|
979
|
+
*
|
|
980
|
+
* const database = new Database({
|
|
981
|
+
* adapter,
|
|
982
|
+
* modelClasses: sdkModelClasses,
|
|
983
|
+
* });
|
|
984
|
+
* ```
|
|
985
|
+
*/
|
|
986
|
+
declare const sdkModelClasses: Class<Model$1>[];
|
|
987
|
+
|
|
907
988
|
declare const memoryStorageSchema: Readonly<{
|
|
908
989
|
version: _nozbe_watermelondb_Schema.SchemaVersion;
|
|
909
990
|
tables: _nozbe_watermelondb_Schema.TableMap;
|
|
@@ -1715,4 +1796,4 @@ interface UseGoogleDriveBackupResult {
|
|
|
1715
1796
|
*/
|
|
1716
1797
|
declare function useGoogleDriveBackup(options: UseGoogleDriveBackupOptions): UseGoogleDriveBackupResult;
|
|
1717
1798
|
|
|
1718
|
-
export { Conversation as ChatConversation, Message as ChatMessage, type ChatRole, type ClientTool, type CreateConversationOptions, type CreateMemoryOptions, type CreateMessageOptions, type CreateModelPreferenceOptions, DEFAULT_BACKUP_FOLDER, DEFAULT_CONVERSATIONS_FOLDER as DEFAULT_DRIVE_CONVERSATIONS_FOLDER, DEFAULT_ROOT_FOLDER as DEFAULT_DRIVE_ROOT_FOLDER, DEFAULT_TOOL_SELECTOR_MODEL, type DropboxAuthContextValue, DropboxAuthProvider, type DropboxAuthProviderProps, type DropboxExportResult, type DropboxImportResult, type FileMetadata, type GoogleDriveExportResult, type GoogleDriveImportResult, type MemoryItem, type MemoryType, type OCRFile, type PdfFile, type SearchMessagesOptions, type SearchSource, type SendMessageWithStorageArgs, type SendMessageWithStorageResult, type SignMessageFn, type ChatCompletionUsage as StoredChatCompletionUsage, type StoredConversation, type StoredMemory, Memory as StoredMemoryModel, type StoredMemoryWithSimilarity, type StoredMessage, type StoredMessageWithSimilarity, type StoredModelPreference, ModelPreference as StoredModelPreferenceModel, type ToolExecutionResult, type ToolParameter, type ToolSelectionResult, type UpdateMemoryOptions, type UpdateModelPreferenceOptions, type UseChatStorageOptions, type UseChatStorageResult, type UseDropboxBackupOptions, type UseDropboxBackupResult, type UseGoogleDriveBackupOptions, type UseGoogleDriveBackupResult, type UseMemoryStorageOptions, type UseMemoryStorageResult, type UseSettingsOptions, type UseSettingsResult, chatStorageMigrations, chatStorageSchema, clearToken as clearDropboxToken, createMemoryContextSystemMessage, decryptData, decryptDataBytes, encryptData, executeTool, extractConversationContext, formatMemoriesForChat, generateCompositeKey, generateConversationId, generateUniqueKey, getStoredToken as getDropboxToken, hasEncryptionKey, memoryStorageSchema, requestEncryptionKey, selectTool, settingsStorageSchema, storeToken as storeDropboxToken, useChat, useChatStorage, useDropboxAuth, useDropboxBackup, useEncryption, useGoogleDriveBackup, useImageGeneration, useMemoryStorage, useModels, useOCR, usePdf, useSearch, useSettings };
|
|
1799
|
+
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 };
|
package/dist/react/index.mjs
CHANGED
|
@@ -1238,7 +1238,8 @@ function useChat(options) {
|
|
|
1238
1238
|
onData,
|
|
1239
1239
|
runTools = true,
|
|
1240
1240
|
headers,
|
|
1241
|
-
memoryContext
|
|
1241
|
+
memoryContext,
|
|
1242
|
+
searchContext
|
|
1242
1243
|
}) => {
|
|
1243
1244
|
const messagesValidation = validateMessages(messages);
|
|
1244
1245
|
if (!messagesValidation.valid) {
|
|
@@ -1264,6 +1265,22 @@ function useChat(options) {
|
|
|
1264
1265
|
};
|
|
1265
1266
|
messagesWithContext = [memorySystemMessage, ...messages];
|
|
1266
1267
|
}
|
|
1268
|
+
if (searchContext) {
|
|
1269
|
+
const searchSystemMessage = {
|
|
1270
|
+
role: "system",
|
|
1271
|
+
content: [
|
|
1272
|
+
{
|
|
1273
|
+
type: "text",
|
|
1274
|
+
text: "Here are the search results for the user's query. Use this information to respond to the user's request:"
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
type: "text",
|
|
1278
|
+
text: searchContext
|
|
1279
|
+
}
|
|
1280
|
+
]
|
|
1281
|
+
};
|
|
1282
|
+
messagesWithContext = [searchSystemMessage, ...messagesWithContext];
|
|
1283
|
+
}
|
|
1267
1284
|
let messagesWithToolContext = messagesWithContext;
|
|
1268
1285
|
const shouldRunTools = runTools && tools && tools.length > 0;
|
|
1269
1286
|
if (shouldRunTools) {
|
|
@@ -2149,7 +2166,9 @@ function useChatStorage(options) {
|
|
|
2149
2166
|
onData: perRequestOnData,
|
|
2150
2167
|
runTools,
|
|
2151
2168
|
headers,
|
|
2152
|
-
memoryContext
|
|
2169
|
+
memoryContext,
|
|
2170
|
+
searchContext,
|
|
2171
|
+
sources
|
|
2153
2172
|
} = args;
|
|
2154
2173
|
let convId;
|
|
2155
2174
|
try {
|
|
@@ -2215,7 +2234,8 @@ function useChatStorage(options) {
|
|
|
2215
2234
|
onData: perRequestOnData,
|
|
2216
2235
|
runTools,
|
|
2217
2236
|
headers,
|
|
2218
|
-
memoryContext
|
|
2237
|
+
memoryContext,
|
|
2238
|
+
searchContext
|
|
2219
2239
|
});
|
|
2220
2240
|
const responseDuration = (Date.now() - startTime) / 1e3;
|
|
2221
2241
|
if (result.error || !result.data) {
|
|
@@ -2232,19 +2252,24 @@ function useChatStorage(options) {
|
|
|
2232
2252
|
model: responseModel,
|
|
2233
2253
|
usage: convertUsageToStored(abortedResult.data?.usage),
|
|
2234
2254
|
responseDuration,
|
|
2235
|
-
wasStopped: true
|
|
2255
|
+
wasStopped: true,
|
|
2256
|
+
sources
|
|
2236
2257
|
});
|
|
2237
2258
|
const completionData = abortedResult.data || {
|
|
2238
2259
|
id: `aborted-${Date.now()}`,
|
|
2239
2260
|
model: responseModel,
|
|
2240
|
-
choices: [
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2261
|
+
choices: [
|
|
2262
|
+
{
|
|
2263
|
+
index: 0,
|
|
2264
|
+
message: {
|
|
2265
|
+
role: "assistant",
|
|
2266
|
+
content: [
|
|
2267
|
+
{ type: "text", text: assistantContent2 }
|
|
2268
|
+
]
|
|
2269
|
+
},
|
|
2270
|
+
finish_reason: "stop"
|
|
2271
|
+
}
|
|
2272
|
+
],
|
|
2248
2273
|
usage: void 0
|
|
2249
2274
|
};
|
|
2250
2275
|
return {
|
|
@@ -2303,7 +2328,12 @@ function useChatStorage(options) {
|
|
|
2303
2328
|
);
|
|
2304
2329
|
const updateMessageEmbedding = useCallback2(
|
|
2305
2330
|
async (uniqueId, vector, embeddingModel) => {
|
|
2306
|
-
return updateMessageEmbeddingOp(
|
|
2331
|
+
return updateMessageEmbeddingOp(
|
|
2332
|
+
storageCtx,
|
|
2333
|
+
uniqueId,
|
|
2334
|
+
vector,
|
|
2335
|
+
embeddingModel
|
|
2336
|
+
);
|
|
2307
2337
|
},
|
|
2308
2338
|
[storageCtx]
|
|
2309
2339
|
);
|
|
@@ -2327,36 +2357,13 @@ function useChatStorage(options) {
|
|
|
2327
2357
|
};
|
|
2328
2358
|
}
|
|
2329
2359
|
|
|
2330
|
-
// src/
|
|
2331
|
-
import { useCallback as useCallback3, useState as useState3, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
2332
|
-
import { postApiV1ChatCompletions } from "@reverbia/sdk";
|
|
2333
|
-
|
|
2334
|
-
// src/lib/db/memory/schema.ts
|
|
2360
|
+
// src/lib/db/schema.ts
|
|
2335
2361
|
import { appSchema as appSchema2, tableSchema as tableSchema2 } from "@nozbe/watermelondb";
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
columns: [
|
|
2342
|
-
{ name: "type", type: "string", isIndexed: true },
|
|
2343
|
-
{ name: "namespace", type: "string", isIndexed: true },
|
|
2344
|
-
{ name: "key", type: "string", isIndexed: true },
|
|
2345
|
-
{ name: "value", type: "string" },
|
|
2346
|
-
{ name: "raw_evidence", type: "string" },
|
|
2347
|
-
{ name: "confidence", type: "number" },
|
|
2348
|
-
{ name: "pii", type: "boolean", isIndexed: true },
|
|
2349
|
-
{ name: "composite_key", type: "string", isIndexed: true },
|
|
2350
|
-
{ name: "unique_key", type: "string", isIndexed: true },
|
|
2351
|
-
{ name: "created_at", type: "number", isIndexed: true },
|
|
2352
|
-
{ name: "updated_at", type: "number" },
|
|
2353
|
-
{ name: "embedding", type: "string", isOptional: true },
|
|
2354
|
-
{ name: "embedding_model", type: "string", isOptional: true },
|
|
2355
|
-
{ name: "is_deleted", type: "boolean", isIndexed: true }
|
|
2356
|
-
]
|
|
2357
|
-
})
|
|
2358
|
-
]
|
|
2359
|
-
});
|
|
2362
|
+
import {
|
|
2363
|
+
schemaMigrations as schemaMigrations2,
|
|
2364
|
+
addColumns as addColumns2,
|
|
2365
|
+
createTable
|
|
2366
|
+
} from "@nozbe/watermelondb/Schema/migrations";
|
|
2360
2367
|
|
|
2361
2368
|
// src/lib/db/memory/models.ts
|
|
2362
2369
|
import { Model as Model2 } from "@nozbe/watermelondb";
|
|
@@ -2407,6 +2414,149 @@ __decorateClass([
|
|
|
2407
2414
|
field2("is_deleted")
|
|
2408
2415
|
], Memory.prototype, "isDeleted", 2);
|
|
2409
2416
|
|
|
2417
|
+
// src/lib/db/settings/models.ts
|
|
2418
|
+
import { Model as Model3 } from "@nozbe/watermelondb";
|
|
2419
|
+
import { text as text3 } from "@nozbe/watermelondb/decorators";
|
|
2420
|
+
var ModelPreference = class extends Model3 {
|
|
2421
|
+
};
|
|
2422
|
+
ModelPreference.table = "modelPreferences";
|
|
2423
|
+
__decorateClass([
|
|
2424
|
+
text3("wallet_address")
|
|
2425
|
+
], ModelPreference.prototype, "walletAddress", 2);
|
|
2426
|
+
__decorateClass([
|
|
2427
|
+
text3("models")
|
|
2428
|
+
], ModelPreference.prototype, "models", 2);
|
|
2429
|
+
|
|
2430
|
+
// src/lib/db/schema.ts
|
|
2431
|
+
var SDK_SCHEMA_VERSION = 4;
|
|
2432
|
+
var sdkSchema = appSchema2({
|
|
2433
|
+
version: SDK_SCHEMA_VERSION,
|
|
2434
|
+
tables: [
|
|
2435
|
+
// Chat storage tables
|
|
2436
|
+
tableSchema2({
|
|
2437
|
+
name: "history",
|
|
2438
|
+
columns: [
|
|
2439
|
+
{ name: "message_id", type: "number" },
|
|
2440
|
+
{ name: "conversation_id", type: "string", isIndexed: true },
|
|
2441
|
+
{ name: "role", type: "string", isIndexed: true },
|
|
2442
|
+
{ name: "content", type: "string" },
|
|
2443
|
+
{ name: "model", type: "string", isOptional: true },
|
|
2444
|
+
{ name: "files", type: "string", isOptional: true },
|
|
2445
|
+
{ name: "created_at", type: "number", isIndexed: true },
|
|
2446
|
+
{ name: "updated_at", type: "number" },
|
|
2447
|
+
{ name: "vector", type: "string", isOptional: true },
|
|
2448
|
+
{ name: "embedding_model", type: "string", isOptional: true },
|
|
2449
|
+
{ name: "usage", type: "string", isOptional: true },
|
|
2450
|
+
{ name: "sources", type: "string", isOptional: true },
|
|
2451
|
+
{ name: "response_duration", type: "number", isOptional: true },
|
|
2452
|
+
{ name: "was_stopped", type: "boolean", isOptional: true }
|
|
2453
|
+
]
|
|
2454
|
+
}),
|
|
2455
|
+
tableSchema2({
|
|
2456
|
+
name: "conversations",
|
|
2457
|
+
columns: [
|
|
2458
|
+
{ name: "conversation_id", type: "string", isIndexed: true },
|
|
2459
|
+
{ name: "title", type: "string" },
|
|
2460
|
+
{ name: "created_at", type: "number" },
|
|
2461
|
+
{ name: "updated_at", type: "number" },
|
|
2462
|
+
{ name: "is_deleted", type: "boolean", isIndexed: true }
|
|
2463
|
+
]
|
|
2464
|
+
}),
|
|
2465
|
+
// Memory storage tables
|
|
2466
|
+
tableSchema2({
|
|
2467
|
+
name: "memories",
|
|
2468
|
+
columns: [
|
|
2469
|
+
{ name: "type", type: "string", isIndexed: true },
|
|
2470
|
+
{ name: "namespace", type: "string", isIndexed: true },
|
|
2471
|
+
{ name: "key", type: "string", isIndexed: true },
|
|
2472
|
+
{ name: "value", type: "string" },
|
|
2473
|
+
{ name: "raw_evidence", type: "string" },
|
|
2474
|
+
{ name: "confidence", type: "number" },
|
|
2475
|
+
{ name: "pii", type: "boolean", isIndexed: true },
|
|
2476
|
+
{ name: "composite_key", type: "string", isIndexed: true },
|
|
2477
|
+
{ name: "unique_key", type: "string", isIndexed: true },
|
|
2478
|
+
{ name: "created_at", type: "number", isIndexed: true },
|
|
2479
|
+
{ name: "updated_at", type: "number" },
|
|
2480
|
+
{ name: "embedding", type: "string", isOptional: true },
|
|
2481
|
+
{ name: "embedding_model", type: "string", isOptional: true },
|
|
2482
|
+
{ name: "is_deleted", type: "boolean", isIndexed: true }
|
|
2483
|
+
]
|
|
2484
|
+
}),
|
|
2485
|
+
// Settings storage tables
|
|
2486
|
+
tableSchema2({
|
|
2487
|
+
name: "modelPreferences",
|
|
2488
|
+
columns: [
|
|
2489
|
+
{ name: "wallet_address", type: "string", isIndexed: true },
|
|
2490
|
+
{ name: "models", type: "string", isOptional: true }
|
|
2491
|
+
]
|
|
2492
|
+
})
|
|
2493
|
+
]
|
|
2494
|
+
});
|
|
2495
|
+
var sdkMigrations = schemaMigrations2({
|
|
2496
|
+
migrations: [
|
|
2497
|
+
// v2 -> v3: Added was_stopped column to history
|
|
2498
|
+
{
|
|
2499
|
+
toVersion: 3,
|
|
2500
|
+
steps: [
|
|
2501
|
+
addColumns2({
|
|
2502
|
+
table: "history",
|
|
2503
|
+
columns: [{ name: "was_stopped", type: "boolean", isOptional: true }]
|
|
2504
|
+
})
|
|
2505
|
+
]
|
|
2506
|
+
},
|
|
2507
|
+
// v3 -> v4: Added settings storage (modelPreferences table)
|
|
2508
|
+
{
|
|
2509
|
+
toVersion: 4,
|
|
2510
|
+
steps: [
|
|
2511
|
+
createTable({
|
|
2512
|
+
name: "modelPreferences",
|
|
2513
|
+
columns: [
|
|
2514
|
+
{ name: "wallet_address", type: "string", isIndexed: true },
|
|
2515
|
+
{ name: "models", type: "string", isOptional: true }
|
|
2516
|
+
]
|
|
2517
|
+
})
|
|
2518
|
+
]
|
|
2519
|
+
}
|
|
2520
|
+
]
|
|
2521
|
+
});
|
|
2522
|
+
var sdkModelClasses = [
|
|
2523
|
+
Message,
|
|
2524
|
+
Conversation,
|
|
2525
|
+
Memory,
|
|
2526
|
+
ModelPreference
|
|
2527
|
+
];
|
|
2528
|
+
|
|
2529
|
+
// src/react/useMemoryStorage.ts
|
|
2530
|
+
import { useCallback as useCallback3, useState as useState3, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
2531
|
+
import { postApiV1ChatCompletions } from "@reverbia/sdk";
|
|
2532
|
+
|
|
2533
|
+
// src/lib/db/memory/schema.ts
|
|
2534
|
+
import { appSchema as appSchema3, tableSchema as tableSchema3 } from "@nozbe/watermelondb";
|
|
2535
|
+
var memoryStorageSchema = appSchema3({
|
|
2536
|
+
version: 1,
|
|
2537
|
+
tables: [
|
|
2538
|
+
tableSchema3({
|
|
2539
|
+
name: "memories",
|
|
2540
|
+
columns: [
|
|
2541
|
+
{ name: "type", type: "string", isIndexed: true },
|
|
2542
|
+
{ name: "namespace", type: "string", isIndexed: true },
|
|
2543
|
+
{ name: "key", type: "string", isIndexed: true },
|
|
2544
|
+
{ name: "value", type: "string" },
|
|
2545
|
+
{ name: "raw_evidence", type: "string" },
|
|
2546
|
+
{ name: "confidence", type: "number" },
|
|
2547
|
+
{ name: "pii", type: "boolean", isIndexed: true },
|
|
2548
|
+
{ name: "composite_key", type: "string", isIndexed: true },
|
|
2549
|
+
{ name: "unique_key", type: "string", isIndexed: true },
|
|
2550
|
+
{ name: "created_at", type: "number", isIndexed: true },
|
|
2551
|
+
{ name: "updated_at", type: "number" },
|
|
2552
|
+
{ name: "embedding", type: "string", isOptional: true },
|
|
2553
|
+
{ name: "embedding_model", type: "string", isOptional: true },
|
|
2554
|
+
{ name: "is_deleted", type: "boolean", isIndexed: true }
|
|
2555
|
+
]
|
|
2556
|
+
})
|
|
2557
|
+
]
|
|
2558
|
+
});
|
|
2559
|
+
|
|
2410
2560
|
// src/lib/db/memory/types.ts
|
|
2411
2561
|
function generateCompositeKey(namespace, key) {
|
|
2412
2562
|
return `${namespace}:${key}`;
|
|
@@ -3468,11 +3618,11 @@ function useMemoryStorage(options) {
|
|
|
3468
3618
|
import { useCallback as useCallback4, useState as useState4, useMemo as useMemo3, useEffect as useEffect2 } from "react";
|
|
3469
3619
|
|
|
3470
3620
|
// src/lib/db/settings/schema.ts
|
|
3471
|
-
import { appSchema as
|
|
3472
|
-
var settingsStorageSchema =
|
|
3621
|
+
import { appSchema as appSchema4, tableSchema as tableSchema4 } from "@nozbe/watermelondb";
|
|
3622
|
+
var settingsStorageSchema = appSchema4({
|
|
3473
3623
|
version: 1,
|
|
3474
3624
|
tables: [
|
|
3475
|
-
|
|
3625
|
+
tableSchema4({
|
|
3476
3626
|
name: "modelPreferences",
|
|
3477
3627
|
columns: [
|
|
3478
3628
|
{ name: "wallet_address", type: "string", isIndexed: true },
|
|
@@ -3482,19 +3632,6 @@ var settingsStorageSchema = appSchema3({
|
|
|
3482
3632
|
]
|
|
3483
3633
|
});
|
|
3484
3634
|
|
|
3485
|
-
// src/lib/db/settings/models.ts
|
|
3486
|
-
import { Model as Model3 } from "@nozbe/watermelondb";
|
|
3487
|
-
import { text as text3 } from "@nozbe/watermelondb/decorators";
|
|
3488
|
-
var ModelPreference = class extends Model3 {
|
|
3489
|
-
};
|
|
3490
|
-
ModelPreference.table = "modelPreferences";
|
|
3491
|
-
__decorateClass([
|
|
3492
|
-
text3("wallet_address")
|
|
3493
|
-
], ModelPreference.prototype, "walletAddress", 2);
|
|
3494
|
-
__decorateClass([
|
|
3495
|
-
text3("models")
|
|
3496
|
-
], ModelPreference.prototype, "models", 2);
|
|
3497
|
-
|
|
3498
3635
|
// src/lib/db/settings/operations.ts
|
|
3499
3636
|
import { Q as Q3 } from "@nozbe/watermelondb";
|
|
3500
3637
|
function modelPreferenceToStored(preference) {
|
|
@@ -5098,6 +5235,9 @@ export {
|
|
|
5098
5235
|
hasEncryptionKey,
|
|
5099
5236
|
memoryStorageSchema,
|
|
5100
5237
|
requestEncryptionKey,
|
|
5238
|
+
sdkMigrations,
|
|
5239
|
+
sdkModelClasses,
|
|
5240
|
+
sdkSchema,
|
|
5101
5241
|
selectTool,
|
|
5102
5242
|
settingsStorageSchema,
|
|
5103
5243
|
storeToken as storeDropboxToken,
|