@prmichaelsen/remember-mcp 3.14.9 → 3.14.10
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-factory.js +50 -0
- package/dist/server.js +50 -0
- package/package.json +1 -1
package/dist/server-factory.js
CHANGED
|
@@ -2451,6 +2451,56 @@ var MemoryService = class {
|
|
|
2451
2451
|
limit
|
|
2452
2452
|
};
|
|
2453
2453
|
}
|
|
2454
|
+
// ── By Density (relationship count) ────────────────────────────────
|
|
2455
|
+
async byDensity(input) {
|
|
2456
|
+
const limit = input.limit ?? 50;
|
|
2457
|
+
const offset = input.offset ?? 0;
|
|
2458
|
+
const memoryFilters = buildMemoryOnlyFilters(this.collection, input.filters);
|
|
2459
|
+
const ghostFilters = [];
|
|
2460
|
+
if (input.ghost_context) {
|
|
2461
|
+
ghostFilters.push(buildTrustFilter(this.collection, input.ghost_context.accessor_trust_level));
|
|
2462
|
+
}
|
|
2463
|
+
if (!input.ghost_context?.include_ghost_content) {
|
|
2464
|
+
ghostFilters.push(this.collection.filter.byProperty("content_type").notEqual("ghost"));
|
|
2465
|
+
}
|
|
2466
|
+
const densityFilters = [];
|
|
2467
|
+
if (input.min_relationship_count !== void 0) {
|
|
2468
|
+
densityFilters.push(this.collection.filter.byProperty("relationship_count").greaterOrEqual(input.min_relationship_count));
|
|
2469
|
+
}
|
|
2470
|
+
const executeQuery = async (useDeletedFilter) => {
|
|
2471
|
+
const deletedFilter = useDeletedFilter ? buildDeletedFilter(this.collection, input.deleted_filter || "exclude") : null;
|
|
2472
|
+
const combinedFilters = combineFiltersWithAnd([deletedFilter, memoryFilters, ...ghostFilters, ...densityFilters].filter((f) => f !== null));
|
|
2473
|
+
const queryOptions = {
|
|
2474
|
+
limit: limit + offset,
|
|
2475
|
+
sort: [
|
|
2476
|
+
{
|
|
2477
|
+
property: "relationship_count",
|
|
2478
|
+
order: "desc"
|
|
2479
|
+
// Highest first
|
|
2480
|
+
}
|
|
2481
|
+
]
|
|
2482
|
+
};
|
|
2483
|
+
if (combinedFilters) {
|
|
2484
|
+
queryOptions.filters = combinedFilters;
|
|
2485
|
+
}
|
|
2486
|
+
return this.collection.query.fetchObjects(queryOptions);
|
|
2487
|
+
};
|
|
2488
|
+
const results = await this.retryWithoutDeletedFilter(executeQuery);
|
|
2489
|
+
const paginated = results.objects.slice(offset);
|
|
2490
|
+
const memories = [];
|
|
2491
|
+
for (const obj of paginated) {
|
|
2492
|
+
const doc = { id: obj.uuid, ...obj.properties };
|
|
2493
|
+
if (doc.doc_type === "memory") {
|
|
2494
|
+
memories.push(doc);
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2497
|
+
return {
|
|
2498
|
+
memories,
|
|
2499
|
+
total: memories.length,
|
|
2500
|
+
offset,
|
|
2501
|
+
limit
|
|
2502
|
+
};
|
|
2503
|
+
}
|
|
2454
2504
|
// ── Find Similar (vector) ──────────────────────────────────────────
|
|
2455
2505
|
async findSimilar(input) {
|
|
2456
2506
|
if (!input.memory_id && !input.text)
|
package/dist/server.js
CHANGED
|
@@ -2135,6 +2135,56 @@ var MemoryService = class {
|
|
|
2135
2135
|
limit
|
|
2136
2136
|
};
|
|
2137
2137
|
}
|
|
2138
|
+
// ── By Density (relationship count) ────────────────────────────────
|
|
2139
|
+
async byDensity(input) {
|
|
2140
|
+
const limit = input.limit ?? 50;
|
|
2141
|
+
const offset = input.offset ?? 0;
|
|
2142
|
+
const memoryFilters = buildMemoryOnlyFilters(this.collection, input.filters);
|
|
2143
|
+
const ghostFilters = [];
|
|
2144
|
+
if (input.ghost_context) {
|
|
2145
|
+
ghostFilters.push(buildTrustFilter(this.collection, input.ghost_context.accessor_trust_level));
|
|
2146
|
+
}
|
|
2147
|
+
if (!input.ghost_context?.include_ghost_content) {
|
|
2148
|
+
ghostFilters.push(this.collection.filter.byProperty("content_type").notEqual("ghost"));
|
|
2149
|
+
}
|
|
2150
|
+
const densityFilters = [];
|
|
2151
|
+
if (input.min_relationship_count !== void 0) {
|
|
2152
|
+
densityFilters.push(this.collection.filter.byProperty("relationship_count").greaterOrEqual(input.min_relationship_count));
|
|
2153
|
+
}
|
|
2154
|
+
const executeQuery = async (useDeletedFilter) => {
|
|
2155
|
+
const deletedFilter = useDeletedFilter ? buildDeletedFilter(this.collection, input.deleted_filter || "exclude") : null;
|
|
2156
|
+
const combinedFilters = combineFiltersWithAnd([deletedFilter, memoryFilters, ...ghostFilters, ...densityFilters].filter((f) => f !== null));
|
|
2157
|
+
const queryOptions = {
|
|
2158
|
+
limit: limit + offset,
|
|
2159
|
+
sort: [
|
|
2160
|
+
{
|
|
2161
|
+
property: "relationship_count",
|
|
2162
|
+
order: "desc"
|
|
2163
|
+
// Highest first
|
|
2164
|
+
}
|
|
2165
|
+
]
|
|
2166
|
+
};
|
|
2167
|
+
if (combinedFilters) {
|
|
2168
|
+
queryOptions.filters = combinedFilters;
|
|
2169
|
+
}
|
|
2170
|
+
return this.collection.query.fetchObjects(queryOptions);
|
|
2171
|
+
};
|
|
2172
|
+
const results = await this.retryWithoutDeletedFilter(executeQuery);
|
|
2173
|
+
const paginated = results.objects.slice(offset);
|
|
2174
|
+
const memories = [];
|
|
2175
|
+
for (const obj of paginated) {
|
|
2176
|
+
const doc = { id: obj.uuid, ...obj.properties };
|
|
2177
|
+
if (doc.doc_type === "memory") {
|
|
2178
|
+
memories.push(doc);
|
|
2179
|
+
}
|
|
2180
|
+
}
|
|
2181
|
+
return {
|
|
2182
|
+
memories,
|
|
2183
|
+
total: memories.length,
|
|
2184
|
+
offset,
|
|
2185
|
+
limit
|
|
2186
|
+
};
|
|
2187
|
+
}
|
|
2138
2188
|
// ── Find Similar (vector) ──────────────────────────────────────────
|
|
2139
2189
|
async findSimilar(input) {
|
|
2140
2190
|
if (!input.memory_id && !input.text)
|