@velvetmonkey/flywheel-memory 2.0.26 → 2.0.27
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/index.js +67 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -7454,7 +7454,7 @@ function registerQueryTools(server2, getIndex, getVaultPath, getStateDb) {
|
|
|
7454
7454
|
import * as fs10 from "fs";
|
|
7455
7455
|
import * as path10 from "path";
|
|
7456
7456
|
import { z as z5 } from "zod";
|
|
7457
|
-
import { scanVaultEntities as scanVaultEntities2 } from "@velvetmonkey/vault-core";
|
|
7457
|
+
import { scanVaultEntities as scanVaultEntities2, getEntityIndexFromDb as getEntityIndexFromDb2 } from "@velvetmonkey/vault-core";
|
|
7458
7458
|
function registerSystemTools(server2, getIndex, setIndex, getVaultPath, setConfig, getStateDb) {
|
|
7459
7459
|
const RefreshIndexOutputSchema = {
|
|
7460
7460
|
success: z5.boolean().describe("Whether the refresh succeeded"),
|
|
@@ -7898,6 +7898,49 @@ function registerSystemTools(server2, getIndex, setIndex, getVaultPath, setConfi
|
|
|
7898
7898
|
};
|
|
7899
7899
|
}
|
|
7900
7900
|
);
|
|
7901
|
+
server2.registerTool(
|
|
7902
|
+
"list_entities",
|
|
7903
|
+
{
|
|
7904
|
+
title: "List Entities",
|
|
7905
|
+
description: "Get all entities grouped by category with aliases and hub scores. Returns the full EntityIndex from StateDb.",
|
|
7906
|
+
inputSchema: {
|
|
7907
|
+
category: z5.string().optional().describe('Filter to a specific category (e.g. "people", "technologies")'),
|
|
7908
|
+
limit: z5.coerce.number().default(2e3).describe("Maximum entities per category")
|
|
7909
|
+
}
|
|
7910
|
+
},
|
|
7911
|
+
async ({
|
|
7912
|
+
category,
|
|
7913
|
+
limit: perCategoryLimit
|
|
7914
|
+
}) => {
|
|
7915
|
+
const stateDb2 = getStateDb?.();
|
|
7916
|
+
if (!stateDb2) {
|
|
7917
|
+
return {
|
|
7918
|
+
content: [{ type: "text", text: JSON.stringify({ error: "StateDb not available" }) }]
|
|
7919
|
+
};
|
|
7920
|
+
}
|
|
7921
|
+
const entityIndex2 = getEntityIndexFromDb2(stateDb2);
|
|
7922
|
+
if (category) {
|
|
7923
|
+
const allCategories = Object.keys(entityIndex2).filter((k) => k !== "_metadata");
|
|
7924
|
+
for (const cat of allCategories) {
|
|
7925
|
+
if (cat !== category) {
|
|
7926
|
+
entityIndex2[cat] = [];
|
|
7927
|
+
}
|
|
7928
|
+
}
|
|
7929
|
+
}
|
|
7930
|
+
if (perCategoryLimit) {
|
|
7931
|
+
const allCategories = Object.keys(entityIndex2).filter((k) => k !== "_metadata");
|
|
7932
|
+
for (const cat of allCategories) {
|
|
7933
|
+
const arr = entityIndex2[cat];
|
|
7934
|
+
if (Array.isArray(arr) && arr.length > perCategoryLimit) {
|
|
7935
|
+
entityIndex2[cat] = arr.slice(0, perCategoryLimit);
|
|
7936
|
+
}
|
|
7937
|
+
}
|
|
7938
|
+
}
|
|
7939
|
+
return {
|
|
7940
|
+
content: [{ type: "text", text: JSON.stringify(entityIndex2) }]
|
|
7941
|
+
};
|
|
7942
|
+
}
|
|
7943
|
+
);
|
|
7901
7944
|
}
|
|
7902
7945
|
|
|
7903
7946
|
// src/tools/read/primitives.ts
|
|
@@ -8133,6 +8176,19 @@ async function getAllTasks(index, vaultPath2, options = {}) {
|
|
|
8133
8176
|
(t) => !excludeTags.some((excludeTag) => t.tags.includes(excludeTag))
|
|
8134
8177
|
);
|
|
8135
8178
|
}
|
|
8179
|
+
filteredTasks.sort((a, b) => {
|
|
8180
|
+
if (a.due_date && !b.due_date) return -1;
|
|
8181
|
+
if (!a.due_date && b.due_date) return 1;
|
|
8182
|
+
if (a.due_date && b.due_date) {
|
|
8183
|
+
const cmp = b.due_date.localeCompare(a.due_date);
|
|
8184
|
+
if (cmp !== 0) return cmp;
|
|
8185
|
+
}
|
|
8186
|
+
const noteA = index.notes.get(a.path);
|
|
8187
|
+
const noteB = index.notes.get(b.path);
|
|
8188
|
+
const mtimeA = noteA?.modified?.getTime() ?? 0;
|
|
8189
|
+
const mtimeB = noteB?.modified?.getTime() ?? 0;
|
|
8190
|
+
return mtimeB - mtimeA;
|
|
8191
|
+
});
|
|
8136
8192
|
const openCount = allTasks.filter((t) => t.status === "open").length;
|
|
8137
8193
|
const completedCount = allTasks.filter((t) => t.status === "completed").length;
|
|
8138
8194
|
const cancelledCount = allTasks.filter((t) => t.status === "cancelled").length;
|
|
@@ -10800,6 +10856,12 @@ async function createNoteFromTemplate(vaultPath2, notePath, config) {
|
|
|
10800
10856
|
const now = /* @__PURE__ */ new Date();
|
|
10801
10857
|
const dateStr = now.toISOString().split("T")[0];
|
|
10802
10858
|
templateContent = templateContent.replace(/\{\{date\}\}/g, dateStr).replace(/\{\{title\}\}/g, path19.basename(notePath, ".md"));
|
|
10859
|
+
const matter9 = (await import("gray-matter")).default;
|
|
10860
|
+
const parsed = matter9(templateContent);
|
|
10861
|
+
if (!parsed.data.date) {
|
|
10862
|
+
parsed.data.date = dateStr;
|
|
10863
|
+
}
|
|
10864
|
+
templateContent = matter9.stringify(parsed.content, parsed.data);
|
|
10803
10865
|
await fs20.writeFile(fullPath, templateContent, "utf-8");
|
|
10804
10866
|
return { created: true, templateUsed: templatePath };
|
|
10805
10867
|
}
|
|
@@ -11333,6 +11395,9 @@ function registerNoteTools(server2, vaultPath2, getIndex) {
|
|
|
11333
11395
|
return formatMcpResult(errorResult(notePath, `Template not found: ${template}`));
|
|
11334
11396
|
}
|
|
11335
11397
|
}
|
|
11398
|
+
if (!effectiveFrontmatter.date) {
|
|
11399
|
+
effectiveFrontmatter.date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
11400
|
+
}
|
|
11336
11401
|
const warnings = [];
|
|
11337
11402
|
const noteName = path20.basename(notePath, ".md");
|
|
11338
11403
|
const existingAliases = Array.isArray(effectiveFrontmatter?.aliases) ? effectiveFrontmatter.aliases.filter((a) => typeof a === "string") : [];
|
|
@@ -14661,6 +14726,7 @@ var TOOL_CATEGORY = {
|
|
|
14661
14726
|
refresh_index: "health",
|
|
14662
14727
|
// absorbed rebuild_search_index
|
|
14663
14728
|
get_all_entities: "health",
|
|
14729
|
+
list_entities: "hubs",
|
|
14664
14730
|
get_unlinked_mentions: "health",
|
|
14665
14731
|
// search (unified: metadata + content + entities)
|
|
14666
14732
|
search: "search",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velvetmonkey/flywheel-memory",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.27",
|
|
4
4
|
"description": "MCP server that gives Claude full read/write access to your Obsidian vault. 42 tools for search, backlinks, graph queries, mutations, and hybrid semantic search.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
53
|
-
"@velvetmonkey/vault-core": "^2.0.
|
|
53
|
+
"@velvetmonkey/vault-core": "^2.0.27",
|
|
54
54
|
"better-sqlite3": "^11.0.0",
|
|
55
55
|
"chokidar": "^4.0.0",
|
|
56
56
|
"gray-matter": "^4.0.3",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=18.0.0"
|
|
74
74
|
},
|
|
75
|
-
"license": "
|
|
75
|
+
"license": "AGPL-3.0-only",
|
|
76
76
|
"files": [
|
|
77
77
|
"dist",
|
|
78
78
|
"README.md",
|