{
  "openapi": "3.1.0",
  "info": {
    "title": "PaintBox control plane",
    "version": "0.0.1",
    "description": "Auth, agent planning, jobs, assets, voice, publication, and the review surface. Generated from apps/web/server/contracts - never edited by hand."
  },
  "servers": [
    {
      "url": "/"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      },
      "reviewCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "ic_review"
      }
    },
    "schemas": {
      "ErrorEnvelope": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "code": {
            "type": "string"
          },
          "details": {},
          "violations": {
            "type": "array",
            "items": {}
          }
        },
        "required": ["error", "message"],
        "additionalProperties": false
      }
    }
  },
  "paths": {
    "/api/agent/plan": {
      "post": {
        "operationId": "planAgentTurn",
        "summary": "Turn one creator utterance into at most one proposal, plus job requests and view changes.",
        "tags": ["Agent"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "debug",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "const": "1"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                  },
                  "utterance": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "headRevision": {
                        "type": "string",
                        "pattern": "^rev_[1-9][0-9]*$"
                      },
                      "summary": {
                        "type": "object",
                        "properties": {
                          "documentId": {
                            "type": "string",
                            "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          },
                          "headRevision": {
                            "type": "string",
                            "pattern": "^rev_[1-9][0-9]*$"
                          },
                          "canvas": {
                            "type": "object",
                            "properties": {
                              "width": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4096
                              },
                              "height": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4096
                              },
                              "crop": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "x": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "y": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "width": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "height": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      }
                                    },
                                    "required": ["x", "y", "width", "height"],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "colorSpace": {
                                "type": "string",
                                "const": "srgb"
                              },
                              "assumedSrgb": {
                                "type": "boolean"
                              }
                            },
                            "required": ["width", "height", "crop", "colorSpace", "assumedSrgb"],
                            "additionalProperties": false
                          },
                          "nodes": {
                            "maxItems": 65536,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "raster"
                                    },
                                    "id": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    },
                                    "parent": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "visible": {
                                      "type": "boolean"
                                    },
                                    "locked": {
                                      "type": "boolean"
                                    },
                                    "opacity": {
                                      "type": "number",
                                      "minimum": 0,
                                      "maximum": 1
                                    },
                                    "blend": {
                                      "type": "string",
                                      "enum": [
                                        "normal",
                                        "multiply",
                                        "screen",
                                        "darken",
                                        "lighten",
                                        "overlay",
                                        "soft_light",
                                        "hard_light",
                                        "difference",
                                        "exclusion",
                                        "color_dodge",
                                        "color_burn"
                                      ]
                                    },
                                    "maskId": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "transform": {
                                      "type": "object",
                                      "properties": {
                                        "tx": {
                                          "type": "number"
                                        },
                                        "ty": {
                                          "type": "number"
                                        },
                                        "sx": {
                                          "type": "number",
                                          "exclusiveMinimum": 0
                                        },
                                        "sy": {
                                          "type": "number",
                                          "exclusiveMinimum": 0
                                        },
                                        "rotation": {
                                          "type": "number"
                                        },
                                        "flipX": {
                                          "type": "boolean"
                                        },
                                        "flipY": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": ["tx", "ty", "sx", "sy", "rotation", "flipX", "flipY"],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": ["kind", "id", "name", "parent", "visible", "locked", "opacity", "blend"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "group"
                                    },
                                    "id": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    },
                                    "parent": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "visible": {
                                      "type": "boolean"
                                    },
                                    "locked": {
                                      "type": "boolean"
                                    },
                                    "opacity": {
                                      "type": "number",
                                      "minimum": 0,
                                      "maximum": 1
                                    },
                                    "blend": {
                                      "type": "string",
                                      "enum": [
                                        "normal",
                                        "multiply",
                                        "screen",
                                        "darken",
                                        "lighten",
                                        "overlay",
                                        "soft_light",
                                        "hard_light",
                                        "difference",
                                        "exclusion",
                                        "color_dodge",
                                        "color_burn"
                                      ]
                                    },
                                    "maskId": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "isolated": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "id",
                                    "name",
                                    "parent",
                                    "visible",
                                    "locked",
                                    "opacity",
                                    "blend",
                                    "isolated"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "mask"
                                    },
                                    "id": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    },
                                    "parent": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "ownerId": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    }
                                  },
                                  "required": ["kind", "id", "name", "parent", "ownerId"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "adjustment"
                                    },
                                    "id": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    },
                                    "parent": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "visible": {
                                      "type": "boolean"
                                    },
                                    "locked": {
                                      "type": "boolean"
                                    },
                                    "opacity": {
                                      "type": "number",
                                      "minimum": 0,
                                      "maximum": 1
                                    },
                                    "maskId": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "adjustment": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "brightness_contrast"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "brightness": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            },
                                            "contrast": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            }
                                          },
                                          "required": ["type", "version", "brightness", "contrast"],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "hue_saturation"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "hue": {
                                              "type": "number",
                                              "minimum": -180,
                                              "maximum": 180
                                            },
                                            "saturation": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            },
                                            "lightness": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            }
                                          },
                                          "required": ["type", "version", "hue", "saturation", "lightness"],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "warmth_tint"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "warmth": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            },
                                            "tint": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            }
                                          },
                                          "required": ["type", "version", "warmth", "tint"],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "levels"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "inputBlack": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "inputWhite": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "gamma": {
                                              "type": "number",
                                              "minimum": 0.1,
                                              "maximum": 10
                                            },
                                            "outputBlack": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "outputWhite": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "version",
                                            "inputBlack",
                                            "inputWhite",
                                            "gamma",
                                            "outputBlack",
                                            "outputWhite"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "curves"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "channel": {
                                              "type": "string",
                                              "enum": ["master", "r", "g", "b"]
                                            },
                                            "points": {
                                              "minItems": 2,
                                              "maxItems": 16,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "x": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "y": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": ["x", "y"],
                                                "additionalProperties": false
                                              }
                                            }
                                          },
                                          "required": ["type", "version", "channel", "points"],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "exposure"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "exposure": {
                                              "type": "number",
                                              "minimum": -5,
                                              "maximum": 5
                                            },
                                            "offset": {
                                              "type": "number",
                                              "minimum": -0.5,
                                              "maximum": 0.5
                                            },
                                            "gamma": {
                                              "type": "number",
                                              "minimum": 0.1,
                                              "maximum": 10
                                            }
                                          },
                                          "required": ["type", "version", "exposure", "offset", "gamma"],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "vibrance"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "vibrance": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            },
                                            "saturation": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            }
                                          },
                                          "required": ["type", "version", "vibrance", "saturation"],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "black_white"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "red": {
                                              "type": "number",
                                              "minimum": -2,
                                              "maximum": 3
                                            },
                                            "yellow": {
                                              "type": "number",
                                              "minimum": -2,
                                              "maximum": 3
                                            },
                                            "green": {
                                              "type": "number",
                                              "minimum": -2,
                                              "maximum": 3
                                            },
                                            "cyan": {
                                              "type": "number",
                                              "minimum": -2,
                                              "maximum": 3
                                            },
                                            "blue": {
                                              "type": "number",
                                              "minimum": -2,
                                              "maximum": 3
                                            },
                                            "magenta": {
                                              "type": "number",
                                              "minimum": -2,
                                              "maximum": 3
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "version",
                                            "red",
                                            "yellow",
                                            "green",
                                            "cyan",
                                            "blue",
                                            "magenta"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "hue_range_remap"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "hueMin": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 360
                                            },
                                            "hueMax": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 360
                                            },
                                            "feather": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 60
                                            },
                                            "minSaturation": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "minValue": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "target": {
                                              "type": "object",
                                              "properties": {
                                                "r": {
                                                  "type": "number",
                                                  "minimum": 0,
                                                  "maximum": 1
                                                },
                                                "g": {
                                                  "type": "number",
                                                  "minimum": 0,
                                                  "maximum": 1
                                                },
                                                "b": {
                                                  "type": "number",
                                                  "minimum": 0,
                                                  "maximum": 1
                                                },
                                                "a": {
                                                  "type": "number",
                                                  "minimum": 0,
                                                  "maximum": 1
                                                }
                                              },
                                              "required": ["r", "g", "b", "a"],
                                              "additionalProperties": false
                                            },
                                            "preserveGradient": {
                                              "type": "boolean"
                                            },
                                            "strength": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "version",
                                            "hueMin",
                                            "hueMax",
                                            "feather",
                                            "minSaturation",
                                            "minValue",
                                            "target",
                                            "preserveGradient",
                                            "strength"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "invert"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            }
                                          },
                                          "required": ["type", "version"],
                                          "additionalProperties": false
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "id",
                                    "name",
                                    "parent",
                                    "visible",
                                    "locked",
                                    "opacity",
                                    "adjustment"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "text"
                                    },
                                    "id": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    },
                                    "parent": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "visible": {
                                      "type": "boolean"
                                    },
                                    "locked": {
                                      "type": "boolean"
                                    },
                                    "opacity": {
                                      "type": "number",
                                      "minimum": 0,
                                      "maximum": 1
                                    },
                                    "blend": {
                                      "type": "string",
                                      "enum": [
                                        "normal",
                                        "multiply",
                                        "screen",
                                        "darken",
                                        "lighten",
                                        "overlay",
                                        "soft_light",
                                        "hard_light",
                                        "difference",
                                        "exclusion",
                                        "color_dodge",
                                        "color_burn"
                                      ]
                                    },
                                    "maskId": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "transform": {
                                      "type": "object",
                                      "properties": {
                                        "tx": {
                                          "type": "number"
                                        },
                                        "ty": {
                                          "type": "number"
                                        },
                                        "sx": {
                                          "type": "number",
                                          "exclusiveMinimum": 0
                                        },
                                        "sy": {
                                          "type": "number",
                                          "exclusiveMinimum": 0
                                        },
                                        "rotation": {
                                          "type": "number"
                                        },
                                        "flipX": {
                                          "type": "boolean"
                                        },
                                        "flipY": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": ["tx", "ty", "sx", "sy", "rotation", "flipX", "flipY"],
                                      "additionalProperties": false
                                    },
                                    "text": {
                                      "type": "object",
                                      "properties": {
                                        "content": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 2000
                                        },
                                        "family": {
                                          "type": "string",
                                          "enum": ["sans-serif", "serif", "monospace", "system-ui"]
                                        },
                                        "sizePx": {
                                          "type": "integer",
                                          "minimum": 4,
                                          "maximum": 512
                                        },
                                        "weight": {
                                          "type": "integer",
                                          "minimum": 100,
                                          "maximum": 900,
                                          "multipleOf": 100
                                        },
                                        "italic": {
                                          "type": "boolean"
                                        },
                                        "color": {
                                          "type": "object",
                                          "properties": {
                                            "r": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "g": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "b": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "a": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            }
                                          },
                                          "required": ["r", "g", "b", "a"],
                                          "additionalProperties": false
                                        },
                                        "align": {
                                          "type": "string",
                                          "enum": ["left", "center", "right"]
                                        },
                                        "lineHeight": {
                                          "type": "number",
                                          "minimum": 0.8,
                                          "maximum": 3
                                        },
                                        "box": {
                                          "type": "object",
                                          "properties": {
                                            "x": {
                                              "type": "integer",
                                              "minimum": -4096,
                                              "maximum": 4096
                                            },
                                            "y": {
                                              "type": "integer",
                                              "minimum": -4096,
                                              "maximum": 4096
                                            },
                                            "width": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "maximum": 4096
                                            }
                                          },
                                          "required": ["x", "y"],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "content",
                                        "family",
                                        "sizePx",
                                        "weight",
                                        "italic",
                                        "color",
                                        "align",
                                        "lineHeight",
                                        "box"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "id",
                                    "name",
                                    "parent",
                                    "visible",
                                    "locked",
                                    "opacity",
                                    "blend",
                                    "text"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "activeVariant": {
                            "type": "string",
                            "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          },
                          "variants": {
                            "maxItems": 1024,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 40
                                },
                                "base": {
                                  "type": "string",
                                  "pattern": "^rev_[1-9][0-9]*$"
                                },
                                "head": {
                                  "type": "string",
                                  "pattern": "^rev_[1-9][0-9]*$"
                                },
                                "parentVariant": {
                                  "type": "string",
                                  "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "settings": {
                                  "maxItems": 128,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "axis": {
                                        "type": "string",
                                        "enum": [
                                          "warmth",
                                          "tint",
                                          "brightness",
                                          "contrast",
                                          "saturation",
                                          "hue",
                                          "lightness",
                                          "cropScale",
                                          "opacity"
                                        ]
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "operationVersion": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 9007199254740991
                                      },
                                      "target": {
                                        "type": "string",
                                        "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                      }
                                    },
                                    "required": ["axis", "value", "operationVersion", "target"],
                                    "additionalProperties": false
                                  }
                                },
                                "constraintIds": {
                                  "maxItems": 128,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200
                                  }
                                },
                                "intent": {
                                  "maxItems": 128,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "claim": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500
                                      },
                                      "source": {
                                        "type": "string",
                                        "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                                      },
                                      "evidenceIds": {
                                        "maxItems": 64,
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200
                                        }
                                      },
                                      "status": {
                                        "type": "string",
                                        "enum": ["recorded", "inferred", "confirmed", "stale"]
                                      },
                                      "uncertainty": {
                                        "type": "string",
                                        "enum": ["low", "medium", "high"]
                                      }
                                    },
                                    "required": ["claim", "source", "evidenceIds", "status"],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": ["id", "label", "base", "head", "settings", "constraintIds", "intent"],
                              "additionalProperties": false
                            }
                          },
                          "constraints": {
                            "maxItems": 1024,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "locked_node",
                                    "protected_region",
                                    "allowed_mask",
                                    "output_dimensions",
                                    "semantic"
                                  ]
                                },
                                "target": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^[0-9a-f]{64}$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 500
                                },
                                "enforcement": {
                                  "type": "string",
                                  "enum": ["engine", "review"]
                                },
                                "status": {
                                  "type": "string",
                                  "enum": ["active", "stale"]
                                },
                                "revision": {
                                  "type": "string",
                                  "pattern": "^rev_[1-9][0-9]*$"
                                }
                              },
                              "required": ["id", "kind", "target", "description", "enforcement", "status", "revision"],
                              "additionalProperties": false
                            }
                          },
                          "selection": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "bbox": {
                                    "type": "object",
                                    "properties": {
                                      "x": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "y": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "width": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "height": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      }
                                    },
                                    "required": ["x", "y", "width", "height"],
                                    "additionalProperties": false
                                  },
                                  "coverage": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1
                                  }
                                },
                                "required": ["bbox", "coverage"],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "assets": {
                            "maxItems": 32,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "hash": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{64}$"
                                },
                                "width": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 4096
                                },
                                "height": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 4096
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                }
                              },
                              "required": ["hash", "width", "height"],
                              "additionalProperties": false
                            }
                          },
                          "exportSpecs": {
                            "maxItems": 16,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "outputCount": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 64
                                }
                              },
                              "required": ["name", "outputCount"],
                              "additionalProperties": false
                            }
                          },
                          "recentRevisions": {
                            "maxItems": 10,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "pattern": "^rev_[1-9][0-9]*$"
                                },
                                "parent": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^rev_[1-9][0-9]*$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "actor": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "actorKind": {
                                  "type": "string",
                                  "enum": ["user", "agent", "reviewer", "system"]
                                },
                                "createdAt": {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                "commandIds": {
                                  "maxItems": 1024,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                  }
                                },
                                "changedNodes": {
                                  "maxItems": 4096,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                  }
                                },
                                "bounds": {
                                  "type": "object",
                                  "properties": {
                                    "x": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "y": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "width": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "height": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": ["x", "y", "width", "height"],
                                  "additionalProperties": false
                                },
                                "schemaVersion": {
                                  "type": "number",
                                  "const": 1
                                }
                              },
                              "required": [
                                "id",
                                "parent",
                                "label",
                                "actor",
                                "actorKind",
                                "createdAt",
                                "commandIds",
                                "changedNodes",
                                "schemaVersion"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "documentId",
                          "headRevision",
                          "canvas",
                          "nodes",
                          "variants",
                          "constraints",
                          "selection",
                          "assets",
                          "exportSpecs",
                          "recentRevisions"
                        ],
                        "additionalProperties": false
                      },
                      "selection": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "bbox": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "y": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "width": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "height": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": ["x", "y", "width", "height"],
                                "additionalProperties": false
                              },
                              "coverage": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1
                              }
                            },
                            "required": ["bbox", "coverage"]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "recentDiffs": {
                        "maxItems": 8,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "a": {
                              "type": "string",
                              "pattern": "^rev_[1-9][0-9]*$"
                            },
                            "b": {
                              "type": "string",
                              "pattern": "^rev_[1-9][0-9]*$"
                            },
                            "nodeChanges": {
                              "maxItems": 4096,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "node": {
                                    "type": "string",
                                    "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                  },
                                  "change": {
                                    "type": "string",
                                    "enum": ["added", "removed", "modified"]
                                  },
                                  "fields": {
                                    "maxItems": 64,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    }
                                  },
                                  "paramDeltas": {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200
                                    },
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "from": {},
                                        "to": {}
                                      },
                                      "required": ["from", "to"],
                                      "additionalProperties": false
                                    }
                                  },
                                  "pixelBbox": {
                                    "type": "object",
                                    "properties": {
                                      "x": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "y": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "width": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "height": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      }
                                    },
                                    "required": ["x", "y", "width", "height"],
                                    "additionalProperties": false
                                  },
                                  "tilesChanged": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 256
                                  }
                                },
                                "required": ["node", "change", "fields"],
                                "additionalProperties": false
                              }
                            },
                            "intent": {
                              "maxItems": 128,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "claim": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 500
                                  },
                                  "source": {
                                    "type": "string",
                                    "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                                  },
                                  "evidenceIds": {
                                    "maxItems": 64,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200
                                    }
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": ["recorded", "inferred", "confirmed", "stale"]
                                  },
                                  "uncertainty": {
                                    "type": "string",
                                    "enum": ["low", "medium", "high"]
                                  }
                                },
                                "required": ["claim", "source", "evidenceIds", "status"],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": ["a", "b", "nodeChanges", "intent"],
                          "additionalProperties": false
                        }
                      },
                      "previews": {
                        "maxItems": 8,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "node": {
                                  "type": "string",
                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "mimeType": {
                                  "type": "string",
                                  "enum": ["image/png", "image/jpeg"]
                                },
                                "base64": {
                                  "type": "string",
                                  "maxLength": 349528
                                },
                                "scope": {
                                  "type": "string",
                                  "enum": ["document", "node"]
                                }
                              },
                              "required": ["node", "mimeType", "base64"]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "node": {
                                  "type": "string",
                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "dataUrl": {
                                  "type": "string",
                                  "maxLength": 349592
                                },
                                "scope": {
                                  "type": "string",
                                  "enum": ["document", "node"]
                                }
                              },
                              "required": ["node", "dataUrl"]
                            }
                          ]
                        }
                      }
                    },
                    "required": ["headRevision", "summary"]
                  }
                },
                "required": ["documentId", "utterance", "context"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Turn one creator utterance into at most one proposal, plus job requests and view changes.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "interpretation": {
                      "type": "string"
                    },
                    "proposal": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "commandId": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                            },
                            "documentId": {
                              "type": "string",
                              "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                            },
                            "actorId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "actorKind": {
                              "type": "string",
                              "enum": ["user", "agent", "reviewer"]
                            },
                            "baseRevision": {
                              "type": "string",
                              "pattern": "^rev_[1-9][0-9]*$"
                            },
                            "readDependencies": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string",
                                "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                              },
                              "additionalProperties": {
                                "type": "string",
                                "pattern": "^rev_[1-9][0-9]*$"
                              }
                            },
                            "writes": {
                              "maxItems": 256,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                              }
                            },
                            "edits": {
                              "minItems": 1,
                              "maxItems": 64,
                              "type": "array",
                              "items": {
                                "anyOf": [
                                  {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "create_layer"
                                          },
                                          "name": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "kind": {
                                            "type": "string",
                                            "enum": ["raster", "group", "adjustment"]
                                          },
                                          "parent": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "index": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 9007199254740991
                                          },
                                          "adjustment": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "brightness_contrast"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "brightness": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  },
                                                  "contrast": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": ["type", "version", "brightness", "contrast"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "hue_saturation"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "hue": {
                                                    "type": "number",
                                                    "minimum": -180,
                                                    "maximum": 180
                                                  },
                                                  "saturation": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  },
                                                  "lightness": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": ["type", "version", "hue", "saturation", "lightness"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "warmth_tint"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "warmth": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  },
                                                  "tint": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": ["type", "version", "warmth", "tint"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "levels"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "inputBlack": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "inputWhite": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "gamma": {
                                                    "type": "number",
                                                    "minimum": 0.1,
                                                    "maximum": 10
                                                  },
                                                  "outputBlack": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "outputWhite": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "version",
                                                  "inputBlack",
                                                  "inputWhite",
                                                  "gamma",
                                                  "outputBlack",
                                                  "outputWhite"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "curves"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "channel": {
                                                    "type": "string",
                                                    "enum": ["master", "r", "g", "b"]
                                                  },
                                                  "points": {
                                                    "minItems": 2,
                                                    "maxItems": 16,
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "properties": {
                                                        "x": {
                                                          "type": "number",
                                                          "minimum": 0,
                                                          "maximum": 1
                                                        },
                                                        "y": {
                                                          "type": "number",
                                                          "minimum": 0,
                                                          "maximum": 1
                                                        }
                                                      },
                                                      "required": ["x", "y"],
                                                      "additionalProperties": false
                                                    }
                                                  }
                                                },
                                                "required": ["type", "version", "channel", "points"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "exposure"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "exposure": {
                                                    "type": "number",
                                                    "minimum": -5,
                                                    "maximum": 5
                                                  },
                                                  "offset": {
                                                    "type": "number",
                                                    "minimum": -0.5,
                                                    "maximum": 0.5
                                                  },
                                                  "gamma": {
                                                    "type": "number",
                                                    "minimum": 0.1,
                                                    "maximum": 10
                                                  }
                                                },
                                                "required": ["type", "version", "exposure", "offset", "gamma"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "vibrance"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "vibrance": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  },
                                                  "saturation": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": ["type", "version", "vibrance", "saturation"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "black_white"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "red": {
                                                    "type": "number",
                                                    "minimum": -2,
                                                    "maximum": 3
                                                  },
                                                  "yellow": {
                                                    "type": "number",
                                                    "minimum": -2,
                                                    "maximum": 3
                                                  },
                                                  "green": {
                                                    "type": "number",
                                                    "minimum": -2,
                                                    "maximum": 3
                                                  },
                                                  "cyan": {
                                                    "type": "number",
                                                    "minimum": -2,
                                                    "maximum": 3
                                                  },
                                                  "blue": {
                                                    "type": "number",
                                                    "minimum": -2,
                                                    "maximum": 3
                                                  },
                                                  "magenta": {
                                                    "type": "number",
                                                    "minimum": -2,
                                                    "maximum": 3
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "version",
                                                  "red",
                                                  "yellow",
                                                  "green",
                                                  "cyan",
                                                  "blue",
                                                  "magenta"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "hue_range_remap"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "hueMin": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 360
                                                  },
                                                  "hueMax": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 360
                                                  },
                                                  "feather": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 60
                                                  },
                                                  "minSaturation": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "minValue": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "target": {
                                                    "type": "object",
                                                    "properties": {
                                                      "r": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      },
                                                      "g": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      },
                                                      "b": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      },
                                                      "a": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      }
                                                    },
                                                    "required": ["r", "g", "b", "a"],
                                                    "additionalProperties": false
                                                  },
                                                  "preserveGradient": {
                                                    "type": "boolean"
                                                  },
                                                  "strength": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "version",
                                                  "hueMin",
                                                  "hueMax",
                                                  "feather",
                                                  "minSaturation",
                                                  "minValue",
                                                  "target",
                                                  "preserveGradient",
                                                  "strength"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "invert"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  }
                                                },
                                                "required": ["type", "version"],
                                                "additionalProperties": false
                                              }
                                            ]
                                          },
                                          "id": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          }
                                        },
                                        "required": ["type", "name", "kind"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "delete_node"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          }
                                        },
                                        "required": ["type", "node"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "reorder_node"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "parent": {
                                            "anyOf": [
                                              {
                                                "type": "string",
                                                "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "index": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": ["type", "node", "parent", "index"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "duplicate_layer"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          }
                                        },
                                        "required": ["type", "node"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "rename_node"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "name": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          }
                                        },
                                        "required": ["type", "node", "name"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "set_visibility"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "visible": {
                                            "type": "boolean"
                                          }
                                        },
                                        "required": ["type", "node", "visible"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "set_opacity"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "opacity": {
                                            "type": "number",
                                            "minimum": 0,
                                            "maximum": 1
                                          }
                                        },
                                        "required": ["type", "node", "opacity"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "set_blend_mode"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "blend": {
                                            "type": "string",
                                            "enum": [
                                              "normal",
                                              "multiply",
                                              "screen",
                                              "darken",
                                              "lighten",
                                              "overlay",
                                              "soft_light",
                                              "hard_light",
                                              "difference",
                                              "exclusion",
                                              "color_dodge",
                                              "color_burn"
                                            ]
                                          }
                                        },
                                        "required": ["type", "node", "blend"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "set_locked"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "locked": {
                                            "type": "boolean"
                                          }
                                        },
                                        "required": ["type", "node", "locked"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "paint_stroke"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "brush": {
                                            "type": "object",
                                            "properties": {
                                              "radius": {
                                                "type": "number",
                                                "minimum": 0.5,
                                                "maximum": 500
                                              },
                                              "hardness": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 1
                                              },
                                              "opacity": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 1
                                              },
                                              "color": {
                                                "type": "object",
                                                "properties": {
                                                  "r": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "g": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "b": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "a": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": ["r", "g", "b", "a"],
                                                "additionalProperties": false
                                              },
                                              "erase": {
                                                "type": "boolean"
                                              },
                                              "spacing": {
                                                "type": "number",
                                                "minimum": 0.05,
                                                "maximum": 1
                                              }
                                            },
                                            "required": ["radius", "hardness", "opacity", "color", "erase", "spacing"],
                                            "additionalProperties": false
                                          },
                                          "samples": {
                                            "minItems": 1,
                                            "maxItems": 4096,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "x": {
                                                  "type": "number"
                                                },
                                                "y": {
                                                  "type": "number"
                                                },
                                                "pressure": {
                                                  "type": "number",
                                                  "minimum": 0,
                                                  "maximum": 1
                                                },
                                                "t": {
                                                  "type": "number",
                                                  "minimum": 0
                                                }
                                              },
                                              "required": ["x", "y", "pressure", "t"],
                                              "additionalProperties": false
                                            }
                                          }
                                        },
                                        "required": ["type", "node", "brush", "samples"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "fill"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "color": {
                                            "type": "object",
                                            "properties": {
                                              "r": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 1
                                              },
                                              "g": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 1
                                              },
                                              "b": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 1
                                              },
                                              "a": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 1
                                              }
                                            },
                                            "required": ["r", "g", "b", "a"],
                                            "additionalProperties": false
                                          },
                                          "useSelection": {
                                            "type": "boolean"
                                          }
                                        },
                                        "required": ["type", "node", "color", "useSelection"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "move_selection"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "dx": {
                                            "type": "integer",
                                            "minimum": -16384,
                                            "maximum": 16384
                                          },
                                          "dy": {
                                            "type": "integer",
                                            "minimum": -16384,
                                            "maximum": 16384
                                          }
                                        },
                                        "required": ["type", "node", "dx", "dy"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "erase_selection"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          }
                                        },
                                        "required": ["type", "node"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "set_selection"
                                          },
                                          "selection": {
                                            "type": "object",
                                            "properties": {
                                              "shape": {
                                                "oneOf": [
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "type": {
                                                        "type": "string",
                                                        "const": "rect"
                                                      },
                                                      "x": {
                                                        "type": "number"
                                                      },
                                                      "y": {
                                                        "type": "number"
                                                      },
                                                      "width": {
                                                        "type": "number",
                                                        "exclusiveMinimum": 0
                                                      },
                                                      "height": {
                                                        "type": "number",
                                                        "exclusiveMinimum": 0
                                                      }
                                                    },
                                                    "required": ["type", "x", "y", "width", "height"],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "type": {
                                                        "type": "string",
                                                        "const": "ellipse"
                                                      },
                                                      "cx": {
                                                        "type": "number"
                                                      },
                                                      "cy": {
                                                        "type": "number"
                                                      },
                                                      "rx": {
                                                        "type": "number",
                                                        "exclusiveMinimum": 0
                                                      },
                                                      "ry": {
                                                        "type": "number",
                                                        "exclusiveMinimum": 0
                                                      }
                                                    },
                                                    "required": ["type", "cx", "cy", "rx", "ry"],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "type": {
                                                        "type": "string",
                                                        "const": "polygon"
                                                      },
                                                      "points": {
                                                        "minItems": 3,
                                                        "maxItems": 4096,
                                                        "type": "array",
                                                        "items": {
                                                          "type": "object",
                                                          "properties": {
                                                            "x": {
                                                              "type": "number"
                                                            },
                                                            "y": {
                                                              "type": "number"
                                                            }
                                                          },
                                                          "required": ["x", "y"],
                                                          "additionalProperties": false
                                                        }
                                                      }
                                                    },
                                                    "required": ["type", "points"],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "type": {
                                                        "type": "string",
                                                        "const": "contiguous"
                                                      },
                                                      "x": {
                                                        "type": "number"
                                                      },
                                                      "y": {
                                                        "type": "number"
                                                      },
                                                      "tolerance": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      }
                                                    },
                                                    "required": ["type", "x", "y", "tolerance"],
                                                    "additionalProperties": false
                                                  }
                                                ]
                                              },
                                              "mode": {
                                                "type": "string",
                                                "enum": ["replace", "add", "subtract"]
                                              },
                                              "feather": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 256
                                              }
                                            },
                                            "required": ["shape", "mode", "feather"],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": ["type", "selection"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "clear_selection"
                                          }
                                        },
                                        "required": ["type"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "invert_selection"
                                          }
                                        },
                                        "required": ["type"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "modify_selection"
                                          },
                                          "op": {
                                            "type": "string",
                                            "enum": ["expand", "contract", "smooth"]
                                          },
                                          "amount": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 256
                                          }
                                        },
                                        "required": ["type", "op", "amount"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "select_color_range"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "mode": {
                                            "type": "string",
                                            "enum": ["distance", "hsv"]
                                          },
                                          "target": {
                                            "type": "object",
                                            "properties": {
                                              "r": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 1
                                              },
                                              "g": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 1
                                              },
                                              "b": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 1
                                              },
                                              "a": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 1
                                              }
                                            },
                                            "required": ["r", "g", "b", "a"],
                                            "additionalProperties": false
                                          },
                                          "tolerance": {
                                            "type": "number",
                                            "minimum": 0,
                                            "maximum": 1
                                          },
                                          "saturationMax": {
                                            "type": "number",
                                            "minimum": 0,
                                            "maximum": 1
                                          },
                                          "feather": {
                                            "type": "number",
                                            "minimum": 0,
                                            "maximum": 50
                                          },
                                          "autoTune": {
                                            "type": "boolean"
                                          },
                                          "combine": {
                                            "type": "string",
                                            "enum": ["replace", "add", "subtract"]
                                          }
                                        },
                                        "required": ["type", "node", "mode", "feather"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "set_mask_from_selection"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          }
                                        },
                                        "required": ["type", "node"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "clear_mask"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          }
                                        },
                                        "required": ["type", "node"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "set_adjustment"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "adjustment": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "brightness_contrast"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "brightness": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  },
                                                  "contrast": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": ["type", "version", "brightness", "contrast"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "hue_saturation"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "hue": {
                                                    "type": "number",
                                                    "minimum": -180,
                                                    "maximum": 180
                                                  },
                                                  "saturation": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  },
                                                  "lightness": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": ["type", "version", "hue", "saturation", "lightness"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "warmth_tint"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "warmth": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  },
                                                  "tint": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": ["type", "version", "warmth", "tint"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "levels"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "inputBlack": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "inputWhite": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "gamma": {
                                                    "type": "number",
                                                    "minimum": 0.1,
                                                    "maximum": 10
                                                  },
                                                  "outputBlack": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "outputWhite": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "version",
                                                  "inputBlack",
                                                  "inputWhite",
                                                  "gamma",
                                                  "outputBlack",
                                                  "outputWhite"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "curves"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "channel": {
                                                    "type": "string",
                                                    "enum": ["master", "r", "g", "b"]
                                                  },
                                                  "points": {
                                                    "minItems": 2,
                                                    "maxItems": 16,
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "properties": {
                                                        "x": {
                                                          "type": "number",
                                                          "minimum": 0,
                                                          "maximum": 1
                                                        },
                                                        "y": {
                                                          "type": "number",
                                                          "minimum": 0,
                                                          "maximum": 1
                                                        }
                                                      },
                                                      "required": ["x", "y"],
                                                      "additionalProperties": false
                                                    }
                                                  }
                                                },
                                                "required": ["type", "version", "channel", "points"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "exposure"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "exposure": {
                                                    "type": "number",
                                                    "minimum": -5,
                                                    "maximum": 5
                                                  },
                                                  "offset": {
                                                    "type": "number",
                                                    "minimum": -0.5,
                                                    "maximum": 0.5
                                                  },
                                                  "gamma": {
                                                    "type": "number",
                                                    "minimum": 0.1,
                                                    "maximum": 10
                                                  }
                                                },
                                                "required": ["type", "version", "exposure", "offset", "gamma"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "vibrance"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "vibrance": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  },
                                                  "saturation": {
                                                    "type": "number",
                                                    "minimum": -1,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": ["type", "version", "vibrance", "saturation"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "black_white"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "red": {
                                                    "type": "number",
                                                    "minimum": -2,
                                                    "maximum": 3
                                                  },
                                                  "yellow": {
                                                    "type": "number",
                                                    "minimum": -2,
                                                    "maximum": 3
                                                  },
                                                  "green": {
                                                    "type": "number",
                                                    "minimum": -2,
                                                    "maximum": 3
                                                  },
                                                  "cyan": {
                                                    "type": "number",
                                                    "minimum": -2,
                                                    "maximum": 3
                                                  },
                                                  "blue": {
                                                    "type": "number",
                                                    "minimum": -2,
                                                    "maximum": 3
                                                  },
                                                  "magenta": {
                                                    "type": "number",
                                                    "minimum": -2,
                                                    "maximum": 3
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "version",
                                                  "red",
                                                  "yellow",
                                                  "green",
                                                  "cyan",
                                                  "blue",
                                                  "magenta"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "hue_range_remap"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  },
                                                  "hueMin": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 360
                                                  },
                                                  "hueMax": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 360
                                                  },
                                                  "feather": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 60
                                                  },
                                                  "minSaturation": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "minValue": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "target": {
                                                    "type": "object",
                                                    "properties": {
                                                      "r": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      },
                                                      "g": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      },
                                                      "b": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      },
                                                      "a": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      }
                                                    },
                                                    "required": ["r", "g", "b", "a"],
                                                    "additionalProperties": false
                                                  },
                                                  "preserveGradient": {
                                                    "type": "boolean"
                                                  },
                                                  "strength": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "version",
                                                  "hueMin",
                                                  "hueMax",
                                                  "feather",
                                                  "minSaturation",
                                                  "minValue",
                                                  "target",
                                                  "preserveGradient",
                                                  "strength"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "invert"
                                                  },
                                                  "version": {
                                                    "type": "number",
                                                    "const": 1
                                                  }
                                                },
                                                "required": ["type", "version"],
                                                "additionalProperties": false
                                              }
                                            ]
                                          }
                                        },
                                        "required": ["type", "node", "adjustment"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "apply_filter"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "filter": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "gaussian_blur"
                                                  },
                                                  "radius": {
                                                    "type": "number",
                                                    "minimum": 0.1,
                                                    "maximum": 50
                                                  }
                                                },
                                                "required": ["type", "radius"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "sharpen"
                                                  },
                                                  "amount": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 4
                                                  }
                                                },
                                                "required": ["type", "amount"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "noise"
                                                  },
                                                  "amount": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "monochrome": {
                                                    "type": "boolean"
                                                  }
                                                },
                                                "required": ["type", "amount", "monochrome"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "alpha_threshold"
                                                  },
                                                  "low": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "high": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": ["type", "low", "high"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "feather_alpha"
                                                  },
                                                  "radius": {
                                                    "type": "number",
                                                    "minimum": 0.5,
                                                    "maximum": 50
                                                  }
                                                },
                                                "required": ["type", "radius"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "outline"
                                                  },
                                                  "width": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 64
                                                  },
                                                  "color": {
                                                    "type": "object",
                                                    "properties": {
                                                      "r": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      },
                                                      "g": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      },
                                                      "b": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      },
                                                      "a": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      }
                                                    },
                                                    "required": ["r", "g", "b", "a"],
                                                    "additionalProperties": false
                                                  },
                                                  "position": {
                                                    "type": "string",
                                                    "enum": ["outside", "inside", "center"]
                                                  }
                                                },
                                                "required": ["type", "width", "color", "position"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "drop_shadow"
                                                  },
                                                  "dx": {
                                                    "type": "integer",
                                                    "minimum": -256,
                                                    "maximum": 256
                                                  },
                                                  "dy": {
                                                    "type": "integer",
                                                    "minimum": -256,
                                                    "maximum": 256
                                                  },
                                                  "blur": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 50
                                                  },
                                                  "color": {
                                                    "type": "object",
                                                    "properties": {
                                                      "r": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      },
                                                      "g": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      },
                                                      "b": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      },
                                                      "a": {
                                                        "type": "number",
                                                        "minimum": 0,
                                                        "maximum": 1
                                                      }
                                                    },
                                                    "required": ["r", "g", "b", "a"],
                                                    "additionalProperties": false
                                                  },
                                                  "opacity": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": ["type", "dx", "dy", "blur", "color", "opacity"],
                                                "additionalProperties": false
                                              }
                                            ]
                                          }
                                        },
                                        "required": ["type", "node", "filter"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "set_transform"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "transform": {
                                            "type": "object",
                                            "properties": {
                                              "tx": {
                                                "type": "number"
                                              },
                                              "ty": {
                                                "type": "number"
                                              },
                                              "sx": {
                                                "type": "number",
                                                "exclusiveMinimum": 0
                                              },
                                              "sy": {
                                                "type": "number",
                                                "exclusiveMinimum": 0
                                              },
                                              "rotation": {
                                                "type": "number"
                                              },
                                              "flipX": {
                                                "type": "boolean"
                                              },
                                              "flipY": {
                                                "type": "boolean"
                                              }
                                            },
                                            "required": ["tx", "ty", "sx", "sy", "rotation", "flipX", "flipY"],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": ["type", "node", "transform"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "set_crop"
                                          },
                                          "crop": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "x": {
                                                    "type": "integer",
                                                    "minimum": -9007199254740991,
                                                    "maximum": 9007199254740991
                                                  },
                                                  "y": {
                                                    "type": "integer",
                                                    "minimum": -9007199254740991,
                                                    "maximum": 9007199254740991
                                                  },
                                                  "width": {
                                                    "type": "integer",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 9007199254740991
                                                  },
                                                  "height": {
                                                    "type": "integer",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 9007199254740991
                                                  }
                                                },
                                                "required": ["x", "y", "width", "height"],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          }
                                        },
                                        "required": ["type", "crop"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "resize_canvas"
                                          },
                                          "width": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 4096
                                          },
                                          "height": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 4096
                                          },
                                          "anchor": {
                                            "type": "string",
                                            "enum": [
                                              "top-left",
                                              "top-center",
                                              "top-right",
                                              "middle-left",
                                              "middle-center",
                                              "middle-right",
                                              "bottom-left",
                                              "bottom-center",
                                              "bottom-right"
                                            ]
                                          }
                                        },
                                        "required": ["type", "width", "height", "anchor"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "resample_document"
                                          },
                                          "width": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 4096
                                          },
                                          "height": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 4096
                                          }
                                        },
                                        "required": ["type", "width", "height"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "trim_to_content"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "padding": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 4096
                                          },
                                          "fit": {
                                            "type": "object",
                                            "properties": {
                                              "aspect": {
                                                "anyOf": [
                                                  {
                                                    "type": "string",
                                                    "const": "square"
                                                  },
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "width": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 4096
                                                      },
                                                      "height": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 4096
                                                      }
                                                    },
                                                    "required": ["width", "height"],
                                                    "additionalProperties": false
                                                  }
                                                ]
                                              },
                                              "anchor": {
                                                "type": "string",
                                                "enum": [
                                                  "top-left",
                                                  "top-center",
                                                  "top-right",
                                                  "middle-left",
                                                  "middle-center",
                                                  "middle-right",
                                                  "bottom-left",
                                                  "bottom-center",
                                                  "bottom-right"
                                                ]
                                              }
                                            },
                                            "required": ["aspect", "anchor"],
                                            "additionalProperties": false
                                          },
                                          "respectMask": {
                                            "type": "boolean"
                                          }
                                        },
                                        "required": ["type", "padding"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "set_export_spec"
                                          },
                                          "spec": {
                                            "type": "object",
                                            "properties": {
                                              "name": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 64
                                              },
                                              "outputs": {
                                                "minItems": 1,
                                                "maxItems": 64,
                                                "type": "array",
                                                "items": {
                                                  "type": "object",
                                                  "properties": {
                                                    "name": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 120
                                                    },
                                                    "source": {
                                                      "oneOf": [
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "composite"
                                                            }
                                                          },
                                                          "required": ["kind"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "variant"
                                                            },
                                                            "id": {
                                                              "type": "string",
                                                              "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                            }
                                                          },
                                                          "required": ["kind", "id"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "node"
                                                            },
                                                            "id": {
                                                              "type": "string",
                                                              "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                            }
                                                          },
                                                          "required": ["kind", "id"],
                                                          "additionalProperties": false
                                                        }
                                                      ]
                                                    },
                                                    "fit": {
                                                      "type": "string",
                                                      "enum": ["contain", "cover", "trim_pad"]
                                                    },
                                                    "width": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 8192
                                                    },
                                                    "height": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 8192
                                                    },
                                                    "format": {
                                                      "oneOf": [
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "png"
                                                            }
                                                          },
                                                          "required": ["kind"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "jpeg"
                                                            },
                                                            "quality": {
                                                              "type": "integer",
                                                              "minimum": 1,
                                                              "maximum": 100
                                                            },
                                                            "background": {
                                                              "type": "object",
                                                              "properties": {
                                                                "r": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                },
                                                                "g": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                },
                                                                "b": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                },
                                                                "a": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                }
                                                              },
                                                              "required": ["r", "g", "b", "a"],
                                                              "additionalProperties": false
                                                            }
                                                          },
                                                          "required": ["kind", "quality", "background"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "webp"
                                                            },
                                                            "quality": {
                                                              "type": "integer",
                                                              "minimum": 1,
                                                              "maximum": 100
                                                            }
                                                          },
                                                          "required": ["kind", "quality"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "ico"
                                                            },
                                                            "sizes": {
                                                              "minItems": 1,
                                                              "maxItems": 8,
                                                              "type": "array",
                                                              "items": {
                                                                "type": "integer",
                                                                "minimum": 16,
                                                                "maximum": 256
                                                              }
                                                            }
                                                          },
                                                          "required": ["kind", "sizes"],
                                                          "additionalProperties": false
                                                        }
                                                      ]
                                                    }
                                                  },
                                                  "required": ["name", "source", "fit", "width", "height", "format"],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "sidecars": {
                                                "maxItems": 8,
                                                "type": "array",
                                                "items": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "kind": {
                                                          "type": "string",
                                                          "const": "manifest_json"
                                                        },
                                                        "name": {
                                                          "type": "string",
                                                          "minLength": 1,
                                                          "maxLength": 120
                                                        },
                                                        "shortName": {
                                                          "type": "string",
                                                          "minLength": 1,
                                                          "maxLength": 60
                                                        },
                                                        "themeColor": {
                                                          "type": "string",
                                                          "pattern": "^#[0-9a-fA-F]{6}$"
                                                        },
                                                        "backgroundColor": {
                                                          "type": "string",
                                                          "pattern": "^#[0-9a-fA-F]{6}$"
                                                        },
                                                        "display": {
                                                          "type": "string",
                                                          "enum": ["fullscreen", "standalone", "minimal-ui", "browser"]
                                                        }
                                                      },
                                                      "required": ["kind", "name"],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "kind": {
                                                          "type": "string",
                                                          "const": "browserconfig_xml"
                                                        },
                                                        "tileColor": {
                                                          "type": "string",
                                                          "pattern": "^#[0-9a-fA-F]{6}$"
                                                        }
                                                      },
                                                      "required": ["kind"],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "kind": {
                                                          "type": "string",
                                                          "const": "html_head"
                                                        },
                                                        "pathPrefix": {
                                                          "default": "/",
                                                          "type": "string",
                                                          "minLength": 1,
                                                          "maxLength": 200
                                                        }
                                                      },
                                                      "required": ["kind", "pathPrefix"],
                                                      "additionalProperties": false
                                                    }
                                                  ]
                                                }
                                              }
                                            },
                                            "required": ["name", "outputs", "sidecars"],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": ["type", "spec"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "delete_export_spec"
                                          },
                                          "name": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 64
                                          }
                                        },
                                        "required": ["type", "name"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "flip"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "axis": {
                                            "type": "string",
                                            "enum": ["x", "y"]
                                          }
                                        },
                                        "required": ["type", "node", "axis"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "import_raster"
                                          },
                                          "name": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "asset": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$"
                                          },
                                          "width": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 4096
                                          },
                                          "height": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 4096
                                          }
                                        },
                                        "required": ["type", "name", "asset", "width", "height"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "add_text"
                                          },
                                          "parent": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "index": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 9007199254740991
                                          },
                                          "name": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "text": {
                                            "type": "object",
                                            "properties": {
                                              "content": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 2000
                                              },
                                              "family": {
                                                "type": "string",
                                                "enum": ["sans-serif", "serif", "monospace", "system-ui"]
                                              },
                                              "sizePx": {
                                                "type": "integer",
                                                "minimum": 4,
                                                "maximum": 512
                                              },
                                              "weight": {
                                                "type": "integer",
                                                "minimum": 100,
                                                "maximum": 900,
                                                "multipleOf": 100
                                              },
                                              "italic": {
                                                "type": "boolean"
                                              },
                                              "color": {
                                                "type": "object",
                                                "properties": {
                                                  "r": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "g": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "b": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "a": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": ["r", "g", "b", "a"],
                                                "additionalProperties": false
                                              },
                                              "align": {
                                                "type": "string",
                                                "enum": ["left", "center", "right"]
                                              },
                                              "lineHeight": {
                                                "type": "number",
                                                "minimum": 0.8,
                                                "maximum": 3
                                              },
                                              "box": {
                                                "type": "object",
                                                "properties": {
                                                  "x": {
                                                    "type": "integer",
                                                    "minimum": -4096,
                                                    "maximum": 4096
                                                  },
                                                  "y": {
                                                    "type": "integer",
                                                    "minimum": -4096,
                                                    "maximum": 4096
                                                  },
                                                  "width": {
                                                    "type": "integer",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 4096
                                                  }
                                                },
                                                "required": ["x", "y"],
                                                "additionalProperties": false
                                              }
                                            },
                                            "required": [
                                              "content",
                                              "family",
                                              "sizePx",
                                              "weight",
                                              "italic",
                                              "color",
                                              "align",
                                              "lineHeight",
                                              "box"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "asset": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$"
                                          }
                                        },
                                        "required": ["type", "text"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "set_text"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          },
                                          "text": {
                                            "type": "object",
                                            "properties": {
                                              "content": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 2000
                                              },
                                              "family": {
                                                "type": "string",
                                                "enum": ["sans-serif", "serif", "monospace", "system-ui"]
                                              },
                                              "sizePx": {
                                                "type": "integer",
                                                "minimum": 4,
                                                "maximum": 512
                                              },
                                              "weight": {
                                                "type": "integer",
                                                "minimum": 100,
                                                "maximum": 900,
                                                "multipleOf": 100
                                              },
                                              "italic": {
                                                "type": "boolean"
                                              },
                                              "color": {
                                                "type": "object",
                                                "properties": {
                                                  "r": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "g": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "b": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "a": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": ["r", "g", "b", "a"],
                                                "additionalProperties": false
                                              },
                                              "align": {
                                                "type": "string",
                                                "enum": ["left", "center", "right"]
                                              },
                                              "lineHeight": {
                                                "type": "number",
                                                "minimum": 0.8,
                                                "maximum": 3
                                              },
                                              "box": {
                                                "type": "object",
                                                "properties": {
                                                  "x": {
                                                    "type": "integer",
                                                    "minimum": -4096,
                                                    "maximum": 4096
                                                  },
                                                  "y": {
                                                    "type": "integer",
                                                    "minimum": -4096,
                                                    "maximum": 4096
                                                  },
                                                  "width": {
                                                    "type": "integer",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 4096
                                                  }
                                                },
                                                "required": ["x", "y"],
                                                "additionalProperties": false
                                              }
                                            },
                                            "required": [
                                              "content",
                                              "family",
                                              "sizePx",
                                              "weight",
                                              "italic",
                                              "color",
                                              "align",
                                              "lineHeight",
                                              "box"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "asset": {
                                            "type": "string",
                                            "pattern": "^[0-9a-f]{64}$"
                                          }
                                        },
                                        "required": ["type", "node", "text"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "merge_down"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          }
                                        },
                                        "required": ["type", "node"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "merge_group"
                                          },
                                          "node": {
                                            "type": "string",
                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          }
                                        },
                                        "required": ["type", "node"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "merge_visible"
                                          }
                                        },
                                        "required": ["type"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "flatten"
                                          }
                                        },
                                        "required": ["type"],
                                        "additionalProperties": false
                                      }
                                    ]
                                  },
                                  {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "create_variant"
                                          },
                                          "label": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 40
                                          },
                                          "base": {
                                            "type": "string",
                                            "pattern": "^rev_[1-9][0-9]*$"
                                          },
                                          "settings": {
                                            "maxItems": 64,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "axis": {
                                                  "type": "string",
                                                  "enum": [
                                                    "warmth",
                                                    "tint",
                                                    "brightness",
                                                    "contrast",
                                                    "saturation",
                                                    "hue",
                                                    "lightness",
                                                    "cropScale",
                                                    "opacity"
                                                  ]
                                                },
                                                "value": {
                                                  "type": "number"
                                                },
                                                "operationVersion": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 9007199254740991
                                                },
                                                "target": {
                                                  "type": "string",
                                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                }
                                              },
                                              "required": ["axis", "value", "operationVersion", "target"],
                                              "additionalProperties": false
                                            }
                                          },
                                          "parentVariant": {
                                            "type": "string",
                                            "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          }
                                        },
                                        "required": ["type", "label", "base", "settings"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "create_variant_grid"
                                          },
                                          "base": {
                                            "type": "string",
                                            "pattern": "^rev_[1-9][0-9]*$"
                                          },
                                          "labels": {
                                            "minItems": 1,
                                            "maxItems": 16,
                                            "type": "array",
                                            "items": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 40
                                            }
                                          },
                                          "axes": {
                                            "minItems": 1,
                                            "maxItems": 3,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "axis": {
                                                  "type": "string",
                                                  "enum": [
                                                    "warmth",
                                                    "tint",
                                                    "brightness",
                                                    "contrast",
                                                    "saturation",
                                                    "hue",
                                                    "lightness",
                                                    "cropScale",
                                                    "opacity"
                                                  ]
                                                },
                                                "target": {
                                                  "type": "string",
                                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                },
                                                "values": {
                                                  "minItems": 1,
                                                  "maxItems": 8,
                                                  "type": "array",
                                                  "items": {
                                                    "type": "number"
                                                  }
                                                }
                                              },
                                              "required": ["axis", "target", "values"],
                                              "additionalProperties": false
                                            }
                                          },
                                          "fixedConstraints": {
                                            "maxItems": 64,
                                            "type": "array",
                                            "items": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 200
                                            }
                                          }
                                        },
                                        "required": ["type", "base", "labels", "axes", "fixedConstraints"],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "switch_variant"
                                          },
                                          "variant": {
                                            "type": "string",
                                            "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                          }
                                        },
                                        "required": ["type", "variant"],
                                        "additionalProperties": false
                                      }
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "batch"
                                      },
                                      "name": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 120
                                      },
                                      "commands": {
                                        "minItems": 1,
                                        "maxItems": 64,
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "create_layer"
                                                    },
                                                    "name": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 120
                                                    },
                                                    "kind": {
                                                      "type": "string",
                                                      "enum": ["raster", "group", "adjustment"]
                                                    },
                                                    "parent": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "index": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 9007199254740991
                                                    },
                                                    "adjustment": {
                                                      "anyOf": [
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "brightness_contrast"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "brightness": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            },
                                                            "contrast": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": ["type", "version", "brightness", "contrast"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "hue_saturation"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "hue": {
                                                              "type": "number",
                                                              "minimum": -180,
                                                              "maximum": 180
                                                            },
                                                            "saturation": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            },
                                                            "lightness": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "version",
                                                            "hue",
                                                            "saturation",
                                                            "lightness"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "warmth_tint"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "warmth": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            },
                                                            "tint": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": ["type", "version", "warmth", "tint"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "levels"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "inputBlack": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "inputWhite": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "gamma": {
                                                              "type": "number",
                                                              "minimum": 0.1,
                                                              "maximum": 10
                                                            },
                                                            "outputBlack": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "outputWhite": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "version",
                                                            "inputBlack",
                                                            "inputWhite",
                                                            "gamma",
                                                            "outputBlack",
                                                            "outputWhite"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "curves"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "channel": {
                                                              "type": "string",
                                                              "enum": ["master", "r", "g", "b"]
                                                            },
                                                            "points": {
                                                              "minItems": 2,
                                                              "maxItems": 16,
                                                              "type": "array",
                                                              "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "x": {
                                                                    "type": "number",
                                                                    "minimum": 0,
                                                                    "maximum": 1
                                                                  },
                                                                  "y": {
                                                                    "type": "number",
                                                                    "minimum": 0,
                                                                    "maximum": 1
                                                                  }
                                                                },
                                                                "required": ["x", "y"],
                                                                "additionalProperties": false
                                                              }
                                                            }
                                                          },
                                                          "required": ["type", "version", "channel", "points"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "exposure"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "exposure": {
                                                              "type": "number",
                                                              "minimum": -5,
                                                              "maximum": 5
                                                            },
                                                            "offset": {
                                                              "type": "number",
                                                              "minimum": -0.5,
                                                              "maximum": 0.5
                                                            },
                                                            "gamma": {
                                                              "type": "number",
                                                              "minimum": 0.1,
                                                              "maximum": 10
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "version",
                                                            "exposure",
                                                            "offset",
                                                            "gamma"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "vibrance"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "vibrance": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            },
                                                            "saturation": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": ["type", "version", "vibrance", "saturation"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "black_white"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "red": {
                                                              "type": "number",
                                                              "minimum": -2,
                                                              "maximum": 3
                                                            },
                                                            "yellow": {
                                                              "type": "number",
                                                              "minimum": -2,
                                                              "maximum": 3
                                                            },
                                                            "green": {
                                                              "type": "number",
                                                              "minimum": -2,
                                                              "maximum": 3
                                                            },
                                                            "cyan": {
                                                              "type": "number",
                                                              "minimum": -2,
                                                              "maximum": 3
                                                            },
                                                            "blue": {
                                                              "type": "number",
                                                              "minimum": -2,
                                                              "maximum": 3
                                                            },
                                                            "magenta": {
                                                              "type": "number",
                                                              "minimum": -2,
                                                              "maximum": 3
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "version",
                                                            "red",
                                                            "yellow",
                                                            "green",
                                                            "cyan",
                                                            "blue",
                                                            "magenta"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "hue_range_remap"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "hueMin": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 360
                                                            },
                                                            "hueMax": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 360
                                                            },
                                                            "feather": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 60
                                                            },
                                                            "minSaturation": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "minValue": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "target": {
                                                              "type": "object",
                                                              "properties": {
                                                                "r": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                },
                                                                "g": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                },
                                                                "b": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                },
                                                                "a": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                }
                                                              },
                                                              "required": ["r", "g", "b", "a"],
                                                              "additionalProperties": false
                                                            },
                                                            "preserveGradient": {
                                                              "type": "boolean"
                                                            },
                                                            "strength": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "version",
                                                            "hueMin",
                                                            "hueMax",
                                                            "feather",
                                                            "minSaturation",
                                                            "minValue",
                                                            "target",
                                                            "preserveGradient",
                                                            "strength"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "invert"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            }
                                                          },
                                                          "required": ["type", "version"],
                                                          "additionalProperties": false
                                                        }
                                                      ]
                                                    },
                                                    "id": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    }
                                                  },
                                                  "required": ["type", "name", "kind"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "delete_node"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    }
                                                  },
                                                  "required": ["type", "node"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "reorder_node"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "parent": {
                                                      "anyOf": [
                                                        {
                                                          "type": "string",
                                                          "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                        },
                                                        {
                                                          "type": "null"
                                                        }
                                                      ]
                                                    },
                                                    "index": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": ["type", "node", "parent", "index"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "duplicate_layer"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    }
                                                  },
                                                  "required": ["type", "node"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "rename_node"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "name": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 120
                                                    }
                                                  },
                                                  "required": ["type", "node", "name"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "set_visibility"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "visible": {
                                                      "type": "boolean"
                                                    }
                                                  },
                                                  "required": ["type", "node", "visible"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "set_opacity"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "opacity": {
                                                      "type": "number",
                                                      "minimum": 0,
                                                      "maximum": 1
                                                    }
                                                  },
                                                  "required": ["type", "node", "opacity"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "set_blend_mode"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "blend": {
                                                      "type": "string",
                                                      "enum": [
                                                        "normal",
                                                        "multiply",
                                                        "screen",
                                                        "darken",
                                                        "lighten",
                                                        "overlay",
                                                        "soft_light",
                                                        "hard_light",
                                                        "difference",
                                                        "exclusion",
                                                        "color_dodge",
                                                        "color_burn"
                                                      ]
                                                    }
                                                  },
                                                  "required": ["type", "node", "blend"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "set_locked"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "locked": {
                                                      "type": "boolean"
                                                    }
                                                  },
                                                  "required": ["type", "node", "locked"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "paint_stroke"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "brush": {
                                                      "type": "object",
                                                      "properties": {
                                                        "radius": {
                                                          "type": "number",
                                                          "minimum": 0.5,
                                                          "maximum": 500
                                                        },
                                                        "hardness": {
                                                          "type": "number",
                                                          "minimum": 0,
                                                          "maximum": 1
                                                        },
                                                        "opacity": {
                                                          "type": "number",
                                                          "minimum": 0,
                                                          "maximum": 1
                                                        },
                                                        "color": {
                                                          "type": "object",
                                                          "properties": {
                                                            "r": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "g": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "b": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "a": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": ["r", "g", "b", "a"],
                                                          "additionalProperties": false
                                                        },
                                                        "erase": {
                                                          "type": "boolean"
                                                        },
                                                        "spacing": {
                                                          "type": "number",
                                                          "minimum": 0.05,
                                                          "maximum": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "radius",
                                                        "hardness",
                                                        "opacity",
                                                        "color",
                                                        "erase",
                                                        "spacing"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "samples": {
                                                      "minItems": 1,
                                                      "maxItems": 4096,
                                                      "type": "array",
                                                      "items": {
                                                        "type": "object",
                                                        "properties": {
                                                          "x": {
                                                            "type": "number"
                                                          },
                                                          "y": {
                                                            "type": "number"
                                                          },
                                                          "pressure": {
                                                            "type": "number",
                                                            "minimum": 0,
                                                            "maximum": 1
                                                          },
                                                          "t": {
                                                            "type": "number",
                                                            "minimum": 0
                                                          }
                                                        },
                                                        "required": ["x", "y", "pressure", "t"],
                                                        "additionalProperties": false
                                                      }
                                                    }
                                                  },
                                                  "required": ["type", "node", "brush", "samples"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "fill"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "color": {
                                                      "type": "object",
                                                      "properties": {
                                                        "r": {
                                                          "type": "number",
                                                          "minimum": 0,
                                                          "maximum": 1
                                                        },
                                                        "g": {
                                                          "type": "number",
                                                          "minimum": 0,
                                                          "maximum": 1
                                                        },
                                                        "b": {
                                                          "type": "number",
                                                          "minimum": 0,
                                                          "maximum": 1
                                                        },
                                                        "a": {
                                                          "type": "number",
                                                          "minimum": 0,
                                                          "maximum": 1
                                                        }
                                                      },
                                                      "required": ["r", "g", "b", "a"],
                                                      "additionalProperties": false
                                                    },
                                                    "useSelection": {
                                                      "type": "boolean"
                                                    }
                                                  },
                                                  "required": ["type", "node", "color", "useSelection"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "move_selection"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "dx": {
                                                      "type": "integer",
                                                      "minimum": -16384,
                                                      "maximum": 16384
                                                    },
                                                    "dy": {
                                                      "type": "integer",
                                                      "minimum": -16384,
                                                      "maximum": 16384
                                                    }
                                                  },
                                                  "required": ["type", "node", "dx", "dy"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "erase_selection"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    }
                                                  },
                                                  "required": ["type", "node"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "set_selection"
                                                    },
                                                    "selection": {
                                                      "type": "object",
                                                      "properties": {
                                                        "shape": {
                                                          "oneOf": [
                                                            {
                                                              "type": "object",
                                                              "properties": {
                                                                "type": {
                                                                  "type": "string",
                                                                  "const": "rect"
                                                                },
                                                                "x": {
                                                                  "type": "number"
                                                                },
                                                                "y": {
                                                                  "type": "number"
                                                                },
                                                                "width": {
                                                                  "type": "number",
                                                                  "exclusiveMinimum": 0
                                                                },
                                                                "height": {
                                                                  "type": "number",
                                                                  "exclusiveMinimum": 0
                                                                }
                                                              },
                                                              "required": ["type", "x", "y", "width", "height"],
                                                              "additionalProperties": false
                                                            },
                                                            {
                                                              "type": "object",
                                                              "properties": {
                                                                "type": {
                                                                  "type": "string",
                                                                  "const": "ellipse"
                                                                },
                                                                "cx": {
                                                                  "type": "number"
                                                                },
                                                                "cy": {
                                                                  "type": "number"
                                                                },
                                                                "rx": {
                                                                  "type": "number",
                                                                  "exclusiveMinimum": 0
                                                                },
                                                                "ry": {
                                                                  "type": "number",
                                                                  "exclusiveMinimum": 0
                                                                }
                                                              },
                                                              "required": ["type", "cx", "cy", "rx", "ry"],
                                                              "additionalProperties": false
                                                            },
                                                            {
                                                              "type": "object",
                                                              "properties": {
                                                                "type": {
                                                                  "type": "string",
                                                                  "const": "polygon"
                                                                },
                                                                "points": {
                                                                  "minItems": 3,
                                                                  "maxItems": 4096,
                                                                  "type": "array",
                                                                  "items": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "x": {
                                                                        "type": "number"
                                                                      },
                                                                      "y": {
                                                                        "type": "number"
                                                                      }
                                                                    },
                                                                    "required": ["x", "y"],
                                                                    "additionalProperties": false
                                                                  }
                                                                }
                                                              },
                                                              "required": ["type", "points"],
                                                              "additionalProperties": false
                                                            },
                                                            {
                                                              "type": "object",
                                                              "properties": {
                                                                "type": {
                                                                  "type": "string",
                                                                  "const": "contiguous"
                                                                },
                                                                "x": {
                                                                  "type": "number"
                                                                },
                                                                "y": {
                                                                  "type": "number"
                                                                },
                                                                "tolerance": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                }
                                                              },
                                                              "required": ["type", "x", "y", "tolerance"],
                                                              "additionalProperties": false
                                                            }
                                                          ]
                                                        },
                                                        "mode": {
                                                          "type": "string",
                                                          "enum": ["replace", "add", "subtract"]
                                                        },
                                                        "feather": {
                                                          "type": "number",
                                                          "minimum": 0,
                                                          "maximum": 256
                                                        }
                                                      },
                                                      "required": ["shape", "mode", "feather"],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": ["type", "selection"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "clear_selection"
                                                    }
                                                  },
                                                  "required": ["type"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "invert_selection"
                                                    }
                                                  },
                                                  "required": ["type"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "modify_selection"
                                                    },
                                                    "op": {
                                                      "type": "string",
                                                      "enum": ["expand", "contract", "smooth"]
                                                    },
                                                    "amount": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 256
                                                    }
                                                  },
                                                  "required": ["type", "op", "amount"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "select_color_range"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "mode": {
                                                      "type": "string",
                                                      "enum": ["distance", "hsv"]
                                                    },
                                                    "target": {
                                                      "type": "object",
                                                      "properties": {
                                                        "r": {
                                                          "type": "number",
                                                          "minimum": 0,
                                                          "maximum": 1
                                                        },
                                                        "g": {
                                                          "type": "number",
                                                          "minimum": 0,
                                                          "maximum": 1
                                                        },
                                                        "b": {
                                                          "type": "number",
                                                          "minimum": 0,
                                                          "maximum": 1
                                                        },
                                                        "a": {
                                                          "type": "number",
                                                          "minimum": 0,
                                                          "maximum": 1
                                                        }
                                                      },
                                                      "required": ["r", "g", "b", "a"],
                                                      "additionalProperties": false
                                                    },
                                                    "tolerance": {
                                                      "type": "number",
                                                      "minimum": 0,
                                                      "maximum": 1
                                                    },
                                                    "saturationMax": {
                                                      "type": "number",
                                                      "minimum": 0,
                                                      "maximum": 1
                                                    },
                                                    "feather": {
                                                      "type": "number",
                                                      "minimum": 0,
                                                      "maximum": 50
                                                    },
                                                    "autoTune": {
                                                      "type": "boolean"
                                                    },
                                                    "combine": {
                                                      "type": "string",
                                                      "enum": ["replace", "add", "subtract"]
                                                    }
                                                  },
                                                  "required": ["type", "node", "mode", "feather"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "set_mask_from_selection"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    }
                                                  },
                                                  "required": ["type", "node"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "clear_mask"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    }
                                                  },
                                                  "required": ["type", "node"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "set_adjustment"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "adjustment": {
                                                      "anyOf": [
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "brightness_contrast"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "brightness": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            },
                                                            "contrast": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": ["type", "version", "brightness", "contrast"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "hue_saturation"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "hue": {
                                                              "type": "number",
                                                              "minimum": -180,
                                                              "maximum": 180
                                                            },
                                                            "saturation": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            },
                                                            "lightness": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "version",
                                                            "hue",
                                                            "saturation",
                                                            "lightness"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "warmth_tint"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "warmth": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            },
                                                            "tint": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": ["type", "version", "warmth", "tint"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "levels"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "inputBlack": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "inputWhite": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "gamma": {
                                                              "type": "number",
                                                              "minimum": 0.1,
                                                              "maximum": 10
                                                            },
                                                            "outputBlack": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "outputWhite": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "version",
                                                            "inputBlack",
                                                            "inputWhite",
                                                            "gamma",
                                                            "outputBlack",
                                                            "outputWhite"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "curves"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "channel": {
                                                              "type": "string",
                                                              "enum": ["master", "r", "g", "b"]
                                                            },
                                                            "points": {
                                                              "minItems": 2,
                                                              "maxItems": 16,
                                                              "type": "array",
                                                              "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "x": {
                                                                    "type": "number",
                                                                    "minimum": 0,
                                                                    "maximum": 1
                                                                  },
                                                                  "y": {
                                                                    "type": "number",
                                                                    "minimum": 0,
                                                                    "maximum": 1
                                                                  }
                                                                },
                                                                "required": ["x", "y"],
                                                                "additionalProperties": false
                                                              }
                                                            }
                                                          },
                                                          "required": ["type", "version", "channel", "points"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "exposure"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "exposure": {
                                                              "type": "number",
                                                              "minimum": -5,
                                                              "maximum": 5
                                                            },
                                                            "offset": {
                                                              "type": "number",
                                                              "minimum": -0.5,
                                                              "maximum": 0.5
                                                            },
                                                            "gamma": {
                                                              "type": "number",
                                                              "minimum": 0.1,
                                                              "maximum": 10
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "version",
                                                            "exposure",
                                                            "offset",
                                                            "gamma"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "vibrance"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "vibrance": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            },
                                                            "saturation": {
                                                              "type": "number",
                                                              "minimum": -1,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": ["type", "version", "vibrance", "saturation"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "black_white"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "red": {
                                                              "type": "number",
                                                              "minimum": -2,
                                                              "maximum": 3
                                                            },
                                                            "yellow": {
                                                              "type": "number",
                                                              "minimum": -2,
                                                              "maximum": 3
                                                            },
                                                            "green": {
                                                              "type": "number",
                                                              "minimum": -2,
                                                              "maximum": 3
                                                            },
                                                            "cyan": {
                                                              "type": "number",
                                                              "minimum": -2,
                                                              "maximum": 3
                                                            },
                                                            "blue": {
                                                              "type": "number",
                                                              "minimum": -2,
                                                              "maximum": 3
                                                            },
                                                            "magenta": {
                                                              "type": "number",
                                                              "minimum": -2,
                                                              "maximum": 3
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "version",
                                                            "red",
                                                            "yellow",
                                                            "green",
                                                            "cyan",
                                                            "blue",
                                                            "magenta"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "hue_range_remap"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            },
                                                            "hueMin": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 360
                                                            },
                                                            "hueMax": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 360
                                                            },
                                                            "feather": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 60
                                                            },
                                                            "minSaturation": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "minValue": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "target": {
                                                              "type": "object",
                                                              "properties": {
                                                                "r": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                },
                                                                "g": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                },
                                                                "b": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                },
                                                                "a": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                }
                                                              },
                                                              "required": ["r", "g", "b", "a"],
                                                              "additionalProperties": false
                                                            },
                                                            "preserveGradient": {
                                                              "type": "boolean"
                                                            },
                                                            "strength": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "version",
                                                            "hueMin",
                                                            "hueMax",
                                                            "feather",
                                                            "minSaturation",
                                                            "minValue",
                                                            "target",
                                                            "preserveGradient",
                                                            "strength"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "invert"
                                                            },
                                                            "version": {
                                                              "type": "number",
                                                              "const": 1
                                                            }
                                                          },
                                                          "required": ["type", "version"],
                                                          "additionalProperties": false
                                                        }
                                                      ]
                                                    }
                                                  },
                                                  "required": ["type", "node", "adjustment"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "apply_filter"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "filter": {
                                                      "anyOf": [
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "gaussian_blur"
                                                            },
                                                            "radius": {
                                                              "type": "number",
                                                              "minimum": 0.1,
                                                              "maximum": 50
                                                            }
                                                          },
                                                          "required": ["type", "radius"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "sharpen"
                                                            },
                                                            "amount": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 4
                                                            }
                                                          },
                                                          "required": ["type", "amount"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "noise"
                                                            },
                                                            "amount": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "monochrome": {
                                                              "type": "boolean"
                                                            }
                                                          },
                                                          "required": ["type", "amount", "monochrome"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "alpha_threshold"
                                                            },
                                                            "low": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "high": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": ["type", "low", "high"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "feather_alpha"
                                                            },
                                                            "radius": {
                                                              "type": "number",
                                                              "minimum": 0.5,
                                                              "maximum": 50
                                                            }
                                                          },
                                                          "required": ["type", "radius"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "outline"
                                                            },
                                                            "width": {
                                                              "type": "integer",
                                                              "minimum": 1,
                                                              "maximum": 64
                                                            },
                                                            "color": {
                                                              "type": "object",
                                                              "properties": {
                                                                "r": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                },
                                                                "g": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                },
                                                                "b": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                },
                                                                "a": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                }
                                                              },
                                                              "required": ["r", "g", "b", "a"],
                                                              "additionalProperties": false
                                                            },
                                                            "position": {
                                                              "type": "string",
                                                              "enum": ["outside", "inside", "center"]
                                                            }
                                                          },
                                                          "required": ["type", "width", "color", "position"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "drop_shadow"
                                                            },
                                                            "dx": {
                                                              "type": "integer",
                                                              "minimum": -256,
                                                              "maximum": 256
                                                            },
                                                            "dy": {
                                                              "type": "integer",
                                                              "minimum": -256,
                                                              "maximum": 256
                                                            },
                                                            "blur": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 50
                                                            },
                                                            "color": {
                                                              "type": "object",
                                                              "properties": {
                                                                "r": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                },
                                                                "g": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                },
                                                                "b": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                },
                                                                "a": {
                                                                  "type": "number",
                                                                  "minimum": 0,
                                                                  "maximum": 1
                                                                }
                                                              },
                                                              "required": ["r", "g", "b", "a"],
                                                              "additionalProperties": false
                                                            },
                                                            "opacity": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": ["type", "dx", "dy", "blur", "color", "opacity"],
                                                          "additionalProperties": false
                                                        }
                                                      ]
                                                    }
                                                  },
                                                  "required": ["type", "node", "filter"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "set_transform"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "transform": {
                                                      "type": "object",
                                                      "properties": {
                                                        "tx": {
                                                          "type": "number"
                                                        },
                                                        "ty": {
                                                          "type": "number"
                                                        },
                                                        "sx": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0
                                                        },
                                                        "sy": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0
                                                        },
                                                        "rotation": {
                                                          "type": "number"
                                                        },
                                                        "flipX": {
                                                          "type": "boolean"
                                                        },
                                                        "flipY": {
                                                          "type": "boolean"
                                                        }
                                                      },
                                                      "required": [
                                                        "tx",
                                                        "ty",
                                                        "sx",
                                                        "sy",
                                                        "rotation",
                                                        "flipX",
                                                        "flipY"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": ["type", "node", "transform"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "set_crop"
                                                    },
                                                    "crop": {
                                                      "anyOf": [
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "x": {
                                                              "type": "integer",
                                                              "minimum": -9007199254740991,
                                                              "maximum": 9007199254740991
                                                            },
                                                            "y": {
                                                              "type": "integer",
                                                              "minimum": -9007199254740991,
                                                              "maximum": 9007199254740991
                                                            },
                                                            "width": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            },
                                                            "height": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": ["x", "y", "width", "height"],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "null"
                                                        }
                                                      ]
                                                    }
                                                  },
                                                  "required": ["type", "crop"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "resize_canvas"
                                                    },
                                                    "width": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 4096
                                                    },
                                                    "height": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 4096
                                                    },
                                                    "anchor": {
                                                      "type": "string",
                                                      "enum": [
                                                        "top-left",
                                                        "top-center",
                                                        "top-right",
                                                        "middle-left",
                                                        "middle-center",
                                                        "middle-right",
                                                        "bottom-left",
                                                        "bottom-center",
                                                        "bottom-right"
                                                      ]
                                                    }
                                                  },
                                                  "required": ["type", "width", "height", "anchor"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "resample_document"
                                                    },
                                                    "width": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 4096
                                                    },
                                                    "height": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 4096
                                                    }
                                                  },
                                                  "required": ["type", "width", "height"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "trim_to_content"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "padding": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 4096
                                                    },
                                                    "fit": {
                                                      "type": "object",
                                                      "properties": {
                                                        "aspect": {
                                                          "anyOf": [
                                                            {
                                                              "type": "string",
                                                              "const": "square"
                                                            },
                                                            {
                                                              "type": "object",
                                                              "properties": {
                                                                "width": {
                                                                  "type": "integer",
                                                                  "exclusiveMinimum": 0,
                                                                  "maximum": 4096
                                                                },
                                                                "height": {
                                                                  "type": "integer",
                                                                  "exclusiveMinimum": 0,
                                                                  "maximum": 4096
                                                                }
                                                              },
                                                              "required": ["width", "height"],
                                                              "additionalProperties": false
                                                            }
                                                          ]
                                                        },
                                                        "anchor": {
                                                          "type": "string",
                                                          "enum": [
                                                            "top-left",
                                                            "top-center",
                                                            "top-right",
                                                            "middle-left",
                                                            "middle-center",
                                                            "middle-right",
                                                            "bottom-left",
                                                            "bottom-center",
                                                            "bottom-right"
                                                          ]
                                                        }
                                                      },
                                                      "required": ["aspect", "anchor"],
                                                      "additionalProperties": false
                                                    },
                                                    "respectMask": {
                                                      "type": "boolean"
                                                    }
                                                  },
                                                  "required": ["type", "padding"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "set_export_spec"
                                                    },
                                                    "spec": {
                                                      "type": "object",
                                                      "properties": {
                                                        "name": {
                                                          "type": "string",
                                                          "minLength": 1,
                                                          "maxLength": 64
                                                        },
                                                        "outputs": {
                                                          "minItems": 1,
                                                          "maxItems": 64,
                                                          "type": "array",
                                                          "items": {
                                                            "type": "object",
                                                            "properties": {
                                                              "name": {
                                                                "type": "string",
                                                                "minLength": 1,
                                                                "maxLength": 120
                                                              },
                                                              "source": {
                                                                "oneOf": [
                                                                  {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "kind": {
                                                                        "type": "string",
                                                                        "const": "composite"
                                                                      }
                                                                    },
                                                                    "required": ["kind"],
                                                                    "additionalProperties": false
                                                                  },
                                                                  {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "kind": {
                                                                        "type": "string",
                                                                        "const": "variant"
                                                                      },
                                                                      "id": {
                                                                        "type": "string",
                                                                        "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                                      }
                                                                    },
                                                                    "required": ["kind", "id"],
                                                                    "additionalProperties": false
                                                                  },
                                                                  {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "kind": {
                                                                        "type": "string",
                                                                        "const": "node"
                                                                      },
                                                                      "id": {
                                                                        "type": "string",
                                                                        "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                                      }
                                                                    },
                                                                    "required": ["kind", "id"],
                                                                    "additionalProperties": false
                                                                  }
                                                                ]
                                                              },
                                                              "fit": {
                                                                "type": "string",
                                                                "enum": ["contain", "cover", "trim_pad"]
                                                              },
                                                              "width": {
                                                                "type": "integer",
                                                                "minimum": 1,
                                                                "maximum": 8192
                                                              },
                                                              "height": {
                                                                "type": "integer",
                                                                "minimum": 1,
                                                                "maximum": 8192
                                                              },
                                                              "format": {
                                                                "oneOf": [
                                                                  {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "kind": {
                                                                        "type": "string",
                                                                        "const": "png"
                                                                      }
                                                                    },
                                                                    "required": ["kind"],
                                                                    "additionalProperties": false
                                                                  },
                                                                  {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "kind": {
                                                                        "type": "string",
                                                                        "const": "jpeg"
                                                                      },
                                                                      "quality": {
                                                                        "type": "integer",
                                                                        "minimum": 1,
                                                                        "maximum": 100
                                                                      },
                                                                      "background": {
                                                                        "type": "object",
                                                                        "properties": {
                                                                          "r": {
                                                                            "type": "number",
                                                                            "minimum": 0,
                                                                            "maximum": 1
                                                                          },
                                                                          "g": {
                                                                            "type": "number",
                                                                            "minimum": 0,
                                                                            "maximum": 1
                                                                          },
                                                                          "b": {
                                                                            "type": "number",
                                                                            "minimum": 0,
                                                                            "maximum": 1
                                                                          },
                                                                          "a": {
                                                                            "type": "number",
                                                                            "minimum": 0,
                                                                            "maximum": 1
                                                                          }
                                                                        },
                                                                        "required": ["r", "g", "b", "a"],
                                                                        "additionalProperties": false
                                                                      }
                                                                    },
                                                                    "required": ["kind", "quality", "background"],
                                                                    "additionalProperties": false
                                                                  },
                                                                  {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "kind": {
                                                                        "type": "string",
                                                                        "const": "webp"
                                                                      },
                                                                      "quality": {
                                                                        "type": "integer",
                                                                        "minimum": 1,
                                                                        "maximum": 100
                                                                      }
                                                                    },
                                                                    "required": ["kind", "quality"],
                                                                    "additionalProperties": false
                                                                  },
                                                                  {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "kind": {
                                                                        "type": "string",
                                                                        "const": "ico"
                                                                      },
                                                                      "sizes": {
                                                                        "minItems": 1,
                                                                        "maxItems": 8,
                                                                        "type": "array",
                                                                        "items": {
                                                                          "type": "integer",
                                                                          "minimum": 16,
                                                                          "maximum": 256
                                                                        }
                                                                      }
                                                                    },
                                                                    "required": ["kind", "sizes"],
                                                                    "additionalProperties": false
                                                                  }
                                                                ]
                                                              }
                                                            },
                                                            "required": [
                                                              "name",
                                                              "source",
                                                              "fit",
                                                              "width",
                                                              "height",
                                                              "format"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        },
                                                        "sidecars": {
                                                          "maxItems": 8,
                                                          "type": "array",
                                                          "items": {
                                                            "oneOf": [
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "kind": {
                                                                    "type": "string",
                                                                    "const": "manifest_json"
                                                                  },
                                                                  "name": {
                                                                    "type": "string",
                                                                    "minLength": 1,
                                                                    "maxLength": 120
                                                                  },
                                                                  "shortName": {
                                                                    "type": "string",
                                                                    "minLength": 1,
                                                                    "maxLength": 60
                                                                  },
                                                                  "themeColor": {
                                                                    "type": "string",
                                                                    "pattern": "^#[0-9a-fA-F]{6}$"
                                                                  },
                                                                  "backgroundColor": {
                                                                    "type": "string",
                                                                    "pattern": "^#[0-9a-fA-F]{6}$"
                                                                  },
                                                                  "display": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "fullscreen",
                                                                      "standalone",
                                                                      "minimal-ui",
                                                                      "browser"
                                                                    ]
                                                                  }
                                                                },
                                                                "required": ["kind", "name"],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "kind": {
                                                                    "type": "string",
                                                                    "const": "browserconfig_xml"
                                                                  },
                                                                  "tileColor": {
                                                                    "type": "string",
                                                                    "pattern": "^#[0-9a-fA-F]{6}$"
                                                                  }
                                                                },
                                                                "required": ["kind"],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "kind": {
                                                                    "type": "string",
                                                                    "const": "html_head"
                                                                  },
                                                                  "pathPrefix": {
                                                                    "default": "/",
                                                                    "type": "string",
                                                                    "minLength": 1,
                                                                    "maxLength": 200
                                                                  }
                                                                },
                                                                "required": ["kind", "pathPrefix"],
                                                                "additionalProperties": false
                                                              }
                                                            ]
                                                          }
                                                        }
                                                      },
                                                      "required": ["name", "outputs", "sidecars"],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": ["type", "spec"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "delete_export_spec"
                                                    },
                                                    "name": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 64
                                                    }
                                                  },
                                                  "required": ["type", "name"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "flip"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "axis": {
                                                      "type": "string",
                                                      "enum": ["x", "y"]
                                                    }
                                                  },
                                                  "required": ["type", "node", "axis"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "import_raster"
                                                    },
                                                    "name": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 120
                                                    },
                                                    "asset": {
                                                      "type": "string",
                                                      "pattern": "^[0-9a-f]{64}$"
                                                    },
                                                    "width": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 4096
                                                    },
                                                    "height": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 4096
                                                    }
                                                  },
                                                  "required": ["type", "name", "asset", "width", "height"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "add_text"
                                                    },
                                                    "parent": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "index": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 9007199254740991
                                                    },
                                                    "name": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 120
                                                    },
                                                    "text": {
                                                      "type": "object",
                                                      "properties": {
                                                        "content": {
                                                          "type": "string",
                                                          "minLength": 1,
                                                          "maxLength": 2000
                                                        },
                                                        "family": {
                                                          "type": "string",
                                                          "enum": ["sans-serif", "serif", "monospace", "system-ui"]
                                                        },
                                                        "sizePx": {
                                                          "type": "integer",
                                                          "minimum": 4,
                                                          "maximum": 512
                                                        },
                                                        "weight": {
                                                          "type": "integer",
                                                          "minimum": 100,
                                                          "maximum": 900,
                                                          "multipleOf": 100
                                                        },
                                                        "italic": {
                                                          "type": "boolean"
                                                        },
                                                        "color": {
                                                          "type": "object",
                                                          "properties": {
                                                            "r": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "g": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "b": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "a": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": ["r", "g", "b", "a"],
                                                          "additionalProperties": false
                                                        },
                                                        "align": {
                                                          "type": "string",
                                                          "enum": ["left", "center", "right"]
                                                        },
                                                        "lineHeight": {
                                                          "type": "number",
                                                          "minimum": 0.8,
                                                          "maximum": 3
                                                        },
                                                        "box": {
                                                          "type": "object",
                                                          "properties": {
                                                            "x": {
                                                              "type": "integer",
                                                              "minimum": -4096,
                                                              "maximum": 4096
                                                            },
                                                            "y": {
                                                              "type": "integer",
                                                              "minimum": -4096,
                                                              "maximum": 4096
                                                            },
                                                            "width": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 4096
                                                            }
                                                          },
                                                          "required": ["x", "y"],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "content",
                                                        "family",
                                                        "sizePx",
                                                        "weight",
                                                        "italic",
                                                        "color",
                                                        "align",
                                                        "lineHeight",
                                                        "box"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "asset": {
                                                      "type": "string",
                                                      "pattern": "^[0-9a-f]{64}$"
                                                    }
                                                  },
                                                  "required": ["type", "text"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "set_text"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    },
                                                    "text": {
                                                      "type": "object",
                                                      "properties": {
                                                        "content": {
                                                          "type": "string",
                                                          "minLength": 1,
                                                          "maxLength": 2000
                                                        },
                                                        "family": {
                                                          "type": "string",
                                                          "enum": ["sans-serif", "serif", "monospace", "system-ui"]
                                                        },
                                                        "sizePx": {
                                                          "type": "integer",
                                                          "minimum": 4,
                                                          "maximum": 512
                                                        },
                                                        "weight": {
                                                          "type": "integer",
                                                          "minimum": 100,
                                                          "maximum": 900,
                                                          "multipleOf": 100
                                                        },
                                                        "italic": {
                                                          "type": "boolean"
                                                        },
                                                        "color": {
                                                          "type": "object",
                                                          "properties": {
                                                            "r": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "g": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "b": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            },
                                                            "a": {
                                                              "type": "number",
                                                              "minimum": 0,
                                                              "maximum": 1
                                                            }
                                                          },
                                                          "required": ["r", "g", "b", "a"],
                                                          "additionalProperties": false
                                                        },
                                                        "align": {
                                                          "type": "string",
                                                          "enum": ["left", "center", "right"]
                                                        },
                                                        "lineHeight": {
                                                          "type": "number",
                                                          "minimum": 0.8,
                                                          "maximum": 3
                                                        },
                                                        "box": {
                                                          "type": "object",
                                                          "properties": {
                                                            "x": {
                                                              "type": "integer",
                                                              "minimum": -4096,
                                                              "maximum": 4096
                                                            },
                                                            "y": {
                                                              "type": "integer",
                                                              "minimum": -4096,
                                                              "maximum": 4096
                                                            },
                                                            "width": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 4096
                                                            }
                                                          },
                                                          "required": ["x", "y"],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "content",
                                                        "family",
                                                        "sizePx",
                                                        "weight",
                                                        "italic",
                                                        "color",
                                                        "align",
                                                        "lineHeight",
                                                        "box"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "asset": {
                                                      "type": "string",
                                                      "pattern": "^[0-9a-f]{64}$"
                                                    }
                                                  },
                                                  "required": ["type", "node", "text"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "merge_down"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    }
                                                  },
                                                  "required": ["type", "node"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "merge_group"
                                                    },
                                                    "node": {
                                                      "type": "string",
                                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    }
                                                  },
                                                  "required": ["type", "node"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "merge_visible"
                                                    }
                                                  },
                                                  "required": ["type"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "flatten"
                                                    }
                                                  },
                                                  "required": ["type"],
                                                  "additionalProperties": false
                                                }
                                              ]
                                            },
                                            {
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "create_variant"
                                                    },
                                                    "label": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 40
                                                    },
                                                    "base": {
                                                      "type": "string",
                                                      "pattern": "^rev_[1-9][0-9]*$"
                                                    },
                                                    "settings": {
                                                      "maxItems": 64,
                                                      "type": "array",
                                                      "items": {
                                                        "type": "object",
                                                        "properties": {
                                                          "axis": {
                                                            "type": "string",
                                                            "enum": [
                                                              "warmth",
                                                              "tint",
                                                              "brightness",
                                                              "contrast",
                                                              "saturation",
                                                              "hue",
                                                              "lightness",
                                                              "cropScale",
                                                              "opacity"
                                                            ]
                                                          },
                                                          "value": {
                                                            "type": "number"
                                                          },
                                                          "operationVersion": {
                                                            "type": "integer",
                                                            "minimum": 1,
                                                            "maximum": 9007199254740991
                                                          },
                                                          "target": {
                                                            "type": "string",
                                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                          }
                                                        },
                                                        "required": ["axis", "value", "operationVersion", "target"],
                                                        "additionalProperties": false
                                                      }
                                                    },
                                                    "parentVariant": {
                                                      "type": "string",
                                                      "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    }
                                                  },
                                                  "required": ["type", "label", "base", "settings"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "create_variant_grid"
                                                    },
                                                    "base": {
                                                      "type": "string",
                                                      "pattern": "^rev_[1-9][0-9]*$"
                                                    },
                                                    "labels": {
                                                      "minItems": 1,
                                                      "maxItems": 16,
                                                      "type": "array",
                                                      "items": {
                                                        "type": "string",
                                                        "minLength": 1,
                                                        "maxLength": 40
                                                      }
                                                    },
                                                    "axes": {
                                                      "minItems": 1,
                                                      "maxItems": 3,
                                                      "type": "array",
                                                      "items": {
                                                        "type": "object",
                                                        "properties": {
                                                          "axis": {
                                                            "type": "string",
                                                            "enum": [
                                                              "warmth",
                                                              "tint",
                                                              "brightness",
                                                              "contrast",
                                                              "saturation",
                                                              "hue",
                                                              "lightness",
                                                              "cropScale",
                                                              "opacity"
                                                            ]
                                                          },
                                                          "target": {
                                                            "type": "string",
                                                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                          },
                                                          "values": {
                                                            "minItems": 1,
                                                            "maxItems": 8,
                                                            "type": "array",
                                                            "items": {
                                                              "type": "number"
                                                            }
                                                          }
                                                        },
                                                        "required": ["axis", "target", "values"],
                                                        "additionalProperties": false
                                                      }
                                                    },
                                                    "fixedConstraints": {
                                                      "maxItems": 64,
                                                      "type": "array",
                                                      "items": {
                                                        "type": "string",
                                                        "minLength": 1,
                                                        "maxLength": 200
                                                      }
                                                    }
                                                  },
                                                  "required": ["type", "base", "labels", "axes", "fixedConstraints"],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "switch_variant"
                                                    },
                                                    "variant": {
                                                      "type": "string",
                                                      "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                                    }
                                                  },
                                                  "required": ["type", "variant"],
                                                  "additionalProperties": false
                                                }
                                              ]
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": ["type", "commands"],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "policyGrantId": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "interpretation": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                            }
                          },
                          "required": [
                            "commandId",
                            "documentId",
                            "actorId",
                            "actorKind",
                            "baseRevision",
                            "readDependencies",
                            "writes",
                            "edits"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "jobRequests": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": ["image_edit", "image_generate"]
                          },
                          "node": {
                            "type": "string",
                            "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          },
                          "prompt": {
                            "type": "string"
                          },
                          "requiresMask": {
                            "type": "boolean"
                          },
                          "params": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          "region": {
                            "type": "object",
                            "properties": {
                              "shape": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "rect"
                                      },
                                      "x": {
                                        "type": "number"
                                      },
                                      "y": {
                                        "type": "number"
                                      },
                                      "width": {
                                        "type": "number",
                                        "exclusiveMinimum": 0
                                      },
                                      "height": {
                                        "type": "number",
                                        "exclusiveMinimum": 0
                                      }
                                    },
                                    "required": ["type", "x", "y", "width", "height"],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "ellipse"
                                      },
                                      "cx": {
                                        "type": "number"
                                      },
                                      "cy": {
                                        "type": "number"
                                      },
                                      "rx": {
                                        "type": "number",
                                        "exclusiveMinimum": 0
                                      },
                                      "ry": {
                                        "type": "number",
                                        "exclusiveMinimum": 0
                                      }
                                    },
                                    "required": ["type", "cx", "cy", "rx", "ry"],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "polygon"
                                      },
                                      "points": {
                                        "minItems": 3,
                                        "maxItems": 4096,
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "x": {
                                              "type": "number"
                                            },
                                            "y": {
                                              "type": "number"
                                            }
                                          },
                                          "required": ["x", "y"],
                                          "additionalProperties": false
                                        }
                                      }
                                    },
                                    "required": ["type", "points"],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "contiguous"
                                      },
                                      "x": {
                                        "type": "number"
                                      },
                                      "y": {
                                        "type": "number"
                                      },
                                      "tolerance": {
                                        "type": "number",
                                        "minimum": 0,
                                        "maximum": 1
                                      }
                                    },
                                    "required": ["type", "x", "y", "tolerance"],
                                    "additionalProperties": false
                                  }
                                ]
                              },
                              "mode": {
                                "type": "string",
                                "enum": ["replace", "add", "subtract"]
                              },
                              "feather": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 256
                              }
                            },
                            "required": ["shape", "mode", "feather"],
                            "additionalProperties": false
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "width": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 4096
                          },
                          "height": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 4096
                          },
                          "styleFrom": {
                            "anyOf": [
                              {
                                "type": "string",
                                "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                              },
                              {
                                "type": "string",
                                "const": "document"
                              }
                            ]
                          }
                        },
                        "required": ["kind", "prompt", "requiresMask", "params"],
                        "additionalProperties": false
                      }
                    },
                    "viewChanges": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "switch_variant"
                              },
                              "variant": {
                                "type": "string",
                                "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                              }
                            },
                            "required": ["type", "variant"],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "compare"
                              },
                              "a": {
                                "type": "string",
                                "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                              },
                              "b": {
                                "type": "string",
                                "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                              }
                            },
                            "required": ["type", "a", "b"],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "questions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "blocked": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "finished",
                        "no_result",
                        "truncated_steps",
                        "truncated_cost",
                        "truncated_time",
                        "aborted",
                        "error"
                      ]
                    },
                    "truncated": {
                      "type": "boolean"
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "usdCost": {
                          "type": "number"
                        },
                        "steps": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "inputTokens": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "outputTokens": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": ["usdCost", "steps"],
                      "additionalProperties": false
                    },
                    "trail": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "trace": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "step": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "tool": {
                            "type": "string"
                          },
                          "ok": {
                            "type": "boolean"
                          },
                          "detail": {
                            "type": "string"
                          }
                        },
                        "required": ["step", "tool", "ok", "detail"],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "interpretation",
                    "proposal",
                    "jobRequests",
                    "viewChanges",
                    "questions",
                    "blocked",
                    "outcome",
                    "truncated",
                    "usage"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/plan-stream": {
      "post": {
        "operationId": "streamAgentTurn",
        "summary": "Stream a planner turn as server-sent events: one event per step, then a final result.",
        "tags": ["Agent"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "debug",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "const": "1"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                  },
                  "utterance": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "headRevision": {
                        "type": "string",
                        "pattern": "^rev_[1-9][0-9]*$"
                      },
                      "summary": {
                        "type": "object",
                        "properties": {
                          "documentId": {
                            "type": "string",
                            "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          },
                          "headRevision": {
                            "type": "string",
                            "pattern": "^rev_[1-9][0-9]*$"
                          },
                          "canvas": {
                            "type": "object",
                            "properties": {
                              "width": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4096
                              },
                              "height": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4096
                              },
                              "crop": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "x": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "y": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "width": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "height": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      }
                                    },
                                    "required": ["x", "y", "width", "height"],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "colorSpace": {
                                "type": "string",
                                "const": "srgb"
                              },
                              "assumedSrgb": {
                                "type": "boolean"
                              }
                            },
                            "required": ["width", "height", "crop", "colorSpace", "assumedSrgb"],
                            "additionalProperties": false
                          },
                          "nodes": {
                            "maxItems": 65536,
                            "type": "array",
                            "items": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "raster"
                                    },
                                    "id": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    },
                                    "parent": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "visible": {
                                      "type": "boolean"
                                    },
                                    "locked": {
                                      "type": "boolean"
                                    },
                                    "opacity": {
                                      "type": "number",
                                      "minimum": 0,
                                      "maximum": 1
                                    },
                                    "blend": {
                                      "type": "string",
                                      "enum": [
                                        "normal",
                                        "multiply",
                                        "screen",
                                        "darken",
                                        "lighten",
                                        "overlay",
                                        "soft_light",
                                        "hard_light",
                                        "difference",
                                        "exclusion",
                                        "color_dodge",
                                        "color_burn"
                                      ]
                                    },
                                    "maskId": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "transform": {
                                      "type": "object",
                                      "properties": {
                                        "tx": {
                                          "type": "number"
                                        },
                                        "ty": {
                                          "type": "number"
                                        },
                                        "sx": {
                                          "type": "number",
                                          "exclusiveMinimum": 0
                                        },
                                        "sy": {
                                          "type": "number",
                                          "exclusiveMinimum": 0
                                        },
                                        "rotation": {
                                          "type": "number"
                                        },
                                        "flipX": {
                                          "type": "boolean"
                                        },
                                        "flipY": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": ["tx", "ty", "sx", "sy", "rotation", "flipX", "flipY"],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": ["kind", "id", "name", "parent", "visible", "locked", "opacity", "blend"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "group"
                                    },
                                    "id": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    },
                                    "parent": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "visible": {
                                      "type": "boolean"
                                    },
                                    "locked": {
                                      "type": "boolean"
                                    },
                                    "opacity": {
                                      "type": "number",
                                      "minimum": 0,
                                      "maximum": 1
                                    },
                                    "blend": {
                                      "type": "string",
                                      "enum": [
                                        "normal",
                                        "multiply",
                                        "screen",
                                        "darken",
                                        "lighten",
                                        "overlay",
                                        "soft_light",
                                        "hard_light",
                                        "difference",
                                        "exclusion",
                                        "color_dodge",
                                        "color_burn"
                                      ]
                                    },
                                    "maskId": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "isolated": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "id",
                                    "name",
                                    "parent",
                                    "visible",
                                    "locked",
                                    "opacity",
                                    "blend",
                                    "isolated"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "mask"
                                    },
                                    "id": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    },
                                    "parent": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "ownerId": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    }
                                  },
                                  "required": ["kind", "id", "name", "parent", "ownerId"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "adjustment"
                                    },
                                    "id": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    },
                                    "parent": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "visible": {
                                      "type": "boolean"
                                    },
                                    "locked": {
                                      "type": "boolean"
                                    },
                                    "opacity": {
                                      "type": "number",
                                      "minimum": 0,
                                      "maximum": 1
                                    },
                                    "maskId": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "adjustment": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "brightness_contrast"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "brightness": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            },
                                            "contrast": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            }
                                          },
                                          "required": ["type", "version", "brightness", "contrast"],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "hue_saturation"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "hue": {
                                              "type": "number",
                                              "minimum": -180,
                                              "maximum": 180
                                            },
                                            "saturation": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            },
                                            "lightness": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            }
                                          },
                                          "required": ["type", "version", "hue", "saturation", "lightness"],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "warmth_tint"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "warmth": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            },
                                            "tint": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            }
                                          },
                                          "required": ["type", "version", "warmth", "tint"],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "levels"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "inputBlack": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "inputWhite": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "gamma": {
                                              "type": "number",
                                              "minimum": 0.1,
                                              "maximum": 10
                                            },
                                            "outputBlack": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "outputWhite": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "version",
                                            "inputBlack",
                                            "inputWhite",
                                            "gamma",
                                            "outputBlack",
                                            "outputWhite"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "curves"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "channel": {
                                              "type": "string",
                                              "enum": ["master", "r", "g", "b"]
                                            },
                                            "points": {
                                              "minItems": 2,
                                              "maxItems": 16,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "x": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "y": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  }
                                                },
                                                "required": ["x", "y"],
                                                "additionalProperties": false
                                              }
                                            }
                                          },
                                          "required": ["type", "version", "channel", "points"],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "exposure"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "exposure": {
                                              "type": "number",
                                              "minimum": -5,
                                              "maximum": 5
                                            },
                                            "offset": {
                                              "type": "number",
                                              "minimum": -0.5,
                                              "maximum": 0.5
                                            },
                                            "gamma": {
                                              "type": "number",
                                              "minimum": 0.1,
                                              "maximum": 10
                                            }
                                          },
                                          "required": ["type", "version", "exposure", "offset", "gamma"],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "vibrance"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "vibrance": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            },
                                            "saturation": {
                                              "type": "number",
                                              "minimum": -1,
                                              "maximum": 1
                                            }
                                          },
                                          "required": ["type", "version", "vibrance", "saturation"],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "black_white"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "red": {
                                              "type": "number",
                                              "minimum": -2,
                                              "maximum": 3
                                            },
                                            "yellow": {
                                              "type": "number",
                                              "minimum": -2,
                                              "maximum": 3
                                            },
                                            "green": {
                                              "type": "number",
                                              "minimum": -2,
                                              "maximum": 3
                                            },
                                            "cyan": {
                                              "type": "number",
                                              "minimum": -2,
                                              "maximum": 3
                                            },
                                            "blue": {
                                              "type": "number",
                                              "minimum": -2,
                                              "maximum": 3
                                            },
                                            "magenta": {
                                              "type": "number",
                                              "minimum": -2,
                                              "maximum": 3
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "version",
                                            "red",
                                            "yellow",
                                            "green",
                                            "cyan",
                                            "blue",
                                            "magenta"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "hue_range_remap"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            },
                                            "hueMin": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 360
                                            },
                                            "hueMax": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 360
                                            },
                                            "feather": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 60
                                            },
                                            "minSaturation": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "minValue": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "target": {
                                              "type": "object",
                                              "properties": {
                                                "r": {
                                                  "type": "number",
                                                  "minimum": 0,
                                                  "maximum": 1
                                                },
                                                "g": {
                                                  "type": "number",
                                                  "minimum": 0,
                                                  "maximum": 1
                                                },
                                                "b": {
                                                  "type": "number",
                                                  "minimum": 0,
                                                  "maximum": 1
                                                },
                                                "a": {
                                                  "type": "number",
                                                  "minimum": 0,
                                                  "maximum": 1
                                                }
                                              },
                                              "required": ["r", "g", "b", "a"],
                                              "additionalProperties": false
                                            },
                                            "preserveGradient": {
                                              "type": "boolean"
                                            },
                                            "strength": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "version",
                                            "hueMin",
                                            "hueMax",
                                            "feather",
                                            "minSaturation",
                                            "minValue",
                                            "target",
                                            "preserveGradient",
                                            "strength"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "invert"
                                            },
                                            "version": {
                                              "type": "number",
                                              "const": 1
                                            }
                                          },
                                          "required": ["type", "version"],
                                          "additionalProperties": false
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "id",
                                    "name",
                                    "parent",
                                    "visible",
                                    "locked",
                                    "opacity",
                                    "adjustment"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "text"
                                    },
                                    "id": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    },
                                    "parent": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "visible": {
                                      "type": "boolean"
                                    },
                                    "locked": {
                                      "type": "boolean"
                                    },
                                    "opacity": {
                                      "type": "number",
                                      "minimum": 0,
                                      "maximum": 1
                                    },
                                    "blend": {
                                      "type": "string",
                                      "enum": [
                                        "normal",
                                        "multiply",
                                        "screen",
                                        "darken",
                                        "lighten",
                                        "overlay",
                                        "soft_light",
                                        "hard_light",
                                        "difference",
                                        "exclusion",
                                        "color_dodge",
                                        "color_burn"
                                      ]
                                    },
                                    "maskId": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "transform": {
                                      "type": "object",
                                      "properties": {
                                        "tx": {
                                          "type": "number"
                                        },
                                        "ty": {
                                          "type": "number"
                                        },
                                        "sx": {
                                          "type": "number",
                                          "exclusiveMinimum": 0
                                        },
                                        "sy": {
                                          "type": "number",
                                          "exclusiveMinimum": 0
                                        },
                                        "rotation": {
                                          "type": "number"
                                        },
                                        "flipX": {
                                          "type": "boolean"
                                        },
                                        "flipY": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": ["tx", "ty", "sx", "sy", "rotation", "flipX", "flipY"],
                                      "additionalProperties": false
                                    },
                                    "text": {
                                      "type": "object",
                                      "properties": {
                                        "content": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 2000
                                        },
                                        "family": {
                                          "type": "string",
                                          "enum": ["sans-serif", "serif", "monospace", "system-ui"]
                                        },
                                        "sizePx": {
                                          "type": "integer",
                                          "minimum": 4,
                                          "maximum": 512
                                        },
                                        "weight": {
                                          "type": "integer",
                                          "minimum": 100,
                                          "maximum": 900,
                                          "multipleOf": 100
                                        },
                                        "italic": {
                                          "type": "boolean"
                                        },
                                        "color": {
                                          "type": "object",
                                          "properties": {
                                            "r": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "g": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "b": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "a": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            }
                                          },
                                          "required": ["r", "g", "b", "a"],
                                          "additionalProperties": false
                                        },
                                        "align": {
                                          "type": "string",
                                          "enum": ["left", "center", "right"]
                                        },
                                        "lineHeight": {
                                          "type": "number",
                                          "minimum": 0.8,
                                          "maximum": 3
                                        },
                                        "box": {
                                          "type": "object",
                                          "properties": {
                                            "x": {
                                              "type": "integer",
                                              "minimum": -4096,
                                              "maximum": 4096
                                            },
                                            "y": {
                                              "type": "integer",
                                              "minimum": -4096,
                                              "maximum": 4096
                                            },
                                            "width": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "maximum": 4096
                                            }
                                          },
                                          "required": ["x", "y"],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "content",
                                        "family",
                                        "sizePx",
                                        "weight",
                                        "italic",
                                        "color",
                                        "align",
                                        "lineHeight",
                                        "box"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": [
                                    "kind",
                                    "id",
                                    "name",
                                    "parent",
                                    "visible",
                                    "locked",
                                    "opacity",
                                    "blend",
                                    "text"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "activeVariant": {
                            "type": "string",
                            "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          },
                          "variants": {
                            "maxItems": 1024,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 40
                                },
                                "base": {
                                  "type": "string",
                                  "pattern": "^rev_[1-9][0-9]*$"
                                },
                                "head": {
                                  "type": "string",
                                  "pattern": "^rev_[1-9][0-9]*$"
                                },
                                "parentVariant": {
                                  "type": "string",
                                  "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "settings": {
                                  "maxItems": 128,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "axis": {
                                        "type": "string",
                                        "enum": [
                                          "warmth",
                                          "tint",
                                          "brightness",
                                          "contrast",
                                          "saturation",
                                          "hue",
                                          "lightness",
                                          "cropScale",
                                          "opacity"
                                        ]
                                      },
                                      "value": {
                                        "type": "number"
                                      },
                                      "operationVersion": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 9007199254740991
                                      },
                                      "target": {
                                        "type": "string",
                                        "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                      }
                                    },
                                    "required": ["axis", "value", "operationVersion", "target"],
                                    "additionalProperties": false
                                  }
                                },
                                "constraintIds": {
                                  "maxItems": 128,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 200
                                  }
                                },
                                "intent": {
                                  "maxItems": 128,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "claim": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500
                                      },
                                      "source": {
                                        "type": "string",
                                        "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                                      },
                                      "evidenceIds": {
                                        "maxItems": 64,
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200
                                        }
                                      },
                                      "status": {
                                        "type": "string",
                                        "enum": ["recorded", "inferred", "confirmed", "stale"]
                                      },
                                      "uncertainty": {
                                        "type": "string",
                                        "enum": ["low", "medium", "high"]
                                      }
                                    },
                                    "required": ["claim", "source", "evidenceIds", "status"],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": ["id", "label", "base", "head", "settings", "constraintIds", "intent"],
                              "additionalProperties": false
                            }
                          },
                          "constraints": {
                            "maxItems": 1024,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "locked_node",
                                    "protected_region",
                                    "allowed_mask",
                                    "output_dimensions",
                                    "semantic"
                                  ]
                                },
                                "target": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    {
                                      "type": "string",
                                      "pattern": "^[0-9a-f]{64}$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "description": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 500
                                },
                                "enforcement": {
                                  "type": "string",
                                  "enum": ["engine", "review"]
                                },
                                "status": {
                                  "type": "string",
                                  "enum": ["active", "stale"]
                                },
                                "revision": {
                                  "type": "string",
                                  "pattern": "^rev_[1-9][0-9]*$"
                                }
                              },
                              "required": ["id", "kind", "target", "description", "enforcement", "status", "revision"],
                              "additionalProperties": false
                            }
                          },
                          "selection": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "bbox": {
                                    "type": "object",
                                    "properties": {
                                      "x": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "y": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "width": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "height": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      }
                                    },
                                    "required": ["x", "y", "width", "height"],
                                    "additionalProperties": false
                                  },
                                  "coverage": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1
                                  }
                                },
                                "required": ["bbox", "coverage"],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "assets": {
                            "maxItems": 32,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "hash": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{64}$"
                                },
                                "width": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 4096
                                },
                                "height": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 4096
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                }
                              },
                              "required": ["hash", "width", "height"],
                              "additionalProperties": false
                            }
                          },
                          "exportSpecs": {
                            "maxItems": 16,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "outputCount": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 64
                                }
                              },
                              "required": ["name", "outputCount"],
                              "additionalProperties": false
                            }
                          },
                          "recentRevisions": {
                            "maxItems": 10,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "pattern": "^rev_[1-9][0-9]*$"
                                },
                                "parent": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^rev_[1-9][0-9]*$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "actor": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "actorKind": {
                                  "type": "string",
                                  "enum": ["user", "agent", "reviewer", "system"]
                                },
                                "createdAt": {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                "commandIds": {
                                  "maxItems": 1024,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                  }
                                },
                                "changedNodes": {
                                  "maxItems": 4096,
                                  "type": "array",
                                  "items": {
                                    "type": "string",
                                    "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                  }
                                },
                                "bounds": {
                                  "type": "object",
                                  "properties": {
                                    "x": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "y": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "width": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "height": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": ["x", "y", "width", "height"],
                                  "additionalProperties": false
                                },
                                "schemaVersion": {
                                  "type": "number",
                                  "const": 1
                                }
                              },
                              "required": [
                                "id",
                                "parent",
                                "label",
                                "actor",
                                "actorKind",
                                "createdAt",
                                "commandIds",
                                "changedNodes",
                                "schemaVersion"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "documentId",
                          "headRevision",
                          "canvas",
                          "nodes",
                          "variants",
                          "constraints",
                          "selection",
                          "assets",
                          "exportSpecs",
                          "recentRevisions"
                        ],
                        "additionalProperties": false
                      },
                      "selection": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "bbox": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "y": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "width": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "height": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": ["x", "y", "width", "height"],
                                "additionalProperties": false
                              },
                              "coverage": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1
                              }
                            },
                            "required": ["bbox", "coverage"]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "recentDiffs": {
                        "maxItems": 8,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "a": {
                              "type": "string",
                              "pattern": "^rev_[1-9][0-9]*$"
                            },
                            "b": {
                              "type": "string",
                              "pattern": "^rev_[1-9][0-9]*$"
                            },
                            "nodeChanges": {
                              "maxItems": 4096,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "node": {
                                    "type": "string",
                                    "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                  },
                                  "change": {
                                    "type": "string",
                                    "enum": ["added", "removed", "modified"]
                                  },
                                  "fields": {
                                    "maxItems": 64,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120
                                    }
                                  },
                                  "paramDeltas": {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200
                                    },
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "from": {},
                                        "to": {}
                                      },
                                      "required": ["from", "to"],
                                      "additionalProperties": false
                                    }
                                  },
                                  "pixelBbox": {
                                    "type": "object",
                                    "properties": {
                                      "x": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "y": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "width": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "height": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      }
                                    },
                                    "required": ["x", "y", "width", "height"],
                                    "additionalProperties": false
                                  },
                                  "tilesChanged": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 256
                                  }
                                },
                                "required": ["node", "change", "fields"],
                                "additionalProperties": false
                              }
                            },
                            "intent": {
                              "maxItems": 128,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "claim": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 500
                                  },
                                  "source": {
                                    "type": "string",
                                    "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                                  },
                                  "evidenceIds": {
                                    "maxItems": 64,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200
                                    }
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": ["recorded", "inferred", "confirmed", "stale"]
                                  },
                                  "uncertainty": {
                                    "type": "string",
                                    "enum": ["low", "medium", "high"]
                                  }
                                },
                                "required": ["claim", "source", "evidenceIds", "status"],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": ["a", "b", "nodeChanges", "intent"],
                          "additionalProperties": false
                        }
                      },
                      "previews": {
                        "maxItems": 8,
                        "type": "array",
                        "items": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "node": {
                                  "type": "string",
                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "mimeType": {
                                  "type": "string",
                                  "enum": ["image/png", "image/jpeg"]
                                },
                                "base64": {
                                  "type": "string",
                                  "maxLength": 349528
                                },
                                "scope": {
                                  "type": "string",
                                  "enum": ["document", "node"]
                                }
                              },
                              "required": ["node", "mimeType", "base64"]
                            },
                            {
                              "type": "object",
                              "properties": {
                                "node": {
                                  "type": "string",
                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "dataUrl": {
                                  "type": "string",
                                  "maxLength": 349592
                                },
                                "scope": {
                                  "type": "string",
                                  "enum": ["document", "node"]
                                }
                              },
                              "required": ["node", "dataUrl"]
                            }
                          ]
                        }
                      }
                    },
                    "required": ["headRevision", "summary"]
                  }
                },
                "required": ["documentId", "utterance", "context"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stream a planner turn as server-sent events: one event per step, then a final result.",
            "content": {
              "text/event-stream": {}
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/assets/{hash}/complete": {
      "post": {
        "operationId": "completeAssetUpload",
        "summary": "Confirm an uploaded object exists at the expected size and record the asset row.",
        "tags": ["Assets"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "hash",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": ["source", "mask", "result", "preview"]
                  },
                  "mimeType": {
                    "type": "string",
                    "enum": ["image/png", "image/jpeg"]
                  },
                  "sizeBytes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 67108864
                  },
                  "width": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 4096
                  },
                  "height": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 4096
                  }
                },
                "required": ["kind", "mimeType", "sizeBytes"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Confirm an uploaded object exists at the expected size and record the asset row.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "asset": {
                      "type": "object",
                      "properties": {
                        "hash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "kind": {
                          "type": "string",
                          "enum": ["source", "mask", "result", "preview"]
                        },
                        "mimeType": {
                          "type": "string",
                          "enum": ["image/png", "image/jpeg"]
                        },
                        "sizeBytes": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "width": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "height": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": ["hash", "kind", "mimeType", "sizeBytes"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["asset"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "object_not_found: No object was uploaded to the presigned key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "size_mismatch: The stored object size differs from the declared size.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/assets/{hash}/download-url": {
      "get": {
        "operationId": "createAssetDownloadUrl",
        "summary": "Issue a short-lived presigned GET for an asset the caller owns.",
        "tags": ["Assets"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "hash",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Issue a short-lived presigned GET for an asset the caller owns.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "expiresInSeconds": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": ["url", "expiresInSeconds"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/assets/upload-url": {
      "post": {
        "operationId": "createAssetUploadUrl",
        "summary": "Issue a short-lived presigned PUT into the caller-scoped asset key space.",
        "tags": ["Assets"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "hash": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "mimeType": {
                    "type": "string",
                    "enum": ["image/png", "image/jpeg"]
                  },
                  "sizeBytes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 67108864
                  },
                  "kind": {
                    "type": "string",
                    "enum": ["source", "mask", "result", "preview"]
                  }
                },
                "required": ["hash", "mimeType", "sizeBytes", "kind"]
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Issue a short-lived presigned PUT into the caller-scoped asset key space.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "method": {
                      "type": "string",
                      "const": "PUT"
                    },
                    "headers": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "assetHash": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    }
                  },
                  "required": ["url", "method", "headers", "assetHash"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/b4m-key": {
      "post": {
        "operationId": "signInWithB4mKey",
        "summary": "Exchange a Bike4Mind API key for a session. Self-host only; a deployed stage federates instead.",
        "tags": ["Auth"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "apiKey": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 512
                  }
                },
                "required": ["apiKey"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Exchange a Bike4Mind API key for a session. Self-host only; a deployed stage federates instead.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "accessToken": {
                      "type": "string"
                    },
                    "refreshToken": {
                      "type": "string"
                    },
                    "user": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string"
                        },
                        "roles": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "hasB4mCredential": {
                          "type": "boolean"
                        }
                      },
                      "required": ["id", "email", "displayName", "roles", "hasB4mCredential"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["accessToken", "refreshToken", "user"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "invalid_b4m_key: Bike4Mind rejected the key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "pasted_key_disabled: This stage federates sign-in; a pasted key is only accepted under IC_SELF_HOST.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "email_claimed: Another Bike4Mind account already owns this email address's user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: Too many attempts, or too many rejected keys, from this address. Honour Retry-After.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "b4m_unavailable: Bike4Mind could not be reached to validate the key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/callback": {
      "get": {
        "operationId": "completeFederatedSignIn",
        "summary": "Exchange the Cognito authorization code for a session and redirect to the editor.",
        "tags": ["Auth"],
        "parameters": [
          {
            "name": "code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          },
          {
            "name": "error",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "error_description",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 1024
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Exchange the Cognito authorization code for a session and redirect to the editor.",
            "content": {
              "application/octet-stream": {}
            }
          },
          "400": {
            "description": "auth_state_missing: The sign-in cookie was absent or had expired.\nauth_state_mismatch: The returned state did not match this browser.\nauth_code_missing: Cognito returned neither a code nor an error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "auth_token_invalid: The returned ID token did not verify against the pool.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "email_claimed: Another Bike4Mind account already owns this email address's user.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "auth_exchange_failed: Cognito did not exchange the code, or returned no refresh token.\nauth_identity_missing: The ID token carried no Bike4Mind identity or no email address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "federation_not_configured: This stage has no Cognito pool or no Bike4Mind client registered yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/config": {
      "get": {
        "operationId": "getAuthConfig",
        "summary": "Report which sign-in this deployment offers: federated Bike4Mind, or a pasted key under self-host.",
        "tags": ["Auth"],
        "responses": {
          "200": {
            "description": "Report which sign-in this deployment offers: federated Bike4Mind, or a pasted key under self-host.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "federationEnabled": {
                      "type": "boolean"
                    },
                    "selfHost": {
                      "type": "boolean"
                    }
                  },
                  "required": ["federationEnabled", "selfHost"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/forget-key": {
      "post": {
        "operationId": "forgetB4mKey",
        "summary": "Revoke this account’s Bike4Mind credential - the federated grant, or the pasted key under self-host. The session survives; AI features stop.",
        "tags": ["Auth"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Revoke this account’s Bike4Mind credential - the federated grant, or the pasted key under self-host. The session survives; AI features stop.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": ["ok"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/login": {
      "get": {
        "operationId": "startFederatedSignIn",
        "summary": "Redirect to the Bike4Mind sign-in through the Cognito hosted UI.",
        "tags": ["Auth"],
        "responses": {
          "302": {
            "description": "Redirect to the Bike4Mind sign-in through the Cognito hosted UI.",
            "content": {
              "application/octet-stream": {}
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "503": {
            "description": "federation_not_configured: This stage has no Cognito pool or no Bike4Mind client registered yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/me": {
      "get": {
        "operationId": "getCurrentUser",
        "summary": "Return the authenticated user, including whether their account can pay for AI work.",
        "tags": ["Auth"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Return the authenticated user, including whether their account can pay for AI work.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "user": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string"
                        },
                        "roles": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "hasB4mCredential": {
                          "type": "boolean"
                        }
                      },
                      "required": ["id", "email", "displayName", "roles", "hasB4mCredential"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["user"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/refresh": {
      "post": {
        "operationId": "refreshSession",
        "summary": "Exchange a refresh token for a new access/refresh pair.",
        "tags": ["Auth"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "refreshToken": {
                    "type": "string",
                    "minLength": 20,
                    "maxLength": 4096
                  }
                },
                "required": ["refreshToken"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Exchange a refresh token for a new access/refresh pair.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "accessToken": {
                      "type": "string"
                    },
                    "refreshToken": {
                      "type": "string"
                    }
                  },
                  "required": ["accessToken", "refreshToken"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/context": {
      "put": {
        "operationId": "putDocumentContext",
        "summary": "Push the editor document state for MCP consumption.",
        "tags": ["Documents"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "headRevision": {
                    "type": "string",
                    "pattern": "^rev_[1-9][0-9]*$"
                  },
                  "summary": {
                    "type": "object",
                    "properties": {
                      "documentId": {
                        "type": "string",
                        "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                      },
                      "headRevision": {
                        "type": "string",
                        "pattern": "^rev_[1-9][0-9]*$"
                      },
                      "canvas": {
                        "type": "object",
                        "properties": {
                          "width": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 4096
                          },
                          "height": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 4096
                          },
                          "crop": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "y": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "width": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "height": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": ["x", "y", "width", "height"],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "colorSpace": {
                            "type": "string",
                            "const": "srgb"
                          },
                          "assumedSrgb": {
                            "type": "boolean"
                          }
                        },
                        "required": ["width", "height", "crop", "colorSpace", "assumedSrgb"],
                        "additionalProperties": false
                      },
                      "nodes": {
                        "maxItems": 65536,
                        "type": "array",
                        "items": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "raster"
                                },
                                "id": {
                                  "type": "string",
                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "parent": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "visible": {
                                  "type": "boolean"
                                },
                                "locked": {
                                  "type": "boolean"
                                },
                                "opacity": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1
                                },
                                "blend": {
                                  "type": "string",
                                  "enum": [
                                    "normal",
                                    "multiply",
                                    "screen",
                                    "darken",
                                    "lighten",
                                    "overlay",
                                    "soft_light",
                                    "hard_light",
                                    "difference",
                                    "exclusion",
                                    "color_dodge",
                                    "color_burn"
                                  ]
                                },
                                "maskId": {
                                  "type": "string",
                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "transform": {
                                  "type": "object",
                                  "properties": {
                                    "tx": {
                                      "type": "number"
                                    },
                                    "ty": {
                                      "type": "number"
                                    },
                                    "sx": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    },
                                    "sy": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    },
                                    "rotation": {
                                      "type": "number"
                                    },
                                    "flipX": {
                                      "type": "boolean"
                                    },
                                    "flipY": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": ["tx", "ty", "sx", "sy", "rotation", "flipX", "flipY"],
                                  "additionalProperties": false
                                }
                              },
                              "required": ["kind", "id", "name", "parent", "visible", "locked", "opacity", "blend"],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "group"
                                },
                                "id": {
                                  "type": "string",
                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "parent": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "visible": {
                                  "type": "boolean"
                                },
                                "locked": {
                                  "type": "boolean"
                                },
                                "opacity": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1
                                },
                                "blend": {
                                  "type": "string",
                                  "enum": [
                                    "normal",
                                    "multiply",
                                    "screen",
                                    "darken",
                                    "lighten",
                                    "overlay",
                                    "soft_light",
                                    "hard_light",
                                    "difference",
                                    "exclusion",
                                    "color_dodge",
                                    "color_burn"
                                  ]
                                },
                                "maskId": {
                                  "type": "string",
                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "isolated": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "kind",
                                "id",
                                "name",
                                "parent",
                                "visible",
                                "locked",
                                "opacity",
                                "blend",
                                "isolated"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "mask"
                                },
                                "id": {
                                  "type": "string",
                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "parent": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "ownerId": {
                                  "type": "string",
                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                }
                              },
                              "required": ["kind", "id", "name", "parent", "ownerId"],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "adjustment"
                                },
                                "id": {
                                  "type": "string",
                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "parent": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "visible": {
                                  "type": "boolean"
                                },
                                "locked": {
                                  "type": "boolean"
                                },
                                "opacity": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1
                                },
                                "maskId": {
                                  "type": "string",
                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "adjustment": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "brightness_contrast"
                                        },
                                        "version": {
                                          "type": "number",
                                          "const": 1
                                        },
                                        "brightness": {
                                          "type": "number",
                                          "minimum": -1,
                                          "maximum": 1
                                        },
                                        "contrast": {
                                          "type": "number",
                                          "minimum": -1,
                                          "maximum": 1
                                        }
                                      },
                                      "required": ["type", "version", "brightness", "contrast"],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "hue_saturation"
                                        },
                                        "version": {
                                          "type": "number",
                                          "const": 1
                                        },
                                        "hue": {
                                          "type": "number",
                                          "minimum": -180,
                                          "maximum": 180
                                        },
                                        "saturation": {
                                          "type": "number",
                                          "minimum": -1,
                                          "maximum": 1
                                        },
                                        "lightness": {
                                          "type": "number",
                                          "minimum": -1,
                                          "maximum": 1
                                        }
                                      },
                                      "required": ["type", "version", "hue", "saturation", "lightness"],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "warmth_tint"
                                        },
                                        "version": {
                                          "type": "number",
                                          "const": 1
                                        },
                                        "warmth": {
                                          "type": "number",
                                          "minimum": -1,
                                          "maximum": 1
                                        },
                                        "tint": {
                                          "type": "number",
                                          "minimum": -1,
                                          "maximum": 1
                                        }
                                      },
                                      "required": ["type", "version", "warmth", "tint"],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "levels"
                                        },
                                        "version": {
                                          "type": "number",
                                          "const": 1
                                        },
                                        "inputBlack": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 1
                                        },
                                        "inputWhite": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 1
                                        },
                                        "gamma": {
                                          "type": "number",
                                          "minimum": 0.1,
                                          "maximum": 10
                                        },
                                        "outputBlack": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 1
                                        },
                                        "outputWhite": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 1
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "version",
                                        "inputBlack",
                                        "inputWhite",
                                        "gamma",
                                        "outputBlack",
                                        "outputWhite"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "curves"
                                        },
                                        "version": {
                                          "type": "number",
                                          "const": 1
                                        },
                                        "channel": {
                                          "type": "string",
                                          "enum": ["master", "r", "g", "b"]
                                        },
                                        "points": {
                                          "minItems": 2,
                                          "maxItems": 16,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "x": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 1
                                              },
                                              "y": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 1
                                              }
                                            },
                                            "required": ["x", "y"],
                                            "additionalProperties": false
                                          }
                                        }
                                      },
                                      "required": ["type", "version", "channel", "points"],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "exposure"
                                        },
                                        "version": {
                                          "type": "number",
                                          "const": 1
                                        },
                                        "exposure": {
                                          "type": "number",
                                          "minimum": -5,
                                          "maximum": 5
                                        },
                                        "offset": {
                                          "type": "number",
                                          "minimum": -0.5,
                                          "maximum": 0.5
                                        },
                                        "gamma": {
                                          "type": "number",
                                          "minimum": 0.1,
                                          "maximum": 10
                                        }
                                      },
                                      "required": ["type", "version", "exposure", "offset", "gamma"],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "vibrance"
                                        },
                                        "version": {
                                          "type": "number",
                                          "const": 1
                                        },
                                        "vibrance": {
                                          "type": "number",
                                          "minimum": -1,
                                          "maximum": 1
                                        },
                                        "saturation": {
                                          "type": "number",
                                          "minimum": -1,
                                          "maximum": 1
                                        }
                                      },
                                      "required": ["type", "version", "vibrance", "saturation"],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "black_white"
                                        },
                                        "version": {
                                          "type": "number",
                                          "const": 1
                                        },
                                        "red": {
                                          "type": "number",
                                          "minimum": -2,
                                          "maximum": 3
                                        },
                                        "yellow": {
                                          "type": "number",
                                          "minimum": -2,
                                          "maximum": 3
                                        },
                                        "green": {
                                          "type": "number",
                                          "minimum": -2,
                                          "maximum": 3
                                        },
                                        "cyan": {
                                          "type": "number",
                                          "minimum": -2,
                                          "maximum": 3
                                        },
                                        "blue": {
                                          "type": "number",
                                          "minimum": -2,
                                          "maximum": 3
                                        },
                                        "magenta": {
                                          "type": "number",
                                          "minimum": -2,
                                          "maximum": 3
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "version",
                                        "red",
                                        "yellow",
                                        "green",
                                        "cyan",
                                        "blue",
                                        "magenta"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "hue_range_remap"
                                        },
                                        "version": {
                                          "type": "number",
                                          "const": 1
                                        },
                                        "hueMin": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 360
                                        },
                                        "hueMax": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 360
                                        },
                                        "feather": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 60
                                        },
                                        "minSaturation": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 1
                                        },
                                        "minValue": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 1
                                        },
                                        "target": {
                                          "type": "object",
                                          "properties": {
                                            "r": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "g": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "b": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            },
                                            "a": {
                                              "type": "number",
                                              "minimum": 0,
                                              "maximum": 1
                                            }
                                          },
                                          "required": ["r", "g", "b", "a"],
                                          "additionalProperties": false
                                        },
                                        "preserveGradient": {
                                          "type": "boolean"
                                        },
                                        "strength": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 1
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "version",
                                        "hueMin",
                                        "hueMax",
                                        "feather",
                                        "minSaturation",
                                        "minValue",
                                        "target",
                                        "preserveGradient",
                                        "strength"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "invert"
                                        },
                                        "version": {
                                          "type": "number",
                                          "const": 1
                                        }
                                      },
                                      "required": ["type", "version"],
                                      "additionalProperties": false
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "kind",
                                "id",
                                "name",
                                "parent",
                                "visible",
                                "locked",
                                "opacity",
                                "adjustment"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "const": "text"
                                },
                                "id": {
                                  "type": "string",
                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "parent": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "visible": {
                                  "type": "boolean"
                                },
                                "locked": {
                                  "type": "boolean"
                                },
                                "opacity": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1
                                },
                                "blend": {
                                  "type": "string",
                                  "enum": [
                                    "normal",
                                    "multiply",
                                    "screen",
                                    "darken",
                                    "lighten",
                                    "overlay",
                                    "soft_light",
                                    "hard_light",
                                    "difference",
                                    "exclusion",
                                    "color_dodge",
                                    "color_burn"
                                  ]
                                },
                                "maskId": {
                                  "type": "string",
                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "transform": {
                                  "type": "object",
                                  "properties": {
                                    "tx": {
                                      "type": "number"
                                    },
                                    "ty": {
                                      "type": "number"
                                    },
                                    "sx": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    },
                                    "sy": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    },
                                    "rotation": {
                                      "type": "number"
                                    },
                                    "flipX": {
                                      "type": "boolean"
                                    },
                                    "flipY": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": ["tx", "ty", "sx", "sy", "rotation", "flipX", "flipY"],
                                  "additionalProperties": false
                                },
                                "text": {
                                  "type": "object",
                                  "properties": {
                                    "content": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 2000
                                    },
                                    "family": {
                                      "type": "string",
                                      "enum": ["sans-serif", "serif", "monospace", "system-ui"]
                                    },
                                    "sizePx": {
                                      "type": "integer",
                                      "minimum": 4,
                                      "maximum": 512
                                    },
                                    "weight": {
                                      "type": "integer",
                                      "minimum": 100,
                                      "maximum": 900,
                                      "multipleOf": 100
                                    },
                                    "italic": {
                                      "type": "boolean"
                                    },
                                    "color": {
                                      "type": "object",
                                      "properties": {
                                        "r": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 1
                                        },
                                        "g": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 1
                                        },
                                        "b": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 1
                                        },
                                        "a": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 1
                                        }
                                      },
                                      "required": ["r", "g", "b", "a"],
                                      "additionalProperties": false
                                    },
                                    "align": {
                                      "type": "string",
                                      "enum": ["left", "center", "right"]
                                    },
                                    "lineHeight": {
                                      "type": "number",
                                      "minimum": 0.8,
                                      "maximum": 3
                                    },
                                    "box": {
                                      "type": "object",
                                      "properties": {
                                        "x": {
                                          "type": "integer",
                                          "minimum": -4096,
                                          "maximum": 4096
                                        },
                                        "y": {
                                          "type": "integer",
                                          "minimum": -4096,
                                          "maximum": 4096
                                        },
                                        "width": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 4096
                                        }
                                      },
                                      "required": ["x", "y"],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": [
                                    "content",
                                    "family",
                                    "sizePx",
                                    "weight",
                                    "italic",
                                    "color",
                                    "align",
                                    "lineHeight",
                                    "box"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "kind",
                                "id",
                                "name",
                                "parent",
                                "visible",
                                "locked",
                                "opacity",
                                "blend",
                                "text"
                              ],
                              "additionalProperties": false
                            }
                          ]
                        }
                      },
                      "activeVariant": {
                        "type": "string",
                        "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                      },
                      "variants": {
                        "maxItems": 1024,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 40
                            },
                            "base": {
                              "type": "string",
                              "pattern": "^rev_[1-9][0-9]*$"
                            },
                            "head": {
                              "type": "string",
                              "pattern": "^rev_[1-9][0-9]*$"
                            },
                            "parentVariant": {
                              "type": "string",
                              "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                            },
                            "settings": {
                              "maxItems": 128,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "axis": {
                                    "type": "string",
                                    "enum": [
                                      "warmth",
                                      "tint",
                                      "brightness",
                                      "contrast",
                                      "saturation",
                                      "hue",
                                      "lightness",
                                      "cropScale",
                                      "opacity"
                                    ]
                                  },
                                  "value": {
                                    "type": "number"
                                  },
                                  "operationVersion": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 9007199254740991
                                  },
                                  "target": {
                                    "type": "string",
                                    "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                  }
                                },
                                "required": ["axis", "value", "operationVersion", "target"],
                                "additionalProperties": false
                              }
                            },
                            "constraintIds": {
                              "maxItems": 128,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              }
                            },
                            "intent": {
                              "maxItems": 128,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "claim": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 500
                                  },
                                  "source": {
                                    "type": "string",
                                    "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                                  },
                                  "evidenceIds": {
                                    "maxItems": 64,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200
                                    }
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": ["recorded", "inferred", "confirmed", "stale"]
                                  },
                                  "uncertainty": {
                                    "type": "string",
                                    "enum": ["low", "medium", "high"]
                                  }
                                },
                                "required": ["claim", "source", "evidenceIds", "status"],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": ["id", "label", "base", "head", "settings", "constraintIds", "intent"],
                          "additionalProperties": false
                        }
                      },
                      "constraints": {
                        "maxItems": 1024,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "locked_node",
                                "protected_region",
                                "allowed_mask",
                                "output_dimensions",
                                "semantic"
                              ]
                            },
                            "target": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{64}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "description": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500
                            },
                            "enforcement": {
                              "type": "string",
                              "enum": ["engine", "review"]
                            },
                            "status": {
                              "type": "string",
                              "enum": ["active", "stale"]
                            },
                            "revision": {
                              "type": "string",
                              "pattern": "^rev_[1-9][0-9]*$"
                            }
                          },
                          "required": ["id", "kind", "target", "description", "enforcement", "status", "revision"],
                          "additionalProperties": false
                        }
                      },
                      "selection": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "bbox": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "y": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "width": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "height": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": ["x", "y", "width", "height"],
                                "additionalProperties": false
                              },
                              "coverage": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1
                              }
                            },
                            "required": ["bbox", "coverage"],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "assets": {
                        "maxItems": 32,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "hash": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            "width": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 4096
                            },
                            "height": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 4096
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": ["hash", "width", "height"],
                          "additionalProperties": false
                        }
                      },
                      "exportSpecs": {
                        "maxItems": 16,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "outputCount": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 64
                            }
                          },
                          "required": ["name", "outputCount"],
                          "additionalProperties": false
                        }
                      },
                      "recentRevisions": {
                        "maxItems": 10,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "pattern": "^rev_[1-9][0-9]*$"
                            },
                            "parent": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^rev_[1-9][0-9]*$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "actor": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "actorKind": {
                              "type": "string",
                              "enum": ["user", "agent", "reviewer", "system"]
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                            },
                            "commandIds": {
                              "maxItems": 1024,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                              }
                            },
                            "changedNodes": {
                              "maxItems": 4096,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                              }
                            },
                            "bounds": {
                              "type": "object",
                              "properties": {
                                "x": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "y": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "width": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "height": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": ["x", "y", "width", "height"],
                              "additionalProperties": false
                            },
                            "schemaVersion": {
                              "type": "number",
                              "const": 1
                            }
                          },
                          "required": [
                            "id",
                            "parent",
                            "label",
                            "actor",
                            "actorKind",
                            "createdAt",
                            "commandIds",
                            "changedNodes",
                            "schemaVersion"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "documentId",
                      "headRevision",
                      "canvas",
                      "nodes",
                      "variants",
                      "constraints",
                      "selection",
                      "assets",
                      "exportSpecs",
                      "recentRevisions"
                    ],
                    "additionalProperties": false
                  },
                  "selection": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "bbox": {
                            "type": "object",
                            "properties": {
                              "x": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "y": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "width": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "height": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": ["x", "y", "width", "height"],
                            "additionalProperties": false
                          },
                          "coverage": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1
                          }
                        },
                        "required": ["bbox", "coverage"]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "recentDiffs": {
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "a": {
                          "type": "string",
                          "pattern": "^rev_[1-9][0-9]*$"
                        },
                        "b": {
                          "type": "string",
                          "pattern": "^rev_[1-9][0-9]*$"
                        },
                        "nodeChanges": {
                          "maxItems": 4096,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "node": {
                                "type": "string",
                                "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                              },
                              "change": {
                                "type": "string",
                                "enum": ["added", "removed", "modified"]
                              },
                              "fields": {
                                "maxItems": 64,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                }
                              },
                              "paramDeltas": {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "from": {},
                                    "to": {}
                                  },
                                  "required": ["from", "to"],
                                  "additionalProperties": false
                                }
                              },
                              "pixelBbox": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "y": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "width": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "height": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": ["x", "y", "width", "height"],
                                "additionalProperties": false
                              },
                              "tilesChanged": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 256
                              }
                            },
                            "required": ["node", "change", "fields"],
                            "additionalProperties": false
                          }
                        },
                        "intent": {
                          "maxItems": 128,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "claim": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500
                              },
                              "source": {
                                "type": "string",
                                "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                              },
                              "evidenceIds": {
                                "maxItems": 64,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                }
                              },
                              "status": {
                                "type": "string",
                                "enum": ["recorded", "inferred", "confirmed", "stale"]
                              },
                              "uncertainty": {
                                "type": "string",
                                "enum": ["low", "medium", "high"]
                              }
                            },
                            "required": ["claim", "source", "evidenceIds", "status"],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": ["a", "b", "nodeChanges", "intent"],
                      "additionalProperties": false
                    }
                  }
                },
                "required": ["headRevision", "summary"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Push the editor document state for MCP consumption.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": ["ok"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/inbox": {
      "get": {
        "operationId": "getProposalInbox",
        "summary": "Poll for proposals deposited by MCP sessions.",
        "tags": ["Documents"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Poll for proposals deposited by MCP sessions.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "interpretation": {
                            "type": "string"
                          },
                          "proposal": {
                            "anyOf": [
                              {},
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "jobRequests": {
                            "type": "array",
                            "items": {}
                          },
                          "viewChanges": {
                            "type": "array",
                            "items": {}
                          },
                          "questions": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "blocked": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "createdAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "interpretation",
                          "proposal",
                          "jobRequests",
                          "viewChanges",
                          "questions",
                          "blocked",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["items"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/inbox/{itemId}/resolve": {
      "post": {
        "operationId": "resolveInboxItem",
        "summary": "Record the editor decision on a delivered inbox proposal.",
        "tags": ["Documents"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "itemId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": ["accepted", "rejected"]
                  }
                },
                "required": ["decision"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Record the editor decision on a delivered inbox proposal.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": ["ok"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/jobs": {
      "get": {
        "operationId": "listDocumentJobs",
        "summary": "List the caller's jobs for one document, newest first.",
        "tags": ["Documents"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List the caller's jobs for one document, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "jobs": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^job_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          },
                          "documentId": {
                            "type": "string",
                            "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          },
                          "kind": {
                            "type": "string",
                            "enum": ["image_edit", "image_generate", "variant_grid"]
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "eligible",
                              "queued",
                              "running",
                              "ready",
                              "previewed",
                              "accepted",
                              "canceled",
                              "stale",
                              "expired",
                              "failed"
                            ]
                          },
                          "baseRevision": {
                            "type": "string",
                            "pattern": "^rev_[1-9][0-9]*$"
                          },
                          "dependencyManifest": {
                            "type": "object",
                            "properties": {
                              "node": {
                                "type": "string",
                                "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                              },
                              "maskHash": {
                                "type": "string",
                                "pattern": "^[0-9a-f]{64}$"
                              },
                              "sourceHash": {
                                "type": "string",
                                "pattern": "^[0-9a-f]{64}$"
                              },
                              "cropRect": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "y": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "width": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "height": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": ["x", "y", "width", "height"],
                                "additionalProperties": false
                              },
                              "constraintIds": {
                                "maxItems": 128,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                }
                              },
                              "prompt": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 2000
                              },
                              "params": {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "additionalProperties": {}
                              }
                            },
                            "required": ["sourceHash", "cropRect", "constraintIds", "params"],
                            "additionalProperties": false
                          },
                          "provider": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "const": "b4m"
                              },
                              "model": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "requestId": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "seed": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "estimatedCostUsd": {
                                "type": "number",
                                "minimum": 0
                              },
                              "finalCostUsd": {
                                "type": "number",
                                "minimum": 0
                              }
                            },
                            "required": ["name", "model"],
                            "additionalProperties": false
                          },
                          "result": {
                            "type": "object",
                            "properties": {
                              "assetHash": {
                                "type": "string",
                                "pattern": "^[0-9a-f]{64}$"
                              },
                              "width": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4096
                              },
                              "height": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4096
                              },
                              "previewQuality": {
                                "type": "string",
                                "enum": ["preview", "final"]
                              },
                              "mimeType": {
                                "type": "string",
                                "enum": ["image/png", "image/jpeg"]
                              }
                            },
                            "required": ["assetHash", "width", "height", "previewQuality", "mimeType"],
                            "additionalProperties": false
                          },
                          "error": {
                            "type": "object",
                            "properties": {
                              "code": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              },
                              "message": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1000
                              }
                            },
                            "required": ["code", "message"],
                            "additionalProperties": false
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "id",
                          "documentId",
                          "kind",
                          "state",
                          "baseRevision",
                          "dependencyManifest",
                          "createdAt",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["jobs"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Liveness probe. Reads no database and no secret, so a client can also use it to wake a cold deployment before it needs a real answer.",
        "tags": ["Health"],
        "responses": {
          "200": {
            "description": "Liveness probe. Reads no database and no secret, so a client can also use it to wake a cold deployment before it needs a real answer.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "time": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    "build": {
                      "type": "string"
                    }
                  },
                  "required": ["ok", "time", "build"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/jobs": {
      "post": {
        "operationId": "createJob",
        "summary": "Reserve spend, persist a job, and enqueue it for the generation worker.",
        "tags": ["Jobs"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                  },
                  "kind": {
                    "type": "string",
                    "enum": ["image_edit", "image_generate"]
                  },
                  "baseRevision": {
                    "type": "string",
                    "pattern": "^rev_[1-9][0-9]*$"
                  },
                  "dependencyManifest": {
                    "type": "object",
                    "properties": {
                      "node": {
                        "type": "string",
                        "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                      },
                      "maskHash": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      },
                      "sourceHash": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      },
                      "cropRect": {
                        "type": "object",
                        "properties": {
                          "x": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "y": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "width": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "height": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": ["x", "y", "width", "height"],
                        "additionalProperties": false
                      },
                      "constraintIds": {
                        "maxItems": 128,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        }
                      },
                      "prompt": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2000
                      },
                      "params": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "additionalProperties": {}
                      }
                    },
                    "required": ["sourceHash", "cropRect", "constraintIds", "params"],
                    "additionalProperties": false
                  },
                  "estimatedUsd": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  }
                },
                "required": ["documentId", "kind", "baseRevision", "dependencyManifest"]
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Reserve spend, persist a job, and enqueue it for the generation worker.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^job_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                    },
                    "documentId": {
                      "type": "string",
                      "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                    },
                    "kind": {
                      "type": "string",
                      "enum": ["image_edit", "image_generate", "variant_grid"]
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "eligible",
                        "queued",
                        "running",
                        "ready",
                        "previewed",
                        "accepted",
                        "canceled",
                        "stale",
                        "expired",
                        "failed"
                      ]
                    },
                    "baseRevision": {
                      "type": "string",
                      "pattern": "^rev_[1-9][0-9]*$"
                    },
                    "dependencyManifest": {
                      "type": "object",
                      "properties": {
                        "node": {
                          "type": "string",
                          "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                        },
                        "maskHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "sourceHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "cropRect": {
                          "type": "object",
                          "properties": {
                            "x": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "y": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "width": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "height": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": ["x", "y", "width", "height"],
                          "additionalProperties": false
                        },
                        "constraintIds": {
                          "maxItems": 128,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          }
                        },
                        "prompt": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 2000
                        },
                        "params": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "additionalProperties": {}
                        }
                      },
                      "required": ["sourceHash", "cropRect", "constraintIds", "params"],
                      "additionalProperties": false
                    },
                    "provider": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "const": "b4m"
                        },
                        "model": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "requestId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "seed": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "estimatedCostUsd": {
                          "type": "number",
                          "minimum": 0
                        },
                        "finalCostUsd": {
                          "type": "number",
                          "minimum": 0
                        }
                      },
                      "required": ["name", "model"],
                      "additionalProperties": false
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "assetHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "width": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4096
                        },
                        "height": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4096
                        },
                        "previewQuality": {
                          "type": "string",
                          "enum": ["preview", "final"]
                        },
                        "mimeType": {
                          "type": "string",
                          "enum": ["image/png", "image/jpeg"]
                        }
                      },
                      "required": ["assetHash", "width", "height", "previewQuality", "mimeType"],
                      "additionalProperties": false
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "message": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        }
                      },
                      "required": ["code", "message"],
                      "additionalProperties": false
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    }
                  },
                  "required": [
                    "id",
                    "documentId",
                    "kind",
                    "state",
                    "baseRevision",
                    "dependencyManifest",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "412": {
            "description": "b4m_key_missing: The caller has no Bike4Mind API key on file to bill the job to.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "spend_cap_exceeded: The session spend cap would be exceeded.\nasset_not_found: The source or mask asset is not owned by the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/jobs/{id}": {
      "get": {
        "operationId": "getJob",
        "summary": "Read one job. Visible only to its owner.",
        "tags": ["Jobs"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^job_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Read one job. Visible only to its owner.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^job_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                    },
                    "documentId": {
                      "type": "string",
                      "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                    },
                    "kind": {
                      "type": "string",
                      "enum": ["image_edit", "image_generate", "variant_grid"]
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "eligible",
                        "queued",
                        "running",
                        "ready",
                        "previewed",
                        "accepted",
                        "canceled",
                        "stale",
                        "expired",
                        "failed"
                      ]
                    },
                    "baseRevision": {
                      "type": "string",
                      "pattern": "^rev_[1-9][0-9]*$"
                    },
                    "dependencyManifest": {
                      "type": "object",
                      "properties": {
                        "node": {
                          "type": "string",
                          "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                        },
                        "maskHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "sourceHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "cropRect": {
                          "type": "object",
                          "properties": {
                            "x": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "y": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "width": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "height": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": ["x", "y", "width", "height"],
                          "additionalProperties": false
                        },
                        "constraintIds": {
                          "maxItems": 128,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          }
                        },
                        "prompt": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 2000
                        },
                        "params": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "additionalProperties": {}
                        }
                      },
                      "required": ["sourceHash", "cropRect", "constraintIds", "params"],
                      "additionalProperties": false
                    },
                    "provider": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "const": "b4m"
                        },
                        "model": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "requestId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "seed": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "estimatedCostUsd": {
                          "type": "number",
                          "minimum": 0
                        },
                        "finalCostUsd": {
                          "type": "number",
                          "minimum": 0
                        }
                      },
                      "required": ["name", "model"],
                      "additionalProperties": false
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "assetHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "width": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4096
                        },
                        "height": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4096
                        },
                        "previewQuality": {
                          "type": "string",
                          "enum": ["preview", "final"]
                        },
                        "mimeType": {
                          "type": "string",
                          "enum": ["image/png", "image/jpeg"]
                        }
                      },
                      "required": ["assetHash", "width", "height", "previewQuality", "mimeType"],
                      "additionalProperties": false
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "message": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        }
                      },
                      "required": ["code", "message"],
                      "additionalProperties": false
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    }
                  },
                  "required": [
                    "id",
                    "documentId",
                    "kind",
                    "state",
                    "baseRevision",
                    "dependencyManifest",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/jobs/{id}/cancel": {
      "post": {
        "operationId": "cancelJob",
        "summary": "Cancel a non-terminal job and release its spend reservation.",
        "tags": ["Jobs"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^job_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cancel a non-terminal job and release its spend reservation.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^job_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                    },
                    "documentId": {
                      "type": "string",
                      "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                    },
                    "kind": {
                      "type": "string",
                      "enum": ["image_edit", "image_generate", "variant_grid"]
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "eligible",
                        "queued",
                        "running",
                        "ready",
                        "previewed",
                        "accepted",
                        "canceled",
                        "stale",
                        "expired",
                        "failed"
                      ]
                    },
                    "baseRevision": {
                      "type": "string",
                      "pattern": "^rev_[1-9][0-9]*$"
                    },
                    "dependencyManifest": {
                      "type": "object",
                      "properties": {
                        "node": {
                          "type": "string",
                          "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                        },
                        "maskHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "sourceHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "cropRect": {
                          "type": "object",
                          "properties": {
                            "x": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "y": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "width": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "height": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": ["x", "y", "width", "height"],
                          "additionalProperties": false
                        },
                        "constraintIds": {
                          "maxItems": 128,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          }
                        },
                        "prompt": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 2000
                        },
                        "params": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "additionalProperties": {}
                        }
                      },
                      "required": ["sourceHash", "cropRect", "constraintIds", "params"],
                      "additionalProperties": false
                    },
                    "provider": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "const": "b4m"
                        },
                        "model": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "requestId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "seed": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "estimatedCostUsd": {
                          "type": "number",
                          "minimum": 0
                        },
                        "finalCostUsd": {
                          "type": "number",
                          "minimum": 0
                        }
                      },
                      "required": ["name", "model"],
                      "additionalProperties": false
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "assetHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "width": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4096
                        },
                        "height": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4096
                        },
                        "previewQuality": {
                          "type": "string",
                          "enum": ["preview", "final"]
                        },
                        "mimeType": {
                          "type": "string",
                          "enum": ["image/png", "image/jpeg"]
                        }
                      },
                      "required": ["assetHash", "width", "height", "previewQuality", "mimeType"],
                      "additionalProperties": false
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "message": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        }
                      },
                      "required": ["code", "message"],
                      "additionalProperties": false
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    }
                  },
                  "required": [
                    "id",
                    "documentId",
                    "kind",
                    "state",
                    "baseRevision",
                    "dependencyManifest",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/jobs/{id}/decision": {
      "post": {
        "operationId": "recordJobDecision",
        "summary": "Record the caller's decision on a candidate result and transition the job accordingly.",
        "tags": ["Jobs"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^job_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": ["accepted", "rejected"]
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": ["decision"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Record the caller's decision on a candidate result and transition the job accordingly.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^job_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                    },
                    "documentId": {
                      "type": "string",
                      "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                    },
                    "kind": {
                      "type": "string",
                      "enum": ["image_edit", "image_generate", "variant_grid"]
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "eligible",
                        "queued",
                        "running",
                        "ready",
                        "previewed",
                        "accepted",
                        "canceled",
                        "stale",
                        "expired",
                        "failed"
                      ]
                    },
                    "baseRevision": {
                      "type": "string",
                      "pattern": "^rev_[1-9][0-9]*$"
                    },
                    "dependencyManifest": {
                      "type": "object",
                      "properties": {
                        "node": {
                          "type": "string",
                          "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                        },
                        "maskHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "sourceHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "cropRect": {
                          "type": "object",
                          "properties": {
                            "x": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "y": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "width": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "height": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": ["x", "y", "width", "height"],
                          "additionalProperties": false
                        },
                        "constraintIds": {
                          "maxItems": 128,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          }
                        },
                        "prompt": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 2000
                        },
                        "params": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "additionalProperties": {}
                        }
                      },
                      "required": ["sourceHash", "cropRect", "constraintIds", "params"],
                      "additionalProperties": false
                    },
                    "provider": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "const": "b4m"
                        },
                        "model": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "requestId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "seed": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "estimatedCostUsd": {
                          "type": "number",
                          "minimum": 0
                        },
                        "finalCostUsd": {
                          "type": "number",
                          "minimum": 0
                        }
                      },
                      "required": ["name", "model"],
                      "additionalProperties": false
                    },
                    "result": {
                      "type": "object",
                      "properties": {
                        "assetHash": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "width": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4096
                        },
                        "height": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4096
                        },
                        "previewQuality": {
                          "type": "string",
                          "enum": ["preview", "final"]
                        },
                        "mimeType": {
                          "type": "string",
                          "enum": ["image/png", "image/jpeg"]
                        }
                      },
                      "required": ["assetHash", "width", "height", "previewQuality", "mimeType"],
                      "additionalProperties": false
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "message": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        }
                      },
                      "required": ["code", "message"],
                      "additionalProperties": false
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                    }
                  },
                  "required": [
                    "id",
                    "documentId",
                    "kind",
                    "state",
                    "baseRevision",
                    "dependencyManifest",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "409": {
            "description": "job_terminal: The job cannot make this transition from its current state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/publications": {
      "post": {
        "operationId": "createPublication",
        "summary": "Publish an immutable review package and return its unguessable share link.",
        "tags": ["Publications"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "documentId": {
                    "type": "string",
                    "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                  },
                  "revision": {
                    "type": "string",
                    "pattern": "^rev_[1-9][0-9]*$"
                  },
                  "title": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "variants": {
                    "minItems": 1,
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "variantId": {
                          "type": "string",
                          "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                        },
                        "label": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 40
                        },
                        "previewAsset": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "width": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4096
                        },
                        "height": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 4096
                        },
                        "summary": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 1000
                        },
                        "intent": {
                          "default": [],
                          "maxItems": 64,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "claim": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500
                              },
                              "source": {
                                "type": "string",
                                "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                              },
                              "evidenceIds": {
                                "maxItems": 64,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                }
                              },
                              "status": {
                                "type": "string",
                                "enum": ["recorded", "inferred", "confirmed", "stale"]
                              },
                              "uncertainty": {
                                "type": "string",
                                "enum": ["low", "medium", "high"]
                              }
                            },
                            "required": ["claim", "source", "evidenceIds", "status"],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": ["variantId", "label", "previewAsset", "width", "height", "summary"]
                    }
                  },
                  "differences": {
                    "default": [],
                    "maxItems": 64,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "a": {
                          "type": "string",
                          "pattern": "^rev_[1-9][0-9]*$"
                        },
                        "b": {
                          "type": "string",
                          "pattern": "^rev_[1-9][0-9]*$"
                        },
                        "nodeChanges": {
                          "maxItems": 4096,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "node": {
                                "type": "string",
                                "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                              },
                              "change": {
                                "type": "string",
                                "enum": ["added", "removed", "modified"]
                              },
                              "fields": {
                                "maxItems": 64,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                }
                              },
                              "paramDeltas": {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                },
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "from": {},
                                    "to": {}
                                  },
                                  "required": ["from", "to"],
                                  "additionalProperties": false
                                }
                              },
                              "pixelBbox": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "y": {
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  },
                                  "width": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "height": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": ["x", "y", "width", "height"],
                                "additionalProperties": false
                              },
                              "tilesChanged": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 256
                              }
                            },
                            "required": ["node", "change", "fields"],
                            "additionalProperties": false
                          }
                        },
                        "intent": {
                          "maxItems": 128,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "claim": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500
                              },
                              "source": {
                                "type": "string",
                                "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                              },
                              "evidenceIds": {
                                "maxItems": 64,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                }
                              },
                              "status": {
                                "type": "string",
                                "enum": ["recorded", "inferred", "confirmed", "stale"]
                              },
                              "uncertainty": {
                                "type": "string",
                                "enum": ["low", "medium", "high"]
                              }
                            },
                            "required": ["claim", "source", "evidenceIds", "status"],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": ["a", "b", "nodeChanges", "intent"],
                      "additionalProperties": false
                    }
                  },
                  "allowedActions": {
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "view",
                        "compare",
                        "comment",
                        "prefer",
                        "request_changes",
                        "explore",
                        "accept",
                        "approve"
                      ]
                    }
                  },
                  "explorationBudgetUsd": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1000
                  },
                  "roleGrants": {
                    "maxItems": 32,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "principal": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 320
                        },
                        "role": {
                          "type": "string",
                          "enum": ["viewer", "reviewer", "explorer"]
                        }
                      },
                      "required": ["principal", "role"]
                    }
                  }
                },
                "required": ["documentId", "revision", "variants", "allowedActions"]
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Publish an immutable review package and return its unguessable share link.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "publication": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^pub_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                        },
                        "documentId": {
                          "type": "string",
                          "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                        },
                        "revision": {
                          "type": "string",
                          "pattern": "^rev_[1-9][0-9]*$"
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        },
                        "variants": {
                          "minItems": 1,
                          "maxItems": 16,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "variantId": {
                                "type": "string",
                                "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              "previewAsset": {
                                "type": "string",
                                "pattern": "^[0-9a-f]{64}$"
                              },
                              "width": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4096
                              },
                              "height": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4096
                              },
                              "summary": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1000
                              },
                              "intent": {
                                "maxItems": 64,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "claim": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 500
                                    },
                                    "source": {
                                      "type": "string",
                                      "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                                    },
                                    "evidenceIds": {
                                      "maxItems": 64,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200
                                      }
                                    },
                                    "status": {
                                      "type": "string",
                                      "enum": ["recorded", "inferred", "confirmed", "stale"]
                                    },
                                    "uncertainty": {
                                      "type": "string",
                                      "enum": ["low", "medium", "high"]
                                    }
                                  },
                                  "required": ["claim", "source", "evidenceIds", "status"],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": ["variantId", "label", "previewAsset", "width", "height", "summary", "intent"],
                            "additionalProperties": false
                          }
                        },
                        "differences": {
                          "maxItems": 64,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "a": {
                                "type": "string",
                                "pattern": "^rev_[1-9][0-9]*$"
                              },
                              "b": {
                                "type": "string",
                                "pattern": "^rev_[1-9][0-9]*$"
                              },
                              "nodeChanges": {
                                "maxItems": 4096,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "node": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "change": {
                                      "type": "string",
                                      "enum": ["added", "removed", "modified"]
                                    },
                                    "fields": {
                                      "maxItems": 64,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 120
                                      }
                                    },
                                    "paramDeltas": {
                                      "type": "object",
                                      "propertyNames": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200
                                      },
                                      "additionalProperties": {
                                        "type": "object",
                                        "properties": {
                                          "from": {},
                                          "to": {}
                                        },
                                        "required": ["from", "to"],
                                        "additionalProperties": false
                                      }
                                    },
                                    "pixelBbox": {
                                      "type": "object",
                                      "properties": {
                                        "x": {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "y": {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "width": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 9007199254740991
                                        },
                                        "height": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": ["x", "y", "width", "height"],
                                      "additionalProperties": false
                                    },
                                    "tilesChanged": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 256
                                    }
                                  },
                                  "required": ["node", "change", "fields"],
                                  "additionalProperties": false
                                }
                              },
                              "intent": {
                                "maxItems": 128,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "claim": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 500
                                    },
                                    "source": {
                                      "type": "string",
                                      "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                                    },
                                    "evidenceIds": {
                                      "maxItems": 64,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200
                                      }
                                    },
                                    "status": {
                                      "type": "string",
                                      "enum": ["recorded", "inferred", "confirmed", "stale"]
                                    },
                                    "uncertainty": {
                                      "type": "string",
                                      "enum": ["low", "medium", "high"]
                                    }
                                  },
                                  "required": ["claim", "source", "evidenceIds", "status"],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": ["a", "b", "nodeChanges", "intent"],
                            "additionalProperties": false
                          }
                        },
                        "allowedActions": {
                          "maxItems": 8,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "view",
                              "compare",
                              "comment",
                              "prefer",
                              "request_changes",
                              "explore",
                              "accept",
                              "approve"
                            ]
                          }
                        },
                        "explorationBudgetUsd": {
                          "type": "number",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "id",
                        "documentId",
                        "revision",
                        "createdAt",
                        "variants",
                        "differences",
                        "allowedActions"
                      ],
                      "additionalProperties": false
                    },
                    "shareUrl": {
                      "type": "string"
                    }
                  },
                  "required": ["publication", "shareUrl"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "asset_not_found: A preview asset is not owned by the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listPublications",
        "summary": "List the caller's own publications, newest first.",
        "tags": ["Publications"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "List the caller's own publications, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "publications": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "pattern": "^pub_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          },
                          "documentId": {
                            "type": "string",
                            "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          },
                          "revision": {
                            "type": "string",
                            "pattern": "^rev_[1-9][0-9]*$"
                          },
                          "title": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          },
                          "variants": {
                            "minItems": 1,
                            "maxItems": 16,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "variantId": {
                                  "type": "string",
                                  "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                },
                                "label": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 40
                                },
                                "previewAsset": {
                                  "type": "string",
                                  "pattern": "^[0-9a-f]{64}$"
                                },
                                "width": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 4096
                                },
                                "height": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 4096
                                },
                                "summary": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 1000
                                },
                                "intent": {
                                  "maxItems": 64,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "claim": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500
                                      },
                                      "source": {
                                        "type": "string",
                                        "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                                      },
                                      "evidenceIds": {
                                        "maxItems": 64,
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200
                                        }
                                      },
                                      "status": {
                                        "type": "string",
                                        "enum": ["recorded", "inferred", "confirmed", "stale"]
                                      },
                                      "uncertainty": {
                                        "type": "string",
                                        "enum": ["low", "medium", "high"]
                                      }
                                    },
                                    "required": ["claim", "source", "evidenceIds", "status"],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "variantId",
                                "label",
                                "previewAsset",
                                "width",
                                "height",
                                "summary",
                                "intent"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "differences": {
                            "maxItems": 64,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "a": {
                                  "type": "string",
                                  "pattern": "^rev_[1-9][0-9]*$"
                                },
                                "b": {
                                  "type": "string",
                                  "pattern": "^rev_[1-9][0-9]*$"
                                },
                                "nodeChanges": {
                                  "maxItems": 4096,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "node": {
                                        "type": "string",
                                        "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                      },
                                      "change": {
                                        "type": "string",
                                        "enum": ["added", "removed", "modified"]
                                      },
                                      "fields": {
                                        "maxItems": 64,
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        }
                                      },
                                      "paramDeltas": {
                                        "type": "object",
                                        "propertyNames": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200
                                        },
                                        "additionalProperties": {
                                          "type": "object",
                                          "properties": {
                                            "from": {},
                                            "to": {}
                                          },
                                          "required": ["from", "to"],
                                          "additionalProperties": false
                                        }
                                      },
                                      "pixelBbox": {
                                        "type": "object",
                                        "properties": {
                                          "x": {
                                            "type": "integer",
                                            "minimum": -9007199254740991,
                                            "maximum": 9007199254740991
                                          },
                                          "y": {
                                            "type": "integer",
                                            "minimum": -9007199254740991,
                                            "maximum": 9007199254740991
                                          },
                                          "width": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          },
                                          "height": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": ["x", "y", "width", "height"],
                                        "additionalProperties": false
                                      },
                                      "tilesChanged": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 256
                                      }
                                    },
                                    "required": ["node", "change", "fields"],
                                    "additionalProperties": false
                                  }
                                },
                                "intent": {
                                  "maxItems": 128,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "claim": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 500
                                      },
                                      "source": {
                                        "type": "string",
                                        "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                                      },
                                      "evidenceIds": {
                                        "maxItems": 64,
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 200
                                        }
                                      },
                                      "status": {
                                        "type": "string",
                                        "enum": ["recorded", "inferred", "confirmed", "stale"]
                                      },
                                      "uncertainty": {
                                        "type": "string",
                                        "enum": ["low", "medium", "high"]
                                      }
                                    },
                                    "required": ["claim", "source", "evidenceIds", "status"],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": ["a", "b", "nodeChanges", "intent"],
                              "additionalProperties": false
                            }
                          },
                          "allowedActions": {
                            "maxItems": 8,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "view",
                                "compare",
                                "comment",
                                "prefer",
                                "request_changes",
                                "explore",
                                "accept",
                                "approve"
                              ]
                            }
                          },
                          "explorationBudgetUsd": {
                            "type": "number",
                            "minimum": 0
                          },
                          "revokedAt": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "shareUrl": {
                            "type": "string"
                          },
                          "decisionCounts": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string",
                              "enum": [
                                "previewed",
                                "compared",
                                "preference",
                                "comment",
                                "request_changes",
                                "explore_request",
                                "accepted",
                                "approved"
                              ]
                            },
                            "additionalProperties": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          }
                        },
                        "required": [
                          "id",
                          "documentId",
                          "revision",
                          "createdAt",
                          "variants",
                          "differences",
                          "allowedActions",
                          "revokedAt",
                          "shareUrl",
                          "decisionCounts"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["publications"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/publications/{id}/decision": {
      "post": {
        "operationId": "recordPublicationDecision",
        "summary": "Record the owner's acceptance or approval of a publication.",
        "tags": ["Publications"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^pub_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": ["accepted", "approved"]
                  },
                  "variantIds": {
                    "default": [],
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                    }
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": ["kind"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Record the owner's acceptance or approval of a publication.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "decision": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "publicationId": {
                          "type": "string",
                          "pattern": "^pub_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                        },
                        "actorId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "role": {
                          "type": "string",
                          "enum": ["viewer", "reviewer", "explorer", "owner"]
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "previewed",
                            "compared",
                            "preference",
                            "comment",
                            "request_changes",
                            "explore_request",
                            "accepted",
                            "approved"
                          ]
                        },
                        "variantIds": {
                          "maxItems": 16,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          }
                        },
                        "shownVariantIds": {
                          "maxItems": 16,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          }
                        },
                        "payload": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "additionalProperties": {}
                        },
                        "reason": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        }
                      },
                      "required": [
                        "id",
                        "publicationId",
                        "actorId",
                        "role",
                        "kind",
                        "variantIds",
                        "shownVariantIds",
                        "payload",
                        "createdAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["decision"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "action_not_allowed: The publication does not permit this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/publications/{id}/decisions": {
      "get": {
        "operationId": "listPublicationDecisions",
        "summary": "List every recorded review decision for a publication the caller owns.",
        "tags": ["Publications"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^pub_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List every recorded review decision for a publication the caller owns.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "decisions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "publicationId": {
                            "type": "string",
                            "pattern": "^pub_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          },
                          "actorId": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "role": {
                            "type": "string",
                            "enum": ["viewer", "reviewer", "explorer", "owner"]
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "previewed",
                              "compared",
                              "preference",
                              "comment",
                              "request_changes",
                              "explore_request",
                              "accepted",
                              "approved"
                            ]
                          },
                          "variantIds": {
                            "maxItems": 16,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                            }
                          },
                          "shownVariantIds": {
                            "maxItems": 16,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                            }
                          },
                          "payload": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "additionalProperties": {}
                          },
                          "reason": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "id",
                          "publicationId",
                          "actorId",
                          "role",
                          "kind",
                          "variantIds",
                          "shownVariantIds",
                          "payload",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["decisions"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/publications/{id}/passphrase": {
      "post": {
        "operationId": "setPublicationPassphrase",
        "summary": "Add or replace the passphrase gate checked before any published object is served.",
        "tags": ["Publications"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^pub_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "passphrase": {
                    "type": "string",
                    "minLength": 8,
                    "maxLength": 200
                  }
                },
                "required": ["passphrase"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Add or replace the passphrase gate checked before any published object is served.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    }
                  },
                  "required": ["ok"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/publications/{id}/revoke": {
      "post": {
        "operationId": "revokePublication",
        "summary": "Revoke a publication. Future access stops; a screenshot already taken cannot be recalled.",
        "tags": ["Publications"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^pub_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoke a publication. Future access stops; a screenshot already taken cannot be recalled.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "const": true
                    },
                    "revokedAt": {
                      "type": "string"
                    }
                  },
                  "required": ["ok", "revokedAt"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/publications/{id}/rotate-token": {
      "post": {
        "operationId": "rotatePublicationToken",
        "summary": "Rotate the share token, invalidating every previously issued link immediately.",
        "tags": ["Publications"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^pub_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rotate the share token, invalidating every previously issued link immediately.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "shareUrl": {
                      "type": "string"
                    }
                  },
                  "required": ["shareUrl"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/review/ask": {
      "post": {
        "operationId": "askReviewQuestion",
        "summary": "Answer a question strictly from the published manifest. Private history is never consulted.",
        "tags": ["Review"],
        "security": [
          {
            "reviewCookie": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "question": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": ["question"]
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Answer a question strictly from the published manifest. Private history is never consulted.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "answer": {
                      "type": "string"
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "usdCost": {
                          "type": "number"
                        },
                        "inputTokens": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "outputTokens": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": ["usdCost"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["answer", "usage"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "ask_unavailable: The publication owner has no Bike4Mind key on file, so there is nothing to bill the answer to.\nask_not_funded: The publication has no exploration budget, so questions are not enabled.\nexploration_budget_exceeded: The question would exceed the publication's remaining exploration budget.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/review/assets/{hash}": {
      "get": {
        "operationId": "getReviewAsset",
        "summary": "Stream one published preview. A hash outside this package is a 404, never a read.",
        "tags": ["Review"],
        "security": [
          {
            "reviewCookie": []
          }
        ],
        "parameters": [
          {
            "name": "hash",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Stream one published preview. A hash outside this package is a 404, never a read.",
            "content": {
              "image/png": {}
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/review/decisions": {
      "post": {
        "operationId": "recordReviewDecision",
        "summary": "Record what a reviewer did, including which alternatives were actually on screen.",
        "tags": ["Review"],
        "security": [
          {
            "reviewCookie": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "previewed",
                      "compared",
                      "preference",
                      "comment",
                      "request_changes",
                      "explore_request",
                      "accepted"
                    ]
                  },
                  "variantIds": {
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                    }
                  },
                  "shownVariantIds": {
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                    }
                  },
                  "payload": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  }
                },
                "required": ["kind", "variantIds", "shownVariantIds", "payload"]
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Record what a reviewer did, including which alternatives were actually on screen.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "decision": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "publicationId": {
                          "type": "string",
                          "pattern": "^pub_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                        },
                        "actorId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "role": {
                          "type": "string",
                          "enum": ["viewer", "reviewer", "explorer", "owner"]
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "previewed",
                            "compared",
                            "preference",
                            "comment",
                            "request_changes",
                            "explore_request",
                            "accepted",
                            "approved"
                          ]
                        },
                        "variantIds": {
                          "maxItems": 16,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          }
                        },
                        "shownVariantIds": {
                          "maxItems": 16,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          }
                        },
                        "payload": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "additionalProperties": {}
                        },
                        "reason": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        }
                      },
                      "required": [
                        "id",
                        "publicationId",
                        "actorId",
                        "role",
                        "kind",
                        "variantIds",
                        "shownVariantIds",
                        "payload",
                        "createdAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["decision"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "action_not_allowed: The role or the package forbids this action.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/review/explore": {
      "post": {
        "operationId": "requestReviewExploration",
        "summary": "Record an explorer request against the publication exploration budget.",
        "tags": ["Review"],
        "security": [
          {
            "reviewCookie": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "axes": {
                    "minItems": 1,
                    "maxItems": 4,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 60
                    }
                  },
                  "labels": {
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 40
                    }
                  }
                },
                "required": ["axes", "labels"]
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Record an explorer request against the publication exploration budget.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "decision": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "publicationId": {
                          "type": "string",
                          "pattern": "^pub_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                        },
                        "actorId": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "role": {
                          "type": "string",
                          "enum": ["viewer", "reviewer", "explorer", "owner"]
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "previewed",
                            "compared",
                            "preference",
                            "comment",
                            "request_changes",
                            "explore_request",
                            "accepted",
                            "approved"
                          ]
                        },
                        "variantIds": {
                          "maxItems": 16,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          }
                        },
                        "shownVariantIds": {
                          "maxItems": 16,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                          }
                        },
                        "payload": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "additionalProperties": {}
                        },
                        "reason": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        }
                      },
                      "required": [
                        "id",
                        "publicationId",
                        "actorId",
                        "role",
                        "kind",
                        "variantIds",
                        "shownVariantIds",
                        "payload",
                        "createdAt"
                      ],
                      "additionalProperties": false
                    },
                    "status": {
                      "type": "string",
                      "const": "requested"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": ["decision", "status", "message"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "action_not_allowed: The session role is not explorer.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "exploration_budget_exceeded: The request exceeds the remaining budget.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/review/package": {
      "get": {
        "operationId": "getReviewPackage",
        "summary": "Read the published review package for the current review session.",
        "tags": ["Review"],
        "security": [
          {
            "reviewCookie": []
          }
        ],
        "responses": {
          "200": {
            "description": "Read the published review package for the current review session.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "publication": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^pub_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                        },
                        "documentId": {
                          "type": "string",
                          "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                        },
                        "revision": {
                          "type": "string",
                          "pattern": "^rev_[1-9][0-9]*$"
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        },
                        "variants": {
                          "minItems": 1,
                          "maxItems": 16,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "variantId": {
                                "type": "string",
                                "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              "previewAsset": {
                                "type": "string",
                                "pattern": "^[0-9a-f]{64}$"
                              },
                              "width": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4096
                              },
                              "height": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4096
                              },
                              "summary": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1000
                              },
                              "intent": {
                                "maxItems": 64,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "claim": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 500
                                    },
                                    "source": {
                                      "type": "string",
                                      "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                                    },
                                    "evidenceIds": {
                                      "maxItems": 64,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200
                                      }
                                    },
                                    "status": {
                                      "type": "string",
                                      "enum": ["recorded", "inferred", "confirmed", "stale"]
                                    },
                                    "uncertainty": {
                                      "type": "string",
                                      "enum": ["low", "medium", "high"]
                                    }
                                  },
                                  "required": ["claim", "source", "evidenceIds", "status"],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": ["variantId", "label", "previewAsset", "width", "height", "summary", "intent"],
                            "additionalProperties": false
                          }
                        },
                        "differences": {
                          "maxItems": 64,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "a": {
                                "type": "string",
                                "pattern": "^rev_[1-9][0-9]*$"
                              },
                              "b": {
                                "type": "string",
                                "pattern": "^rev_[1-9][0-9]*$"
                              },
                              "nodeChanges": {
                                "maxItems": 4096,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "node": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "change": {
                                      "type": "string",
                                      "enum": ["added", "removed", "modified"]
                                    },
                                    "fields": {
                                      "maxItems": 64,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 120
                                      }
                                    },
                                    "paramDeltas": {
                                      "type": "object",
                                      "propertyNames": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200
                                      },
                                      "additionalProperties": {
                                        "type": "object",
                                        "properties": {
                                          "from": {},
                                          "to": {}
                                        },
                                        "required": ["from", "to"],
                                        "additionalProperties": false
                                      }
                                    },
                                    "pixelBbox": {
                                      "type": "object",
                                      "properties": {
                                        "x": {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "y": {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "width": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 9007199254740991
                                        },
                                        "height": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": ["x", "y", "width", "height"],
                                      "additionalProperties": false
                                    },
                                    "tilesChanged": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 256
                                    }
                                  },
                                  "required": ["node", "change", "fields"],
                                  "additionalProperties": false
                                }
                              },
                              "intent": {
                                "maxItems": 128,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "claim": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 500
                                    },
                                    "source": {
                                      "type": "string",
                                      "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                                    },
                                    "evidenceIds": {
                                      "maxItems": 64,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200
                                      }
                                    },
                                    "status": {
                                      "type": "string",
                                      "enum": ["recorded", "inferred", "confirmed", "stale"]
                                    },
                                    "uncertainty": {
                                      "type": "string",
                                      "enum": ["low", "medium", "high"]
                                    }
                                  },
                                  "required": ["claim", "source", "evidenceIds", "status"],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": ["a", "b", "nodeChanges", "intent"],
                            "additionalProperties": false
                          }
                        },
                        "allowedActions": {
                          "maxItems": 8,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "view",
                              "compare",
                              "comment",
                              "prefer",
                              "request_changes",
                              "explore",
                              "accept",
                              "approve"
                            ]
                          }
                        },
                        "explorationBudgetUsd": {
                          "type": "number",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "id",
                        "documentId",
                        "revision",
                        "createdAt",
                        "variants",
                        "differences",
                        "allowedActions"
                      ],
                      "additionalProperties": false
                    },
                    "role": {
                      "type": "string",
                      "enum": ["viewer", "reviewer", "explorer"]
                    },
                    "allowedActions": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "view",
                          "compare",
                          "comment",
                          "prefer",
                          "request_changes",
                          "explore",
                          "accept",
                          "approve"
                        ]
                      }
                    }
                  },
                  "required": ["publication", "role", "allowedActions"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/review/session": {
      "post": {
        "operationId": "createReviewSession",
        "summary": "Exchange a share token (and passphrase, when gated) for a review session cookie.",
        "tags": ["Review"],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "minLength": 16,
                    "maxLength": 200
                  },
                  "passphrase": {
                    "type": "string",
                    "maxLength": 200
                  }
                },
                "required": ["token"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Exchange a share token (and passphrase, when gated) for a review session cookie.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "publication": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "pattern": "^pub_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                        },
                        "documentId": {
                          "type": "string",
                          "pattern": "^doc_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                        },
                        "revision": {
                          "type": "string",
                          "pattern": "^rev_[1-9][0-9]*$"
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 120
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                        },
                        "variants": {
                          "minItems": 1,
                          "maxItems": 16,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "variantId": {
                                "type": "string",
                                "pattern": "^var_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                              },
                              "label": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 40
                              },
                              "previewAsset": {
                                "type": "string",
                                "pattern": "^[0-9a-f]{64}$"
                              },
                              "width": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4096
                              },
                              "height": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4096
                              },
                              "summary": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 1000
                              },
                              "intent": {
                                "maxItems": 64,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "claim": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 500
                                    },
                                    "source": {
                                      "type": "string",
                                      "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                                    },
                                    "evidenceIds": {
                                      "maxItems": 64,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200
                                      }
                                    },
                                    "status": {
                                      "type": "string",
                                      "enum": ["recorded", "inferred", "confirmed", "stale"]
                                    },
                                    "uncertainty": {
                                      "type": "string",
                                      "enum": ["low", "medium", "high"]
                                    }
                                  },
                                  "required": ["claim", "source", "evidenceIds", "status"],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": ["variantId", "label", "previewAsset", "width", "height", "summary", "intent"],
                            "additionalProperties": false
                          }
                        },
                        "differences": {
                          "maxItems": 64,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "a": {
                                "type": "string",
                                "pattern": "^rev_[1-9][0-9]*$"
                              },
                              "b": {
                                "type": "string",
                                "pattern": "^rev_[1-9][0-9]*$"
                              },
                              "nodeChanges": {
                                "maxItems": 4096,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "node": {
                                      "type": "string",
                                      "pattern": "^node_[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
                                    },
                                    "change": {
                                      "type": "string",
                                      "enum": ["added", "removed", "modified"]
                                    },
                                    "fields": {
                                      "maxItems": 64,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 120
                                      }
                                    },
                                    "paramDeltas": {
                                      "type": "object",
                                      "propertyNames": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200
                                      },
                                      "additionalProperties": {
                                        "type": "object",
                                        "properties": {
                                          "from": {},
                                          "to": {}
                                        },
                                        "required": ["from", "to"],
                                        "additionalProperties": false
                                      }
                                    },
                                    "pixelBbox": {
                                      "type": "object",
                                      "properties": {
                                        "x": {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "y": {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "width": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 9007199254740991
                                        },
                                        "height": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": ["x", "y", "width", "height"],
                                      "additionalProperties": false
                                    },
                                    "tilesChanged": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 256
                                    }
                                  },
                                  "required": ["node", "change", "fields"],
                                  "additionalProperties": false
                                }
                              },
                              "intent": {
                                "maxItems": 128,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "claim": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 500
                                    },
                                    "source": {
                                      "type": "string",
                                      "enum": ["user", "operation-diff", "agent-inference", "reviewer-confirmation"]
                                    },
                                    "evidenceIds": {
                                      "maxItems": 64,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 200
                                      }
                                    },
                                    "status": {
                                      "type": "string",
                                      "enum": ["recorded", "inferred", "confirmed", "stale"]
                                    },
                                    "uncertainty": {
                                      "type": "string",
                                      "enum": ["low", "medium", "high"]
                                    }
                                  },
                                  "required": ["claim", "source", "evidenceIds", "status"],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": ["a", "b", "nodeChanges", "intent"],
                            "additionalProperties": false
                          }
                        },
                        "allowedActions": {
                          "maxItems": 8,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "view",
                              "compare",
                              "comment",
                              "prefer",
                              "request_changes",
                              "explore",
                              "accept",
                              "approve"
                            ]
                          }
                        },
                        "explorationBudgetUsd": {
                          "type": "number",
                          "minimum": 0
                        }
                      },
                      "required": [
                        "id",
                        "documentId",
                        "revision",
                        "createdAt",
                        "variants",
                        "differences",
                        "allowedActions"
                      ],
                      "additionalProperties": false
                    },
                    "role": {
                      "type": "string",
                      "enum": ["viewer", "reviewer", "explorer"]
                    },
                    "allowedActions": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "view",
                          "compare",
                          "comment",
                          "prefer",
                          "request_changes",
                          "explore",
                          "accept",
                          "approve"
                        ]
                      }
                    }
                  },
                  "required": ["publication", "role", "allowedActions"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "passphrase_required: The publication is gated and the passphrase failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "not_found: The token does not resolve to a live publication.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/voice/transcribe": {
      "post": {
        "operationId": "transcribeVoiceClip",
        "summary": "Transcribe one push-to-talk clip. Raw audio is not retained after transcription.",
        "tags": ["Voice"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "description": "A UUID v4. The 2xx response is replayed for an hour under the same key.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Transcribe one push-to-talk clip. Raw audio is not retained after transcription.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": ["text"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request failed validation, or an Idempotency-Key is missing or malformed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "405": {
            "description": "The method is not allowed for this path.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "payload_too_large: The clip exceeds 5 MiB.\nunsupported_media_type: The clip is not an accepted audio type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    }
  }
}
