@velvetmonkey/flywheel-memory 2.6.1 → 2.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +56 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5799,6 +5799,29 @@ function insertInSection(content, section, newContent, position, options) {
|
|
|
5799
5799
|
}
|
|
5800
5800
|
return lines.join("\n");
|
|
5801
5801
|
}
|
|
5802
|
+
function indentContinuation(text) {
|
|
5803
|
+
const lines = text.split("\n");
|
|
5804
|
+
if (lines.length <= 1) return text;
|
|
5805
|
+
let inCodeBlock = false;
|
|
5806
|
+
return lines.map((line, i) => {
|
|
5807
|
+
if (/^\s*(```|~~~)/.test(line)) inCodeBlock = !inCodeBlock;
|
|
5808
|
+
if (i === 0) return line;
|
|
5809
|
+
if (line === "") return inCodeBlock ? " " : " <!-- -->";
|
|
5810
|
+
return ` ${line}`;
|
|
5811
|
+
}).join("\n");
|
|
5812
|
+
}
|
|
5813
|
+
function sanitizeForObsidian(text) {
|
|
5814
|
+
const lines = text.split("\n");
|
|
5815
|
+
let inFence = false;
|
|
5816
|
+
return lines.map((line) => {
|
|
5817
|
+
if (/^\s*(```|~~~)/.test(line)) {
|
|
5818
|
+
inFence = !inFence;
|
|
5819
|
+
return line;
|
|
5820
|
+
}
|
|
5821
|
+
if (inFence) return line;
|
|
5822
|
+
return line.replace(/<(?=[A-Za-z0-9])/g, "<").replace(/^(\s*)>/gm, "$1>").replace(/%%/g, "%%").replace(/==(.*?)==/g, "==$1==").replace(/(?<=\s)#(?=[A-Za-z0-9])/g, "#");
|
|
5823
|
+
}).join("\n");
|
|
5824
|
+
}
|
|
5802
5825
|
var EMPTY_PLACEHOLDER_PATTERNS;
|
|
5803
5826
|
var init_markdown_structure = __esm({
|
|
5804
5827
|
"src/core/write/markdown-structure.ts"() {
|
|
@@ -20146,6 +20169,7 @@ async function executeDeleteNote(options) {
|
|
|
20146
20169
|
}
|
|
20147
20170
|
|
|
20148
20171
|
// src/tools/write/mutations.ts
|
|
20172
|
+
init_markdown_structure();
|
|
20149
20173
|
async function createNoteFromTemplate(vaultPath2, notePath, config2) {
|
|
20150
20174
|
const validation = await validatePathSecure(vaultPath2, notePath);
|
|
20151
20175
|
if (!validation.valid) {
|
|
@@ -20246,13 +20270,17 @@ function registerMutationTools(server2, getVaultPath, getConfig2 = () => ({})) {
|
|
|
20246
20270
|
commit: z12.boolean().default(false).describe("If true, commit this change to git (creates undo point)"),
|
|
20247
20271
|
skipWikilinks: z12.boolean().default(false).describe("If true, skip auto-wikilink application (wikilinks are applied by default)"),
|
|
20248
20272
|
suggestOutgoingLinks: z12.boolean().default(false).describe('Suggest related outgoing wikilinks based on content (e.g., "\u2192 [[AI]], [[Philosophy]]"). Off by default \u2014 set true for daily notes, journals, or capture-heavy contexts.'),
|
|
20273
|
+
children: z12.array(z12.object({
|
|
20274
|
+
label: z12.string().describe('Bold label, e.g. "**Result:**"'),
|
|
20275
|
+
content: z12.string().describe("Pre-neutralized text; sanitized and indented by this tool")
|
|
20276
|
+
})).optional().describe("Labeled sub-bullets appended under the parent content line"),
|
|
20249
20277
|
maxSuggestions: z12.number().min(1).max(10).default(5).describe("Maximum number of suggested wikilinks (1-10, default: 5)"),
|
|
20250
20278
|
linkedEntities: z12.array(z12.string()).optional().describe("Entity names already linked in the content. When skipWikilinks=true, these are tracked for feedback without re-processing the content."),
|
|
20251
20279
|
dry_run: z12.boolean().optional().default(false).describe("Preview changes without writing to disk"),
|
|
20252
20280
|
agent_id: z12.string().optional().describe('Agent identifier for multi-agent scoping (e.g., "claude-opus", "planning-agent")'),
|
|
20253
20281
|
session_id: z12.string().optional().describe('Session identifier for conversation scoping (e.g., "sess-abc123")')
|
|
20254
20282
|
},
|
|
20255
|
-
async ({ path: notePath, section, content, create_if_missing, position, format, commit, skipWikilinks, suggestOutgoingLinks, maxSuggestions, linkedEntities, dry_run, agent_id, session_id }) => {
|
|
20283
|
+
async ({ path: notePath, section, content, create_if_missing, position, format, commit, skipWikilinks, suggestOutgoingLinks, children, maxSuggestions, linkedEntities, dry_run, agent_id, session_id }) => {
|
|
20256
20284
|
const vaultPath2 = getVaultPath();
|
|
20257
20285
|
const preserveListNesting = true;
|
|
20258
20286
|
const bumpHeadings = true;
|
|
@@ -20316,15 +20344,39 @@ function registerMutationTools(server2, getVaultPath, getConfig2 = () => ({})) {
|
|
|
20316
20344
|
trackWikilinkApplications(stateDb2, notePath, linkedEntities);
|
|
20317
20345
|
}
|
|
20318
20346
|
}
|
|
20347
|
+
let finalContent = processedContent;
|
|
20348
|
+
let finalFormat = format;
|
|
20349
|
+
let childTextsForLinks = [];
|
|
20350
|
+
if (children && children.length > 0) {
|
|
20351
|
+
const childBlocks = children.map(({ label, content: childContent }) => {
|
|
20352
|
+
const sanitized = sanitizeForObsidian(childContent);
|
|
20353
|
+
const processed = indentContinuation(sanitized);
|
|
20354
|
+
const lines = processed.split("\n");
|
|
20355
|
+
if (/^\s*(```|~~~)/.test(lines[0])) {
|
|
20356
|
+
return [` - ${label}`, ...lines.map((l) => ` ${l}`)].join("\n");
|
|
20357
|
+
}
|
|
20358
|
+
return [`- ${label} ${lines[0]}`, ...lines.slice(1)].map((l) => ` ${l}`).join("\n");
|
|
20359
|
+
});
|
|
20360
|
+
finalContent = `- ${processedContent}
|
|
20361
|
+
${childBlocks.join("\n")}`;
|
|
20362
|
+
finalFormat = "plain";
|
|
20363
|
+
childTextsForLinks = children.map((c) => c.content);
|
|
20364
|
+
}
|
|
20319
20365
|
let suggestInfo;
|
|
20320
20366
|
if (suggestOutgoingLinks && !skipWikilinks) {
|
|
20321
|
-
const
|
|
20367
|
+
const suggestionText = childTextsForLinks.length > 0 ? childTextsForLinks.join(" ") : processedContent;
|
|
20368
|
+
const result = await suggestRelatedLinks(suggestionText, { maxSuggestions, notePath });
|
|
20322
20369
|
if (result.suffix) {
|
|
20323
|
-
|
|
20370
|
+
if (childTextsForLinks.length > 0) {
|
|
20371
|
+
finalContent = finalContent + " " + result.suffix;
|
|
20372
|
+
} else {
|
|
20373
|
+
processedContent = processedContent + " " + result.suffix;
|
|
20374
|
+
finalContent = processedContent;
|
|
20375
|
+
}
|
|
20324
20376
|
suggestInfo = `Suggested: ${result.suggestions.join(", ")}`;
|
|
20325
20377
|
}
|
|
20326
20378
|
}
|
|
20327
|
-
const formattedContent = formatContent(
|
|
20379
|
+
const formattedContent = formatContent(finalContent, finalFormat);
|
|
20328
20380
|
const updatedContent = insertInSection(
|
|
20329
20381
|
ctx.content,
|
|
20330
20382
|
ctx.sectionBoundary,
|
package/package.json
CHANGED