@anuma/sdk 1.1.0 → 1.1.1
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/{chunk-PUKP5H4F.mjs → chunk-3HZFU3PV.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-MCB3TVBW.mjs} +1 -1
- package/dist/react/{chunk-Q2ANFWEP.mjs → chunk-ELDXIXRE.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-CSOMIT4H.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 +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -4311,6 +4311,7 @@ function vaultMemoryToStoredRaw(memory) {
|
|
|
4311
4311
|
eventTimeStart: memory.eventTimeStart ?? null,
|
|
4312
4312
|
eventTimeEnd: memory.eventTimeEnd ?? null,
|
|
4313
4313
|
eventTimeKind: memory.eventTimeKind ?? null,
|
|
4314
|
+
topicsUserManaged: memory.topicsUserManaged ?? false,
|
|
4314
4315
|
createdAt: memory.createdAt,
|
|
4315
4316
|
updatedAt: memory.updatedAt,
|
|
4316
4317
|
isDeleted: memory.isDeleted
|
|
@@ -4492,9 +4493,10 @@ function vaultMemoryRawToStoredRaw(raw) {
|
|
|
4492
4493
|
eventTimeStart: raw.event_time_start ?? null,
|
|
4493
4494
|
eventTimeEnd: raw.event_time_end ?? null,
|
|
4494
4495
|
eventTimeKind: raw.event_time_kind ?? null,
|
|
4496
|
+
// SQLite stores booleans as 0/1, LokiJS as true/false — coerce both.
|
|
4497
|
+
topicsUserManaged: raw.topics_user_managed === true || raw.topics_user_managed === 1,
|
|
4495
4498
|
createdAt: new Date(raw.created_at),
|
|
4496
4499
|
updatedAt: new Date(raw.updated_at),
|
|
4497
|
-
// SQLite stores booleans as 0/1, LokiJS as true/false — coerce both.
|
|
4498
4500
|
isDeleted: raw.is_deleted === true || raw.is_deleted === 1
|
|
4499
4501
|
};
|
|
4500
4502
|
}
|
|
@@ -4578,6 +4580,9 @@ async function updateVaultMemoryOp(ctx, id, opts) {
|
|
|
4578
4580
|
r._setRaw("event_time_end", opts.eventTime.end ?? null);
|
|
4579
4581
|
r._setRaw("event_time_kind", opts.eventTime.kind ?? null);
|
|
4580
4582
|
}
|
|
4583
|
+
if (opts.topicsUserManaged !== void 0) {
|
|
4584
|
+
r._setRaw("topics_user_managed", opts.topicsUserManaged);
|
|
4585
|
+
}
|
|
4581
4586
|
if (opts.preserveUpdatedAt) {
|
|
4582
4587
|
r._setRaw("updated_at", originalUpdatedAt);
|
|
4583
4588
|
}
|
|
@@ -4594,6 +4599,59 @@ async function updateVaultMemoryOp(ctx, id, opts) {
|
|
|
4594
4599
|
return null;
|
|
4595
4600
|
}
|
|
4596
4601
|
}
|
|
4602
|
+
async function setMemoryEntitiesOp(ctx, memoryId, entities) {
|
|
4603
|
+
const entityCtx = ctx.entityCtx;
|
|
4604
|
+
if (!entityCtx) {
|
|
4605
|
+
throw new Error("setMemoryEntitiesOp requires ctx.entityCtx (entity collections)");
|
|
4606
|
+
}
|
|
4607
|
+
let record;
|
|
4608
|
+
try {
|
|
4609
|
+
record = await ctx.vaultMemoryCollection.find(memoryId);
|
|
4610
|
+
} catch {
|
|
4611
|
+
return null;
|
|
4612
|
+
}
|
|
4613
|
+
if (record.isDeleted || !isOwnedByCtxUser(ctx, record)) return null;
|
|
4614
|
+
let stale = false;
|
|
4615
|
+
const originalUpdatedAt = record.updatedAt.getTime();
|
|
4616
|
+
await ctx.database.write(async () => {
|
|
4617
|
+
if (record.isDeleted || !isOwnedByCtxUser(ctx, record)) {
|
|
4618
|
+
stale = true;
|
|
4619
|
+
return;
|
|
4620
|
+
}
|
|
4621
|
+
await record.update((r) => {
|
|
4622
|
+
r._setRaw("topics_user_managed", true);
|
|
4623
|
+
r._setRaw("updated_at", originalUpdatedAt);
|
|
4624
|
+
});
|
|
4625
|
+
});
|
|
4626
|
+
if (stale) return null;
|
|
4627
|
+
const linked = entities.length > 0 ? await linkMemoryEntitiesOp(entityCtx, memoryId, entities) : [];
|
|
4628
|
+
const keep = new Set(linked.map((e) => e.uniqueId));
|
|
4629
|
+
const existing = await entityCtx.memoryEntityCollection.query(import_watermelondb10.Q.where("memory_id", memoryId)).fetch();
|
|
4630
|
+
const staleLinks = existing.filter((l) => !keep.has(String(l.entityId)));
|
|
4631
|
+
if (staleLinks.length > 0) {
|
|
4632
|
+
await ctx.database.write(async () => {
|
|
4633
|
+
await ctx.database.batch(...staleLinks.map((l) => l.prepareDestroyPermanently()));
|
|
4634
|
+
});
|
|
4635
|
+
}
|
|
4636
|
+
return vaultMemoryToStored(record, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner);
|
|
4637
|
+
}
|
|
4638
|
+
async function clearMemoryTopicsOverrideOp(ctx, memoryId) {
|
|
4639
|
+
let record;
|
|
4640
|
+
try {
|
|
4641
|
+
record = await ctx.vaultMemoryCollection.find(memoryId);
|
|
4642
|
+
} catch {
|
|
4643
|
+
return false;
|
|
4644
|
+
}
|
|
4645
|
+
if (record.isDeleted || !isOwnedByCtxUser(ctx, record)) return false;
|
|
4646
|
+
const originalUpdatedAt = record.updatedAt.getTime();
|
|
4647
|
+
await ctx.database.write(async () => {
|
|
4648
|
+
await record.update((r) => {
|
|
4649
|
+
r._setRaw("topics_user_managed", false);
|
|
4650
|
+
r._setRaw("updated_at", originalUpdatedAt);
|
|
4651
|
+
});
|
|
4652
|
+
});
|
|
4653
|
+
return true;
|
|
4654
|
+
}
|
|
4597
4655
|
async function deleteVaultMemoryOp(ctx, id) {
|
|
4598
4656
|
try {
|
|
4599
4657
|
const record = await ctx.vaultMemoryCollection.find(id);
|
|
@@ -6953,6 +7011,7 @@ __export(index_exports, {
|
|
|
6953
7011
|
clearICloudAuth: () => clearICloudAuth,
|
|
6954
7012
|
clearKeyPair: () => clearKeyPair,
|
|
6955
7013
|
clearLazyTitleCache: () => clearLazyTitleCache,
|
|
7014
|
+
clearMemoryTopicsOverrideOp: () => clearMemoryTopicsOverrideOp,
|
|
6956
7015
|
clearNotionToken: () => clearNotionToken,
|
|
6957
7016
|
clearServerToolsCache: () => clearServerToolsCache,
|
|
6958
7017
|
consoleLogger: () => consoleLogger,
|
|
@@ -7163,6 +7222,7 @@ __export(index_exports, {
|
|
|
7163
7222
|
selectServerToolsForPrompt: () => selectServerToolsForPrompt,
|
|
7164
7223
|
serializeJsx: () => serializeJsx,
|
|
7165
7224
|
setLogger: () => setLogger,
|
|
7225
|
+
setMemoryEntitiesOp: () => setMemoryEntitiesOp,
|
|
7166
7226
|
settingsStorageSchema: () => settingsStorageSchema,
|
|
7167
7227
|
shouldChunkMessage: () => shouldChunkMessage,
|
|
7168
7228
|
shouldRefreshTools: () => shouldRefreshTools,
|
|
@@ -11739,6 +11799,13 @@ function assembleMessagesWithHistory(historyMessages, callerMessages, summarySys
|
|
|
11739
11799
|
];
|
|
11740
11800
|
}
|
|
11741
11801
|
|
|
11802
|
+
// src/lib/chat/imageParts.ts
|
|
11803
|
+
function isSendableImageURL(url) {
|
|
11804
|
+
if (!url) return false;
|
|
11805
|
+
const lower = url.toLowerCase();
|
|
11806
|
+
return lower.startsWith("http://") || lower.startsWith("https://") || lower.startsWith("data:image/");
|
|
11807
|
+
}
|
|
11808
|
+
|
|
11742
11809
|
// src/lib/chat/sources.ts
|
|
11743
11810
|
function extractSourcesFromToolCallEvents(toolCallEvents) {
|
|
11744
11811
|
try {
|
|
@@ -13769,6 +13836,9 @@ __decorateClass([
|
|
|
13769
13836
|
__decorateClass([
|
|
13770
13837
|
(0, import_decorators3.field)("event_time_kind")
|
|
13771
13838
|
], VaultMemory.prototype, "eventTimeKind", 2);
|
|
13839
|
+
__decorateClass([
|
|
13840
|
+
(0, import_decorators3.field)("topics_user_managed")
|
|
13841
|
+
], VaultMemory.prototype, "topicsUserManaged", 2);
|
|
13772
13842
|
__decorateClass([
|
|
13773
13843
|
import_decorators3.readonly,
|
|
13774
13844
|
(0, import_decorators3.date)("created_at")
|
|
@@ -13787,6 +13857,7 @@ init_operations3();
|
|
|
13787
13857
|
init_logger();
|
|
13788
13858
|
|
|
13789
13859
|
// src/lib/memory/autoExtract.ts
|
|
13860
|
+
var import_watermelondb11 = require("@nozbe/watermelondb");
|
|
13790
13861
|
init_operations2();
|
|
13791
13862
|
init_types3();
|
|
13792
13863
|
init_logger();
|
|
@@ -13844,12 +13915,15 @@ async function retain(content, ctx, options = {}) {
|
|
|
13844
13915
|
preserveUpdatedAt: true,
|
|
13845
13916
|
...eventTimeUpdate && { eventTime: eventTimeUpdate }
|
|
13846
13917
|
});
|
|
13847
|
-
|
|
13848
|
-
|
|
13849
|
-
|
|
13850
|
-
|
|
13851
|
-
|
|
13852
|
-
|
|
13918
|
+
if (updated) {
|
|
13919
|
+
return {
|
|
13920
|
+
action: "merge",
|
|
13921
|
+
memoryId: targetId,
|
|
13922
|
+
targetId,
|
|
13923
|
+
proofCount: updated.proofCount ?? (existing.proofCount ?? 1) + 1
|
|
13924
|
+
};
|
|
13925
|
+
}
|
|
13926
|
+
await assertMergeTargetGoneOrThrow(ctx, targetId);
|
|
13853
13927
|
}
|
|
13854
13928
|
}
|
|
13855
13929
|
}
|
|
@@ -13932,11 +14006,15 @@ async function tryConsolidate(trimmed, ctx, options) {
|
|
|
13932
14006
|
preserveUpdatedAt: true,
|
|
13933
14007
|
...eventTimeUpdate && { eventTime: eventTimeUpdate }
|
|
13934
14008
|
});
|
|
14009
|
+
if (!updated) {
|
|
14010
|
+
await assertMergeTargetGoneOrThrow(ctx, decision.targetId);
|
|
14011
|
+
return null;
|
|
14012
|
+
}
|
|
13935
14013
|
return {
|
|
13936
14014
|
action: "merge",
|
|
13937
14015
|
memoryId: decision.targetId,
|
|
13938
14016
|
targetId: decision.targetId,
|
|
13939
|
-
proofCount: updated
|
|
14017
|
+
proofCount: updated.proofCount ?? (existing.proofCount ?? 1) + 1
|
|
13940
14018
|
};
|
|
13941
14019
|
}
|
|
13942
14020
|
if (decision.action === "update" && decision.targetId && decision.content) {
|
|
@@ -13963,17 +14041,35 @@ async function tryConsolidate(trimmed, ctx, options) {
|
|
|
13963
14041
|
preserveUpdatedAt: true,
|
|
13964
14042
|
...eventTimeUpdate && { eventTime: eventTimeUpdate }
|
|
13965
14043
|
});
|
|
14044
|
+
if (!updated) {
|
|
14045
|
+
await assertMergeTargetGoneOrThrow(ctx, decision.targetId);
|
|
14046
|
+
return null;
|
|
14047
|
+
}
|
|
13966
14048
|
return {
|
|
13967
14049
|
action: "update",
|
|
13968
14050
|
memoryId: decision.targetId,
|
|
13969
14051
|
targetId: decision.targetId,
|
|
13970
|
-
proofCount: updated
|
|
14052
|
+
proofCount: updated.proofCount ?? (existing.proofCount ?? 1) + 1
|
|
13971
14053
|
};
|
|
13972
14054
|
}
|
|
13973
14055
|
return null;
|
|
13974
14056
|
}
|
|
14057
|
+
async function assertMergeTargetGoneOrThrow(ctx, targetId) {
|
|
14058
|
+
const stillExists = await getVaultMemoryOp(ctx.vaultCtx, targetId);
|
|
14059
|
+
if (stillExists) {
|
|
14060
|
+
throw new Error(`retain: merge into memory ${targetId} failed to persist`);
|
|
14061
|
+
}
|
|
14062
|
+
}
|
|
13975
14063
|
|
|
13976
14064
|
// src/lib/memory/autoExtract.ts
|
|
14065
|
+
async function isMemoryTopicsUserManaged(ctx, memoryId) {
|
|
14066
|
+
try {
|
|
14067
|
+
const rows = await ctx.database.get(VaultMemory.table).query(import_watermelondb11.Q.where("id", memoryId)).fetch();
|
|
14068
|
+
return rows[0]?.topicsUserManaged === true;
|
|
14069
|
+
} catch {
|
|
14070
|
+
return true;
|
|
14071
|
+
}
|
|
14072
|
+
}
|
|
13977
14073
|
var DEFAULT_MODEL3 = "gpt-oss/gpt-oss-120b";
|
|
13978
14074
|
var DEFAULT_MIN_CONFIDENCE = 0.7;
|
|
13979
14075
|
var MAX_CONTENT_LENGTH = 200;
|
|
@@ -14132,7 +14228,9 @@ async function extractAndRetain(messages, retainCtx, options) {
|
|
|
14132
14228
|
results.push(result);
|
|
14133
14229
|
if (options.entityCtx && candidate.entities.length > 0) {
|
|
14134
14230
|
try {
|
|
14135
|
-
await
|
|
14231
|
+
if (!await isMemoryTopicsUserManaged(options.entityCtx, result.memoryId)) {
|
|
14232
|
+
await linkMemoryEntitiesOp(options.entityCtx, result.memoryId, candidate.entities);
|
|
14233
|
+
}
|
|
14136
14234
|
} catch (err) {
|
|
14137
14235
|
log.warn("[memory/extract] linkMemoryEntitiesOp failed", err);
|
|
14138
14236
|
}
|
|
@@ -17098,7 +17196,7 @@ async function storedToLlmapiMessage(stored, encryptionKey, resolveMediaByIds) {
|
|
|
17098
17196
|
const imageParts = [];
|
|
17099
17197
|
if (stored.role !== "assistant" && stored.files?.length) {
|
|
17100
17198
|
for (const file of stored.files) {
|
|
17101
|
-
if (file.url) {
|
|
17199
|
+
if (isSendableImageURL(file.url)) {
|
|
17102
17200
|
imageParts.push({
|
|
17103
17201
|
type: "image_url",
|
|
17104
17202
|
image_url: { url: file.url }
|
|
@@ -18829,13 +18927,13 @@ Based on these results, continue with the task.`;
|
|
|
18829
18927
|
}
|
|
18830
18928
|
|
|
18831
18929
|
// src/lib/db/schema.ts
|
|
18832
|
-
var
|
|
18930
|
+
var import_watermelondb19 = require("@nozbe/watermelondb");
|
|
18833
18931
|
var import_migrations2 = require("@nozbe/watermelondb/Schema/migrations");
|
|
18834
18932
|
|
|
18835
18933
|
// src/lib/db/appFiles/models.ts
|
|
18836
|
-
var
|
|
18934
|
+
var import_watermelondb12 = require("@nozbe/watermelondb");
|
|
18837
18935
|
var import_decorators4 = require("@nozbe/watermelondb/decorators");
|
|
18838
|
-
var AppFile = class extends
|
|
18936
|
+
var AppFile = class extends import_watermelondb12.Model {
|
|
18839
18937
|
};
|
|
18840
18938
|
AppFile.table = "app_files";
|
|
18841
18939
|
AppFile.associations = {};
|
|
@@ -18857,9 +18955,9 @@ __decorateClass([
|
|
|
18857
18955
|
], AppFile.prototype, "updatedAt", 2);
|
|
18858
18956
|
|
|
18859
18957
|
// src/lib/db/entities/models.ts
|
|
18860
|
-
var
|
|
18958
|
+
var import_watermelondb13 = require("@nozbe/watermelondb");
|
|
18861
18959
|
var import_decorators5 = require("@nozbe/watermelondb/decorators");
|
|
18862
|
-
var Entity = class extends
|
|
18960
|
+
var Entity = class extends import_watermelondb13.Model {
|
|
18863
18961
|
};
|
|
18864
18962
|
Entity.table = "entity";
|
|
18865
18963
|
__decorateClass([
|
|
@@ -18875,7 +18973,7 @@ __decorateClass([
|
|
|
18875
18973
|
__decorateClass([
|
|
18876
18974
|
(0, import_decorators5.date)("updated_at")
|
|
18877
18975
|
], Entity.prototype, "updatedAt", 2);
|
|
18878
|
-
var MemoryEntity = class extends
|
|
18976
|
+
var MemoryEntity = class extends import_watermelondb13.Model {
|
|
18879
18977
|
};
|
|
18880
18978
|
MemoryEntity.table = "memory_entity";
|
|
18881
18979
|
__decorateClass([
|
|
@@ -18893,9 +18991,9 @@ __decorateClass([
|
|
|
18893
18991
|
], MemoryEntity.prototype, "createdAt", 2);
|
|
18894
18992
|
|
|
18895
18993
|
// src/lib/db/project/models.ts
|
|
18896
|
-
var
|
|
18994
|
+
var import_watermelondb14 = require("@nozbe/watermelondb");
|
|
18897
18995
|
var import_decorators6 = require("@nozbe/watermelondb/decorators");
|
|
18898
|
-
var Project = class extends
|
|
18996
|
+
var Project = class extends import_watermelondb14.Model {
|
|
18899
18997
|
};
|
|
18900
18998
|
Project.table = "projects";
|
|
18901
18999
|
Project.associations = {
|
|
@@ -18918,10 +19016,10 @@ __decorateClass([
|
|
|
18918
19016
|
], Project.prototype, "isDeleted", 2);
|
|
18919
19017
|
|
|
18920
19018
|
// src/lib/db/savedTools/models.ts
|
|
18921
|
-
var
|
|
19019
|
+
var import_watermelondb15 = require("@nozbe/watermelondb");
|
|
18922
19020
|
var import_decorators7 = require("@nozbe/watermelondb/decorators");
|
|
18923
19021
|
var sanitizeParameters = (raw) => raw ?? {};
|
|
18924
|
-
var SavedTool = class extends
|
|
19022
|
+
var SavedTool = class extends import_watermelondb15.Model {
|
|
18925
19023
|
};
|
|
18926
19024
|
SavedTool.table = "saved_tools";
|
|
18927
19025
|
SavedTool.associations = {};
|
|
@@ -18955,9 +19053,9 @@ __decorateClass([
|
|
|
18955
19053
|
], SavedTool.prototype, "isDeleted", 2);
|
|
18956
19054
|
|
|
18957
19055
|
// src/lib/db/settings/models.ts
|
|
18958
|
-
var
|
|
19056
|
+
var import_watermelondb16 = require("@nozbe/watermelondb");
|
|
18959
19057
|
var import_decorators8 = require("@nozbe/watermelondb/decorators");
|
|
18960
|
-
var ModelPreference = class extends
|
|
19058
|
+
var ModelPreference = class extends import_watermelondb16.Model {
|
|
18961
19059
|
};
|
|
18962
19060
|
ModelPreference.table = "modelPreferences";
|
|
18963
19061
|
__decorateClass([
|
|
@@ -18968,9 +19066,9 @@ __decorateClass([
|
|
|
18968
19066
|
], ModelPreference.prototype, "models", 2);
|
|
18969
19067
|
|
|
18970
19068
|
// src/lib/db/userPreferences/models.ts
|
|
18971
|
-
var
|
|
19069
|
+
var import_watermelondb17 = require("@nozbe/watermelondb");
|
|
18972
19070
|
var import_decorators9 = require("@nozbe/watermelondb/decorators");
|
|
18973
|
-
var UserPreference = class extends
|
|
19071
|
+
var UserPreference = class extends import_watermelondb17.Model {
|
|
18974
19072
|
};
|
|
18975
19073
|
UserPreference.table = "userPreferences";
|
|
18976
19074
|
__decorateClass([
|
|
@@ -18999,9 +19097,9 @@ __decorateClass([
|
|
|
18999
19097
|
], UserPreference.prototype, "updatedAt", 2);
|
|
19000
19098
|
|
|
19001
19099
|
// src/lib/db/vaultFolders/models.ts
|
|
19002
|
-
var
|
|
19100
|
+
var import_watermelondb18 = require("@nozbe/watermelondb");
|
|
19003
19101
|
var import_decorators10 = require("@nozbe/watermelondb/decorators");
|
|
19004
|
-
var VaultFolder = class extends
|
|
19102
|
+
var VaultFolder = class extends import_watermelondb18.Model {
|
|
19005
19103
|
};
|
|
19006
19104
|
VaultFolder.table = "vault_folders";
|
|
19007
19105
|
__decorateClass([
|
|
@@ -19028,12 +19126,12 @@ __decorateClass([
|
|
|
19028
19126
|
], VaultFolder.prototype, "context", 2);
|
|
19029
19127
|
|
|
19030
19128
|
// src/lib/db/schema.ts
|
|
19031
|
-
var SDK_SCHEMA_VERSION =
|
|
19032
|
-
var sdkSchema = (0,
|
|
19129
|
+
var SDK_SCHEMA_VERSION = 34;
|
|
19130
|
+
var sdkSchema = (0, import_watermelondb19.appSchema)({
|
|
19033
19131
|
version: SDK_SCHEMA_VERSION,
|
|
19034
19132
|
tables: [
|
|
19035
19133
|
// Chat storage tables
|
|
19036
|
-
(0,
|
|
19134
|
+
(0, import_watermelondb19.tableSchema)({
|
|
19037
19135
|
name: "history",
|
|
19038
19136
|
columns: [
|
|
19039
19137
|
{ name: "message_id", type: "number" },
|
|
@@ -19070,7 +19168,7 @@ var sdkSchema = (0, import_watermelondb18.appSchema)({
|
|
|
19070
19168
|
// JSON stringified LlmapiToolCallEvent[]
|
|
19071
19169
|
]
|
|
19072
19170
|
}),
|
|
19073
|
-
(0,
|
|
19171
|
+
(0, import_watermelondb19.tableSchema)({
|
|
19074
19172
|
name: "conversations",
|
|
19075
19173
|
columns: [
|
|
19076
19174
|
{ name: "conversation_id", type: "string", isIndexed: true },
|
|
@@ -19083,7 +19181,7 @@ var sdkSchema = (0, import_watermelondb18.appSchema)({
|
|
|
19083
19181
|
]
|
|
19084
19182
|
}),
|
|
19085
19183
|
// Project storage table
|
|
19086
|
-
(0,
|
|
19184
|
+
(0, import_watermelondb19.tableSchema)({
|
|
19087
19185
|
name: "projects",
|
|
19088
19186
|
columns: [
|
|
19089
19187
|
{ name: "project_id", type: "string", isIndexed: true },
|
|
@@ -19094,7 +19192,7 @@ var sdkSchema = (0, import_watermelondb18.appSchema)({
|
|
|
19094
19192
|
]
|
|
19095
19193
|
}),
|
|
19096
19194
|
// Settings storage tables (deprecated - use userPreferences)
|
|
19097
|
-
(0,
|
|
19195
|
+
(0, import_watermelondb19.tableSchema)({
|
|
19098
19196
|
name: "modelPreferences",
|
|
19099
19197
|
columns: [
|
|
19100
19198
|
{ name: "wallet_address", type: "string", isIndexed: true },
|
|
@@ -19102,7 +19200,7 @@ var sdkSchema = (0, import_watermelondb18.appSchema)({
|
|
|
19102
19200
|
]
|
|
19103
19201
|
}),
|
|
19104
19202
|
// Unified user preferences storage
|
|
19105
|
-
(0,
|
|
19203
|
+
(0, import_watermelondb19.tableSchema)({
|
|
19106
19204
|
name: "userPreferences",
|
|
19107
19205
|
columns: [
|
|
19108
19206
|
// Identity
|
|
@@ -19121,7 +19219,7 @@ var sdkSchema = (0, import_watermelondb18.appSchema)({
|
|
|
19121
19219
|
]
|
|
19122
19220
|
}),
|
|
19123
19221
|
// Memory vault storage
|
|
19124
|
-
(0,
|
|
19222
|
+
(0, import_watermelondb19.tableSchema)({
|
|
19125
19223
|
name: "memory_vault",
|
|
19126
19224
|
columns: [
|
|
19127
19225
|
{ name: "content", type: "string" },
|
|
@@ -19145,11 +19243,15 @@ var sdkSchema = (0, import_watermelondb18.appSchema)({
|
|
|
19145
19243
|
// (start set, end null + kind='ongoing'), or none (both null).
|
|
19146
19244
|
{ name: "event_time_start", type: "number", isOptional: true, isIndexed: true },
|
|
19147
19245
|
{ name: "event_time_end", type: "number", isOptional: true },
|
|
19148
|
-
{ name: "event_time_kind", type: "string", isOptional: true }
|
|
19246
|
+
{ name: "event_time_kind", type: "string", isOptional: true },
|
|
19247
|
+
// When true, the user has manually set this memory's topics (entity
|
|
19248
|
+
// links). Auto-extraction then leaves its links alone — the user owns
|
|
19249
|
+
// them. Null/false = topics are auto-derived (default).
|
|
19250
|
+
{ name: "topics_user_managed", type: "boolean", isOptional: true }
|
|
19149
19251
|
]
|
|
19150
19252
|
}),
|
|
19151
19253
|
// Entity table — canonical names extracted from auto-extraction (W5).
|
|
19152
|
-
(0,
|
|
19254
|
+
(0, import_watermelondb19.tableSchema)({
|
|
19153
19255
|
name: "entity",
|
|
19154
19256
|
columns: [
|
|
19155
19257
|
{ name: "canonical_name", type: "string", isIndexed: true },
|
|
@@ -19159,7 +19261,7 @@ var sdkSchema = (0, import_watermelondb18.appSchema)({
|
|
|
19159
19261
|
]
|
|
19160
19262
|
}),
|
|
19161
19263
|
// Many-to-many join: which memories reference which entities.
|
|
19162
|
-
(0,
|
|
19264
|
+
(0, import_watermelondb19.tableSchema)({
|
|
19163
19265
|
name: "memory_entity",
|
|
19164
19266
|
columns: [
|
|
19165
19267
|
{ name: "memory_id", type: "string", isIndexed: true },
|
|
@@ -19169,7 +19271,7 @@ var sdkSchema = (0, import_watermelondb18.appSchema)({
|
|
|
19169
19271
|
]
|
|
19170
19272
|
}),
|
|
19171
19273
|
// Vault folder organization
|
|
19172
|
-
(0,
|
|
19274
|
+
(0, import_watermelondb19.tableSchema)({
|
|
19173
19275
|
name: "vault_folders",
|
|
19174
19276
|
columns: [
|
|
19175
19277
|
{ name: "name", type: "string" },
|
|
@@ -19182,7 +19284,7 @@ var sdkSchema = (0, import_watermelondb18.appSchema)({
|
|
|
19182
19284
|
]
|
|
19183
19285
|
}),
|
|
19184
19286
|
// Conversation summary cache for progressive history summarization
|
|
19185
|
-
(0,
|
|
19287
|
+
(0, import_watermelondb19.tableSchema)({
|
|
19186
19288
|
name: "conversation_summaries",
|
|
19187
19289
|
columns: [
|
|
19188
19290
|
{ name: "conversation_id", type: "string", isIndexed: true },
|
|
@@ -19195,7 +19297,7 @@ var sdkSchema = (0, import_watermelondb18.appSchema)({
|
|
|
19195
19297
|
]
|
|
19196
19298
|
}),
|
|
19197
19299
|
// Media library storage (images, videos, audio, documents)
|
|
19198
|
-
(0,
|
|
19300
|
+
(0, import_watermelondb19.tableSchema)({
|
|
19199
19301
|
name: "media",
|
|
19200
19302
|
columns: [
|
|
19201
19303
|
// Identity
|
|
@@ -19231,7 +19333,7 @@ var sdkSchema = (0, import_watermelondb18.appSchema)({
|
|
|
19231
19333
|
]
|
|
19232
19334
|
}),
|
|
19233
19335
|
// ── App files ─────────────────────────────────────────────────────────
|
|
19234
|
-
(0,
|
|
19336
|
+
(0, import_watermelondb19.tableSchema)({
|
|
19235
19337
|
name: "app_files",
|
|
19236
19338
|
columns: [
|
|
19237
19339
|
{ name: "conversation_id", type: "string", isIndexed: true },
|
|
@@ -19242,7 +19344,7 @@ var sdkSchema = (0, import_watermelondb18.appSchema)({
|
|
|
19242
19344
|
]
|
|
19243
19345
|
}),
|
|
19244
19346
|
// ── Saved tools ──────────────────────────────────────────────────────
|
|
19245
|
-
(0,
|
|
19347
|
+
(0, import_watermelondb19.tableSchema)({
|
|
19246
19348
|
name: "saved_tools",
|
|
19247
19349
|
columns: [
|
|
19248
19350
|
{ name: "name", type: "string" },
|
|
@@ -19704,6 +19806,18 @@ var sdkMigrations = (0, import_migrations2.schemaMigrations)({
|
|
|
19704
19806
|
columns: [{ name: "embedding_model", type: "string", isOptional: true }]
|
|
19705
19807
|
})
|
|
19706
19808
|
]
|
|
19809
|
+
},
|
|
19810
|
+
// v33 -> v34: user-managed topics. `topics_user_managed` marks a memory
|
|
19811
|
+
// whose entity links the user has taken manual control of, so
|
|
19812
|
+
// auto-extraction stops touching them.
|
|
19813
|
+
{
|
|
19814
|
+
toVersion: 34,
|
|
19815
|
+
steps: [
|
|
19816
|
+
(0, import_migrations2.addColumns)({
|
|
19817
|
+
table: "memory_vault",
|
|
19818
|
+
columns: [{ name: "topics_user_managed", type: "boolean", isOptional: true }]
|
|
19819
|
+
})
|
|
19820
|
+
]
|
|
19707
19821
|
}
|
|
19708
19822
|
]
|
|
19709
19823
|
});
|
|
@@ -19724,7 +19838,7 @@ var sdkModelClasses = [
|
|
|
19724
19838
|
];
|
|
19725
19839
|
|
|
19726
19840
|
// src/lib/db/manager.ts
|
|
19727
|
-
var
|
|
19841
|
+
var import_watermelondb20 = require("@nozbe/watermelondb");
|
|
19728
19842
|
var DESTRUCTIVE_MIGRATION_VERSION = 8;
|
|
19729
19843
|
var webPlatformStorage = {
|
|
19730
19844
|
getItem: (key) => localStorage.getItem(key),
|
|
@@ -19802,7 +19916,7 @@ var DatabaseManager = class {
|
|
|
19802
19916
|
walletAddress
|
|
19803
19917
|
});
|
|
19804
19918
|
const adapter = this.createAdapter(dbName, sdkSchema, sdkMigrations);
|
|
19805
|
-
this.database = new
|
|
19919
|
+
this.database = new import_watermelondb20.Database({
|
|
19806
19920
|
adapter,
|
|
19807
19921
|
modelClasses: sdkModelClasses
|
|
19808
19922
|
});
|
|
@@ -19878,7 +19992,7 @@ function useDatabaseManager(walletAddress, manager) {
|
|
|
19878
19992
|
}
|
|
19879
19993
|
|
|
19880
19994
|
// src/lib/db/project/operations.ts
|
|
19881
|
-
var
|
|
19995
|
+
var import_watermelondb21 = require("@nozbe/watermelondb");
|
|
19882
19996
|
init_operations();
|
|
19883
19997
|
|
|
19884
19998
|
// src/lib/db/project/types.ts
|
|
@@ -19910,15 +20024,15 @@ async function createProjectOp(ctx, opts, defaultName = "New Project") {
|
|
|
19910
20024
|
return projectToStored(created);
|
|
19911
20025
|
}
|
|
19912
20026
|
async function getProjectOp(ctx, id) {
|
|
19913
|
-
const results = await ctx.projectsCollection.query(
|
|
20027
|
+
const results = await ctx.projectsCollection.query(import_watermelondb21.Q.where("project_id", id), import_watermelondb21.Q.where("is_deleted", false)).fetch();
|
|
19914
20028
|
return results.length > 0 ? projectToStored(results[0]) : null;
|
|
19915
20029
|
}
|
|
19916
20030
|
async function getProjectsOp(ctx) {
|
|
19917
|
-
const results = await ctx.projectsCollection.query(
|
|
20031
|
+
const results = await ctx.projectsCollection.query(import_watermelondb21.Q.where("is_deleted", false), import_watermelondb21.Q.sortBy("created_at", import_watermelondb21.Q.desc)).fetch();
|
|
19918
20032
|
return results.map(projectToStored);
|
|
19919
20033
|
}
|
|
19920
20034
|
async function updateProjectNameOp(ctx, id, name) {
|
|
19921
|
-
const results = await ctx.projectsCollection.query(
|
|
20035
|
+
const results = await ctx.projectsCollection.query(import_watermelondb21.Q.where("project_id", id), import_watermelondb21.Q.where("is_deleted", false)).fetch();
|
|
19922
20036
|
if (results.length > 0) {
|
|
19923
20037
|
await ctx.database.write(async () => {
|
|
19924
20038
|
await results[0].update((proj) => {
|
|
@@ -19930,7 +20044,7 @@ async function updateProjectNameOp(ctx, id, name) {
|
|
|
19930
20044
|
return false;
|
|
19931
20045
|
}
|
|
19932
20046
|
async function updateProjectOp(ctx, id, opts) {
|
|
19933
|
-
const results = await ctx.projectsCollection.query(
|
|
20047
|
+
const results = await ctx.projectsCollection.query(import_watermelondb21.Q.where("project_id", id), import_watermelondb21.Q.where("is_deleted", false)).fetch();
|
|
19934
20048
|
if (results.length > 0) {
|
|
19935
20049
|
await ctx.database.write(async () => {
|
|
19936
20050
|
await results[0].update((proj) => {
|
|
@@ -19942,7 +20056,7 @@ async function updateProjectOp(ctx, id, opts) {
|
|
|
19942
20056
|
return false;
|
|
19943
20057
|
}
|
|
19944
20058
|
async function deleteProjectOp(ctx, id) {
|
|
19945
|
-
const results = await ctx.projectsCollection.query(
|
|
20059
|
+
const results = await ctx.projectsCollection.query(import_watermelondb21.Q.where("project_id", id), import_watermelondb21.Q.where("is_deleted", false)).fetch();
|
|
19946
20060
|
if (results.length > 0) {
|
|
19947
20061
|
await ctx.database.write(async () => {
|
|
19948
20062
|
await results[0].update((proj) => {
|
|
@@ -19955,18 +20069,18 @@ async function deleteProjectOp(ctx, id) {
|
|
|
19955
20069
|
}
|
|
19956
20070
|
async function getProjectConversationsOp(ctx, projectId) {
|
|
19957
20071
|
const results = await ctx.conversationsCollection.query(
|
|
19958
|
-
|
|
19959
|
-
|
|
19960
|
-
|
|
20072
|
+
import_watermelondb21.Q.where("project_id", projectId),
|
|
20073
|
+
import_watermelondb21.Q.where("is_deleted", false),
|
|
20074
|
+
import_watermelondb21.Q.sortBy("created_at", import_watermelondb21.Q.desc)
|
|
19961
20075
|
).fetch();
|
|
19962
20076
|
return results.map(conversationToStoredRaw);
|
|
19963
20077
|
}
|
|
19964
20078
|
async function getProjectConversationCountOp(ctx, projectId) {
|
|
19965
|
-
return await ctx.conversationsCollection.query(
|
|
20079
|
+
return await ctx.conversationsCollection.query(import_watermelondb21.Q.where("project_id", projectId), import_watermelondb21.Q.where("is_deleted", false)).fetchCount();
|
|
19966
20080
|
}
|
|
19967
20081
|
|
|
19968
20082
|
// src/react/useFiles.ts
|
|
19969
|
-
var
|
|
20083
|
+
var import_watermelondb22 = require("@nozbe/watermelondb");
|
|
19970
20084
|
var import_react7 = require("react");
|
|
19971
20085
|
init_logger();
|
|
19972
20086
|
init_useEncryption();
|
|
@@ -19986,7 +20100,7 @@ function useFiles(options) {
|
|
|
19986
20100
|
setIsLoading(true);
|
|
19987
20101
|
try {
|
|
19988
20102
|
const coll = database.get("media");
|
|
19989
|
-
await coll.query(
|
|
20103
|
+
await coll.query(import_watermelondb22.Q.take(1)).fetch();
|
|
19990
20104
|
setMediaCollection(coll);
|
|
19991
20105
|
setIsReady(true);
|
|
19992
20106
|
} catch (error) {
|
|
@@ -20394,7 +20508,7 @@ function useFiles(options) {
|
|
|
20394
20508
|
}
|
|
20395
20509
|
|
|
20396
20510
|
// src/react/useProjects.ts
|
|
20397
|
-
var
|
|
20511
|
+
var import_watermelondb23 = require("@nozbe/watermelondb");
|
|
20398
20512
|
var import_react8 = require("react");
|
|
20399
20513
|
init_logger();
|
|
20400
20514
|
function useProjects(options) {
|
|
@@ -20417,7 +20531,7 @@ function useProjects(options) {
|
|
|
20417
20531
|
conversations: convColl?.table
|
|
20418
20532
|
});
|
|
20419
20533
|
getLogger().debug("[useProjects] Running test query on projects table...");
|
|
20420
|
-
const testResult = await projColl.query(
|
|
20534
|
+
const testResult = await projColl.query(import_watermelondb23.Q.take(1)).fetch();
|
|
20421
20535
|
getLogger().debug(
|
|
20422
20536
|
"[useProjects] Test query succeeded, found",
|
|
20423
20537
|
testResult.length,
|
|
@@ -20504,7 +20618,7 @@ function useProjects(options) {
|
|
|
20504
20618
|
if (!projectsCollection) {
|
|
20505
20619
|
return;
|
|
20506
20620
|
}
|
|
20507
|
-
const subscription = projectsCollection.query(
|
|
20621
|
+
const subscription = projectsCollection.query(import_watermelondb23.Q.where("is_deleted", false)).observe().subscribe((records) => {
|
|
20508
20622
|
setProjects(records.map(projectToStored));
|
|
20509
20623
|
});
|
|
20510
20624
|
return () => subscription.unsubscribe();
|
|
@@ -20627,7 +20741,7 @@ function useProjects(options) {
|
|
|
20627
20741
|
}
|
|
20628
20742
|
|
|
20629
20743
|
// src/lib/db/settings/operations.ts
|
|
20630
|
-
var
|
|
20744
|
+
var import_watermelondb24 = require("@nozbe/watermelondb");
|
|
20631
20745
|
function modelPreferenceToStored(preference) {
|
|
20632
20746
|
return {
|
|
20633
20747
|
uniqueId: preference.id,
|
|
@@ -20636,12 +20750,12 @@ function modelPreferenceToStored(preference) {
|
|
|
20636
20750
|
};
|
|
20637
20751
|
}
|
|
20638
20752
|
async function getModelPreferenceOp(ctx, walletAddress) {
|
|
20639
|
-
const results = await ctx.modelPreferencesCollection.query(
|
|
20753
|
+
const results = await ctx.modelPreferencesCollection.query(import_watermelondb24.Q.where("wallet_address", walletAddress)).fetch();
|
|
20640
20754
|
return results.length > 0 ? modelPreferenceToStored(results[0]) : null;
|
|
20641
20755
|
}
|
|
20642
20756
|
async function setModelPreferenceOp(ctx, walletAddress, models) {
|
|
20643
20757
|
const result = await ctx.database.write(async () => {
|
|
20644
|
-
const results = await ctx.modelPreferencesCollection.query(
|
|
20758
|
+
const results = await ctx.modelPreferencesCollection.query(import_watermelondb24.Q.where("wallet_address", walletAddress)).fetch();
|
|
20645
20759
|
if (results.length > 0) {
|
|
20646
20760
|
const preference = results[0];
|
|
20647
20761
|
await preference.update((pref) => {
|
|
@@ -20659,7 +20773,7 @@ async function setModelPreferenceOp(ctx, walletAddress, models) {
|
|
|
20659
20773
|
return modelPreferenceToStored(result);
|
|
20660
20774
|
}
|
|
20661
20775
|
async function deleteModelPreferenceOp(ctx, walletAddress) {
|
|
20662
|
-
const results = await ctx.modelPreferencesCollection.query(
|
|
20776
|
+
const results = await ctx.modelPreferencesCollection.query(import_watermelondb24.Q.where("wallet_address", walletAddress)).fetch();
|
|
20663
20777
|
if (results.length === 0) return false;
|
|
20664
20778
|
await ctx.database.write(async () => {
|
|
20665
20779
|
await results[0].destroyPermanently();
|
|
@@ -20668,11 +20782,11 @@ async function deleteModelPreferenceOp(ctx, walletAddress) {
|
|
|
20668
20782
|
}
|
|
20669
20783
|
|
|
20670
20784
|
// src/lib/db/settings/schema.ts
|
|
20671
|
-
var
|
|
20672
|
-
var settingsStorageSchema = (0,
|
|
20785
|
+
var import_watermelondb25 = require("@nozbe/watermelondb");
|
|
20786
|
+
var settingsStorageSchema = (0, import_watermelondb25.appSchema)({
|
|
20673
20787
|
version: 1,
|
|
20674
20788
|
tables: [
|
|
20675
|
-
(0,
|
|
20789
|
+
(0, import_watermelondb25.tableSchema)({
|
|
20676
20790
|
name: "modelPreferences",
|
|
20677
20791
|
columns: [
|
|
20678
20792
|
{ name: "wallet_address", type: "string", isIndexed: true },
|
|
@@ -20683,7 +20797,7 @@ var settingsStorageSchema = (0, import_watermelondb24.appSchema)({
|
|
|
20683
20797
|
});
|
|
20684
20798
|
|
|
20685
20799
|
// src/lib/db/vaultFolders/operations.ts
|
|
20686
|
-
var
|
|
20800
|
+
var import_watermelondb26 = require("@nozbe/watermelondb");
|
|
20687
20801
|
function folderToStored(folder) {
|
|
20688
20802
|
return {
|
|
20689
20803
|
uniqueId: folder.id,
|
|
@@ -20708,7 +20822,7 @@ async function createVaultFolderOp(ctx, opts) {
|
|
|
20708
20822
|
return folderToStored(created);
|
|
20709
20823
|
}
|
|
20710
20824
|
async function getAllVaultFoldersOp(ctx) {
|
|
20711
|
-
const results = await ctx.vaultFolderCollection.query(
|
|
20825
|
+
const results = await ctx.vaultFolderCollection.query(import_watermelondb26.Q.where("is_deleted", false), import_watermelondb26.Q.sortBy("created_at", import_watermelondb26.Q.desc)).fetch();
|
|
20712
20826
|
return results.map(folderToStored);
|
|
20713
20827
|
}
|
|
20714
20828
|
async function updateVaultFolderOp(ctx, id, opts) {
|
|
@@ -20725,7 +20839,7 @@ async function updateVaultFolderOp(ctx, id, opts) {
|
|
|
20725
20839
|
})
|
|
20726
20840
|
);
|
|
20727
20841
|
if (scopeChanged) {
|
|
20728
|
-
const memories = await ctx.vaultMemoryCollection.query(
|
|
20842
|
+
const memories = await ctx.vaultMemoryCollection.query(import_watermelondb26.Q.where("folder_id", id), import_watermelondb26.Q.where("is_deleted", false)).fetch();
|
|
20729
20843
|
for (const memory of memories) {
|
|
20730
20844
|
updates.push(
|
|
20731
20845
|
memory.prepareUpdate((r) => {
|
|
@@ -20747,7 +20861,7 @@ async function deleteVaultFolderOp(ctx, id) {
|
|
|
20747
20861
|
const record = await ctx.vaultFolderCollection.find(id);
|
|
20748
20862
|
if (record.isDeleted) return false;
|
|
20749
20863
|
await ctx.database.write(async () => {
|
|
20750
|
-
const memories = await ctx.vaultMemoryCollection.query(
|
|
20864
|
+
const memories = await ctx.vaultMemoryCollection.query(import_watermelondb26.Q.where("folder_id", id), import_watermelondb26.Q.where("is_deleted", false)).fetch();
|
|
20751
20865
|
const preparedMemories = memories.map(
|
|
20752
20866
|
(memory) => memory.prepareUpdate((r) => {
|
|
20753
20867
|
r._setRaw("folder_id", null);
|
|
@@ -20816,7 +20930,7 @@ async function updateVaultFolderContextOp(ctx, id, context) {
|
|
|
20816
20930
|
}
|
|
20817
20931
|
}
|
|
20818
20932
|
async function getVaultFolderMemoryCountOp(ctx, folderId) {
|
|
20819
|
-
return await ctx.vaultMemoryCollection.query(
|
|
20933
|
+
return await ctx.vaultMemoryCollection.query(import_watermelondb26.Q.where("folder_id", folderId), import_watermelondb26.Q.where("is_deleted", false)).fetchCount();
|
|
20820
20934
|
}
|
|
20821
20935
|
|
|
20822
20936
|
// src/lib/db/vaultFolders/defaults.ts
|
|
@@ -20866,7 +20980,7 @@ init_types3();
|
|
|
20866
20980
|
var import_react9 = require("react");
|
|
20867
20981
|
|
|
20868
20982
|
// src/lib/db/userPreferences/operations.ts
|
|
20869
|
-
var
|
|
20983
|
+
var import_watermelondb27 = require("@nozbe/watermelondb");
|
|
20870
20984
|
function userPreferenceToStored(preference) {
|
|
20871
20985
|
return {
|
|
20872
20986
|
uniqueId: preference.id,
|
|
@@ -20881,7 +20995,7 @@ function userPreferenceToStored(preference) {
|
|
|
20881
20995
|
};
|
|
20882
20996
|
}
|
|
20883
20997
|
async function getUserPreferenceOp(ctx, walletAddress) {
|
|
20884
|
-
const results = await ctx.userPreferencesCollection.query(
|
|
20998
|
+
const results = await ctx.userPreferencesCollection.query(import_watermelondb27.Q.where("wallet_address", walletAddress)).fetch();
|
|
20885
20999
|
return results.length > 0 ? userPreferenceToStored(results[0]) : null;
|
|
20886
21000
|
}
|
|
20887
21001
|
async function createUserPreferenceOp(ctx, opts) {
|
|
@@ -20901,7 +21015,7 @@ async function createUserPreferenceOp(ctx, opts) {
|
|
|
20901
21015
|
return userPreferenceToStored(created);
|
|
20902
21016
|
}
|
|
20903
21017
|
async function updateUserPreferenceOp(ctx, walletAddress, opts) {
|
|
20904
|
-
const results = await ctx.userPreferencesCollection.query(
|
|
21018
|
+
const results = await ctx.userPreferencesCollection.query(import_watermelondb27.Q.where("wallet_address", walletAddress)).fetch();
|
|
20905
21019
|
if (results.length === 0) return null;
|
|
20906
21020
|
const preference = results[0];
|
|
20907
21021
|
await ctx.database.write(async () => {
|
|
@@ -20929,7 +21043,7 @@ async function updateUserPreferenceOp(ctx, walletAddress, opts) {
|
|
|
20929
21043
|
async function setUserPreferenceOp(ctx, walletAddress, opts) {
|
|
20930
21044
|
const now = Date.now();
|
|
20931
21045
|
const result = await ctx.database.write(async () => {
|
|
20932
|
-
const results = await ctx.userPreferencesCollection.query(
|
|
21046
|
+
const results = await ctx.userPreferencesCollection.query(import_watermelondb27.Q.where("wallet_address", walletAddress)).fetch();
|
|
20933
21047
|
if (results.length > 0) {
|
|
20934
21048
|
const preference = results[0];
|
|
20935
21049
|
await preference.update((pref) => {
|
|
@@ -20977,7 +21091,7 @@ async function updateModelsOp(ctx, walletAddress, models) {
|
|
|
20977
21091
|
return updateUserPreferenceOp(ctx, walletAddress, { models });
|
|
20978
21092
|
}
|
|
20979
21093
|
async function deleteUserPreferenceOp(ctx, walletAddress) {
|
|
20980
|
-
const results = await ctx.userPreferencesCollection.query(
|
|
21094
|
+
const results = await ctx.userPreferencesCollection.query(import_watermelondb27.Q.where("wallet_address", walletAddress)).fetch();
|
|
20981
21095
|
if (results.length === 0) return false;
|
|
20982
21096
|
await ctx.database.write(async () => {
|
|
20983
21097
|
await results[0].destroyPermanently();
|
|
@@ -20992,9 +21106,9 @@ async function migrateFromModelPreferencesOp(ctx, walletAddress) {
|
|
|
20992
21106
|
if (existing) {
|
|
20993
21107
|
return existing;
|
|
20994
21108
|
}
|
|
20995
|
-
const modelResults = await ctx.modelPreferencesCollection.query(
|
|
21109
|
+
const modelResults = await ctx.modelPreferencesCollection.query(import_watermelondb27.Q.where("wallet_address", walletAddress)).fetch();
|
|
20996
21110
|
const personalityKey = `${walletAddress}_personality_settings`;
|
|
20997
|
-
const personalityResults = await ctx.modelPreferencesCollection.query(
|
|
21111
|
+
const personalityResults = await ctx.modelPreferencesCollection.query(import_watermelondb27.Q.where("wallet_address", personalityKey)).fetch();
|
|
20998
21112
|
if (modelResults.length === 0 && personalityResults.length === 0) {
|
|
20999
21113
|
return null;
|
|
21000
21114
|
}
|
|
@@ -21036,11 +21150,11 @@ async function migrateFromModelPreferencesOp(ctx, walletAddress) {
|
|
|
21036
21150
|
}
|
|
21037
21151
|
|
|
21038
21152
|
// src/lib/db/userPreferences/schema.ts
|
|
21039
|
-
var
|
|
21040
|
-
var userPreferencesStorageSchema = (0,
|
|
21153
|
+
var import_watermelondb28 = require("@nozbe/watermelondb");
|
|
21154
|
+
var userPreferencesStorageSchema = (0, import_watermelondb28.appSchema)({
|
|
21041
21155
|
version: 1,
|
|
21042
21156
|
tables: [
|
|
21043
|
-
(0,
|
|
21157
|
+
(0, import_watermelondb28.tableSchema)({
|
|
21044
21158
|
name: "userPreferences",
|
|
21045
21159
|
columns: [
|
|
21046
21160
|
// Identity
|
|
@@ -21100,7 +21214,7 @@ var SLIDER_CONFIG = [
|
|
|
21100
21214
|
];
|
|
21101
21215
|
|
|
21102
21216
|
// src/react/userSettingsStore.ts
|
|
21103
|
-
var
|
|
21217
|
+
var import_watermelondb29 = require("@nozbe/watermelondb");
|
|
21104
21218
|
var EMPTY_SNAPSHOT = Object.freeze({
|
|
21105
21219
|
modelPreference: null,
|
|
21106
21220
|
userPreference: null,
|
|
@@ -21162,7 +21276,7 @@ async function startLoad(entry, walletAddress) {
|
|
|
21162
21276
|
}
|
|
21163
21277
|
function startObserve(entry, walletAddress) {
|
|
21164
21278
|
let isInitialEmission = true;
|
|
21165
|
-
entry.observeSub = entry.storageCtx.userPreferencesCollection.query(
|
|
21279
|
+
entry.observeSub = entry.storageCtx.userPreferencesCollection.query(import_watermelondb29.Q.where("wallet_address", walletAddress)).observeWithColumns([
|
|
21166
21280
|
"nickname",
|
|
21167
21281
|
"occupation",
|
|
21168
21282
|
"description",
|
|
@@ -21416,7 +21530,7 @@ function useSettings(options) {
|
|
|
21416
21530
|
}
|
|
21417
21531
|
|
|
21418
21532
|
// src/lib/db/appFiles/operations.ts
|
|
21419
|
-
var
|
|
21533
|
+
var import_watermelondb30 = require("@nozbe/watermelondb");
|
|
21420
21534
|
|
|
21421
21535
|
// src/utils/paths.ts
|
|
21422
21536
|
function normalizePath(p) {
|
|
@@ -21442,7 +21556,7 @@ async function putAppFileOp(ctx, conversationId, path, content) {
|
|
|
21442
21556
|
const normalized = normalizePath(path);
|
|
21443
21557
|
const now = Date.now();
|
|
21444
21558
|
const result = await ctx.database.write(async () => {
|
|
21445
|
-
const existing = await ctx.appFilesCollection.query(
|
|
21559
|
+
const existing = await ctx.appFilesCollection.query(import_watermelondb30.Q.where("conversation_id", conversationId), import_watermelondb30.Q.where("path", normalized)).fetch();
|
|
21446
21560
|
if (existing.length > 0) {
|
|
21447
21561
|
await existing[0].update((f) => {
|
|
21448
21562
|
f._setRaw("content", content);
|
|
@@ -21462,11 +21576,11 @@ async function putAppFileOp(ctx, conversationId, path, content) {
|
|
|
21462
21576
|
}
|
|
21463
21577
|
async function getAppFileOp(ctx, conversationId, path) {
|
|
21464
21578
|
const normalized = normalizePath(path);
|
|
21465
|
-
const results = await ctx.appFilesCollection.query(
|
|
21579
|
+
const results = await ctx.appFilesCollection.query(import_watermelondb30.Q.where("conversation_id", conversationId), import_watermelondb30.Q.where("path", normalized)).fetch();
|
|
21466
21580
|
return results.length > 0 ? appFileToStored(results[0]) : null;
|
|
21467
21581
|
}
|
|
21468
21582
|
async function getAppFilesOp(ctx, conversationId) {
|
|
21469
|
-
const results = await ctx.appFilesCollection.query(
|
|
21583
|
+
const results = await ctx.appFilesCollection.query(import_watermelondb30.Q.where("conversation_id", conversationId)).fetch();
|
|
21470
21584
|
return results.map(appFileToStored);
|
|
21471
21585
|
}
|
|
21472
21586
|
async function getAppFileMapOp(ctx, conversationId) {
|
|
@@ -21477,7 +21591,7 @@ async function getAppFileMapOp(ctx, conversationId) {
|
|
|
21477
21591
|
}
|
|
21478
21592
|
async function deleteAppFileOp(ctx, conversationId, path) {
|
|
21479
21593
|
const normalized = normalizePath(path);
|
|
21480
|
-
const results = await ctx.appFilesCollection.query(
|
|
21594
|
+
const results = await ctx.appFilesCollection.query(import_watermelondb30.Q.where("conversation_id", conversationId), import_watermelondb30.Q.where("path", normalized)).fetch();
|
|
21481
21595
|
if (results.length === 0) return false;
|
|
21482
21596
|
await ctx.database.write(async () => {
|
|
21483
21597
|
await results[0].destroyPermanently();
|
|
@@ -21485,7 +21599,7 @@ async function deleteAppFileOp(ctx, conversationId, path) {
|
|
|
21485
21599
|
return true;
|
|
21486
21600
|
}
|
|
21487
21601
|
async function deleteAllAppFilesOp(ctx, conversationId) {
|
|
21488
|
-
const results = await ctx.appFilesCollection.query(
|
|
21602
|
+
const results = await ctx.appFilesCollection.query(import_watermelondb30.Q.where("conversation_id", conversationId)).fetch();
|
|
21489
21603
|
if (results.length === 0) return;
|
|
21490
21604
|
await ctx.database.write(async () => {
|
|
21491
21605
|
const batch = results.map((file) => file.prepareDestroyPermanently());
|
|
@@ -21494,7 +21608,7 @@ async function deleteAllAppFilesOp(ctx, conversationId) {
|
|
|
21494
21608
|
}
|
|
21495
21609
|
|
|
21496
21610
|
// src/lib/db/savedTools/operations.ts
|
|
21497
|
-
var
|
|
21611
|
+
var import_watermelondb31 = require("@nozbe/watermelondb");
|
|
21498
21612
|
function savedToolToStored(tool) {
|
|
21499
21613
|
return {
|
|
21500
21614
|
uniqueId: tool.id,
|
|
@@ -21527,7 +21641,7 @@ async function createSavedToolOp(ctx, opts) {
|
|
|
21527
21641
|
return savedToolToStored(created);
|
|
21528
21642
|
}
|
|
21529
21643
|
async function getAllSavedToolsOp(ctx) {
|
|
21530
|
-
const results = await ctx.savedToolsCollection.query(
|
|
21644
|
+
const results = await ctx.savedToolsCollection.query(import_watermelondb31.Q.where("is_deleted", false), import_watermelondb31.Q.sortBy("created_at", import_watermelondb31.Q.desc)).fetch();
|
|
21531
21645
|
return results.map(savedToolToStored);
|
|
21532
21646
|
}
|
|
21533
21647
|
async function getSavedToolByIdOp(ctx, uniqueId) {
|
|
@@ -24065,9 +24179,9 @@ async function pushConversationToDropbox(database, conversationId, userAddress,
|
|
|
24065
24179
|
const filename = `${conversationId}.json`;
|
|
24066
24180
|
const existingFile = await findDropboxFile(token, filename, backupFolder);
|
|
24067
24181
|
if (existingFile) {
|
|
24068
|
-
const { Q:
|
|
24182
|
+
const { Q: Q17 } = await import("@nozbe/watermelondb");
|
|
24069
24183
|
const conversationsCollection = database.get("conversations");
|
|
24070
|
-
const records = await conversationsCollection.query(
|
|
24184
|
+
const records = await conversationsCollection.query(Q17.where("conversation_id", conversationId)).fetch();
|
|
24071
24185
|
if (records.length > 0) {
|
|
24072
24186
|
const conversation = conversationToStoredRaw(records[0]);
|
|
24073
24187
|
const localUpdated = conversation.updatedAt.getTime();
|
|
@@ -24105,9 +24219,9 @@ async function pushConversationToDropbox(database, conversationId, userAddress,
|
|
|
24105
24219
|
}
|
|
24106
24220
|
async function performDropboxExport(database, userAddress, token, deps, onProgress, backupFolder = DEFAULT_BACKUP_FOLDER) {
|
|
24107
24221
|
await deps.requestEncryptionKey(userAddress);
|
|
24108
|
-
const { Q:
|
|
24222
|
+
const { Q: Q17 } = await import("@nozbe/watermelondb");
|
|
24109
24223
|
const conversationsCollection = database.get("conversations");
|
|
24110
|
-
const records = await conversationsCollection.query(
|
|
24224
|
+
const records = await conversationsCollection.query(Q17.where("is_deleted", false)).fetch();
|
|
24111
24225
|
const conversations = records.map(conversationToStoredRaw);
|
|
24112
24226
|
const total = conversations.length;
|
|
24113
24227
|
if (total === 0) {
|
|
@@ -24748,9 +24862,9 @@ async function pushConversationToDrive(database, conversationId, userAddress, to
|
|
|
24748
24862
|
const filename = `${conversationId}.json`;
|
|
24749
24863
|
const existingFile = await findDriveFile(activeToken, folderId, filename);
|
|
24750
24864
|
if (existingFile) {
|
|
24751
|
-
const { Q:
|
|
24865
|
+
const { Q: Q17 } = await import("@nozbe/watermelondb");
|
|
24752
24866
|
const conversationsCollection = database.get("conversations");
|
|
24753
|
-
const records = await conversationsCollection.query(
|
|
24867
|
+
const records = await conversationsCollection.query(Q17.where("conversation_id", conversationId)).fetch();
|
|
24754
24868
|
if (records.length > 0) {
|
|
24755
24869
|
const conversation = conversationToStoredRaw(records[0]);
|
|
24756
24870
|
const localUpdated = conversation.updatedAt.getTime();
|
|
@@ -24803,9 +24917,9 @@ async function performGoogleDriveExport(database, userAddress, token, deps, onPr
|
|
|
24803
24917
|
return { success: false, uploaded: 0, skipped: 0, total: 0 };
|
|
24804
24918
|
}
|
|
24805
24919
|
const { token: activeToken } = folderResult;
|
|
24806
|
-
const { Q:
|
|
24920
|
+
const { Q: Q17 } = await import("@nozbe/watermelondb");
|
|
24807
24921
|
const conversationsCollection = database.get("conversations");
|
|
24808
|
-
const records = await conversationsCollection.query(
|
|
24922
|
+
const records = await conversationsCollection.query(Q17.where("is_deleted", false)).fetch();
|
|
24809
24923
|
const conversations = records.map(conversationToStoredRaw);
|
|
24810
24924
|
const total = conversations.length;
|
|
24811
24925
|
if (total === 0) {
|
|
@@ -25390,9 +25504,9 @@ async function pushConversationToICloud(database, conversationId, userAddress, d
|
|
|
25390
25504
|
const filename = `${conversationId}.json`;
|
|
25391
25505
|
const existingFile = await findICloudFile(filename);
|
|
25392
25506
|
if (existingFile) {
|
|
25393
|
-
const { Q:
|
|
25507
|
+
const { Q: Q17 } = await import("@nozbe/watermelondb");
|
|
25394
25508
|
const conversationsCollection = database.get("conversations");
|
|
25395
|
-
const records = await conversationsCollection.query(
|
|
25509
|
+
const records = await conversationsCollection.query(Q17.where("conversation_id", conversationId)).fetch();
|
|
25396
25510
|
if (records.length > 0) {
|
|
25397
25511
|
const conversation = conversationToStoredRaw(records[0]);
|
|
25398
25512
|
const localUpdated = conversation.updatedAt.getTime();
|
|
@@ -25422,9 +25536,9 @@ async function pushConversationToICloud(database, conversationId, userAddress, d
|
|
|
25422
25536
|
}
|
|
25423
25537
|
async function performICloudExport(database, userAddress, deps, onProgress) {
|
|
25424
25538
|
await deps.requestEncryptionKey(userAddress);
|
|
25425
|
-
const { Q:
|
|
25539
|
+
const { Q: Q17 } = await import("@nozbe/watermelondb");
|
|
25426
25540
|
const conversationsCollection = database.get("conversations");
|
|
25427
|
-
const records = await conversationsCollection.query(
|
|
25541
|
+
const records = await conversationsCollection.query(Q17.where("is_deleted", false)).fetch();
|
|
25428
25542
|
const conversations = records.map(conversationToStoredRaw);
|
|
25429
25543
|
const total = conversations.length;
|
|
25430
25544
|
if (total === 0) {
|
|
@@ -29328,6 +29442,7 @@ function renderAnumaJsx(jsx3) {
|
|
|
29328
29442
|
clearICloudAuth,
|
|
29329
29443
|
clearKeyPair,
|
|
29330
29444
|
clearLazyTitleCache,
|
|
29445
|
+
clearMemoryTopicsOverrideOp,
|
|
29331
29446
|
clearNotionToken,
|
|
29332
29447
|
clearServerToolsCache,
|
|
29333
29448
|
consoleLogger,
|
|
@@ -29538,6 +29653,7 @@ function renderAnumaJsx(jsx3) {
|
|
|
29538
29653
|
selectServerToolsForPrompt,
|
|
29539
29654
|
serializeJsx,
|
|
29540
29655
|
setLogger,
|
|
29656
|
+
setMemoryEntitiesOp,
|
|
29541
29657
|
settingsStorageSchema,
|
|
29542
29658
|
shouldChunkMessage,
|
|
29543
29659
|
shouldRefreshTools,
|