@anuma/sdk 1.1.0 → 1.1.2
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/client/index.cjs +52 -0
- package/dist/client/index.d.mts +190 -1
- package/dist/client/index.d.ts +190 -1
- package/dist/client/index.mjs +46 -0
- package/dist/expo/{chunk-PUKP5H4F.mjs → chunk-3RXNQBS3.mjs} +7 -2
- package/dist/expo/index.cjs +109 -50
- package/dist/expo/index.d.mts +10 -1
- package/dist/expo/index.d.ts +10 -1
- package/dist/expo/index.mjs +74 -18
- package/dist/expo/{recall-YRWAAU6K.mjs → recall-GJ6RNZMF.mjs} +1 -1
- package/dist/react/{chunk-Q2ANFWEP.mjs → chunk-IMUF4U55.mjs} +62 -2
- package/dist/react/index.cjs +220 -104
- package/dist/react/index.d.mts +26 -2
- package/dist/react/index.d.ts +26 -2
- package/dist/react/index.mjs +126 -66
- package/dist/react/{recall-YBC7YCNC.mjs → recall-NQ6ANFYN.mjs} +1 -1
- package/dist/server/{chunk-HPURS22B.mjs → chunk-G3DC7QBH.mjs} +7 -2
- package/dist/server/index.cjs +76 -24
- package/dist/server/index.d.mts +10 -1
- package/dist/server/index.d.ts +10 -1
- package/dist/server/index.mjs +63 -14
- package/dist/server/{recall-PFYFVYMS.mjs → recall-LFYTTIIY.mjs} +1 -1
- package/package.json +2 -2
package/dist/expo/index.cjs
CHANGED
|
@@ -4033,6 +4033,7 @@ function vaultMemoryToStoredRaw(memory) {
|
|
|
4033
4033
|
eventTimeStart: memory.eventTimeStart ?? null,
|
|
4034
4034
|
eventTimeEnd: memory.eventTimeEnd ?? null,
|
|
4035
4035
|
eventTimeKind: memory.eventTimeKind ?? null,
|
|
4036
|
+
topicsUserManaged: memory.topicsUserManaged ?? false,
|
|
4036
4037
|
createdAt: memory.createdAt,
|
|
4037
4038
|
updatedAt: memory.updatedAt,
|
|
4038
4039
|
isDeleted: memory.isDeleted
|
|
@@ -4214,9 +4215,10 @@ function vaultMemoryRawToStoredRaw(raw) {
|
|
|
4214
4215
|
eventTimeStart: raw.event_time_start ?? null,
|
|
4215
4216
|
eventTimeEnd: raw.event_time_end ?? null,
|
|
4216
4217
|
eventTimeKind: raw.event_time_kind ?? null,
|
|
4218
|
+
// SQLite stores booleans as 0/1, LokiJS as true/false — coerce both.
|
|
4219
|
+
topicsUserManaged: raw.topics_user_managed === true || raw.topics_user_managed === 1,
|
|
4217
4220
|
createdAt: new Date(raw.created_at),
|
|
4218
4221
|
updatedAt: new Date(raw.updated_at),
|
|
4219
|
-
// SQLite stores booleans as 0/1, LokiJS as true/false — coerce both.
|
|
4220
4222
|
isDeleted: raw.is_deleted === true || raw.is_deleted === 1
|
|
4221
4223
|
};
|
|
4222
4224
|
}
|
|
@@ -4300,6 +4302,9 @@ async function updateVaultMemoryOp(ctx, id, opts) {
|
|
|
4300
4302
|
r._setRaw("event_time_end", opts.eventTime.end ?? null);
|
|
4301
4303
|
r._setRaw("event_time_kind", opts.eventTime.kind ?? null);
|
|
4302
4304
|
}
|
|
4305
|
+
if (opts.topicsUserManaged !== void 0) {
|
|
4306
|
+
r._setRaw("topics_user_managed", opts.topicsUserManaged);
|
|
4307
|
+
}
|
|
4303
4308
|
if (opts.preserveUpdatedAt) {
|
|
4304
4309
|
r._setRaw("updated_at", originalUpdatedAt);
|
|
4305
4310
|
}
|
|
@@ -10904,6 +10909,13 @@ function assembleMessagesWithHistory(historyMessages, callerMessages, summarySys
|
|
|
10904
10909
|
];
|
|
10905
10910
|
}
|
|
10906
10911
|
|
|
10912
|
+
// src/lib/chat/imageParts.ts
|
|
10913
|
+
function isSendableImageURL(url) {
|
|
10914
|
+
if (!url) return false;
|
|
10915
|
+
const lower = url.toLowerCase();
|
|
10916
|
+
return lower.startsWith("http://") || lower.startsWith("https://") || lower.startsWith("data:image/");
|
|
10917
|
+
}
|
|
10918
|
+
|
|
10907
10919
|
// src/lib/chat/sources.ts
|
|
10908
10920
|
function extractSourcesFromToolCallEvents(toolCallEvents) {
|
|
10909
10921
|
try {
|
|
@@ -12135,6 +12147,9 @@ __decorateClass([
|
|
|
12135
12147
|
__decorateClass([
|
|
12136
12148
|
(0, import_decorators3.field)("event_time_kind")
|
|
12137
12149
|
], VaultMemory.prototype, "eventTimeKind", 2);
|
|
12150
|
+
__decorateClass([
|
|
12151
|
+
(0, import_decorators3.field)("topics_user_managed")
|
|
12152
|
+
], VaultMemory.prototype, "topicsUserManaged", 2);
|
|
12138
12153
|
__decorateClass([
|
|
12139
12154
|
import_decorators3.readonly,
|
|
12140
12155
|
(0, import_decorators3.date)("created_at")
|
|
@@ -12493,6 +12508,7 @@ var WalletPoller = class {
|
|
|
12493
12508
|
init_logger();
|
|
12494
12509
|
|
|
12495
12510
|
// src/lib/memory/autoExtract.ts
|
|
12511
|
+
var import_watermelondb10 = require("@nozbe/watermelondb");
|
|
12496
12512
|
init_operations2();
|
|
12497
12513
|
init_types3();
|
|
12498
12514
|
init_logger();
|
|
@@ -12550,12 +12566,15 @@ async function retain(content, ctx, options = {}) {
|
|
|
12550
12566
|
preserveUpdatedAt: true,
|
|
12551
12567
|
...eventTimeUpdate && { eventTime: eventTimeUpdate }
|
|
12552
12568
|
});
|
|
12553
|
-
|
|
12554
|
-
|
|
12555
|
-
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
|
|
12569
|
+
if (updated) {
|
|
12570
|
+
return {
|
|
12571
|
+
action: "merge",
|
|
12572
|
+
memoryId: targetId,
|
|
12573
|
+
targetId,
|
|
12574
|
+
proofCount: updated.proofCount ?? (existing.proofCount ?? 1) + 1
|
|
12575
|
+
};
|
|
12576
|
+
}
|
|
12577
|
+
await assertMergeTargetGoneOrThrow(ctx, targetId);
|
|
12559
12578
|
}
|
|
12560
12579
|
}
|
|
12561
12580
|
}
|
|
@@ -12638,11 +12657,15 @@ async function tryConsolidate(trimmed, ctx, options) {
|
|
|
12638
12657
|
preserveUpdatedAt: true,
|
|
12639
12658
|
...eventTimeUpdate && { eventTime: eventTimeUpdate }
|
|
12640
12659
|
});
|
|
12660
|
+
if (!updated) {
|
|
12661
|
+
await assertMergeTargetGoneOrThrow(ctx, decision.targetId);
|
|
12662
|
+
return null;
|
|
12663
|
+
}
|
|
12641
12664
|
return {
|
|
12642
12665
|
action: "merge",
|
|
12643
12666
|
memoryId: decision.targetId,
|
|
12644
12667
|
targetId: decision.targetId,
|
|
12645
|
-
proofCount: updated
|
|
12668
|
+
proofCount: updated.proofCount ?? (existing.proofCount ?? 1) + 1
|
|
12646
12669
|
};
|
|
12647
12670
|
}
|
|
12648
12671
|
if (decision.action === "update" && decision.targetId && decision.content) {
|
|
@@ -12669,17 +12692,35 @@ async function tryConsolidate(trimmed, ctx, options) {
|
|
|
12669
12692
|
preserveUpdatedAt: true,
|
|
12670
12693
|
...eventTimeUpdate && { eventTime: eventTimeUpdate }
|
|
12671
12694
|
});
|
|
12695
|
+
if (!updated) {
|
|
12696
|
+
await assertMergeTargetGoneOrThrow(ctx, decision.targetId);
|
|
12697
|
+
return null;
|
|
12698
|
+
}
|
|
12672
12699
|
return {
|
|
12673
12700
|
action: "update",
|
|
12674
12701
|
memoryId: decision.targetId,
|
|
12675
12702
|
targetId: decision.targetId,
|
|
12676
|
-
proofCount: updated
|
|
12703
|
+
proofCount: updated.proofCount ?? (existing.proofCount ?? 1) + 1
|
|
12677
12704
|
};
|
|
12678
12705
|
}
|
|
12679
12706
|
return null;
|
|
12680
12707
|
}
|
|
12708
|
+
async function assertMergeTargetGoneOrThrow(ctx, targetId) {
|
|
12709
|
+
const stillExists = await getVaultMemoryOp(ctx.vaultCtx, targetId);
|
|
12710
|
+
if (stillExists) {
|
|
12711
|
+
throw new Error(`retain: merge into memory ${targetId} failed to persist`);
|
|
12712
|
+
}
|
|
12713
|
+
}
|
|
12681
12714
|
|
|
12682
12715
|
// src/lib/memory/autoExtract.ts
|
|
12716
|
+
async function isMemoryTopicsUserManaged(ctx, memoryId) {
|
|
12717
|
+
try {
|
|
12718
|
+
const rows = await ctx.database.get(VaultMemory.table).query(import_watermelondb10.Q.where("id", memoryId)).fetch();
|
|
12719
|
+
return rows[0]?.topicsUserManaged === true;
|
|
12720
|
+
} catch {
|
|
12721
|
+
return true;
|
|
12722
|
+
}
|
|
12723
|
+
}
|
|
12683
12724
|
var DEFAULT_MODEL3 = "gpt-oss/gpt-oss-120b";
|
|
12684
12725
|
var DEFAULT_MIN_CONFIDENCE = 0.7;
|
|
12685
12726
|
var MAX_CONTENT_LENGTH = 200;
|
|
@@ -12838,7 +12879,9 @@ async function extractAndRetain(messages, retainCtx, options) {
|
|
|
12838
12879
|
results.push(result);
|
|
12839
12880
|
if (options.entityCtx && candidate.entities.length > 0) {
|
|
12840
12881
|
try {
|
|
12841
|
-
await
|
|
12882
|
+
if (!await isMemoryTopicsUserManaged(options.entityCtx, result.memoryId)) {
|
|
12883
|
+
await linkMemoryEntitiesOp(options.entityCtx, result.memoryId, candidate.entities);
|
|
12884
|
+
}
|
|
12842
12885
|
} catch (err) {
|
|
12843
12886
|
log.warn("[memory/extract] linkMemoryEntitiesOp failed", err);
|
|
12844
12887
|
}
|
|
@@ -14266,7 +14309,7 @@ function storedToLlmapiMessage(stored) {
|
|
|
14266
14309
|
const content = [{ type: "text", text: stored.content }];
|
|
14267
14310
|
if (stored.role !== "assistant" && stored.files?.length) {
|
|
14268
14311
|
for (const file of stored.files) {
|
|
14269
|
-
if (file.url) {
|
|
14312
|
+
if (isSendableImageURL(file.url)) {
|
|
14270
14313
|
content.push({
|
|
14271
14314
|
type: "image_url",
|
|
14272
14315
|
image_url: { url: file.url }
|
|
@@ -15690,13 +15733,13 @@ init_redactor();
|
|
|
15690
15733
|
init_useEncryption();
|
|
15691
15734
|
|
|
15692
15735
|
// src/lib/db/schema.ts
|
|
15693
|
-
var
|
|
15736
|
+
var import_watermelondb18 = require("@nozbe/watermelondb");
|
|
15694
15737
|
var import_migrations2 = require("@nozbe/watermelondb/Schema/migrations");
|
|
15695
15738
|
|
|
15696
15739
|
// src/lib/db/appFiles/models.ts
|
|
15697
|
-
var
|
|
15740
|
+
var import_watermelondb11 = require("@nozbe/watermelondb");
|
|
15698
15741
|
var import_decorators4 = require("@nozbe/watermelondb/decorators");
|
|
15699
|
-
var AppFile = class extends
|
|
15742
|
+
var AppFile = class extends import_watermelondb11.Model {
|
|
15700
15743
|
};
|
|
15701
15744
|
AppFile.table = "app_files";
|
|
15702
15745
|
AppFile.associations = {};
|
|
@@ -15718,9 +15761,9 @@ __decorateClass([
|
|
|
15718
15761
|
], AppFile.prototype, "updatedAt", 2);
|
|
15719
15762
|
|
|
15720
15763
|
// src/lib/db/entities/models.ts
|
|
15721
|
-
var
|
|
15764
|
+
var import_watermelondb12 = require("@nozbe/watermelondb");
|
|
15722
15765
|
var import_decorators5 = require("@nozbe/watermelondb/decorators");
|
|
15723
|
-
var Entity = class extends
|
|
15766
|
+
var Entity = class extends import_watermelondb12.Model {
|
|
15724
15767
|
};
|
|
15725
15768
|
Entity.table = "entity";
|
|
15726
15769
|
__decorateClass([
|
|
@@ -15736,7 +15779,7 @@ __decorateClass([
|
|
|
15736
15779
|
__decorateClass([
|
|
15737
15780
|
(0, import_decorators5.date)("updated_at")
|
|
15738
15781
|
], Entity.prototype, "updatedAt", 2);
|
|
15739
|
-
var MemoryEntity = class extends
|
|
15782
|
+
var MemoryEntity = class extends import_watermelondb12.Model {
|
|
15740
15783
|
};
|
|
15741
15784
|
MemoryEntity.table = "memory_entity";
|
|
15742
15785
|
__decorateClass([
|
|
@@ -15754,9 +15797,9 @@ __decorateClass([
|
|
|
15754
15797
|
], MemoryEntity.prototype, "createdAt", 2);
|
|
15755
15798
|
|
|
15756
15799
|
// src/lib/db/project/models.ts
|
|
15757
|
-
var
|
|
15800
|
+
var import_watermelondb13 = require("@nozbe/watermelondb");
|
|
15758
15801
|
var import_decorators6 = require("@nozbe/watermelondb/decorators");
|
|
15759
|
-
var Project = class extends
|
|
15802
|
+
var Project = class extends import_watermelondb13.Model {
|
|
15760
15803
|
};
|
|
15761
15804
|
Project.table = "projects";
|
|
15762
15805
|
Project.associations = {
|
|
@@ -15779,10 +15822,10 @@ __decorateClass([
|
|
|
15779
15822
|
], Project.prototype, "isDeleted", 2);
|
|
15780
15823
|
|
|
15781
15824
|
// src/lib/db/savedTools/models.ts
|
|
15782
|
-
var
|
|
15825
|
+
var import_watermelondb14 = require("@nozbe/watermelondb");
|
|
15783
15826
|
var import_decorators7 = require("@nozbe/watermelondb/decorators");
|
|
15784
15827
|
var sanitizeParameters = (raw) => raw ?? {};
|
|
15785
|
-
var SavedTool = class extends
|
|
15828
|
+
var SavedTool = class extends import_watermelondb14.Model {
|
|
15786
15829
|
};
|
|
15787
15830
|
SavedTool.table = "saved_tools";
|
|
15788
15831
|
SavedTool.associations = {};
|
|
@@ -15816,9 +15859,9 @@ __decorateClass([
|
|
|
15816
15859
|
], SavedTool.prototype, "isDeleted", 2);
|
|
15817
15860
|
|
|
15818
15861
|
// src/lib/db/settings/models.ts
|
|
15819
|
-
var
|
|
15862
|
+
var import_watermelondb15 = require("@nozbe/watermelondb");
|
|
15820
15863
|
var import_decorators8 = require("@nozbe/watermelondb/decorators");
|
|
15821
|
-
var ModelPreference = class extends
|
|
15864
|
+
var ModelPreference = class extends import_watermelondb15.Model {
|
|
15822
15865
|
};
|
|
15823
15866
|
ModelPreference.table = "modelPreferences";
|
|
15824
15867
|
__decorateClass([
|
|
@@ -15829,9 +15872,9 @@ __decorateClass([
|
|
|
15829
15872
|
], ModelPreference.prototype, "models", 2);
|
|
15830
15873
|
|
|
15831
15874
|
// src/lib/db/userPreferences/models.ts
|
|
15832
|
-
var
|
|
15875
|
+
var import_watermelondb16 = require("@nozbe/watermelondb");
|
|
15833
15876
|
var import_decorators9 = require("@nozbe/watermelondb/decorators");
|
|
15834
|
-
var UserPreference = class extends
|
|
15877
|
+
var UserPreference = class extends import_watermelondb16.Model {
|
|
15835
15878
|
};
|
|
15836
15879
|
UserPreference.table = "userPreferences";
|
|
15837
15880
|
__decorateClass([
|
|
@@ -15860,9 +15903,9 @@ __decorateClass([
|
|
|
15860
15903
|
], UserPreference.prototype, "updatedAt", 2);
|
|
15861
15904
|
|
|
15862
15905
|
// src/lib/db/vaultFolders/models.ts
|
|
15863
|
-
var
|
|
15906
|
+
var import_watermelondb17 = require("@nozbe/watermelondb");
|
|
15864
15907
|
var import_decorators10 = require("@nozbe/watermelondb/decorators");
|
|
15865
|
-
var VaultFolder = class extends
|
|
15908
|
+
var VaultFolder = class extends import_watermelondb17.Model {
|
|
15866
15909
|
};
|
|
15867
15910
|
VaultFolder.table = "vault_folders";
|
|
15868
15911
|
__decorateClass([
|
|
@@ -15889,12 +15932,12 @@ __decorateClass([
|
|
|
15889
15932
|
], VaultFolder.prototype, "context", 2);
|
|
15890
15933
|
|
|
15891
15934
|
// src/lib/db/schema.ts
|
|
15892
|
-
var SDK_SCHEMA_VERSION =
|
|
15893
|
-
var sdkSchema = (0,
|
|
15935
|
+
var SDK_SCHEMA_VERSION = 34;
|
|
15936
|
+
var sdkSchema = (0, import_watermelondb18.appSchema)({
|
|
15894
15937
|
version: SDK_SCHEMA_VERSION,
|
|
15895
15938
|
tables: [
|
|
15896
15939
|
// Chat storage tables
|
|
15897
|
-
(0,
|
|
15940
|
+
(0, import_watermelondb18.tableSchema)({
|
|
15898
15941
|
name: "history",
|
|
15899
15942
|
columns: [
|
|
15900
15943
|
{ name: "message_id", type: "number" },
|
|
@@ -15931,7 +15974,7 @@ var sdkSchema = (0, import_watermelondb17.appSchema)({
|
|
|
15931
15974
|
// JSON stringified LlmapiToolCallEvent[]
|
|
15932
15975
|
]
|
|
15933
15976
|
}),
|
|
15934
|
-
(0,
|
|
15977
|
+
(0, import_watermelondb18.tableSchema)({
|
|
15935
15978
|
name: "conversations",
|
|
15936
15979
|
columns: [
|
|
15937
15980
|
{ name: "conversation_id", type: "string", isIndexed: true },
|
|
@@ -15944,7 +15987,7 @@ var sdkSchema = (0, import_watermelondb17.appSchema)({
|
|
|
15944
15987
|
]
|
|
15945
15988
|
}),
|
|
15946
15989
|
// Project storage table
|
|
15947
|
-
(0,
|
|
15990
|
+
(0, import_watermelondb18.tableSchema)({
|
|
15948
15991
|
name: "projects",
|
|
15949
15992
|
columns: [
|
|
15950
15993
|
{ name: "project_id", type: "string", isIndexed: true },
|
|
@@ -15955,7 +15998,7 @@ var sdkSchema = (0, import_watermelondb17.appSchema)({
|
|
|
15955
15998
|
]
|
|
15956
15999
|
}),
|
|
15957
16000
|
// Settings storage tables (deprecated - use userPreferences)
|
|
15958
|
-
(0,
|
|
16001
|
+
(0, import_watermelondb18.tableSchema)({
|
|
15959
16002
|
name: "modelPreferences",
|
|
15960
16003
|
columns: [
|
|
15961
16004
|
{ name: "wallet_address", type: "string", isIndexed: true },
|
|
@@ -15963,7 +16006,7 @@ var sdkSchema = (0, import_watermelondb17.appSchema)({
|
|
|
15963
16006
|
]
|
|
15964
16007
|
}),
|
|
15965
16008
|
// Unified user preferences storage
|
|
15966
|
-
(0,
|
|
16009
|
+
(0, import_watermelondb18.tableSchema)({
|
|
15967
16010
|
name: "userPreferences",
|
|
15968
16011
|
columns: [
|
|
15969
16012
|
// Identity
|
|
@@ -15982,7 +16025,7 @@ var sdkSchema = (0, import_watermelondb17.appSchema)({
|
|
|
15982
16025
|
]
|
|
15983
16026
|
}),
|
|
15984
16027
|
// Memory vault storage
|
|
15985
|
-
(0,
|
|
16028
|
+
(0, import_watermelondb18.tableSchema)({
|
|
15986
16029
|
name: "memory_vault",
|
|
15987
16030
|
columns: [
|
|
15988
16031
|
{ name: "content", type: "string" },
|
|
@@ -16006,11 +16049,15 @@ var sdkSchema = (0, import_watermelondb17.appSchema)({
|
|
|
16006
16049
|
// (start set, end null + kind='ongoing'), or none (both null).
|
|
16007
16050
|
{ name: "event_time_start", type: "number", isOptional: true, isIndexed: true },
|
|
16008
16051
|
{ name: "event_time_end", type: "number", isOptional: true },
|
|
16009
|
-
{ name: "event_time_kind", type: "string", isOptional: true }
|
|
16052
|
+
{ name: "event_time_kind", type: "string", isOptional: true },
|
|
16053
|
+
// When true, the user has manually set this memory's topics (entity
|
|
16054
|
+
// links). Auto-extraction then leaves its links alone — the user owns
|
|
16055
|
+
// them. Null/false = topics are auto-derived (default).
|
|
16056
|
+
{ name: "topics_user_managed", type: "boolean", isOptional: true }
|
|
16010
16057
|
]
|
|
16011
16058
|
}),
|
|
16012
16059
|
// Entity table — canonical names extracted from auto-extraction (W5).
|
|
16013
|
-
(0,
|
|
16060
|
+
(0, import_watermelondb18.tableSchema)({
|
|
16014
16061
|
name: "entity",
|
|
16015
16062
|
columns: [
|
|
16016
16063
|
{ name: "canonical_name", type: "string", isIndexed: true },
|
|
@@ -16020,7 +16067,7 @@ var sdkSchema = (0, import_watermelondb17.appSchema)({
|
|
|
16020
16067
|
]
|
|
16021
16068
|
}),
|
|
16022
16069
|
// Many-to-many join: which memories reference which entities.
|
|
16023
|
-
(0,
|
|
16070
|
+
(0, import_watermelondb18.tableSchema)({
|
|
16024
16071
|
name: "memory_entity",
|
|
16025
16072
|
columns: [
|
|
16026
16073
|
{ name: "memory_id", type: "string", isIndexed: true },
|
|
@@ -16030,7 +16077,7 @@ var sdkSchema = (0, import_watermelondb17.appSchema)({
|
|
|
16030
16077
|
]
|
|
16031
16078
|
}),
|
|
16032
16079
|
// Vault folder organization
|
|
16033
|
-
(0,
|
|
16080
|
+
(0, import_watermelondb18.tableSchema)({
|
|
16034
16081
|
name: "vault_folders",
|
|
16035
16082
|
columns: [
|
|
16036
16083
|
{ name: "name", type: "string" },
|
|
@@ -16043,7 +16090,7 @@ var sdkSchema = (0, import_watermelondb17.appSchema)({
|
|
|
16043
16090
|
]
|
|
16044
16091
|
}),
|
|
16045
16092
|
// Conversation summary cache for progressive history summarization
|
|
16046
|
-
(0,
|
|
16093
|
+
(0, import_watermelondb18.tableSchema)({
|
|
16047
16094
|
name: "conversation_summaries",
|
|
16048
16095
|
columns: [
|
|
16049
16096
|
{ name: "conversation_id", type: "string", isIndexed: true },
|
|
@@ -16056,7 +16103,7 @@ var sdkSchema = (0, import_watermelondb17.appSchema)({
|
|
|
16056
16103
|
]
|
|
16057
16104
|
}),
|
|
16058
16105
|
// Media library storage (images, videos, audio, documents)
|
|
16059
|
-
(0,
|
|
16106
|
+
(0, import_watermelondb18.tableSchema)({
|
|
16060
16107
|
name: "media",
|
|
16061
16108
|
columns: [
|
|
16062
16109
|
// Identity
|
|
@@ -16092,7 +16139,7 @@ var sdkSchema = (0, import_watermelondb17.appSchema)({
|
|
|
16092
16139
|
]
|
|
16093
16140
|
}),
|
|
16094
16141
|
// ── App files ─────────────────────────────────────────────────────────
|
|
16095
|
-
(0,
|
|
16142
|
+
(0, import_watermelondb18.tableSchema)({
|
|
16096
16143
|
name: "app_files",
|
|
16097
16144
|
columns: [
|
|
16098
16145
|
{ name: "conversation_id", type: "string", isIndexed: true },
|
|
@@ -16103,7 +16150,7 @@ var sdkSchema = (0, import_watermelondb17.appSchema)({
|
|
|
16103
16150
|
]
|
|
16104
16151
|
}),
|
|
16105
16152
|
// ── Saved tools ──────────────────────────────────────────────────────
|
|
16106
|
-
(0,
|
|
16153
|
+
(0, import_watermelondb18.tableSchema)({
|
|
16107
16154
|
name: "saved_tools",
|
|
16108
16155
|
columns: [
|
|
16109
16156
|
{ name: "name", type: "string" },
|
|
@@ -16565,6 +16612,18 @@ var sdkMigrations = (0, import_migrations2.schemaMigrations)({
|
|
|
16565
16612
|
columns: [{ name: "embedding_model", type: "string", isOptional: true }]
|
|
16566
16613
|
})
|
|
16567
16614
|
]
|
|
16615
|
+
},
|
|
16616
|
+
// v33 -> v34: user-managed topics. `topics_user_managed` marks a memory
|
|
16617
|
+
// whose entity links the user has taken manual control of, so
|
|
16618
|
+
// auto-extraction stops touching them.
|
|
16619
|
+
{
|
|
16620
|
+
toVersion: 34,
|
|
16621
|
+
steps: [
|
|
16622
|
+
(0, import_migrations2.addColumns)({
|
|
16623
|
+
table: "memory_vault",
|
|
16624
|
+
columns: [{ name: "topics_user_managed", type: "boolean", isOptional: true }]
|
|
16625
|
+
})
|
|
16626
|
+
]
|
|
16568
16627
|
}
|
|
16569
16628
|
]
|
|
16570
16629
|
});
|
|
@@ -16585,7 +16644,7 @@ var sdkModelClasses = [
|
|
|
16585
16644
|
];
|
|
16586
16645
|
|
|
16587
16646
|
// src/lib/db/manager.ts
|
|
16588
|
-
var
|
|
16647
|
+
var import_watermelondb19 = require("@nozbe/watermelondb");
|
|
16589
16648
|
var DESTRUCTIVE_MIGRATION_VERSION = 8;
|
|
16590
16649
|
var webPlatformStorage = {
|
|
16591
16650
|
getItem: (key) => localStorage.getItem(key),
|
|
@@ -16663,7 +16722,7 @@ var DatabaseManager = class {
|
|
|
16663
16722
|
walletAddress
|
|
16664
16723
|
});
|
|
16665
16724
|
const adapter = this.createAdapter(dbName, sdkSchema, sdkMigrations);
|
|
16666
|
-
this.database = new
|
|
16725
|
+
this.database = new import_watermelondb19.Database({
|
|
16667
16726
|
adapter,
|
|
16668
16727
|
modelClasses: sdkModelClasses
|
|
16669
16728
|
});
|
|
@@ -16733,7 +16792,7 @@ var DatabaseManager = class {
|
|
|
16733
16792
|
};
|
|
16734
16793
|
|
|
16735
16794
|
// src/lib/db/vaultFolders/operations.ts
|
|
16736
|
-
var
|
|
16795
|
+
var import_watermelondb20 = require("@nozbe/watermelondb");
|
|
16737
16796
|
function folderToStored(folder) {
|
|
16738
16797
|
return {
|
|
16739
16798
|
uniqueId: folder.id,
|
|
@@ -16758,7 +16817,7 @@ async function createVaultFolderOp(ctx, opts) {
|
|
|
16758
16817
|
return folderToStored(created);
|
|
16759
16818
|
}
|
|
16760
16819
|
async function getAllVaultFoldersOp(ctx) {
|
|
16761
|
-
const results = await ctx.vaultFolderCollection.query(
|
|
16820
|
+
const results = await ctx.vaultFolderCollection.query(import_watermelondb20.Q.where("is_deleted", false), import_watermelondb20.Q.sortBy("created_at", import_watermelondb20.Q.desc)).fetch();
|
|
16762
16821
|
return results.map(folderToStored);
|
|
16763
16822
|
}
|
|
16764
16823
|
async function updateVaultFolderOp(ctx, id, opts) {
|
|
@@ -16775,7 +16834,7 @@ async function updateVaultFolderOp(ctx, id, opts) {
|
|
|
16775
16834
|
})
|
|
16776
16835
|
);
|
|
16777
16836
|
if (scopeChanged) {
|
|
16778
|
-
const memories = await ctx.vaultMemoryCollection.query(
|
|
16837
|
+
const memories = await ctx.vaultMemoryCollection.query(import_watermelondb20.Q.where("folder_id", id), import_watermelondb20.Q.where("is_deleted", false)).fetch();
|
|
16779
16838
|
for (const memory of memories) {
|
|
16780
16839
|
updates.push(
|
|
16781
16840
|
memory.prepareUpdate((r) => {
|
|
@@ -16797,7 +16856,7 @@ async function deleteVaultFolderOp(ctx, id) {
|
|
|
16797
16856
|
const record = await ctx.vaultFolderCollection.find(id);
|
|
16798
16857
|
if (record.isDeleted) return false;
|
|
16799
16858
|
await ctx.database.write(async () => {
|
|
16800
|
-
const memories = await ctx.vaultMemoryCollection.query(
|
|
16859
|
+
const memories = await ctx.vaultMemoryCollection.query(import_watermelondb20.Q.where("folder_id", id), import_watermelondb20.Q.where("is_deleted", false)).fetch();
|
|
16801
16860
|
const preparedMemories = memories.map(
|
|
16802
16861
|
(memory) => memory.prepareUpdate((r) => {
|
|
16803
16862
|
r._setRaw("folder_id", null);
|
|
@@ -16866,7 +16925,7 @@ async function updateVaultFolderContextOp(ctx, id, context) {
|
|
|
16866
16925
|
}
|
|
16867
16926
|
}
|
|
16868
16927
|
async function getVaultFolderMemoryCountOp(ctx, folderId) {
|
|
16869
|
-
return await ctx.vaultMemoryCollection.query(
|
|
16928
|
+
return await ctx.vaultMemoryCollection.query(import_watermelondb20.Q.where("folder_id", folderId), import_watermelondb20.Q.where("is_deleted", false)).fetchCount();
|
|
16870
16929
|
}
|
|
16871
16930
|
|
|
16872
16931
|
// src/lib/db/vaultFolders/defaults.ts
|
package/dist/expo/index.d.mts
CHANGED
|
@@ -4279,6 +4279,9 @@ declare class VaultMemory extends Model {
|
|
|
4279
4279
|
eventTimeEnd: number | null;
|
|
4280
4280
|
/** W6 temporal lane — `point | range | ongoing | null`. */
|
|
4281
4281
|
eventTimeKind: string | null;
|
|
4282
|
+
/** When true, the user has manually set this memory's topics; auto-extraction
|
|
4283
|
+
* leaves its entity links alone. Null on legacy rows (treated as false). */
|
|
4284
|
+
topicsUserManaged: boolean | null;
|
|
4282
4285
|
createdAt: Date;
|
|
4283
4286
|
updatedAt: Date;
|
|
4284
4287
|
isDeleted: boolean;
|
|
@@ -4379,6 +4382,9 @@ interface StoredVaultMemory {
|
|
|
4379
4382
|
eventTimeEnd: number | null;
|
|
4380
4383
|
/** W6 temporal lane — `point | range | ongoing | null`. */
|
|
4381
4384
|
eventTimeKind: string | null;
|
|
4385
|
+
/** When true, the user has manually set this memory's topics (entity links);
|
|
4386
|
+
* auto-extraction leaves them alone. False on legacy/auto rows. */
|
|
4387
|
+
topicsUserManaged: boolean;
|
|
4382
4388
|
createdAt: Date;
|
|
4383
4389
|
updatedAt: Date;
|
|
4384
4390
|
isDeleted: boolean;
|
|
@@ -4452,6 +4458,9 @@ interface UpdateVaultMemoryOptions {
|
|
|
4452
4458
|
* without inflating recency on top.
|
|
4453
4459
|
*/
|
|
4454
4460
|
preserveUpdatedAt?: boolean;
|
|
4461
|
+
/** If provided, sets whether the user has taken manual control of this
|
|
4462
|
+
* memory's topics. Set by {@link setMemoryEntitiesOp}. */
|
|
4463
|
+
topicsUserManaged?: boolean;
|
|
4455
4464
|
}
|
|
4456
4465
|
|
|
4457
4466
|
interface VaultMemoryOperationsContext {
|
|
@@ -6330,7 +6339,7 @@ declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageR
|
|
|
6330
6339
|
* detectable and re-embeddable after an embedding-model change (null = legacy
|
|
6331
6340
|
* rows, grandfathered as compatible with the current model)
|
|
6332
6341
|
*/
|
|
6333
|
-
declare const SDK_SCHEMA_VERSION =
|
|
6342
|
+
declare const SDK_SCHEMA_VERSION = 34;
|
|
6334
6343
|
/**
|
|
6335
6344
|
* Combined WatermelonDB schema for all SDK storage modules.
|
|
6336
6345
|
*
|
package/dist/expo/index.d.ts
CHANGED
|
@@ -4279,6 +4279,9 @@ declare class VaultMemory extends Model {
|
|
|
4279
4279
|
eventTimeEnd: number | null;
|
|
4280
4280
|
/** W6 temporal lane — `point | range | ongoing | null`. */
|
|
4281
4281
|
eventTimeKind: string | null;
|
|
4282
|
+
/** When true, the user has manually set this memory's topics; auto-extraction
|
|
4283
|
+
* leaves its entity links alone. Null on legacy rows (treated as false). */
|
|
4284
|
+
topicsUserManaged: boolean | null;
|
|
4282
4285
|
createdAt: Date;
|
|
4283
4286
|
updatedAt: Date;
|
|
4284
4287
|
isDeleted: boolean;
|
|
@@ -4379,6 +4382,9 @@ interface StoredVaultMemory {
|
|
|
4379
4382
|
eventTimeEnd: number | null;
|
|
4380
4383
|
/** W6 temporal lane — `point | range | ongoing | null`. */
|
|
4381
4384
|
eventTimeKind: string | null;
|
|
4385
|
+
/** When true, the user has manually set this memory's topics (entity links);
|
|
4386
|
+
* auto-extraction leaves them alone. False on legacy/auto rows. */
|
|
4387
|
+
topicsUserManaged: boolean;
|
|
4382
4388
|
createdAt: Date;
|
|
4383
4389
|
updatedAt: Date;
|
|
4384
4390
|
isDeleted: boolean;
|
|
@@ -4452,6 +4458,9 @@ interface UpdateVaultMemoryOptions {
|
|
|
4452
4458
|
* without inflating recency on top.
|
|
4453
4459
|
*/
|
|
4454
4460
|
preserveUpdatedAt?: boolean;
|
|
4461
|
+
/** If provided, sets whether the user has taken manual control of this
|
|
4462
|
+
* memory's topics. Set by {@link setMemoryEntitiesOp}. */
|
|
4463
|
+
topicsUserManaged?: boolean;
|
|
4455
4464
|
}
|
|
4456
4465
|
|
|
4457
4466
|
interface VaultMemoryOperationsContext {
|
|
@@ -6330,7 +6339,7 @@ declare function useChatStorage(options: UseChatStorageOptions): UseChatStorageR
|
|
|
6330
6339
|
* detectable and re-embeddable after an embedding-model change (null = legacy
|
|
6331
6340
|
* rows, grandfathered as compatible with the current model)
|
|
6332
6341
|
*/
|
|
6333
|
-
declare const SDK_SCHEMA_VERSION =
|
|
6342
|
+
declare const SDK_SCHEMA_VERSION = 34;
|
|
6334
6343
|
/**
|
|
6335
6344
|
* Combined WatermelonDB schema for all SDK storage modules.
|
|
6336
6345
|
*
|