{
  "name": "A2A-SIN-Email - Inbound Intake",
  "nodes": [
    {
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "parameters": {
        "httpMethod": "POST",
        "path": "email-intake"
      }
    },
    {
      "name": "Normalize Work Item",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "// Normalize to shared work-item schema\nconst item = $input.first().json;\nreturn [{json: {work_item: {id: 'wi-' + Date.now(), source: item.source || 'webhook', priority: item.priority || 'medium', type: item.type || 'task', description: item.description || '', created_at: new Date().toISOString(), status: 'queued'}}}];"
      }
    },
    {
      "name": "Log to Supabase",
      "type": "n8n-nodes-base.supabase",
      "parameters": {
        "operation": "create",
        "tableId": "work_items"
      }
    },
    {
      "name": "Create GitHub Issue",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "method": "POST",
        "url": "https://api.github.com/repos/OpenSIN-AI/A2A-SIN-Email/issues"
      }
    },
    {
      "name": "Dispatch to Hermes",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "method": "POST",
        "url": "http://92.5.60.87:8014/api/v1/tasks/claim"
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Normalize Work Item",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Work Item": {
      "main": [
        [
          {
            "node": "Log to Supabase",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Supabase": {
      "main": [
        [
          {
            "node": "Create GitHub Issue",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create GitHub Issue": {
      "main": [
        [
          {
            "node": "Dispatch to Hermes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}