sync: Workflows P2 features from private repo

- 5 bundled workflows (prep, research, connect, integrate, survey)
- quickLink tool for fast edge creation
- queryDimensionNodes tool for dimension queries
- Workflow orchestration tools (list, get, edit)
- Dimension awareness with active dimension tracking
- Unified Workflows tab in Agent Panel
- MCP server updates for workflow execution

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
“BeeRad”
2026-01-11 18:54:34 +11:00
co-authored by Claude Opus 4.5
parent 3951d9daf4
commit f9271aeeb4
24 changed files with 2842 additions and 153 deletions
+62
View File
@@ -0,0 +1,62 @@
import { tool } from 'ai';
import { z } from 'zod';
import { WorkflowRegistry } from '@/services/workflows/registry';
import { saveWorkflow, loadUserWorkflow } from '@/services/workflows/workflowFileService';
export const editWorkflowTool = tool({
description: 'Update a workflow definition. Use to refine instructions, update description, or toggle enabled state.',
inputSchema: z.object({
workflowKey: z.string().describe('The key of the workflow to edit'),
updates: z.object({
displayName: z.string().optional().describe('New display name'),
description: z.string().optional().describe('New description'),
instructions: z.string().optional().describe('New instructions (full replacement)'),
enabled: z.boolean().optional().describe('Enable or disable the workflow'),
requiresFocusedNode: z.boolean().optional().describe('Whether workflow requires a focused node'),
}).describe('Fields to update'),
}),
execute: async ({ workflowKey, updates }) => {
try {
// Get existing workflow (from user file or bundled default)
const existing = await WorkflowRegistry.getWorkflowByKey(workflowKey);
if (!existing) {
return {
success: false,
error: `Workflow '${workflowKey}' not found`,
};
}
// Merge updates with existing values
const updated = {
key: workflowKey,
displayName: updates.displayName ?? existing.displayName,
description: updates.description ?? existing.description,
instructions: updates.instructions ?? existing.instructions,
enabled: updates.enabled ?? existing.enabled,
requiresFocusedNode: updates.requiresFocusedNode ?? existing.requiresFocusedNode,
};
// Save to user workflow file (this will override bundled if same key)
saveWorkflow(updated);
return {
success: true,
message: `Workflow '${workflowKey}' updated`,
workflow: {
key: updated.key,
displayName: updated.displayName,
description: updated.description,
enabled: updated.enabled,
requiresFocusedNode: updated.requiresFocusedNode,
},
};
} catch (error) {
console.error('editWorkflow error:', error);
return {
success: false,
error: error instanceof Error ? error.message : 'Failed to edit workflow',
};
}
},
});
+43
View File
@@ -0,0 +1,43 @@
import { tool } from 'ai';
import { z } from 'zod';
import { WorkflowRegistry, BUNDLED_WORKFLOW_KEYS } from '@/services/workflows/registry';
import { userWorkflowExists } from '@/services/workflows/workflowFileService';
export const getWorkflowTool = tool({
description: 'Retrieve a workflow definition including its full instructions',
inputSchema: z.object({
workflowKey: z.string().describe('The key of the workflow to retrieve (e.g., "integrate", "prep")'),
}),
execute: async ({ workflowKey }) => {
try {
const workflow = await WorkflowRegistry.getWorkflowByKey(workflowKey);
if (!workflow) {
return {
success: false,
error: `Workflow '${workflowKey}' not found`,
};
}
return {
success: true,
workflow: {
key: workflow.key,
displayName: workflow.displayName,
description: workflow.description,
instructions: workflow.instructions,
enabled: workflow.enabled,
requiresFocusedNode: workflow.requiresFocusedNode,
isBundled: BUNDLED_WORKFLOW_KEYS.has(workflow.key),
hasUserOverride: userWorkflowExists(workflow.key),
},
};
} catch (error) {
console.error('getWorkflow error:', error);
return {
success: false,
error: error instanceof Error ? error.message : 'Failed to get workflow',
};
}
},
});
+31
View File
@@ -0,0 +1,31 @@
import { tool } from 'ai';
import { z } from 'zod';
import { WorkflowRegistry, BUNDLED_WORKFLOW_KEYS } from '@/services/workflows/registry';
export const listWorkflowsTool = tool({
description: 'List all available workflows',
inputSchema: z.object({}),
execute: async () => {
try {
const workflows = await WorkflowRegistry.getAllWorkflows();
return {
success: true,
workflows: workflows.map(w => ({
key: w.key,
displayName: w.displayName,
description: w.description,
enabled: w.enabled,
requiresFocusedNode: w.requiresFocusedNode,
isBundled: BUNDLED_WORKFLOW_KEYS.has(w.key),
})),
};
} catch (error) {
console.error('listWorkflows error:', error);
return {
success: false,
error: error instanceof Error ? error.message : 'Failed to list workflows',
};
}
},
});