{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Tau user access configuration",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion"],
  "properties": {
    "schemaVersion": {
      "const": 1
    },
    "permissions": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "filesystem": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "write": {
              "type": "array",
              "maxItems": 256,
              "items": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4096,
                    "pattern": "^(?:/|~/|[A-Za-z]:[\\\\/]|\\\\\\\\)"
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["path"],
                    "properties": {
                      "path": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 4096,
                        "pattern": "^(?:/|~/|[A-Za-z]:[\\\\/]|\\\\\\\\)"
                      },
                      "scope": {
                        "const": "subtree"
                      }
                    }
                  }
                ]
              }
            },
            "denyRead": {
              "type": "array",
              "maxItems": 256,
              "items": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4096
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["path"],
                    "properties": {
                      "path": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 4096
                      },
                      "scope": {
                        "enum": ["exact", "subtree"]
                      }
                    }
                  }
                ]
              }
            },
            "denyWrite": {
              "type": "array",
              "maxItems": 256,
              "items": {
                "anyOf": [
                  {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4096
                  },
                  {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["path"],
                    "properties": {
                      "path": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 4096
                      },
                      "scope": {
                        "enum": ["exact", "subtree"]
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "reviewShell": {
          "type": "boolean"
        },
        "sandboxMode": {
          "enum": ["read-only", "workspace-write", "danger-full-access"]
        },
        "approvalPolicy": {
          "enum": ["untrusted", "on-request", "never"]
        },
        "approvalsReviewer": {
          "enum": ["user", "auto-review"]
        },
        "fullAccess": {
          "type": "boolean"
        }
      }
    },
    "projects": {
      "type": "object",
      "maxProperties": 256,
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "filesystem": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "read": {
                "type": "array",
                "maxItems": 256,
                "items": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": ["path"],
                      "properties": {
                        "path": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 4096
                        },
                        "scope": {
                          "const": "subtree"
                        }
                      }
                    }
                  ]
                }
              },
              "write": {
                "type": "array",
                "maxItems": 256,
                "items": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": ["path"],
                      "properties": {
                        "path": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 4096
                        },
                        "scope": {
                          "const": "subtree"
                        }
                      }
                    }
                  ]
                }
              },
              "denyRead": {
                "type": "array",
                "maxItems": 256,
                "items": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": ["path"],
                      "properties": {
                        "path": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 4096
                        },
                        "scope": {
                          "enum": ["exact", "subtree"]
                        }
                      }
                    }
                  ]
                }
              },
              "denyWrite": {
                "type": "array",
                "maxItems": 256,
                "items": {
                  "anyOf": [
                    {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 4096
                    },
                    {
                      "type": "object",
                      "additionalProperties": false,
                      "required": ["path"],
                      "properties": {
                        "path": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 4096
                        },
                        "scope": {
                          "enum": ["exact", "subtree"]
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "reviewShell": {
            "type": "boolean"
          }
        }
      }
    }
  }
}
