flowengine-n8n-workflow-builder
Version:
Build n8n workflows from text using AI. Connect to Claude, Cursor, or any LLM to generate and validate n8n workflows with expert knowledge and intelligent auto-fixing. Built by FlowEngine. Now with real node parameter schemas from n8n packages!
109 lines • 3.37 kB
TypeScript
/**
* Workflow Generator - FlowEngine-Compatible Generation Engine
*
* Generates n8n workflows using real node descriptions and parameter schemas.
* Replicates FlowEngine's approach by loading actual INodeTypeDescription from n8n packages.
*/
import type { INode, INodeParameters, IConnections, INodeCredentials } from 'n8n-workflow';
export type WorkflowNode = INode;
export type WorkflowConnection = IConnections;
export interface Workflow {
id?: string;
name: string;
nodes: INode[];
connections: IConnections;
active?: boolean;
settings?: Record<string, any>;
}
export interface GeneratorOptions {
name?: string;
description?: string;
pattern?: 'linear' | 'conditional' | 'parallel' | 'ai-agent' | 'event-driven';
addErrorHandling?: boolean;
addLogging?: boolean;
}
/**
* Workflow Generator Class
*/
export declare class WorkflowGenerator {
private workflow;
private nodeCounter;
private xPosition;
private yPosition;
constructor(name?: string);
/**
* Add a node to the workflow with real parameter schemas
*/
addNode(nodeType: string, parameters?: INodeParameters, options?: {
name?: string;
position?: [number, number];
credentials?: INodeCredentials;
description?: string;
}): Promise<string>;
/**
* Generate contextual parameters based on workflow description
* NOTE: This is intentionally empty - the LLM calling the MCP provides parameters
* We only use defaults from n8n node descriptions
*/
private generateContextualParameters;
/**
* Connect two nodes
*/
connect(sourceNode: string, targetNode: string, connectionType?: 'main' | 'ai_languageModel' | 'ai_memory' | 'ai_tool', sourceIndex?: number, targetIndex?: number): void;
/**
* Build a linear workflow (trigger -> action1 -> action2 -> ...)
*/
buildLinear(nodes: Array<{
type: string;
parameters?: INodeParameters;
}>): Promise<Workflow>;
/**
* Build a conditional workflow (IF node with true/false branches)
*/
buildConditional(trigger: {
type: string;
parameters?: Record<string, any>;
}, condition: {
type: string;
parameters?: Record<string, any>;
}, trueBranch: Array<{
type: string;
parameters?: Record<string, any>;
}>, falseBranch: Array<{
type: string;
parameters?: Record<string, any>;
}>): Promise<Workflow>;
/**
* Build an AI Agent workflow
*/
buildAIAgent(options: {
modelType: 'openai' | 'anthropic' | 'gemini' | 'groq' | 'ollama';
tools: string[];
memory?: boolean;
trigger?: {
type: string;
parameters?: Record<string, any>;
};
}): Promise<Workflow>;
/**
* Get the current workflow
*/
getWorkflow(): Workflow;
/**
* Generate a unique node name
*/
private generateNodeName;
/**
* Get next position for a node
*/
private getNextPosition;
/**
* Get placeholder credentials for a node
*/
private getPlaceholderCredentials;
}
/**
* Quick workflow generation functions
*/
export declare function generateWorkflow(description: string, options?: GeneratorOptions): Promise<Workflow>;
//# sourceMappingURL=generator.d.ts.map