{
  "schema_version": 2,
  "diagram_type": "workflow",
  "meta": {
    "title": "Safety gate: luật cứng trước, Jev sau (đơn giản hoá)",
    "quality_profile": "showcase",
    "legend": {
      "mode": "hidden"
    },
    "views": [
      {
        "id": "flow",
        "label": "Một lệnh bash",
        "focus": [
          "cmd",
          "rules",
          "jev",
          "allow"
        ],
        "note": "Hook PreToolUse nhận lệnh; luật cứng trong code chạy trước, Jev chỉ phân loại phần còn lại."
      },
      {
        "id": "human",
        "label": "Chuyển cho người",
        "focus": [
          "jev",
          "ask"
        ],
        "note": "Lệnh ra ngoài hoặc nhãn other luôn chuyển cho người. Sơ đồ đơn giản hoá: chia allow/deny/ask là cách digest vẽ."
      }
    ]
  },
  "lanes": [
    {
      "id": "code",
      "label": "Code (luật cứng)"
    },
    {
      "id": "jev",
      "label": "Jev (phân loại)"
    },
    {
      "id": "out",
      "label": "Kết quả hook"
    }
  ],
  "phases": [
    {
      "id": "p1",
      "label": "Trước khi chạy lệnh",
      "fromCol": 0,
      "toCol": 2,
      "variant": "emphasis"
    },
    {
      "id": "p2",
      "label": "Trả lời",
      "fromCol": 3,
      "toCol": 3,
      "variant": "dashed"
    }
  ],
  "mainPath": [
    "cmd",
    "rules",
    "jev",
    "allow"
  ],
  "nodes": [
    {
      "id": "cmd",
      "lane": "code",
      "col": 0,
      "type": "frontend",
      "label": "Lệnh bash",
      "sublabel": "PreToolUse",
      "width": 140
    },
    {
      "id": "rules",
      "lane": "code",
      "col": 1,
      "type": "security",
      "label": "Luật cứng",
      "sublabel": "chạy trước Jev",
      "width": 140
    },
    {
      "id": "jev",
      "lane": "jev",
      "col": 2,
      "type": "backend",
      "label": "Jev phân loại",
      "sublabel": "~100 ms",
      "width": 150
    },
    {
      "id": "allow",
      "lane": "out",
      "col": 3,
      "type": "frontend",
      "label": "allow",
      "sublabel": "an toàn, cho chạy",
      "width": 150
    },
    {
      "id": "ask",
      "lane": "jev",
      "col": 3,
      "type": "external",
      "label": "ask người",
      "sublabel": "ra ngoài hoặc other",
      "width": 160
    },
    {
      "id": "deny",
      "lane": "code",
      "col": 3,
      "type": "security",
      "label": "deny",
      "sublabel": "vi phạm luật",
      "width": 140
    }
  ],
  "edges": [
    {
      "id": "e1",
      "from": "cmd",
      "to": "rules",
      "variant": "emphasis"
    },
    {
      "id": "e2",
      "from": "rules",
      "to": "jev",
      "label": "qua luật",
      "variant": "emphasis"
    },
    {
      "id": "e3",
      "from": "jev",
      "to": "allow",
      "variant": "emphasis"
    },
    {
      "id": "e4",
      "from": "jev",
      "to": "ask",
      "variant": "dashed"
    },
    {
      "id": "e5",
      "from": "rules",
      "to": "deny",
      "variant": "dashed"
    }
  ]
}