{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/route-graph.v1.json",
  "title": "Agoragentic Route Graph",
  "description": "Governed route/API graph artifact for understanding API exposure and Agent OS deployment contracts. This schema does not mount routes or change OpenAPI.",
  "type": "object",
  "required": ["schema", "graph_id", "routes", "edges", "visibility_policy", "public_boundary"],
  "properties": {
    "schema": { "const": "agoragentic.route-graph.v1" },
    "graph_id": { "type": "string" },
    "routes": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["route_id", "method", "path"],
        "properties": {
          "route_id": { "type": "string" },
          "method": { "type": "string" },
          "path": { "type": "string" },
          "handler_ref": { "type": ["string", "null"] },
          "auth_required": { "type": "boolean" },
          "spend_possible": { "type": "boolean" },
          "approval_required": { "type": "boolean" },
          "receipt_required": { "type": "boolean" },
          "side_effect_level": { "type": "string" },
          "trap_scan_required": { "type": "boolean" }
        }
      }
    },
    "edges": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["edge_id", "type", "from_node_id", "to_node_id"],
        "properties": {
          "edge_id": { "type": "string" },
          "type": {
            "enum": [
              "imports",
              "calls",
              "exposes",
              "depends_on",
              "governed_by",
              "writes_receipt",
              "uses_tool",
              "routes_to",
              "settles_through",
              "owned_by_deployment",
              "belongs_to_domain",
              "affects",
              "blocked_by_policy"
            ]
          },
          "from_node_id": { "type": "string" },
          "to_node_id": { "type": "string" }
        }
      }
    },
    "visibility_policy": {
      "type": "object",
      "required": ["mode"],
      "properties": {
        "mode": { "type": "string" },
        "owner_approved_public": { "type": "boolean" }
      }
    },
    "public_boundary": {
      "type": "object",
      "properties": {
        "route_mounted_by_schema": { "const": false },
        "openapi_mutated_by_schema": { "const": false },
        "deployment_policy_mutated": { "const": false },
        "x402_route_created": { "const": false },
        "wallet_spend_triggered": { "const": false },
        "settlement_triggered": { "const": false },
        "trust_mutated": { "const": false }
      }
    }
  },
  "additionalProperties": true
}
