@anuma/sdk 3.11.3 → 3.11.4
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/server/index.cjs +76 -268
- package/dist/server/index.d.mts +1 -82
- package/dist/server/index.d.ts +1 -82
- package/dist/server/index.mjs +66 -249
- package/package.json +1 -1
package/dist/server/index.cjs
CHANGED
|
@@ -12352,7 +12352,7 @@ var require_Query = __commonJS({
|
|
|
12352
12352
|
var _subscribeToCount = _interopRequireDefault(require_subscribeToCount());
|
|
12353
12353
|
var _subscribeToQuery = _interopRequireDefault(require_subscribeToQuery());
|
|
12354
12354
|
var _subscribeToQueryWithColumns = _interopRequireDefault(require_subscribeToQueryWithColumns());
|
|
12355
|
-
var
|
|
12355
|
+
var Q10 = _interopRequireWildcard(require_QueryDescription());
|
|
12356
12356
|
var _helpers = require_helpers2();
|
|
12357
12357
|
var _class;
|
|
12358
12358
|
var _descriptor;
|
|
@@ -12384,8 +12384,8 @@ var require_Query = __commonJS({
|
|
|
12384
12384
|
(0, _initializerDefineProperty2.default)(this, "_cachedCountSubscribable", _descriptor2, this);
|
|
12385
12385
|
(0, _initializerDefineProperty2.default)(this, "_cachedCountThrottledSubscribable", _descriptor3, this);
|
|
12386
12386
|
this.collection = collection;
|
|
12387
|
-
this._rawDescription =
|
|
12388
|
-
this.description =
|
|
12387
|
+
this._rawDescription = Q10.buildQueryDescription(clauses);
|
|
12388
|
+
this.description = Q10.queryWithoutDeleted(this._rawDescription);
|
|
12389
12389
|
}
|
|
12390
12390
|
var _proto = Query2.prototype;
|
|
12391
12391
|
_proto.extend = function(...args) {
|
|
@@ -12404,12 +12404,12 @@ var require_Query = __commonJS({
|
|
|
12404
12404
|
sql
|
|
12405
12405
|
} = this._rawDescription;
|
|
12406
12406
|
(0, _invariant.default)(!sql, "Cannot extend an unsafe SQL query");
|
|
12407
|
-
return new Query2(collection, [
|
|
12407
|
+
return new Query2(collection, [Q10.experimentalJoinTables(joinTables)].concat((0, _toConsumableArray2.default)(nestedJoinTables.map(function({
|
|
12408
12408
|
from,
|
|
12409
12409
|
to
|
|
12410
12410
|
}) {
|
|
12411
|
-
return
|
|
12412
|
-
})), (0, _toConsumableArray2.default)(where), (0, _toConsumableArray2.default)(sortBy), (0, _toConsumableArray2.default)(take ? [
|
|
12411
|
+
return Q10.experimentalNestedJoin(from, to);
|
|
12412
|
+
})), (0, _toConsumableArray2.default)(where), (0, _toConsumableArray2.default)(sortBy), (0, _toConsumableArray2.default)(take ? [Q10.take(take)] : []), (0, _toConsumableArray2.default)(skip ? [Q10.skip(skip)] : []), (0, _toConsumableArray2.default)(lokiTransform ? [Q10.unsafeLokiTransform(lokiTransform)] : []), (0, _toConsumableArray2.default)(clauses)));
|
|
12413
12413
|
};
|
|
12414
12414
|
_proto.pipe = function(transform) {
|
|
12415
12415
|
return transform(this);
|
|
@@ -13851,7 +13851,7 @@ var require_helpers5 = __commonJS({
|
|
|
13851
13851
|
exports2.createTimestampsFor = void 0;
|
|
13852
13852
|
exports2.fetchDescendants = fetchDescendants;
|
|
13853
13853
|
var _fp = require_fp();
|
|
13854
|
-
var
|
|
13854
|
+
var Q10 = _interopRequireWildcard(require_QueryDescription());
|
|
13855
13855
|
function _getRequireWildcardCache(e) {
|
|
13856
13856
|
if ("function" != typeof WeakMap) return null;
|
|
13857
13857
|
var r = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
|
|
@@ -13889,7 +13889,7 @@ var require_helpers5 = __commonJS({
|
|
|
13889
13889
|
});
|
|
13890
13890
|
var childrenQueries = hasManyAssociations.map(function([key, value]) {
|
|
13891
13891
|
var childCollection = model.collections.get(key);
|
|
13892
|
-
return childCollection.query(
|
|
13892
|
+
return childCollection.query(Q10.where(value.foreignKey, model.id));
|
|
13893
13893
|
});
|
|
13894
13894
|
return childrenQueries;
|
|
13895
13895
|
}
|
|
@@ -14270,8 +14270,8 @@ var require_watermelondb = __commonJS({
|
|
|
14270
14270
|
var _interopRequireDefault = require_interopRequireDefault();
|
|
14271
14271
|
exports2.__esModule = true;
|
|
14272
14272
|
exports2.tableSchema = exports2.tableName = exports2.localStorageKey = exports2.columnName = exports2.associations = exports2.appSchema = exports2.Relation = exports2.Query = exports2.Q = exports2.Model = exports2.Database = exports2.Collection = void 0;
|
|
14273
|
-
var
|
|
14274
|
-
exports2.Q =
|
|
14273
|
+
var Q10 = _interopRequireWildcard(require_QueryDescription());
|
|
14274
|
+
exports2.Q = Q10;
|
|
14275
14275
|
var _Collection = _interopRequireDefault(require_Collection());
|
|
14276
14276
|
exports2.Collection = _Collection.default;
|
|
14277
14277
|
var _Database = _interopRequireDefault(require_Database());
|
|
@@ -14475,7 +14475,7 @@ var require_children = __commonJS({
|
|
|
14475
14475
|
var _makeDecorator = _interopRequireDefault(require_makeDecorator());
|
|
14476
14476
|
var _logError = _interopRequireDefault(require_logError());
|
|
14477
14477
|
var _invariant = _interopRequireDefault(require_invariant());
|
|
14478
|
-
var
|
|
14478
|
+
var Q10 = _interopRequireWildcard(require_QueryDescription());
|
|
14479
14479
|
function _getRequireWildcardCache(e) {
|
|
14480
14480
|
if ("function" != typeof WeakMap) return null;
|
|
14481
14481
|
var r = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
|
|
@@ -14509,7 +14509,7 @@ var require_children = __commonJS({
|
|
|
14509
14509
|
var childCollection = model.collections.get(childTable);
|
|
14510
14510
|
var association = model.constructor.associations[childTable];
|
|
14511
14511
|
(0, _invariant.default)(association && "has_many" === association.type, "@children decorator used for a table that's not has_many");
|
|
14512
|
-
var query = childCollection.query(
|
|
14512
|
+
var query = childCollection.query(Q10.where(association.foreignKey, model.id));
|
|
14513
14513
|
that._childrenQueryCache[childTable] = query;
|
|
14514
14514
|
return query;
|
|
14515
14515
|
},
|
|
@@ -23211,7 +23211,6 @@ __export(index_exports, {
|
|
|
23211
23211
|
TextProcessor: () => TextProcessor,
|
|
23212
23212
|
UserPreference: () => UserPreference,
|
|
23213
23213
|
VAULT_SIZE_HOP_CAP: () => VAULT_SIZE_HOP_CAP,
|
|
23214
|
-
VaultFolder: () => VaultFolder,
|
|
23215
23214
|
VaultMemory: () => VaultMemory,
|
|
23216
23215
|
WalletPoller: () => WalletPoller,
|
|
23217
23216
|
WordProcessor: () => WordProcessor,
|
|
@@ -23267,7 +23266,6 @@ __export(index_exports, {
|
|
|
23267
23266
|
createStockPricePreProcessor: () => createStockPricePreProcessor,
|
|
23268
23267
|
createSummaryContext: () => createSummaryContext,
|
|
23269
23268
|
createVaultEmbeddingCache: () => createVaultEmbeddingCache,
|
|
23270
|
-
createVaultFolderOp: () => createVaultFolderOp,
|
|
23271
23269
|
createVaultMemoriesBatchOp: () => createVaultMemoriesBatchOp,
|
|
23272
23270
|
createVaultMemoryOp: () => createVaultMemoryOp,
|
|
23273
23271
|
createWeatherPreProcessor: () => createWeatherPreProcessor,
|
|
@@ -23288,7 +23286,6 @@ __export(index_exports, {
|
|
|
23288
23286
|
deleteModelPreferenceOp: () => deleteModelPreferenceOp,
|
|
23289
23287
|
deleteProjectOp: () => deleteProjectOp,
|
|
23290
23288
|
deleteUserPreferenceOp: () => deleteUserPreferenceOp,
|
|
23291
|
-
deleteVaultFolderOp: () => deleteVaultFolderOp,
|
|
23292
23289
|
deleteVaultMemoryOp: () => deleteVaultMemoryOp,
|
|
23293
23290
|
eagerEmbedContent: () => eagerEmbedContent,
|
|
23294
23291
|
embedAllMessages: () => embedAllMessages,
|
|
@@ -23297,7 +23294,6 @@ __export(index_exports, {
|
|
|
23297
23294
|
encryptDataBatch: () => encryptDataBatch,
|
|
23298
23295
|
encryptDataBytes: () => encryptDataBytes,
|
|
23299
23296
|
encryptDataWithKey: () => encryptDataWithKey,
|
|
23300
|
-
ensureDefaultFoldersOp: () => ensureDefaultFoldersOp,
|
|
23301
23297
|
estimateMessagesTokens: () => estimateMessagesTokens,
|
|
23302
23298
|
estimateTokens: () => estimateTokens,
|
|
23303
23299
|
exportPublicKey: () => exportPublicKey,
|
|
@@ -23313,7 +23309,6 @@ __export(index_exports, {
|
|
|
23313
23309
|
generateProjectId: () => generateProjectId,
|
|
23314
23310
|
getAIGeneratedMediaOp: () => getAIGeneratedMediaOp,
|
|
23315
23311
|
getAllFilesOp: () => getAllFilesOp,
|
|
23316
|
-
getAllVaultFoldersOp: () => getAllVaultFoldersOp,
|
|
23317
23312
|
getAllVaultMemoriesOp: () => getAllVaultMemoriesOp,
|
|
23318
23313
|
getAllVaultMemoryContentsOp: () => getAllVaultMemoryContentsOp,
|
|
23319
23314
|
getAudioOp: () => getAudioOp,
|
|
@@ -23356,7 +23351,6 @@ __export(index_exports, {
|
|
|
23356
23351
|
getUnfiledVaultMemoriesOp: () => getUnfiledVaultMemoriesOp,
|
|
23357
23352
|
getUserPreferenceOp: () => getUserPreferenceOp,
|
|
23358
23353
|
getUserUploadedMediaOp: () => getUserUploadedMediaOp,
|
|
23359
|
-
getVaultFolderMemoryCountOp: () => getVaultFolderMemoryCountOp,
|
|
23360
23354
|
getVaultMemoryOp: () => getVaultMemoryOp,
|
|
23361
23355
|
getVideosOp: () => getVideosOp,
|
|
23362
23356
|
hardDeleteDecayedOp: () => hardDeleteDecayedOp,
|
|
@@ -23372,7 +23366,6 @@ __export(index_exports, {
|
|
|
23372
23366
|
maybeSummarizeHistory: () => maybeSummarizeHistory,
|
|
23373
23367
|
mediaToStored: () => mediaToStored,
|
|
23374
23368
|
migrateFromModelPreferencesOp: () => migrateFromModelPreferencesOp,
|
|
23375
|
-
moveMemoriesToFolderOp: () => moveMemoriesToFolderOp,
|
|
23376
23369
|
onKeyAvailable: () => onKeyAvailable,
|
|
23377
23370
|
preEmbedVaultMemories: () => preEmbedVaultMemories,
|
|
23378
23371
|
preprocessFiles: () => preprocessFiles,
|
|
@@ -23433,8 +23426,6 @@ __export(index_exports, {
|
|
|
23433
23426
|
updateProfileOp: () => updateProfileOp,
|
|
23434
23427
|
updateProjectNameOp: () => updateProjectNameOp,
|
|
23435
23428
|
updateProjectOp: () => updateProjectOp,
|
|
23436
|
-
updateVaultFolderContextOp: () => updateVaultFolderContextOp,
|
|
23437
|
-
updateVaultFolderOp: () => updateVaultFolderOp,
|
|
23438
23429
|
updateVaultMemoryEmbeddingOp: () => updateVaultMemoryEmbeddingOp,
|
|
23439
23430
|
updateVaultMemoryOp: () => updateVaultMemoryOp,
|
|
23440
23431
|
upsertConversationSummaryOp: () => upsertConversationSummaryOp,
|
|
@@ -26115,182 +26106,8 @@ async function cleanupConversationSummary(database, conversationId) {
|
|
|
26115
26106
|
// src/lib/db/memoryVault/index.ts
|
|
26116
26107
|
init_operations3();
|
|
26117
26108
|
|
|
26118
|
-
// src/lib/db/vaultFolders/operations.ts
|
|
26119
|
-
var import_watermelondb18 = __toESM(require_watermelondb());
|
|
26120
|
-
function folderToStored(folder) {
|
|
26121
|
-
return {
|
|
26122
|
-
uniqueId: folder.id,
|
|
26123
|
-
name: folder.name,
|
|
26124
|
-
scope: folder.scope,
|
|
26125
|
-
createdAt: folder.createdAt,
|
|
26126
|
-
updatedAt: folder.updatedAt,
|
|
26127
|
-
isDeleted: folder.isDeleted,
|
|
26128
|
-
isSystem: folder.isSystem ?? false,
|
|
26129
|
-
context: folder.context ?? null
|
|
26130
|
-
};
|
|
26131
|
-
}
|
|
26132
|
-
async function createVaultFolderOp(ctx, opts) {
|
|
26133
|
-
const created = await ctx.database.write(async () => {
|
|
26134
|
-
return ctx.vaultFolderCollection.create((record) => {
|
|
26135
|
-
record._setRaw("name", opts.name);
|
|
26136
|
-
record._setRaw("scope", opts.scope ?? "private");
|
|
26137
|
-
record._setRaw("is_system", opts.isSystem ?? false);
|
|
26138
|
-
record._setRaw("is_deleted", false);
|
|
26139
|
-
});
|
|
26140
|
-
});
|
|
26141
|
-
return folderToStored(created);
|
|
26142
|
-
}
|
|
26143
|
-
async function getAllVaultFoldersOp(ctx) {
|
|
26144
|
-
const results = await ctx.vaultFolderCollection.query(import_watermelondb18.Q.where("is_deleted", false), import_watermelondb18.Q.sortBy("created_at", import_watermelondb18.Q.desc)).fetch();
|
|
26145
|
-
return results.map(folderToStored);
|
|
26146
|
-
}
|
|
26147
|
-
async function updateVaultFolderOp(ctx, id, opts) {
|
|
26148
|
-
try {
|
|
26149
|
-
const record = await ctx.vaultFolderCollection.find(id);
|
|
26150
|
-
if (record.isDeleted) return null;
|
|
26151
|
-
const scopeChanged = opts.scope !== void 0 && opts.scope !== record.scope;
|
|
26152
|
-
const updated = await ctx.database.write(async () => {
|
|
26153
|
-
const memories = scopeChanged ? await ctx.vaultMemoryCollection.query(import_watermelondb18.Q.where("folder_id", id), import_watermelondb18.Q.where("is_deleted", false)).fetch() : [];
|
|
26154
|
-
const updates = [];
|
|
26155
|
-
updates.push(
|
|
26156
|
-
record.prepareUpdate((r) => {
|
|
26157
|
-
if (opts.name !== void 0) r._setRaw("name", opts.name);
|
|
26158
|
-
if (opts.scope !== void 0) r._setRaw("scope", opts.scope);
|
|
26159
|
-
})
|
|
26160
|
-
);
|
|
26161
|
-
for (const memory of memories) {
|
|
26162
|
-
updates.push(
|
|
26163
|
-
memory.prepareUpdate((r) => {
|
|
26164
|
-
r._setRaw("scope", opts.scope);
|
|
26165
|
-
})
|
|
26166
|
-
);
|
|
26167
|
-
}
|
|
26168
|
-
await ctx.database.batch(...updates);
|
|
26169
|
-
return ctx.vaultFolderCollection.find(id);
|
|
26170
|
-
});
|
|
26171
|
-
return folderToStored(updated);
|
|
26172
|
-
} catch {
|
|
26173
|
-
return null;
|
|
26174
|
-
}
|
|
26175
|
-
}
|
|
26176
|
-
async function deleteVaultFolderOp(ctx, id) {
|
|
26177
|
-
try {
|
|
26178
|
-
const record = await ctx.vaultFolderCollection.find(id);
|
|
26179
|
-
if (record.isDeleted) return false;
|
|
26180
|
-
await ctx.database.write(async () => {
|
|
26181
|
-
const memories = await ctx.vaultMemoryCollection.query(import_watermelondb18.Q.where("folder_id", id), import_watermelondb18.Q.where("is_deleted", false)).fetch();
|
|
26182
|
-
const preparedMemories = memories.map(
|
|
26183
|
-
(memory) => memory.prepareUpdate((r) => {
|
|
26184
|
-
r._setRaw("folder_id", null);
|
|
26185
|
-
r._setRaw("scope", "private");
|
|
26186
|
-
})
|
|
26187
|
-
);
|
|
26188
|
-
const preparedFolder = record.prepareUpdate((r) => {
|
|
26189
|
-
r._setRaw("is_deleted", true);
|
|
26190
|
-
});
|
|
26191
|
-
await ctx.database.batch(...preparedMemories, preparedFolder);
|
|
26192
|
-
});
|
|
26193
|
-
return true;
|
|
26194
|
-
} catch {
|
|
26195
|
-
return false;
|
|
26196
|
-
}
|
|
26197
|
-
}
|
|
26198
|
-
async function moveMemoriesToFolderOp(ctx, memoryIds, folderId) {
|
|
26199
|
-
if (memoryIds.length === 0) return true;
|
|
26200
|
-
try {
|
|
26201
|
-
let targetScope = "private";
|
|
26202
|
-
if (folderId) {
|
|
26203
|
-
const folder = await ctx.vaultFolderCollection.find(folderId);
|
|
26204
|
-
if (folder.isDeleted) return false;
|
|
26205
|
-
targetScope = folder.scope;
|
|
26206
|
-
}
|
|
26207
|
-
let movedCount = 0;
|
|
26208
|
-
await ctx.database.write(async () => {
|
|
26209
|
-
const memories = [];
|
|
26210
|
-
for (const id of memoryIds) {
|
|
26211
|
-
try {
|
|
26212
|
-
const m = await ctx.vaultMemoryCollection.find(id);
|
|
26213
|
-
if (!m.isDeleted) memories.push(m);
|
|
26214
|
-
} catch {
|
|
26215
|
-
}
|
|
26216
|
-
}
|
|
26217
|
-
if (memories.length === 0) return;
|
|
26218
|
-
const prepared = memories.map(
|
|
26219
|
-
(memory) => memory.prepareUpdate((r) => {
|
|
26220
|
-
r._setRaw("folder_id", folderId);
|
|
26221
|
-
r._setRaw("scope", targetScope);
|
|
26222
|
-
})
|
|
26223
|
-
);
|
|
26224
|
-
await ctx.database.batch(...prepared);
|
|
26225
|
-
movedCount = memories.length;
|
|
26226
|
-
});
|
|
26227
|
-
return movedCount > 0;
|
|
26228
|
-
} catch {
|
|
26229
|
-
return false;
|
|
26230
|
-
}
|
|
26231
|
-
}
|
|
26232
|
-
async function updateVaultFolderContextOp(ctx, id, context) {
|
|
26233
|
-
try {
|
|
26234
|
-
const record = await ctx.vaultFolderCollection.find(id);
|
|
26235
|
-
if (record.isDeleted) return null;
|
|
26236
|
-
const updated = await ctx.database.write(async () => {
|
|
26237
|
-
await ctx.database.batch(
|
|
26238
|
-
record.prepareUpdate((r) => {
|
|
26239
|
-
r._setRaw("context", context);
|
|
26240
|
-
})
|
|
26241
|
-
);
|
|
26242
|
-
return ctx.vaultFolderCollection.find(id);
|
|
26243
|
-
});
|
|
26244
|
-
return folderToStored(updated);
|
|
26245
|
-
} catch {
|
|
26246
|
-
return null;
|
|
26247
|
-
}
|
|
26248
|
-
}
|
|
26249
|
-
async function getVaultFolderMemoryCountOp(ctx, folderId) {
|
|
26250
|
-
return await ctx.vaultMemoryCollection.query(import_watermelondb18.Q.where("folder_id", folderId), import_watermelondb18.Q.where("is_deleted", false)).fetchCount();
|
|
26251
|
-
}
|
|
26252
|
-
|
|
26253
|
-
// src/lib/db/vaultFolders/defaults.ts
|
|
26254
|
-
var DEFAULT_FOLDER_NAMES = ["Personal", "Work", "Interests"];
|
|
26255
|
-
var ensureDefaultFoldersLocks = /* @__PURE__ */ new WeakMap();
|
|
26256
|
-
async function ensureDefaultFoldersOp(ctx) {
|
|
26257
|
-
const existing = ensureDefaultFoldersLocks.get(ctx.database);
|
|
26258
|
-
if (existing) return existing;
|
|
26259
|
-
const promise = _ensureDefaultFoldersImpl(ctx);
|
|
26260
|
-
ensureDefaultFoldersLocks.set(ctx.database, promise);
|
|
26261
|
-
try {
|
|
26262
|
-
return await promise;
|
|
26263
|
-
} finally {
|
|
26264
|
-
ensureDefaultFoldersLocks.delete(ctx.database);
|
|
26265
|
-
}
|
|
26266
|
-
}
|
|
26267
|
-
async function _ensureDefaultFoldersImpl(ctx) {
|
|
26268
|
-
const existing = await getAllVaultFoldersOp(ctx);
|
|
26269
|
-
const folderMap = /* @__PURE__ */ new Map();
|
|
26270
|
-
const existingByName = new Map(existing.map((f) => [f.name, f]));
|
|
26271
|
-
for (const name of DEFAULT_FOLDER_NAMES) {
|
|
26272
|
-
const found = existingByName.get(name);
|
|
26273
|
-
if (found) {
|
|
26274
|
-
folderMap.set(found.name, found.uniqueId);
|
|
26275
|
-
} else {
|
|
26276
|
-
const created = await createVaultFolderOp(ctx, {
|
|
26277
|
-
name,
|
|
26278
|
-
scope: "private",
|
|
26279
|
-
isSystem: true
|
|
26280
|
-
});
|
|
26281
|
-
folderMap.set(created.name, created.uniqueId);
|
|
26282
|
-
}
|
|
26283
|
-
}
|
|
26284
|
-
for (const folder of existing) {
|
|
26285
|
-
if (!folderMap.has(folder.name)) {
|
|
26286
|
-
folderMap.set(folder.name, folder.uniqueId);
|
|
26287
|
-
}
|
|
26288
|
-
}
|
|
26289
|
-
return folderMap;
|
|
26290
|
-
}
|
|
26291
|
-
|
|
26292
26109
|
// src/lib/db/project/operations.ts
|
|
26293
|
-
var
|
|
26110
|
+
var import_watermelondb18 = __toESM(require_watermelondb());
|
|
26294
26111
|
init_operations();
|
|
26295
26112
|
|
|
26296
26113
|
// src/lib/db/project/types.ts
|
|
@@ -26322,15 +26139,15 @@ async function createProjectOp(ctx, opts, defaultName = "New Project") {
|
|
|
26322
26139
|
return projectToStored(created);
|
|
26323
26140
|
}
|
|
26324
26141
|
async function getProjectOp(ctx, id) {
|
|
26325
|
-
const results = await ctx.projectsCollection.query(
|
|
26142
|
+
const results = await ctx.projectsCollection.query(import_watermelondb18.Q.where("project_id", id), import_watermelondb18.Q.where("is_deleted", false)).fetch();
|
|
26326
26143
|
return results.length > 0 ? projectToStored(results[0]) : null;
|
|
26327
26144
|
}
|
|
26328
26145
|
async function getProjectsOp(ctx) {
|
|
26329
|
-
const results = await ctx.projectsCollection.query(
|
|
26146
|
+
const results = await ctx.projectsCollection.query(import_watermelondb18.Q.where("is_deleted", false), import_watermelondb18.Q.sortBy("created_at", import_watermelondb18.Q.desc)).fetch();
|
|
26330
26147
|
return results.map(projectToStored);
|
|
26331
26148
|
}
|
|
26332
26149
|
async function updateProjectNameOp(ctx, id, name) {
|
|
26333
|
-
const results = await ctx.projectsCollection.query(
|
|
26150
|
+
const results = await ctx.projectsCollection.query(import_watermelondb18.Q.where("project_id", id), import_watermelondb18.Q.where("is_deleted", false)).fetch();
|
|
26334
26151
|
if (results.length > 0) {
|
|
26335
26152
|
await ctx.database.write(async () => {
|
|
26336
26153
|
await results[0].update((proj) => {
|
|
@@ -26342,7 +26159,7 @@ async function updateProjectNameOp(ctx, id, name) {
|
|
|
26342
26159
|
return false;
|
|
26343
26160
|
}
|
|
26344
26161
|
async function updateProjectOp(ctx, id, opts) {
|
|
26345
|
-
const results = await ctx.projectsCollection.query(
|
|
26162
|
+
const results = await ctx.projectsCollection.query(import_watermelondb18.Q.where("project_id", id), import_watermelondb18.Q.where("is_deleted", false)).fetch();
|
|
26346
26163
|
if (results.length > 0) {
|
|
26347
26164
|
await ctx.database.write(async () => {
|
|
26348
26165
|
await results[0].update((proj) => {
|
|
@@ -26354,7 +26171,7 @@ async function updateProjectOp(ctx, id, opts) {
|
|
|
26354
26171
|
return false;
|
|
26355
26172
|
}
|
|
26356
26173
|
async function deleteProjectOp(ctx, id) {
|
|
26357
|
-
const results = await ctx.projectsCollection.query(
|
|
26174
|
+
const results = await ctx.projectsCollection.query(import_watermelondb18.Q.where("project_id", id), import_watermelondb18.Q.where("is_deleted", false)).fetch();
|
|
26358
26175
|
if (results.length > 0) {
|
|
26359
26176
|
await ctx.database.write(async () => {
|
|
26360
26177
|
await results[0].update((proj) => {
|
|
@@ -26367,14 +26184,14 @@ async function deleteProjectOp(ctx, id) {
|
|
|
26367
26184
|
}
|
|
26368
26185
|
async function getProjectConversationsOp(ctx, projectId) {
|
|
26369
26186
|
const results = await ctx.conversationsCollection.query(
|
|
26370
|
-
|
|
26371
|
-
|
|
26372
|
-
|
|
26187
|
+
import_watermelondb18.Q.where("project_id", projectId),
|
|
26188
|
+
import_watermelondb18.Q.where("is_deleted", false),
|
|
26189
|
+
import_watermelondb18.Q.sortBy("created_at", import_watermelondb18.Q.desc)
|
|
26373
26190
|
).fetch();
|
|
26374
26191
|
return results.map(conversationToStoredRaw);
|
|
26375
26192
|
}
|
|
26376
26193
|
async function getProjectConversationCountOp(ctx, projectId) {
|
|
26377
|
-
return await ctx.conversationsCollection.query(
|
|
26194
|
+
return await ctx.conversationsCollection.query(import_watermelondb18.Q.where("project_id", projectId), import_watermelondb18.Q.where("is_deleted", false)).fetchCount();
|
|
26378
26195
|
}
|
|
26379
26196
|
|
|
26380
26197
|
// src/lib/db/media/types.ts
|
|
@@ -26401,7 +26218,7 @@ function isSupportedMediaType(mimeType) {
|
|
|
26401
26218
|
}
|
|
26402
26219
|
|
|
26403
26220
|
// src/lib/db/media/operations.ts
|
|
26404
|
-
var
|
|
26221
|
+
var import_watermelondb19 = __toESM(require_watermelondb());
|
|
26405
26222
|
init_logger();
|
|
26406
26223
|
|
|
26407
26224
|
// src/lib/storage/mcpImages.ts
|
|
@@ -26635,7 +26452,7 @@ async function createMediaBatchOp(ctx, optionsArray) {
|
|
|
26635
26452
|
})
|
|
26636
26453
|
);
|
|
26637
26454
|
});
|
|
26638
|
-
const results = await mediaCollection.query(
|
|
26455
|
+
const results = await mediaCollection.query(import_watermelondb19.Q.where("media_id", import_watermelondb19.Q.oneOf(mediaIds))).fetch();
|
|
26639
26456
|
return Promise.all(
|
|
26640
26457
|
results.map(
|
|
26641
26458
|
(m) => mediaToStored(m, ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner)
|
|
@@ -26644,21 +26461,21 @@ async function createMediaBatchOp(ctx, optionsArray) {
|
|
|
26644
26461
|
}
|
|
26645
26462
|
async function getMediaByIdOp(ctx, mediaId) {
|
|
26646
26463
|
const mediaCollection = ctx.database.get("media");
|
|
26647
|
-
const results = await mediaCollection.query(
|
|
26464
|
+
const results = await mediaCollection.query(import_watermelondb19.Q.where("media_id", mediaId), import_watermelondb19.Q.where("is_deleted", false)).fetch();
|
|
26648
26465
|
return results.length > 0 ? await mediaToStored(results[0], ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner) : null;
|
|
26649
26466
|
}
|
|
26650
26467
|
async function getMediaBySourceUrlOp(ctx, sourceUrl, walletAddress) {
|
|
26651
26468
|
const mediaCollection = ctx.database.get("media");
|
|
26652
26469
|
const results = await mediaCollection.query(
|
|
26653
|
-
|
|
26654
|
-
|
|
26655
|
-
|
|
26470
|
+
import_watermelondb19.Q.where("source_url", sourceUrl),
|
|
26471
|
+
import_watermelondb19.Q.where("wallet_address", walletAddress),
|
|
26472
|
+
import_watermelondb19.Q.where("is_deleted", false)
|
|
26656
26473
|
).fetch();
|
|
26657
26474
|
return results.length > 0 ? await mediaToStored(results[0], ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner) : null;
|
|
26658
26475
|
}
|
|
26659
26476
|
async function updateMediaOp(ctx, mediaId, options) {
|
|
26660
26477
|
const mediaCollection = ctx.database.get("media");
|
|
26661
|
-
const results = await mediaCollection.query(
|
|
26478
|
+
const results = await mediaCollection.query(import_watermelondb19.Q.where("media_id", mediaId)).fetch();
|
|
26662
26479
|
if (results.length === 0) {
|
|
26663
26480
|
return null;
|
|
26664
26481
|
}
|
|
@@ -26678,7 +26495,7 @@ async function updateMediaOp(ctx, mediaId, options) {
|
|
|
26678
26495
|
m._setRaw("updated_at", now);
|
|
26679
26496
|
});
|
|
26680
26497
|
});
|
|
26681
|
-
const updated = await mediaCollection.query(
|
|
26498
|
+
const updated = await mediaCollection.query(import_watermelondb19.Q.where("media_id", mediaId)).fetch();
|
|
26682
26499
|
return updated.length > 0 ? await mediaToStored(updated[0], ctx.walletAddress, ctx.signMessage, ctx.embeddedWalletSigner) : null;
|
|
26683
26500
|
}
|
|
26684
26501
|
async function updateMediaMessageIdBatchOp(ctx, mediaIds, messageId) {
|
|
@@ -26686,7 +26503,7 @@ async function updateMediaMessageIdBatchOp(ctx, mediaIds, messageId) {
|
|
|
26686
26503
|
return 0;
|
|
26687
26504
|
}
|
|
26688
26505
|
const mediaCollection = ctx.database.get("media");
|
|
26689
|
-
const results = await mediaCollection.query(
|
|
26506
|
+
const results = await mediaCollection.query(import_watermelondb19.Q.where("media_id", import_watermelondb19.Q.oneOf(mediaIds))).fetch();
|
|
26690
26507
|
if (results.length === 0) {
|
|
26691
26508
|
return 0;
|
|
26692
26509
|
}
|
|
@@ -26708,13 +26525,13 @@ var IMAGE_VIDEO_MIMES = VIDEO_EXTENSIONS.map((ext) => `image/${ext}`);
|
|
|
26708
26525
|
async function relinkMisclassifiedVideosOp(ctx, walletAddress) {
|
|
26709
26526
|
const mediaCollection = ctx.database.get("media");
|
|
26710
26527
|
const candidates = await mediaCollection.query(
|
|
26711
|
-
|
|
26712
|
-
|
|
26713
|
-
|
|
26714
|
-
|
|
26715
|
-
|
|
26716
|
-
...IMAGE_VIDEO_MIMES.map((m) =>
|
|
26717
|
-
|
|
26528
|
+
import_watermelondb19.Q.where("wallet_address", walletAddress),
|
|
26529
|
+
import_watermelondb19.Q.where("is_deleted", false),
|
|
26530
|
+
import_watermelondb19.Q.where("media_type", "image"),
|
|
26531
|
+
import_watermelondb19.Q.or(
|
|
26532
|
+
import_watermelondb19.Q.where("mime_type", import_watermelondb19.Q.like("video/%")),
|
|
26533
|
+
...IMAGE_VIDEO_MIMES.map((m) => import_watermelondb19.Q.where("mime_type", m)),
|
|
26534
|
+
import_watermelondb19.Q.where("mime_type", "application/octet-stream")
|
|
26718
26535
|
)
|
|
26719
26536
|
).fetch();
|
|
26720
26537
|
if (candidates.length === 0) {
|
|
@@ -26763,7 +26580,7 @@ async function relinkMisclassifiedVideosOp(ctx, walletAddress) {
|
|
|
26763
26580
|
}
|
|
26764
26581
|
async function deleteMediaOp(ctx, mediaId) {
|
|
26765
26582
|
const mediaCollection = ctx.database.get("media");
|
|
26766
|
-
const results = await mediaCollection.query(
|
|
26583
|
+
const results = await mediaCollection.query(import_watermelondb19.Q.where("media_id", mediaId)).fetch();
|
|
26767
26584
|
if (results.length === 0) {
|
|
26768
26585
|
return false;
|
|
26769
26586
|
}
|
|
@@ -26781,7 +26598,7 @@ async function deleteMediaOp(ctx, mediaId) {
|
|
|
26781
26598
|
}
|
|
26782
26599
|
async function hardDeleteMediaOp(ctx, mediaId) {
|
|
26783
26600
|
const mediaCollection = ctx.database.get("media");
|
|
26784
|
-
const results = await mediaCollection.query(
|
|
26601
|
+
const results = await mediaCollection.query(import_watermelondb19.Q.where("media_id", mediaId)).fetch();
|
|
26785
26602
|
if (results.length === 0) {
|
|
26786
26603
|
return false;
|
|
26787
26604
|
}
|
|
@@ -26793,28 +26610,28 @@ async function hardDeleteMediaOp(ctx, mediaId) {
|
|
|
26793
26610
|
}
|
|
26794
26611
|
async function getMediaOp(ctx, filters) {
|
|
26795
26612
|
const mediaCollection = ctx.database.get("media");
|
|
26796
|
-
const conditions = [
|
|
26613
|
+
const conditions = [import_watermelondb19.Q.where("wallet_address", filters.walletAddress)];
|
|
26797
26614
|
if (!filters.includeDeleted) {
|
|
26798
|
-
conditions.push(
|
|
26615
|
+
conditions.push(import_watermelondb19.Q.where("is_deleted", false));
|
|
26799
26616
|
}
|
|
26800
26617
|
if (filters.mediaType) {
|
|
26801
|
-
conditions.push(
|
|
26618
|
+
conditions.push(import_watermelondb19.Q.where("media_type", filters.mediaType));
|
|
26802
26619
|
}
|
|
26803
26620
|
if (filters.role) {
|
|
26804
|
-
conditions.push(
|
|
26621
|
+
conditions.push(import_watermelondb19.Q.where("role", filters.role));
|
|
26805
26622
|
}
|
|
26806
26623
|
if (filters.conversationId) {
|
|
26807
|
-
conditions.push(
|
|
26624
|
+
conditions.push(import_watermelondb19.Q.where("conversation_id", filters.conversationId));
|
|
26808
26625
|
}
|
|
26809
26626
|
if (filters.model) {
|
|
26810
|
-
conditions.push(
|
|
26627
|
+
conditions.push(import_watermelondb19.Q.where("model", filters.model));
|
|
26811
26628
|
}
|
|
26812
|
-
conditions.push(
|
|
26629
|
+
conditions.push(import_watermelondb19.Q.sortBy("created_at", import_watermelondb19.Q.desc));
|
|
26813
26630
|
if (filters.limit) {
|
|
26814
|
-
conditions.push(
|
|
26631
|
+
conditions.push(import_watermelondb19.Q.take(filters.limit));
|
|
26815
26632
|
}
|
|
26816
26633
|
if (filters.offset) {
|
|
26817
|
-
conditions.push(
|
|
26634
|
+
conditions.push(import_watermelondb19.Q.skip(filters.offset));
|
|
26818
26635
|
}
|
|
26819
26636
|
const results = await mediaCollection.query(...conditions).fetch();
|
|
26820
26637
|
return Promise.all(
|
|
@@ -26844,9 +26661,9 @@ async function getMediaByConversationOp(ctx, walletAddress, conversationId, limi
|
|
|
26844
26661
|
async function getMediaByMessageOp(ctx, messageId) {
|
|
26845
26662
|
const mediaCollection = ctx.database.get("media");
|
|
26846
26663
|
const results = await mediaCollection.query(
|
|
26847
|
-
|
|
26848
|
-
|
|
26849
|
-
|
|
26664
|
+
import_watermelondb19.Q.where("message_id", messageId),
|
|
26665
|
+
import_watermelondb19.Q.where("is_deleted", false),
|
|
26666
|
+
import_watermelondb19.Q.sortBy("created_at", import_watermelondb19.Q.asc)
|
|
26850
26667
|
).fetch();
|
|
26851
26668
|
return Promise.all(
|
|
26852
26669
|
results.map(
|
|
@@ -26859,9 +26676,9 @@ async function getMediaByIdsOp(ctx, mediaIds, includeDeleted = false) {
|
|
|
26859
26676
|
return [];
|
|
26860
26677
|
}
|
|
26861
26678
|
const mediaCollection = ctx.database.get("media");
|
|
26862
|
-
const conditions = [
|
|
26679
|
+
const conditions = [import_watermelondb19.Q.where("media_id", import_watermelondb19.Q.oneOf(mediaIds))];
|
|
26863
26680
|
if (!includeDeleted) {
|
|
26864
|
-
conditions.push(
|
|
26681
|
+
conditions.push(import_watermelondb19.Q.where("is_deleted", false));
|
|
26865
26682
|
}
|
|
26866
26683
|
const results = await mediaCollection.query(...conditions).fetch();
|
|
26867
26684
|
const mediaMap = new Map(results.map((m) => [m.mediaId, m]));
|
|
@@ -26898,10 +26715,10 @@ async function searchMediaOp(ctx, walletAddress, query, limit) {
|
|
|
26898
26715
|
const queryLower = query.toLowerCase();
|
|
26899
26716
|
const MAX_SEARCH_RECORDS = 500;
|
|
26900
26717
|
const allResults = await mediaCollection.query(
|
|
26901
|
-
|
|
26902
|
-
|
|
26903
|
-
|
|
26904
|
-
|
|
26718
|
+
import_watermelondb19.Q.where("wallet_address", walletAddress),
|
|
26719
|
+
import_watermelondb19.Q.where("is_deleted", false),
|
|
26720
|
+
import_watermelondb19.Q.sortBy("created_at", import_watermelondb19.Q.desc),
|
|
26721
|
+
import_watermelondb19.Q.take(MAX_SEARCH_RECORDS)
|
|
26905
26722
|
).fetch();
|
|
26906
26723
|
const decrypted = await Promise.all(
|
|
26907
26724
|
allResults.map(
|
|
@@ -26914,11 +26731,11 @@ async function searchMediaOp(ctx, walletAddress, query, limit) {
|
|
|
26914
26731
|
async function getMediaCountOp(ctx, walletAddress, mediaType) {
|
|
26915
26732
|
const mediaCollection = ctx.database.get("media");
|
|
26916
26733
|
const conditions = [
|
|
26917
|
-
|
|
26918
|
-
|
|
26734
|
+
import_watermelondb19.Q.where("wallet_address", walletAddress),
|
|
26735
|
+
import_watermelondb19.Q.where("is_deleted", false)
|
|
26919
26736
|
];
|
|
26920
26737
|
if (mediaType) {
|
|
26921
|
-
conditions.push(
|
|
26738
|
+
conditions.push(import_watermelondb19.Q.where("media_type", mediaType));
|
|
26922
26739
|
}
|
|
26923
26740
|
return await mediaCollection.query(...conditions).fetchCount();
|
|
26924
26741
|
}
|
|
@@ -26933,7 +26750,7 @@ async function getMediaCountsByTypeOp(ctx, walletAddress) {
|
|
|
26933
26750
|
}
|
|
26934
26751
|
async function deleteMediaByConversationOp(ctx, conversationId) {
|
|
26935
26752
|
const mediaCollection = ctx.database.get("media");
|
|
26936
|
-
const results = await mediaCollection.query(
|
|
26753
|
+
const results = await mediaCollection.query(import_watermelondb19.Q.where("conversation_id", conversationId), import_watermelondb19.Q.where("is_deleted", false)).fetch();
|
|
26937
26754
|
if (results.length === 0) {
|
|
26938
26755
|
return 0;
|
|
26939
26756
|
}
|
|
@@ -26954,7 +26771,7 @@ async function deleteMediaByConversationOp(ctx, conversationId) {
|
|
|
26954
26771
|
}
|
|
26955
26772
|
async function deleteMediaByMessageOp(ctx, messageId) {
|
|
26956
26773
|
const mediaCollection = ctx.database.get("media");
|
|
26957
|
-
const results = await mediaCollection.query(
|
|
26774
|
+
const results = await mediaCollection.query(import_watermelondb19.Q.where("message_id", messageId), import_watermelondb19.Q.where("is_deleted", false)).fetch();
|
|
26958
26775
|
if (results.length === 0) {
|
|
26959
26776
|
return 0;
|
|
26960
26777
|
}
|
|
@@ -26975,7 +26792,7 @@ async function deleteMediaByMessageOp(ctx, messageId) {
|
|
|
26975
26792
|
}
|
|
26976
26793
|
|
|
26977
26794
|
// src/lib/db/userPreferences/operations.ts
|
|
26978
|
-
var
|
|
26795
|
+
var import_watermelondb20 = __toESM(require_watermelondb());
|
|
26979
26796
|
function userPreferenceToStored(preference) {
|
|
26980
26797
|
return {
|
|
26981
26798
|
uniqueId: preference.id,
|
|
@@ -26990,7 +26807,7 @@ function userPreferenceToStored(preference) {
|
|
|
26990
26807
|
};
|
|
26991
26808
|
}
|
|
26992
26809
|
async function getUserPreferenceOp(ctx, walletAddress) {
|
|
26993
|
-
const results = await ctx.userPreferencesCollection.query(
|
|
26810
|
+
const results = await ctx.userPreferencesCollection.query(import_watermelondb20.Q.where("wallet_address", walletAddress)).fetch();
|
|
26994
26811
|
return results.length > 0 ? userPreferenceToStored(results[0]) : null;
|
|
26995
26812
|
}
|
|
26996
26813
|
async function createUserPreferenceOp(ctx, opts) {
|
|
@@ -27010,7 +26827,7 @@ async function createUserPreferenceOp(ctx, opts) {
|
|
|
27010
26827
|
return userPreferenceToStored(created);
|
|
27011
26828
|
}
|
|
27012
26829
|
async function updateUserPreferenceOp(ctx, walletAddress, opts) {
|
|
27013
|
-
const results = await ctx.userPreferencesCollection.query(
|
|
26830
|
+
const results = await ctx.userPreferencesCollection.query(import_watermelondb20.Q.where("wallet_address", walletAddress)).fetch();
|
|
27014
26831
|
if (results.length === 0) return null;
|
|
27015
26832
|
const preference = results[0];
|
|
27016
26833
|
await ctx.database.write(async () => {
|
|
@@ -27038,7 +26855,7 @@ async function updateUserPreferenceOp(ctx, walletAddress, opts) {
|
|
|
27038
26855
|
async function setUserPreferenceOp(ctx, walletAddress, opts) {
|
|
27039
26856
|
const now = Date.now();
|
|
27040
26857
|
const result = await ctx.database.write(async () => {
|
|
27041
|
-
const results = await ctx.userPreferencesCollection.query(
|
|
26858
|
+
const results = await ctx.userPreferencesCollection.query(import_watermelondb20.Q.where("wallet_address", walletAddress)).fetch();
|
|
27042
26859
|
if (results.length > 0) {
|
|
27043
26860
|
const preference = results[0];
|
|
27044
26861
|
await preference.update((pref) => {
|
|
@@ -27086,7 +26903,7 @@ async function updateModelsOp(ctx, walletAddress, models) {
|
|
|
27086
26903
|
return updateUserPreferenceOp(ctx, walletAddress, { models });
|
|
27087
26904
|
}
|
|
27088
26905
|
async function deleteUserPreferenceOp(ctx, walletAddress) {
|
|
27089
|
-
const results = await ctx.userPreferencesCollection.query(
|
|
26906
|
+
const results = await ctx.userPreferencesCollection.query(import_watermelondb20.Q.where("wallet_address", walletAddress)).fetch();
|
|
27090
26907
|
if (results.length === 0) return false;
|
|
27091
26908
|
await ctx.database.write(async () => {
|
|
27092
26909
|
await results[0].destroyPermanently();
|
|
@@ -27101,9 +26918,9 @@ async function migrateFromModelPreferencesOp(ctx, walletAddress) {
|
|
|
27101
26918
|
if (existing) {
|
|
27102
26919
|
return existing;
|
|
27103
26920
|
}
|
|
27104
|
-
const modelResults = await ctx.modelPreferencesCollection.query(
|
|
26921
|
+
const modelResults = await ctx.modelPreferencesCollection.query(import_watermelondb20.Q.where("wallet_address", walletAddress)).fetch();
|
|
27105
26922
|
const personalityKey = `${walletAddress}_personality_settings`;
|
|
27106
|
-
const personalityResults = await ctx.modelPreferencesCollection.query(
|
|
26923
|
+
const personalityResults = await ctx.modelPreferencesCollection.query(import_watermelondb20.Q.where("wallet_address", personalityKey)).fetch();
|
|
27107
26924
|
if (modelResults.length === 0 && personalityResults.length === 0) {
|
|
27108
26925
|
return null;
|
|
27109
26926
|
}
|
|
@@ -27183,7 +27000,7 @@ var SLIDER_CONFIG = [
|
|
|
27183
27000
|
];
|
|
27184
27001
|
|
|
27185
27002
|
// src/lib/db/settings/operations.ts
|
|
27186
|
-
var
|
|
27003
|
+
var import_watermelondb21 = __toESM(require_watermelondb());
|
|
27187
27004
|
function modelPreferenceToStored(preference) {
|
|
27188
27005
|
return {
|
|
27189
27006
|
uniqueId: preference.id,
|
|
@@ -27192,12 +27009,12 @@ function modelPreferenceToStored(preference) {
|
|
|
27192
27009
|
};
|
|
27193
27010
|
}
|
|
27194
27011
|
async function getModelPreferenceOp(ctx, walletAddress) {
|
|
27195
|
-
const results = await ctx.modelPreferencesCollection.query(
|
|
27012
|
+
const results = await ctx.modelPreferencesCollection.query(import_watermelondb21.Q.where("wallet_address", walletAddress)).fetch();
|
|
27196
27013
|
return results.length > 0 ? modelPreferenceToStored(results[0]) : null;
|
|
27197
27014
|
}
|
|
27198
27015
|
async function setModelPreferenceOp(ctx, walletAddress, models) {
|
|
27199
27016
|
const result = await ctx.database.write(async () => {
|
|
27200
|
-
const results = await ctx.modelPreferencesCollection.query(
|
|
27017
|
+
const results = await ctx.modelPreferencesCollection.query(import_watermelondb21.Q.where("wallet_address", walletAddress)).fetch();
|
|
27201
27018
|
if (results.length > 0) {
|
|
27202
27019
|
const preference = results[0];
|
|
27203
27020
|
await preference.update((pref) => {
|
|
@@ -27215,7 +27032,7 @@ async function setModelPreferenceOp(ctx, walletAddress, models) {
|
|
|
27215
27032
|
return modelPreferenceToStored(result);
|
|
27216
27033
|
}
|
|
27217
27034
|
async function deleteModelPreferenceOp(ctx, walletAddress) {
|
|
27218
|
-
const results = await ctx.modelPreferencesCollection.query(
|
|
27035
|
+
const results = await ctx.modelPreferencesCollection.query(import_watermelondb21.Q.where("wallet_address", walletAddress)).fetch();
|
|
27219
27036
|
if (results.length === 0) return false;
|
|
27220
27037
|
await ctx.database.write(async () => {
|
|
27221
27038
|
await results[0].destroyPermanently();
|
|
@@ -27561,7 +27378,7 @@ function createMemoryVaultTool(vaultCtx, options, embeddingOptions, cache) {
|
|
|
27561
27378
|
}
|
|
27562
27379
|
|
|
27563
27380
|
// src/lib/memory/autoExtract.ts
|
|
27564
|
-
var
|
|
27381
|
+
var import_watermelondb22 = __toESM(require_watermelondb());
|
|
27565
27382
|
init_operations2();
|
|
27566
27383
|
init_types3();
|
|
27567
27384
|
init_logger();
|
|
@@ -28359,7 +28176,7 @@ async function assertMergeTargetGoneOrThrow(ctx, targetId) {
|
|
|
28359
28176
|
// src/lib/memory/autoExtract.ts
|
|
28360
28177
|
async function isMemoryTopicsUserManaged(ctx, memoryId) {
|
|
28361
28178
|
try {
|
|
28362
|
-
const rows = await ctx.database.get(VaultMemory.table).query(
|
|
28179
|
+
const rows = await ctx.database.get(VaultMemory.table).query(import_watermelondb22.Q.where("id", memoryId)).fetch();
|
|
28363
28180
|
return rows[0]?.topicsUserManaged === true;
|
|
28364
28181
|
} catch {
|
|
28365
28182
|
return true;
|
|
@@ -35864,7 +35681,6 @@ function buildSystemPrompt(ctx, options) {
|
|
|
35864
35681
|
TextProcessor,
|
|
35865
35682
|
UserPreference,
|
|
35866
35683
|
VAULT_SIZE_HOP_CAP,
|
|
35867
|
-
VaultFolder,
|
|
35868
35684
|
VaultMemory,
|
|
35869
35685
|
WalletPoller,
|
|
35870
35686
|
WordProcessor,
|
|
@@ -35920,7 +35736,6 @@ function buildSystemPrompt(ctx, options) {
|
|
|
35920
35736
|
createStockPricePreProcessor,
|
|
35921
35737
|
createSummaryContext,
|
|
35922
35738
|
createVaultEmbeddingCache,
|
|
35923
|
-
createVaultFolderOp,
|
|
35924
35739
|
createVaultMemoriesBatchOp,
|
|
35925
35740
|
createVaultMemoryOp,
|
|
35926
35741
|
createWeatherPreProcessor,
|
|
@@ -35941,7 +35756,6 @@ function buildSystemPrompt(ctx, options) {
|
|
|
35941
35756
|
deleteModelPreferenceOp,
|
|
35942
35757
|
deleteProjectOp,
|
|
35943
35758
|
deleteUserPreferenceOp,
|
|
35944
|
-
deleteVaultFolderOp,
|
|
35945
35759
|
deleteVaultMemoryOp,
|
|
35946
35760
|
eagerEmbedContent,
|
|
35947
35761
|
embedAllMessages,
|
|
@@ -35950,7 +35764,6 @@ function buildSystemPrompt(ctx, options) {
|
|
|
35950
35764
|
encryptDataBatch,
|
|
35951
35765
|
encryptDataBytes,
|
|
35952
35766
|
encryptDataWithKey,
|
|
35953
|
-
ensureDefaultFoldersOp,
|
|
35954
35767
|
estimateMessagesTokens,
|
|
35955
35768
|
estimateTokens,
|
|
35956
35769
|
exportPublicKey,
|
|
@@ -35966,7 +35779,6 @@ function buildSystemPrompt(ctx, options) {
|
|
|
35966
35779
|
generateProjectId,
|
|
35967
35780
|
getAIGeneratedMediaOp,
|
|
35968
35781
|
getAllFilesOp,
|
|
35969
|
-
getAllVaultFoldersOp,
|
|
35970
35782
|
getAllVaultMemoriesOp,
|
|
35971
35783
|
getAllVaultMemoryContentsOp,
|
|
35972
35784
|
getAudioOp,
|
|
@@ -36009,7 +35821,6 @@ function buildSystemPrompt(ctx, options) {
|
|
|
36009
35821
|
getUnfiledVaultMemoriesOp,
|
|
36010
35822
|
getUserPreferenceOp,
|
|
36011
35823
|
getUserUploadedMediaOp,
|
|
36012
|
-
getVaultFolderMemoryCountOp,
|
|
36013
35824
|
getVaultMemoryOp,
|
|
36014
35825
|
getVideosOp,
|
|
36015
35826
|
hardDeleteDecayedOp,
|
|
@@ -36025,7 +35836,6 @@ function buildSystemPrompt(ctx, options) {
|
|
|
36025
35836
|
maybeSummarizeHistory,
|
|
36026
35837
|
mediaToStored,
|
|
36027
35838
|
migrateFromModelPreferencesOp,
|
|
36028
|
-
moveMemoriesToFolderOp,
|
|
36029
35839
|
onKeyAvailable,
|
|
36030
35840
|
preEmbedVaultMemories,
|
|
36031
35841
|
preprocessFiles,
|
|
@@ -36086,8 +35896,6 @@ function buildSystemPrompt(ctx, options) {
|
|
|
36086
35896
|
updateProfileOp,
|
|
36087
35897
|
updateProjectNameOp,
|
|
36088
35898
|
updateProjectOp,
|
|
36089
|
-
updateVaultFolderContextOp,
|
|
36090
|
-
updateVaultFolderOp,
|
|
36091
35899
|
updateVaultMemoryEmbeddingOp,
|
|
36092
35900
|
updateVaultMemoryOp,
|
|
36093
35901
|
upsertConversationSummaryOp,
|