secondbrainos-mcp-server 1.4.2 → 1.4.3
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/build/index.js +35 -32
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -616,43 +616,46 @@ class SecondBrainOSServer {
|
|
|
616
616
|
console.error('Failed to write agent skill files:', error);
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
// 3. workflows
|
|
619
|
+
// 3. workflows (parallelized — each workflow fetched concurrently)
|
|
620
620
|
if (this.runPromptChainPath) {
|
|
621
621
|
try {
|
|
622
622
|
const data = await this.callRunPromptChain('', '');
|
|
623
|
-
const workflows = data.workflows || [];
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
623
|
+
const workflows = (data.workflows || []).filter((wf) => wf.name && wf.workflow_id);
|
|
624
|
+
await Promise.all(workflows.map(async (wf) => {
|
|
625
|
+
try {
|
|
626
|
+
const folderName = toSnakeCase(wf.name);
|
|
627
|
+
const workflowDetail = await this.callRunPromptChain('workflow', wf.workflow_id);
|
|
628
|
+
const promptIds = workflowDetail.prompt_id || [];
|
|
629
|
+
const promptResults = await Promise.all(promptIds.map(async (promptId) => {
|
|
630
|
+
try {
|
|
631
|
+
const promptData = await this.callRunPromptChain('prompt', promptId);
|
|
632
|
+
return {
|
|
633
|
+
id: promptId,
|
|
634
|
+
name: promptData.name,
|
|
635
|
+
order: promptData.order,
|
|
636
|
+
description: promptData.description || ''
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
catch {
|
|
640
|
+
return { id: promptId, name: '', order: 0, description: '' };
|
|
641
|
+
}
|
|
642
|
+
}));
|
|
643
|
+
const sortedPrompts = promptResults.sort((a, b) => (a.order || 0) - (b.order || 0));
|
|
644
|
+
const workflowDocument = {
|
|
645
|
+
skill_id: wf.workflow_id,
|
|
646
|
+
name: wf.name,
|
|
647
|
+
description: wf.description || '',
|
|
648
|
+
prompts: sortedPrompts
|
|
649
|
+
};
|
|
650
|
+
writeSkill(path.join(skillsBase, 'workflows', folderName), `---\nname: secondbrainos_skill_${folderName}\ndescription: "${wf.description || wf.name}"\nuser-invocable: false\n---\n\n${JSON.stringify(workflowDocument, null, 2)}\n`);
|
|
651
|
+
}
|
|
652
|
+
catch (error) {
|
|
653
|
+
console.error(`Failed to write skill file for workflow "${wf.name}":`, error);
|
|
654
|
+
}
|
|
655
|
+
}));
|
|
653
656
|
}
|
|
654
657
|
catch (error) {
|
|
655
|
-
console.error('Failed to
|
|
658
|
+
console.error('Failed to fetch workflows for skill files:', error);
|
|
656
659
|
}
|
|
657
660
|
}
|
|
658
661
|
// 4. knowledgebases
|