- Add intelligent protocol version negotiation (2024-11-05 for n8n, 2025-03-26 for standard clients) - Fix memory leak potential with async cleanup and connection close handling - Enhance error sanitization for production environments - Add schema validation for n8n nested output workaround - Improve Docker security with unpredictable UIDs/GIDs - Create n8n-friendly tool descriptions to reduce schema validation errors - Add comprehensive protocol negotiation test suite Addresses code review feedback: - Protocol version inconsistency resolved - Memory management improved - Error information leakage fixed - Docker security enhanced 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
112 lines
2.1 KiB
TypeScript
112 lines
2.1 KiB
TypeScript
/**
|
|
* Example workflows for n8n AI agents to understand the structure
|
|
*/
|
|
|
|
export const MINIMAL_WORKFLOW_EXAMPLE = {
|
|
nodes: [
|
|
{
|
|
name: "Webhook",
|
|
type: "n8n-nodes-base.webhook",
|
|
typeVersion: 2,
|
|
position: [250, 300],
|
|
parameters: {
|
|
httpMethod: "POST",
|
|
path: "webhook"
|
|
}
|
|
}
|
|
],
|
|
connections: {}
|
|
};
|
|
|
|
export const SIMPLE_WORKFLOW_EXAMPLE = {
|
|
nodes: [
|
|
{
|
|
name: "Webhook",
|
|
type: "n8n-nodes-base.webhook",
|
|
typeVersion: 2,
|
|
position: [250, 300],
|
|
parameters: {
|
|
httpMethod: "POST",
|
|
path: "webhook"
|
|
}
|
|
},
|
|
{
|
|
name: "Set",
|
|
type: "n8n-nodes-base.set",
|
|
typeVersion: 2,
|
|
position: [450, 300],
|
|
parameters: {
|
|
mode: "manual",
|
|
assignments: {
|
|
assignments: [
|
|
{
|
|
name: "message",
|
|
type: "string",
|
|
value: "Hello"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
name: "Respond to Webhook",
|
|
type: "n8n-nodes-base.respondToWebhook",
|
|
typeVersion: 1,
|
|
position: [650, 300],
|
|
parameters: {
|
|
respondWith: "firstIncomingItem"
|
|
}
|
|
}
|
|
],
|
|
connections: {
|
|
"Webhook": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Set",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Set": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Respond to Webhook",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
}
|
|
};
|
|
|
|
export function getWorkflowExampleString(): string {
|
|
return `Example workflow structure:
|
|
${JSON.stringify(MINIMAL_WORKFLOW_EXAMPLE, null, 2)}
|
|
|
|
Each node MUST have:
|
|
- name: unique string identifier
|
|
- type: full node type with prefix (e.g., "n8n-nodes-base.webhook")
|
|
- typeVersion: number (usually 1 or 2)
|
|
- position: [x, y] coordinates array
|
|
- parameters: object with node-specific settings
|
|
|
|
Connections format:
|
|
{
|
|
"SourceNodeName": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "TargetNodeName",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
}`;
|
|
} |