@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/expo/index.mjs
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
|
|
1
12
|
// src/expo/useChat.ts
|
|
2
13
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
14
|
|
|
@@ -283,7 +294,137 @@ function useChat(options) {
|
|
|
283
294
|
// src/expo/useChatStorage.ts
|
|
284
295
|
import { useCallback as useCallback2, useState as useState2, useMemo } from "react";
|
|
285
296
|
|
|
286
|
-
// src/lib/
|
|
297
|
+
// src/lib/db/chat/schema.ts
|
|
298
|
+
import { appSchema, tableSchema } from "@nozbe/watermelondb";
|
|
299
|
+
import {
|
|
300
|
+
schemaMigrations,
|
|
301
|
+
addColumns
|
|
302
|
+
} from "@nozbe/watermelondb/Schema/migrations";
|
|
303
|
+
var chatStorageSchema = appSchema({
|
|
304
|
+
version: 2,
|
|
305
|
+
tables: [
|
|
306
|
+
tableSchema({
|
|
307
|
+
name: "history",
|
|
308
|
+
columns: [
|
|
309
|
+
{ name: "message_id", type: "number" },
|
|
310
|
+
{ name: "conversation_id", type: "string", isIndexed: true },
|
|
311
|
+
{ name: "role", type: "string", isIndexed: true },
|
|
312
|
+
{ name: "content", type: "string" },
|
|
313
|
+
{ name: "model", type: "string", isOptional: true },
|
|
314
|
+
{ name: "files", type: "string", isOptional: true },
|
|
315
|
+
{ name: "created_at", type: "number", isIndexed: true },
|
|
316
|
+
{ name: "updated_at", type: "number" },
|
|
317
|
+
{ name: "vector", type: "string", isOptional: true },
|
|
318
|
+
{ name: "embedding_model", type: "string", isOptional: true },
|
|
319
|
+
{ name: "usage", type: "string", isOptional: true },
|
|
320
|
+
{ name: "sources", type: "string", isOptional: true },
|
|
321
|
+
{ name: "response_duration", type: "number", isOptional: true },
|
|
322
|
+
{ name: "was_stopped", type: "boolean", isOptional: true }
|
|
323
|
+
]
|
|
324
|
+
}),
|
|
325
|
+
tableSchema({
|
|
326
|
+
name: "conversations",
|
|
327
|
+
columns: [
|
|
328
|
+
{ name: "conversation_id", type: "string", isIndexed: true },
|
|
329
|
+
{ name: "title", type: "string" },
|
|
330
|
+
{ name: "created_at", type: "number" },
|
|
331
|
+
{ name: "updated_at", type: "number" },
|
|
332
|
+
{ name: "is_deleted", type: "boolean", isIndexed: true }
|
|
333
|
+
]
|
|
334
|
+
})
|
|
335
|
+
]
|
|
336
|
+
});
|
|
337
|
+
var chatStorageMigrations = schemaMigrations({
|
|
338
|
+
migrations: [
|
|
339
|
+
{
|
|
340
|
+
toVersion: 2,
|
|
341
|
+
steps: [
|
|
342
|
+
addColumns({
|
|
343
|
+
table: "history",
|
|
344
|
+
columns: [{ name: "was_stopped", type: "boolean", isOptional: true }]
|
|
345
|
+
})
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
]
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
// src/lib/db/chat/models.ts
|
|
352
|
+
import { Model } from "@nozbe/watermelondb";
|
|
353
|
+
import { field, text, date, json } from "@nozbe/watermelondb/decorators";
|
|
354
|
+
var Message = class extends Model {
|
|
355
|
+
};
|
|
356
|
+
Message.table = "history";
|
|
357
|
+
Message.associations = {
|
|
358
|
+
conversations: { type: "belongs_to", key: "conversation_id" }
|
|
359
|
+
};
|
|
360
|
+
__decorateClass([
|
|
361
|
+
field("message_id")
|
|
362
|
+
], Message.prototype, "messageId", 2);
|
|
363
|
+
__decorateClass([
|
|
364
|
+
text("conversation_id")
|
|
365
|
+
], Message.prototype, "conversationId", 2);
|
|
366
|
+
__decorateClass([
|
|
367
|
+
text("role")
|
|
368
|
+
], Message.prototype, "role", 2);
|
|
369
|
+
__decorateClass([
|
|
370
|
+
text("content")
|
|
371
|
+
], Message.prototype, "content", 2);
|
|
372
|
+
__decorateClass([
|
|
373
|
+
text("model")
|
|
374
|
+
], Message.prototype, "model", 2);
|
|
375
|
+
__decorateClass([
|
|
376
|
+
json("files", (json3) => json3)
|
|
377
|
+
], Message.prototype, "files", 2);
|
|
378
|
+
__decorateClass([
|
|
379
|
+
date("created_at")
|
|
380
|
+
], Message.prototype, "createdAt", 2);
|
|
381
|
+
__decorateClass([
|
|
382
|
+
date("updated_at")
|
|
383
|
+
], Message.prototype, "updatedAt", 2);
|
|
384
|
+
__decorateClass([
|
|
385
|
+
json("vector", (json3) => json3)
|
|
386
|
+
], Message.prototype, "vector", 2);
|
|
387
|
+
__decorateClass([
|
|
388
|
+
text("embedding_model")
|
|
389
|
+
], Message.prototype, "embeddingModel", 2);
|
|
390
|
+
__decorateClass([
|
|
391
|
+
json("usage", (json3) => json3)
|
|
392
|
+
], Message.prototype, "usage", 2);
|
|
393
|
+
__decorateClass([
|
|
394
|
+
json("sources", (json3) => json3)
|
|
395
|
+
], Message.prototype, "sources", 2);
|
|
396
|
+
__decorateClass([
|
|
397
|
+
field("response_duration")
|
|
398
|
+
], Message.prototype, "responseDuration", 2);
|
|
399
|
+
__decorateClass([
|
|
400
|
+
field("was_stopped")
|
|
401
|
+
], Message.prototype, "wasStopped", 2);
|
|
402
|
+
var Conversation = class extends Model {
|
|
403
|
+
};
|
|
404
|
+
Conversation.table = "conversations";
|
|
405
|
+
Conversation.associations = {
|
|
406
|
+
history: { type: "has_many", foreignKey: "conversation_id" }
|
|
407
|
+
};
|
|
408
|
+
__decorateClass([
|
|
409
|
+
text("conversation_id")
|
|
410
|
+
], Conversation.prototype, "conversationId", 2);
|
|
411
|
+
__decorateClass([
|
|
412
|
+
text("title")
|
|
413
|
+
], Conversation.prototype, "title", 2);
|
|
414
|
+
__decorateClass([
|
|
415
|
+
date("created_at")
|
|
416
|
+
], Conversation.prototype, "createdAt", 2);
|
|
417
|
+
__decorateClass([
|
|
418
|
+
date("updated_at")
|
|
419
|
+
], Conversation.prototype, "updatedAt", 2);
|
|
420
|
+
__decorateClass([
|
|
421
|
+
field("is_deleted")
|
|
422
|
+
], Conversation.prototype, "isDeleted", 2);
|
|
423
|
+
|
|
424
|
+
// src/lib/db/chat/types.ts
|
|
425
|
+
function generateConversationId() {
|
|
426
|
+
return `conv_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
427
|
+
}
|
|
287
428
|
function convertUsageToStored(usage) {
|
|
288
429
|
if (!usage) return void 0;
|
|
289
430
|
return {
|
|
@@ -293,11 +434,8 @@ function convertUsageToStored(usage) {
|
|
|
293
434
|
costMicroUsd: usage.cost_micro_usd
|
|
294
435
|
};
|
|
295
436
|
}
|
|
296
|
-
function generateConversationId() {
|
|
297
|
-
return `conv_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
298
|
-
}
|
|
299
437
|
|
|
300
|
-
// src/lib/
|
|
438
|
+
// src/lib/db/chat/operations.ts
|
|
301
439
|
import { Q } from "@nozbe/watermelondb";
|
|
302
440
|
function messageToStored(message) {
|
|
303
441
|
return {
|
|
@@ -1734,10 +1872,83 @@ function useModels(options = {}) {
|
|
|
1734
1872
|
import { useCallback as useCallback5, useState as useState5, useMemo as useMemo2, useRef as useRef4 } from "react";
|
|
1735
1873
|
import { postApiV1ChatCompletions } from "@reverbia/sdk";
|
|
1736
1874
|
|
|
1737
|
-
// src/lib/
|
|
1738
|
-
import {
|
|
1875
|
+
// src/lib/db/memory/schema.ts
|
|
1876
|
+
import { appSchema as appSchema2, tableSchema as tableSchema2 } from "@nozbe/watermelondb";
|
|
1877
|
+
var memoryStorageSchema = appSchema2({
|
|
1878
|
+
version: 1,
|
|
1879
|
+
tables: [
|
|
1880
|
+
tableSchema2({
|
|
1881
|
+
name: "memories",
|
|
1882
|
+
columns: [
|
|
1883
|
+
{ name: "type", type: "string", isIndexed: true },
|
|
1884
|
+
{ name: "namespace", type: "string", isIndexed: true },
|
|
1885
|
+
{ name: "key", type: "string", isIndexed: true },
|
|
1886
|
+
{ name: "value", type: "string" },
|
|
1887
|
+
{ name: "raw_evidence", type: "string" },
|
|
1888
|
+
{ name: "confidence", type: "number" },
|
|
1889
|
+
{ name: "pii", type: "boolean", isIndexed: true },
|
|
1890
|
+
{ name: "composite_key", type: "string", isIndexed: true },
|
|
1891
|
+
{ name: "unique_key", type: "string", isIndexed: true },
|
|
1892
|
+
{ name: "created_at", type: "number", isIndexed: true },
|
|
1893
|
+
{ name: "updated_at", type: "number" },
|
|
1894
|
+
{ name: "embedding", type: "string", isOptional: true },
|
|
1895
|
+
{ name: "embedding_model", type: "string", isOptional: true },
|
|
1896
|
+
{ name: "is_deleted", type: "boolean", isIndexed: true }
|
|
1897
|
+
]
|
|
1898
|
+
})
|
|
1899
|
+
]
|
|
1900
|
+
});
|
|
1901
|
+
|
|
1902
|
+
// src/lib/db/memory/models.ts
|
|
1903
|
+
import { Model as Model2 } from "@nozbe/watermelondb";
|
|
1904
|
+
import { field as field2, text as text2, date as date2, json as json2 } from "@nozbe/watermelondb/decorators";
|
|
1905
|
+
var Memory = class extends Model2 {
|
|
1906
|
+
};
|
|
1907
|
+
Memory.table = "memories";
|
|
1908
|
+
__decorateClass([
|
|
1909
|
+
text2("type")
|
|
1910
|
+
], Memory.prototype, "type", 2);
|
|
1911
|
+
__decorateClass([
|
|
1912
|
+
text2("namespace")
|
|
1913
|
+
], Memory.prototype, "namespace", 2);
|
|
1914
|
+
__decorateClass([
|
|
1915
|
+
text2("key")
|
|
1916
|
+
], Memory.prototype, "key", 2);
|
|
1917
|
+
__decorateClass([
|
|
1918
|
+
text2("value")
|
|
1919
|
+
], Memory.prototype, "value", 2);
|
|
1920
|
+
__decorateClass([
|
|
1921
|
+
text2("raw_evidence")
|
|
1922
|
+
], Memory.prototype, "rawEvidence", 2);
|
|
1923
|
+
__decorateClass([
|
|
1924
|
+
field2("confidence")
|
|
1925
|
+
], Memory.prototype, "confidence", 2);
|
|
1926
|
+
__decorateClass([
|
|
1927
|
+
field2("pii")
|
|
1928
|
+
], Memory.prototype, "pii", 2);
|
|
1929
|
+
__decorateClass([
|
|
1930
|
+
text2("composite_key")
|
|
1931
|
+
], Memory.prototype, "compositeKey", 2);
|
|
1932
|
+
__decorateClass([
|
|
1933
|
+
text2("unique_key")
|
|
1934
|
+
], Memory.prototype, "uniqueKey", 2);
|
|
1935
|
+
__decorateClass([
|
|
1936
|
+
date2("created_at")
|
|
1937
|
+
], Memory.prototype, "createdAt", 2);
|
|
1938
|
+
__decorateClass([
|
|
1939
|
+
date2("updated_at")
|
|
1940
|
+
], Memory.prototype, "updatedAt", 2);
|
|
1941
|
+
__decorateClass([
|
|
1942
|
+
json2("embedding", (json3) => json3)
|
|
1943
|
+
], Memory.prototype, "embedding", 2);
|
|
1944
|
+
__decorateClass([
|
|
1945
|
+
text2("embedding_model")
|
|
1946
|
+
], Memory.prototype, "embeddingModel", 2);
|
|
1947
|
+
__decorateClass([
|
|
1948
|
+
field2("is_deleted")
|
|
1949
|
+
], Memory.prototype, "isDeleted", 2);
|
|
1739
1950
|
|
|
1740
|
-
// src/lib/
|
|
1951
|
+
// src/lib/db/memory/types.ts
|
|
1741
1952
|
function generateCompositeKey(namespace, key) {
|
|
1742
1953
|
return `${namespace}:${key}`;
|
|
1743
1954
|
}
|
|
@@ -1763,7 +1974,8 @@ function cosineSimilarity(a, b) {
|
|
|
1763
1974
|
return dotProduct / denominator;
|
|
1764
1975
|
}
|
|
1765
1976
|
|
|
1766
|
-
// src/lib/
|
|
1977
|
+
// src/lib/db/memory/operations.ts
|
|
1978
|
+
import { Q as Q2 } from "@nozbe/watermelondb";
|
|
1767
1979
|
function memoryToStored(memory) {
|
|
1768
1980
|
return {
|
|
1769
1981
|
uniqueId: memory.id,
|
|
@@ -2141,7 +2353,7 @@ var DEFAULT_COMPLETION_MODEL = "openai/gpt-4o";
|
|
|
2141
2353
|
|
|
2142
2354
|
// src/expo/useMemoryStorage.ts
|
|
2143
2355
|
import { postApiV1Embeddings } from "@reverbia/sdk";
|
|
2144
|
-
async function generateEmbeddingForTextApi(
|
|
2356
|
+
async function generateEmbeddingForTextApi(text3, options) {
|
|
2145
2357
|
const token = options.getToken ? await options.getToken() : null;
|
|
2146
2358
|
if (!token) {
|
|
2147
2359
|
throw new Error("No auth token available for embedding generation");
|
|
@@ -2149,7 +2361,7 @@ async function generateEmbeddingForTextApi(text, options) {
|
|
|
2149
2361
|
const response = await postApiV1Embeddings({
|
|
2150
2362
|
baseUrl: options.baseUrl,
|
|
2151
2363
|
body: {
|
|
2152
|
-
input:
|
|
2364
|
+
input: text3,
|
|
2153
2365
|
model: options.model
|
|
2154
2366
|
},
|
|
2155
2367
|
headers: {
|
|
@@ -2166,8 +2378,8 @@ async function generateEmbeddingForTextApi(text, options) {
|
|
|
2166
2378
|
return embedding;
|
|
2167
2379
|
}
|
|
2168
2380
|
async function generateEmbeddingForMemoryApi(memory, options) {
|
|
2169
|
-
const
|
|
2170
|
-
return generateEmbeddingForTextApi(
|
|
2381
|
+
const text3 = `${memory.type}: ${memory.namespace}/${memory.key} = ${memory.value}. Evidence: ${memory.rawEvidence}`;
|
|
2382
|
+
return generateEmbeddingForTextApi(text3, options);
|
|
2171
2383
|
}
|
|
2172
2384
|
function useMemoryStorage(options) {
|
|
2173
2385
|
const {
|
|
@@ -2691,290 +2903,6 @@ function useMemoryStorage(options) {
|
|
|
2691
2903
|
clearMemories
|
|
2692
2904
|
};
|
|
2693
2905
|
}
|
|
2694
|
-
|
|
2695
|
-
// src/lib/chatStorage/schema.ts
|
|
2696
|
-
import { appSchema, tableSchema } from "@nozbe/watermelondb";
|
|
2697
|
-
import { schemaMigrations, addColumns } from "@nozbe/watermelondb/Schema/migrations";
|
|
2698
|
-
var chatStorageSchema = appSchema({
|
|
2699
|
-
version: 2,
|
|
2700
|
-
tables: [
|
|
2701
|
-
tableSchema({
|
|
2702
|
-
name: "history",
|
|
2703
|
-
columns: [
|
|
2704
|
-
{ name: "message_id", type: "number" },
|
|
2705
|
-
// Sequential ID within conversation
|
|
2706
|
-
{ name: "conversation_id", type: "string", isIndexed: true },
|
|
2707
|
-
{ name: "role", type: "string", isIndexed: true },
|
|
2708
|
-
// 'user' | 'assistant' | 'system'
|
|
2709
|
-
{ name: "content", type: "string" },
|
|
2710
|
-
{ name: "model", type: "string", isOptional: true },
|
|
2711
|
-
{ name: "files", type: "string", isOptional: true },
|
|
2712
|
-
// JSON stringified FileMetadata[]
|
|
2713
|
-
{ name: "created_at", type: "number", isIndexed: true },
|
|
2714
|
-
{ name: "updated_at", type: "number" },
|
|
2715
|
-
{ name: "vector", type: "string", isOptional: true },
|
|
2716
|
-
// JSON stringified number[]
|
|
2717
|
-
{ name: "embedding_model", type: "string", isOptional: true },
|
|
2718
|
-
{ name: "usage", type: "string", isOptional: true },
|
|
2719
|
-
// JSON stringified ChatCompletionUsage
|
|
2720
|
-
{ name: "sources", type: "string", isOptional: true },
|
|
2721
|
-
// JSON stringified SearchSource[]
|
|
2722
|
-
{ name: "response_duration", type: "number", isOptional: true },
|
|
2723
|
-
{ name: "was_stopped", type: "boolean", isOptional: true }
|
|
2724
|
-
]
|
|
2725
|
-
}),
|
|
2726
|
-
tableSchema({
|
|
2727
|
-
name: "conversations",
|
|
2728
|
-
columns: [
|
|
2729
|
-
{ name: "conversation_id", type: "string", isIndexed: true },
|
|
2730
|
-
{ name: "title", type: "string" },
|
|
2731
|
-
{ name: "created_at", type: "number" },
|
|
2732
|
-
{ name: "updated_at", type: "number" },
|
|
2733
|
-
{ name: "is_deleted", type: "boolean", isIndexed: true }
|
|
2734
|
-
]
|
|
2735
|
-
})
|
|
2736
|
-
]
|
|
2737
|
-
});
|
|
2738
|
-
var chatStorageMigrations = schemaMigrations({
|
|
2739
|
-
migrations: [
|
|
2740
|
-
{
|
|
2741
|
-
toVersion: 2,
|
|
2742
|
-
steps: [
|
|
2743
|
-
addColumns({
|
|
2744
|
-
table: "history",
|
|
2745
|
-
columns: [
|
|
2746
|
-
{ name: "was_stopped", type: "boolean", isOptional: true }
|
|
2747
|
-
]
|
|
2748
|
-
})
|
|
2749
|
-
]
|
|
2750
|
-
}
|
|
2751
|
-
]
|
|
2752
|
-
});
|
|
2753
|
-
|
|
2754
|
-
// src/lib/chatStorage/models.ts
|
|
2755
|
-
import { Model } from "@nozbe/watermelondb";
|
|
2756
|
-
var Message = class extends Model {
|
|
2757
|
-
/** Sequential message ID within conversation */
|
|
2758
|
-
get messageId() {
|
|
2759
|
-
return this._getRaw("message_id");
|
|
2760
|
-
}
|
|
2761
|
-
/** Links message to its conversation */
|
|
2762
|
-
get conversationId() {
|
|
2763
|
-
return this._getRaw("conversation_id");
|
|
2764
|
-
}
|
|
2765
|
-
/** Who sent the message: 'user' | 'assistant' | 'system' */
|
|
2766
|
-
get role() {
|
|
2767
|
-
return this._getRaw("role");
|
|
2768
|
-
}
|
|
2769
|
-
/** The message text content */
|
|
2770
|
-
get content() {
|
|
2771
|
-
return this._getRaw("content");
|
|
2772
|
-
}
|
|
2773
|
-
/** LLM model used (e.g., GPT-4, Claude) */
|
|
2774
|
-
get model() {
|
|
2775
|
-
const value = this._getRaw("model");
|
|
2776
|
-
return value ? value : void 0;
|
|
2777
|
-
}
|
|
2778
|
-
/** Optional attached files */
|
|
2779
|
-
get files() {
|
|
2780
|
-
const raw = this._getRaw("files");
|
|
2781
|
-
if (!raw) return void 0;
|
|
2782
|
-
try {
|
|
2783
|
-
return JSON.parse(raw);
|
|
2784
|
-
} catch {
|
|
2785
|
-
return void 0;
|
|
2786
|
-
}
|
|
2787
|
-
}
|
|
2788
|
-
/** Created timestamp */
|
|
2789
|
-
get createdAt() {
|
|
2790
|
-
return new Date(this._getRaw("created_at"));
|
|
2791
|
-
}
|
|
2792
|
-
/** Updated timestamp */
|
|
2793
|
-
get updatedAt() {
|
|
2794
|
-
return new Date(this._getRaw("updated_at"));
|
|
2795
|
-
}
|
|
2796
|
-
/** Embedding vector for semantic search */
|
|
2797
|
-
get vector() {
|
|
2798
|
-
const raw = this._getRaw("vector");
|
|
2799
|
-
if (!raw) return void 0;
|
|
2800
|
-
try {
|
|
2801
|
-
return JSON.parse(raw);
|
|
2802
|
-
} catch {
|
|
2803
|
-
return void 0;
|
|
2804
|
-
}
|
|
2805
|
-
}
|
|
2806
|
-
/** Model used to generate embedding */
|
|
2807
|
-
get embeddingModel() {
|
|
2808
|
-
const value = this._getRaw("embedding_model");
|
|
2809
|
-
return value ? value : void 0;
|
|
2810
|
-
}
|
|
2811
|
-
/** Token counts and cost */
|
|
2812
|
-
get usage() {
|
|
2813
|
-
const raw = this._getRaw("usage");
|
|
2814
|
-
if (!raw) return void 0;
|
|
2815
|
-
try {
|
|
2816
|
-
return JSON.parse(raw);
|
|
2817
|
-
} catch {
|
|
2818
|
-
return void 0;
|
|
2819
|
-
}
|
|
2820
|
-
}
|
|
2821
|
-
/** Web search sources */
|
|
2822
|
-
get sources() {
|
|
2823
|
-
const raw = this._getRaw("sources");
|
|
2824
|
-
if (!raw) return void 0;
|
|
2825
|
-
try {
|
|
2826
|
-
return JSON.parse(raw);
|
|
2827
|
-
} catch {
|
|
2828
|
-
return void 0;
|
|
2829
|
-
}
|
|
2830
|
-
}
|
|
2831
|
-
/** Response time in seconds */
|
|
2832
|
-
get responseDuration() {
|
|
2833
|
-
const value = this._getRaw("response_duration");
|
|
2834
|
-
return value !== null && value !== void 0 ? value : void 0;
|
|
2835
|
-
}
|
|
2836
|
-
/** Whether the message generation was stopped by the user */
|
|
2837
|
-
get wasStopped() {
|
|
2838
|
-
return this._getRaw("was_stopped");
|
|
2839
|
-
}
|
|
2840
|
-
};
|
|
2841
|
-
Message.table = "history";
|
|
2842
|
-
Message.associations = {
|
|
2843
|
-
conversations: { type: "belongs_to", key: "conversation_id" }
|
|
2844
|
-
};
|
|
2845
|
-
var Conversation = class extends Model {
|
|
2846
|
-
/** Unique conversation identifier */
|
|
2847
|
-
get conversationId() {
|
|
2848
|
-
return this._getRaw("conversation_id");
|
|
2849
|
-
}
|
|
2850
|
-
/** Conversation title */
|
|
2851
|
-
get title() {
|
|
2852
|
-
return this._getRaw("title");
|
|
2853
|
-
}
|
|
2854
|
-
/** Created timestamp */
|
|
2855
|
-
get createdAt() {
|
|
2856
|
-
return new Date(this._getRaw("created_at"));
|
|
2857
|
-
}
|
|
2858
|
-
/** Updated timestamp */
|
|
2859
|
-
get updatedAt() {
|
|
2860
|
-
return new Date(this._getRaw("updated_at"));
|
|
2861
|
-
}
|
|
2862
|
-
/** Soft delete flag */
|
|
2863
|
-
get isDeleted() {
|
|
2864
|
-
return this._getRaw("is_deleted");
|
|
2865
|
-
}
|
|
2866
|
-
};
|
|
2867
|
-
Conversation.table = "conversations";
|
|
2868
|
-
Conversation.associations = {
|
|
2869
|
-
history: { type: "has_many", foreignKey: "conversation_id" }
|
|
2870
|
-
};
|
|
2871
|
-
|
|
2872
|
-
// src/lib/memoryStorage/schema.ts
|
|
2873
|
-
import { appSchema as appSchema2, tableSchema as tableSchema2 } from "@nozbe/watermelondb";
|
|
2874
|
-
var memoryStorageSchema = appSchema2({
|
|
2875
|
-
version: 1,
|
|
2876
|
-
tables: [
|
|
2877
|
-
tableSchema2({
|
|
2878
|
-
name: "memories",
|
|
2879
|
-
columns: [
|
|
2880
|
-
// Memory type classification
|
|
2881
|
-
{ name: "type", type: "string", isIndexed: true },
|
|
2882
|
-
// 'identity' | 'preference' | 'project' | 'skill' | 'constraint'
|
|
2883
|
-
// Hierarchical key structure
|
|
2884
|
-
{ name: "namespace", type: "string", isIndexed: true },
|
|
2885
|
-
{ name: "key", type: "string", isIndexed: true },
|
|
2886
|
-
{ name: "value", type: "string" },
|
|
2887
|
-
// Evidence and confidence
|
|
2888
|
-
{ name: "raw_evidence", type: "string" },
|
|
2889
|
-
{ name: "confidence", type: "number" },
|
|
2890
|
-
{ name: "pii", type: "boolean", isIndexed: true },
|
|
2891
|
-
// Composite keys for efficient lookups
|
|
2892
|
-
{ name: "composite_key", type: "string", isIndexed: true },
|
|
2893
|
-
// namespace:key
|
|
2894
|
-
{ name: "unique_key", type: "string", isIndexed: true },
|
|
2895
|
-
// namespace:key:value
|
|
2896
|
-
// Timestamps
|
|
2897
|
-
{ name: "created_at", type: "number", isIndexed: true },
|
|
2898
|
-
{ name: "updated_at", type: "number" },
|
|
2899
|
-
// Vector embeddings for semantic search
|
|
2900
|
-
{ name: "embedding", type: "string", isOptional: true },
|
|
2901
|
-
// JSON stringified number[]
|
|
2902
|
-
{ name: "embedding_model", type: "string", isOptional: true },
|
|
2903
|
-
// Soft delete flag
|
|
2904
|
-
{ name: "is_deleted", type: "boolean", isIndexed: true }
|
|
2905
|
-
]
|
|
2906
|
-
})
|
|
2907
|
-
]
|
|
2908
|
-
});
|
|
2909
|
-
|
|
2910
|
-
// src/lib/memoryStorage/models.ts
|
|
2911
|
-
import { Model as Model2 } from "@nozbe/watermelondb";
|
|
2912
|
-
var Memory = class extends Model2 {
|
|
2913
|
-
/** Memory type classification */
|
|
2914
|
-
get type() {
|
|
2915
|
-
return this._getRaw("type");
|
|
2916
|
-
}
|
|
2917
|
-
/** Namespace for grouping related memories */
|
|
2918
|
-
get namespace() {
|
|
2919
|
-
return this._getRaw("namespace");
|
|
2920
|
-
}
|
|
2921
|
-
/** Key within the namespace */
|
|
2922
|
-
get key() {
|
|
2923
|
-
return this._getRaw("key");
|
|
2924
|
-
}
|
|
2925
|
-
/** The memory value/content */
|
|
2926
|
-
get value() {
|
|
2927
|
-
return this._getRaw("value");
|
|
2928
|
-
}
|
|
2929
|
-
/** Raw evidence from which this memory was extracted */
|
|
2930
|
-
get rawEvidence() {
|
|
2931
|
-
return this._getRaw("raw_evidence");
|
|
2932
|
-
}
|
|
2933
|
-
/** Confidence score (0-1) */
|
|
2934
|
-
get confidence() {
|
|
2935
|
-
return this._getRaw("confidence");
|
|
2936
|
-
}
|
|
2937
|
-
/** Whether this memory contains PII */
|
|
2938
|
-
get pii() {
|
|
2939
|
-
return this._getRaw("pii");
|
|
2940
|
-
}
|
|
2941
|
-
/** Composite key (namespace:key) for efficient lookups */
|
|
2942
|
-
get compositeKey() {
|
|
2943
|
-
return this._getRaw("composite_key");
|
|
2944
|
-
}
|
|
2945
|
-
/** Unique key (namespace:key:value) for deduplication */
|
|
2946
|
-
get uniqueKey() {
|
|
2947
|
-
return this._getRaw("unique_key");
|
|
2948
|
-
}
|
|
2949
|
-
/** Created timestamp */
|
|
2950
|
-
get createdAt() {
|
|
2951
|
-
return new Date(this._getRaw("created_at"));
|
|
2952
|
-
}
|
|
2953
|
-
/** Updated timestamp */
|
|
2954
|
-
get updatedAt() {
|
|
2955
|
-
return new Date(this._getRaw("updated_at"));
|
|
2956
|
-
}
|
|
2957
|
-
/** Embedding vector for semantic search */
|
|
2958
|
-
get embedding() {
|
|
2959
|
-
const raw = this._getRaw("embedding");
|
|
2960
|
-
if (!raw) return void 0;
|
|
2961
|
-
try {
|
|
2962
|
-
return JSON.parse(raw);
|
|
2963
|
-
} catch {
|
|
2964
|
-
return void 0;
|
|
2965
|
-
}
|
|
2966
|
-
}
|
|
2967
|
-
/** Model used to generate embedding */
|
|
2968
|
-
get embeddingModel() {
|
|
2969
|
-
const value = this._getRaw("embedding_model");
|
|
2970
|
-
return value ? value : void 0;
|
|
2971
|
-
}
|
|
2972
|
-
/** Soft delete flag */
|
|
2973
|
-
get isDeleted() {
|
|
2974
|
-
return this._getRaw("is_deleted");
|
|
2975
|
-
}
|
|
2976
|
-
};
|
|
2977
|
-
Memory.table = "memories";
|
|
2978
2906
|
export {
|
|
2979
2907
|
Conversation as ChatConversation,
|
|
2980
2908
|
Message as ChatMessage,
|
package/dist/index.cjs
CHANGED
|
@@ -20,12 +20,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
getApiV1DocsSwaggerJson: () => getApiV1DocsSwaggerJson,
|
|
23
24
|
getApiV1Models: () => getApiV1Models,
|
|
24
25
|
getHealth: () => getHealth,
|
|
25
26
|
postApiV1ChatCompletions: () => postApiV1ChatCompletions,
|
|
26
27
|
postApiV1Embeddings: () => postApiV1Embeddings,
|
|
27
28
|
postApiV1ImagesGenerations: () => postApiV1ImagesGenerations,
|
|
28
|
-
postApiV1Search: () => postApiV1Search
|
|
29
|
+
postApiV1Search: () => postApiV1Search,
|
|
30
|
+
postAuthOauthByProviderExchange: () => postAuthOauthByProviderExchange,
|
|
31
|
+
postAuthOauthByProviderRefresh: () => postAuthOauthByProviderRefresh,
|
|
32
|
+
postAuthOauthByProviderRevoke: () => postAuthOauthByProviderRevoke
|
|
29
33
|
});
|
|
30
34
|
module.exports = __toCommonJS(index_exports);
|
|
31
35
|
|
|
@@ -855,6 +859,12 @@ var postApiV1ChatCompletions = (options) => {
|
|
|
855
859
|
}
|
|
856
860
|
});
|
|
857
861
|
};
|
|
862
|
+
var getApiV1DocsSwaggerJson = (options) => {
|
|
863
|
+
return (options?.client ?? client).get({
|
|
864
|
+
url: "/api/v1/docs/swagger.json",
|
|
865
|
+
...options
|
|
866
|
+
});
|
|
867
|
+
};
|
|
858
868
|
var postApiV1Embeddings = (options) => {
|
|
859
869
|
return (options.client ?? client).post({
|
|
860
870
|
url: "/api/v1/embeddings",
|
|
@@ -891,6 +901,36 @@ var postApiV1Search = (options) => {
|
|
|
891
901
|
}
|
|
892
902
|
});
|
|
893
903
|
};
|
|
904
|
+
var postAuthOauthByProviderExchange = (options) => {
|
|
905
|
+
return (options.client ?? client).post({
|
|
906
|
+
url: "/auth/oauth/{provider}/exchange",
|
|
907
|
+
...options,
|
|
908
|
+
headers: {
|
|
909
|
+
"Content-Type": "application/json",
|
|
910
|
+
...options.headers
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
};
|
|
914
|
+
var postAuthOauthByProviderRefresh = (options) => {
|
|
915
|
+
return (options.client ?? client).post({
|
|
916
|
+
url: "/auth/oauth/{provider}/refresh",
|
|
917
|
+
...options,
|
|
918
|
+
headers: {
|
|
919
|
+
"Content-Type": "application/json",
|
|
920
|
+
...options.headers
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
};
|
|
924
|
+
var postAuthOauthByProviderRevoke = (options) => {
|
|
925
|
+
return (options.client ?? client).post({
|
|
926
|
+
url: "/auth/oauth/{provider}/revoke",
|
|
927
|
+
...options,
|
|
928
|
+
headers: {
|
|
929
|
+
"Content-Type": "application/json",
|
|
930
|
+
...options.headers
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
};
|
|
894
934
|
var getHealth = (options) => {
|
|
895
935
|
return (options?.client ?? client).get({
|
|
896
936
|
url: "/health",
|
|
@@ -899,10 +939,14 @@ var getHealth = (options) => {
|
|
|
899
939
|
};
|
|
900
940
|
// Annotate the CommonJS export names for ESM import in node:
|
|
901
941
|
0 && (module.exports = {
|
|
942
|
+
getApiV1DocsSwaggerJson,
|
|
902
943
|
getApiV1Models,
|
|
903
944
|
getHealth,
|
|
904
945
|
postApiV1ChatCompletions,
|
|
905
946
|
postApiV1Embeddings,
|
|
906
947
|
postApiV1ImagesGenerations,
|
|
907
|
-
postApiV1Search
|
|
948
|
+
postApiV1Search,
|
|
949
|
+
postAuthOauthByProviderExchange,
|
|
950
|
+
postAuthOauthByProviderRefresh,
|
|
951
|
+
postAuthOauthByProviderRevoke
|
|
908
952
|
});
|