{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/canonical/main/json-schema/canonical-prompting-reply-schema.json",
  "title": "PromptingReply",
  "x-generated": "2026-10-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/canonical-experimental-api-openapi.yml#/components/schemas/PromptingReply",
  "type": "object",
  "required": [
    "action",
    "lifespan",
    "constraints"
  ],
  "properties": {
    "action": {
      "type": "string",
      "enum": [
        "allow",
        "deny"
      ]
    },
    "lifespan": {
      "type": "string",
      "description": "The lifespan for which the decision applies.\n\nsingle: the decision only applies to the prompt with the given ID\n\ntimespan: the decision creates a rule which applies for the duration\nspecified by the duration field or until it is deleted\n\nsession: the decision creates a rule which applies until the user logs\nout (specifically, until the systemd user session ends)\n\nforever: the decision creates a rule which applies until it is deleted",
      "enum": [
        "single",
        "timespan",
        "session",
        "forever"
      ]
    },
    "duration": {
      "type": "string",
      "description": "The duration for which the decision applies. Required if lifespan is\ntimespan, otherwise must be omitted.",
      "format": "Go duration"
    },
    "constraints": {
      "oneOf": [
        {
          "$ref": "#/$defs/PromptingReplyConstraintsCamera"
        },
        {
          "$ref": "#/$defs/PromptingReplyConstraintsHome"
        }
      ]
    }
  },
  "$defs": {
    "PromptingReplyConstraintsCamera": {
      "type": "object",
      "description": "Represents the constraints associated with a reply to a prompt for the camera interface.",
      "required": [
        "permissions"
      ],
      "properties": {
        "permissions": {
          "type": "array",
          "description": "The permissions applied to requests to access cameras via the camera interface.",
          "items": {
            "type": "string",
            "enum": [
              "access"
            ]
          }
        }
      }
    },
    "PromptingReplyConstraintsHome": {
      "type": "object",
      "description": "Represents the constraints associated with a reply to a prompt for the home interface.",
      "required": [
        "path-pattern",
        "permissions"
      ],
      "properties": {
        "path-pattern": {
          "type": "string",
          "description": "Path glob matching filepaths for which the reply applies, which must\nmatch (in the globstar sense) the originally-requested path, must\nbegin with /, and may include bash-like constructions such as *, /**/,\nand {a,b}, but must not include character classes of the form [abc] or\n[^abc]."
        },
        "permissions": {
          "type": "array",
          "description": "The permission applied to files matching the path glob in\n'path-pattern'.",
          "items": {
            "type": "string",
            "enum": [
              "read",
              "write",
              "execute"
            ]
          }
        }
      }
    }
  }
}