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.
Files changed (2) hide show
  1. package/build/index.js +35 -32
  2. 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
- for (const wf of workflows) {
625
- if (!wf.name || !wf.workflow_id)
626
- continue;
627
- const folderName = toSnakeCase(wf.name);
628
- const workflowDetail = await this.callRunPromptChain('workflow', wf.workflow_id);
629
- const promptIds = workflowDetail.prompt_id || [];
630
- const promptResults = await Promise.all(promptIds.map(async (promptId) => {
631
- try {
632
- const promptData = await this.callRunPromptChain('prompt', promptId);
633
- return {
634
- id: promptId,
635
- name: promptData.name,
636
- order: promptData.order,
637
- description: promptData.description || ''
638
- };
639
- }
640
- catch {
641
- return { id: promptId, name: '', order: 0, description: '' };
642
- }
643
- }));
644
- const sortedPrompts = promptResults.sort((a, b) => (a.order || 0) - (b.order || 0));
645
- const workflowDocument = {
646
- skill_id: wf.workflow_id,
647
- name: wf.name,
648
- description: wf.description || '',
649
- prompts: sortedPrompts
650
- };
651
- 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`);
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 write workflow skill files:', error);
658
+ console.error('Failed to fetch workflows for skill files:', error);
656
659
  }
657
660
  }
658
661
  // 4. knowledgebases
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "secondbrainos-mcp-server",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Second Brain OS MCP Server for Claude Desktop",
5
5
  "type": "module",
6
6
  "main": "build/index.js",