{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cdn.jsdelivr.net/npm/@osovv/vv-opencode@0.34.4/schemas/vvoc/v3.json",
  "title": "vvoc config",
  "description": "Canonical vvoc configuration document.",
  "type": "object",
  "additionalProperties": false,
  "required": ["$schema", "version", "roles", "guardian", "secretsRedaction", "presets"],
  "properties": {
    "$schema": {
      "type": "string",
      "minLength": 1,
      "description": "Hosted JSON Schema URL for vvoc.json."
    },
    "version": {
      "type": "integer",
      "const": 3
    },
    "roles": {
      "type": "object",
      "propertyNames": {
        "minLength": 1,
        "pattern": "^[a-z][a-z0-9-]*$"
      },
      "minProperties": 4,
      "additionalProperties": {
        "type": "string",
        "minLength": 1
      }
    },
    "guardian": {
      "type": "object",
      "additionalProperties": false,
      "required": ["timeoutMs", "approvalRiskThreshold", "reviewToastDurationMs"],
      "properties": {
        "model": { "type": "string", "minLength": 1 },
        "variant": { "type": "string", "minLength": 1 },
        "timeoutMs": { "type": "integer", "minimum": 1 },
        "approvalRiskThreshold": { "type": "integer", "minimum": 0, "maximum": 100 },
        "reviewToastDurationMs": { "type": "integer", "minimum": 1 }
      }
    },
    "secretsRedaction": {
      "type": "object",
      "additionalProperties": false,
      "required": ["secret", "ttlMs", "maxMappings", "patterns", "debug"],
      "properties": {
        "secret": { "type": "string", "minLength": 1 },
        "ttlMs": { "type": "integer", "minimum": 0 },
        "maxMappings": { "type": "integer", "minimum": 1 },
        "debug": { "type": "boolean" },
        "patterns": {
          "type": "object",
          "additionalProperties": false,
          "required": ["keywords", "regex", "builtin", "exclude"],
          "properties": {
            "keywords": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": ["value"],
                "properties": {
                  "value": { "type": "string", "minLength": 1 },
                  "category": { "type": "string", "minLength": 1 }
                }
              }
            },
            "regex": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": ["pattern", "category"],
                "properties": {
                  "pattern": { "type": "string", "minLength": 1 },
                  "category": { "type": "string", "minLength": 1 }
                }
              }
            },
            "builtin": {
              "type": "array",
              "items": { "type": "string", "minLength": 1 }
            },
            "exclude": {
              "type": "array",
              "items": { "type": "string", "minLength": 1 }
            }
          }
        }
      }
    },
    "presets": {
      "type": "object",
      "propertyNames": { "minLength": 1 },
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "required": ["agents"],
        "properties": {
          "description": { "type": "string", "minLength": 1 },
          "agents": {
            "type": "object",
            "propertyNames": {
              "minLength": 1,
              "pattern": "^[a-z][a-z0-9-]*$"
            },
            "minProperties": 1,
            "additionalProperties": { "type": "string", "minLength": 1 }
          }
        }
      }
    }
  }
,
    "plugins": {
      "type": "object",
      "propertyNames": { "minLength": 1 },
      "additionalProperties": {
        "type": "boolean"
      }
    }
}
