{
  "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"
      },
      "oauth2": {
        "type": "oauth2",
        "description": "PaintBox OAuth 2.1 for agents: public clients, PKCE S256, rotating refresh tokens.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "/oauth/authorize",
            "tokenUrl": "/api/oauth/token",
            "refreshUrl": "/api/oauth/token",
            "scopes": {
              "propose": "Read your documents, upload images, and send you proposals to review. It cannot change your documents by itself.",
              "edit": "Change documents without your review: create documents from your uploads, apply edits to them, and export them.",
              "generate": "Spend your Bike4Mind credits on image generation, planning and transcription, up to the daily cap below."
            }
          }
        }
      },
      "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
      },
      "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": {
                "$ref": "#/components/schemas/Color"
              },
              "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": "color_mixer"
              },
              "version": {
                "type": "number",
                "const": 1
              },
              "bands": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "enum": ["red", "orange", "yellow", "green", "aqua", "blue", "purple", "magenta"]
                },
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "hue": {
                      "type": "number",
                      "minimum": -1,
                      "maximum": 1
                    },
                    "saturation": {
                      "type": "number",
                      "minimum": -1,
                      "maximum": 1
                    },
                    "luminance": {
                      "type": "number",
                      "minimum": -1,
                      "maximum": 1
                    }
                  },
                  "required": ["hue", "saturation", "luminance"],
                  "additionalProperties": false
                },
                "required": ["red", "orange", "yellow", "green", "aqua", "blue", "purple", "magenta"]
              }
            },
            "required": ["type", "version", "bands"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "color_grading"
              },
              "version": {
                "type": "number",
                "const": 1
              },
              "shadows": {
                "type": "object",
                "properties": {
                  "hue": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 360
                  },
                  "saturation": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  }
                },
                "required": ["hue", "saturation"],
                "additionalProperties": false
              },
              "midtones": {
                "type": "object",
                "properties": {
                  "hue": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 360
                  },
                  "saturation": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  }
                },
                "required": ["hue", "saturation"],
                "additionalProperties": false
              },
              "highlights": {
                "type": "object",
                "properties": {
                  "hue": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 360
                  },
                  "saturation": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  }
                },
                "required": ["hue", "saturation"],
                "additionalProperties": false
              },
              "blending": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "balance": {
                "type": "number",
                "minimum": -1,
                "maximum": 1
              }
            },
            "required": ["type", "version", "shadows", "midtones", "highlights", "blending", "balance"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "color_balance"
              },
              "version": {
                "type": "number",
                "const": 1
              },
              "shadows": {
                "type": "object",
                "properties": {
                  "cyanRed": {
                    "type": "number",
                    "minimum": -1,
                    "maximum": 1
                  },
                  "magentaGreen": {
                    "type": "number",
                    "minimum": -1,
                    "maximum": 1
                  },
                  "yellowBlue": {
                    "type": "number",
                    "minimum": -1,
                    "maximum": 1
                  }
                },
                "required": ["cyanRed", "magentaGreen", "yellowBlue"],
                "additionalProperties": false
              },
              "midtones": {
                "type": "object",
                "properties": {
                  "cyanRed": {
                    "type": "number",
                    "minimum": -1,
                    "maximum": 1
                  },
                  "magentaGreen": {
                    "type": "number",
                    "minimum": -1,
                    "maximum": 1
                  },
                  "yellowBlue": {
                    "type": "number",
                    "minimum": -1,
                    "maximum": 1
                  }
                },
                "required": ["cyanRed", "magentaGreen", "yellowBlue"],
                "additionalProperties": false
              },
              "highlights": {
                "type": "object",
                "properties": {
                  "cyanRed": {
                    "type": "number",
                    "minimum": -1,
                    "maximum": 1
                  },
                  "magentaGreen": {
                    "type": "number",
                    "minimum": -1,
                    "maximum": 1
                  },
                  "yellowBlue": {
                    "type": "number",
                    "minimum": -1,
                    "maximum": 1
                  }
                },
                "required": ["cyanRed", "magentaGreen", "yellowBlue"],
                "additionalProperties": false
              },
              "preserveLuminosity": {
                "type": "boolean"
              }
            },
            "required": ["type", "version", "shadows", "midtones", "highlights", "preserveLuminosity"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "photo_filter"
              },
              "version": {
                "type": "number",
                "const": 1
              },
              "color": {
                "$ref": "#/components/schemas/Color"
              },
              "density": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "preserveLuminosity": {
                "type": "boolean"
              }
            },
            "required": ["type", "version", "color", "density", "preserveLuminosity"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "channel_mixer"
              },
              "version": {
                "type": "number",
                "const": 1
              },
              "red": {
                "type": "object",
                "properties": {
                  "r": {
                    "type": "number",
                    "minimum": -2,
                    "maximum": 2
                  },
                  "g": {
                    "type": "number",
                    "minimum": -2,
                    "maximum": 2
                  },
                  "b": {
                    "type": "number",
                    "minimum": -2,
                    "maximum": 2
                  },
                  "constant": {
                    "type": "number",
                    "minimum": -2,
                    "maximum": 2
                  }
                },
                "required": ["r", "g", "b", "constant"],
                "additionalProperties": false
              },
              "green": {
                "type": "object",
                "properties": {
                  "r": {
                    "type": "number",
                    "minimum": -2,
                    "maximum": 2
                  },
                  "g": {
                    "type": "number",
                    "minimum": -2,
                    "maximum": 2
                  },
                  "b": {
                    "type": "number",
                    "minimum": -2,
                    "maximum": 2
                  },
                  "constant": {
                    "type": "number",
                    "minimum": -2,
                    "maximum": 2
                  }
                },
                "required": ["r", "g", "b", "constant"],
                "additionalProperties": false
              },
              "blue": {
                "type": "object",
                "properties": {
                  "r": {
                    "type": "number",
                    "minimum": -2,
                    "maximum": 2
                  },
                  "g": {
                    "type": "number",
                    "minimum": -2,
                    "maximum": 2
                  },
                  "b": {
                    "type": "number",
                    "minimum": -2,
                    "maximum": 2
                  },
                  "constant": {
                    "type": "number",
                    "minimum": -2,
                    "maximum": 2
                  }
                },
                "required": ["r", "g", "b", "constant"],
                "additionalProperties": false
              },
              "monochrome": {
                "type": "boolean"
              }
            },
            "required": ["type", "version", "red", "green", "blue", "monochrome"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "selective_color"
              },
              "version": {
                "type": "number",
                "const": 1
              },
              "colors": {
                "type": "object",
                "propertyNames": {
                  "type": "string",
                  "enum": ["reds", "yellows", "greens", "cyans", "blues", "magentas", "whites", "neutrals", "blacks"]
                },
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "cyan": {
                      "type": "number",
                      "minimum": -1,
                      "maximum": 1
                    },
                    "magenta": {
                      "type": "number",
                      "minimum": -1,
                      "maximum": 1
                    },
                    "yellow": {
                      "type": "number",
                      "minimum": -1,
                      "maximum": 1
                    },
                    "black": {
                      "type": "number",
                      "minimum": -1,
                      "maximum": 1
                    }
                  },
                  "required": ["cyan", "magenta", "yellow", "black"],
                  "additionalProperties": false
                },
                "required": ["reds", "yellows", "greens", "cyans", "blues", "magentas", "whites", "neutrals", "blacks"]
              },
              "method": {
                "type": "string",
                "enum": ["relative", "absolute"]
              }
            },
            "required": ["type", "version", "colors", "method"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "posterize"
              },
              "version": {
                "type": "number",
                "const": 1
              },
              "levels": {
                "type": "integer",
                "minimum": 2,
                "maximum": 255
              }
            },
            "required": ["type", "version", "levels"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "threshold"
              },
              "version": {
                "type": "number",
                "const": 1
              },
              "level": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": ["type", "version", "level"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "gradient_map"
              },
              "version": {
                "type": "number",
                "const": 1
              },
              "stops": {
                "minItems": 2,
                "maxItems": 16,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "position": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1
                    },
                    "color": {
                      "$ref": "#/components/schemas/Color"
                    }
                  },
                  "required": ["position", "color"],
                  "additionalProperties": false
                }
              }
            },
            "required": ["type", "version", "stops"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "tone_regions"
              },
              "version": {
                "type": "number",
                "const": 1
              },
              "highlights": {
                "type": "number",
                "minimum": -1,
                "maximum": 1
              },
              "shadows": {
                "type": "number",
                "minimum": -1,
                "maximum": 1
              },
              "whites": {
                "type": "number",
                "minimum": -1,
                "maximum": 1
              },
              "blacks": {
                "type": "number",
                "minimum": -1,
                "maximum": 1
              }
            },
            "required": ["type", "version", "highlights", "shadows", "whites", "blacks"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "invert"
              },
              "version": {
                "type": "number",
                "const": 1
              }
            },
            "required": ["type", "version"],
            "additionalProperties": false
          }
        ]
      },
      "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
      },
      "DocumentSummary": {
        "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}$"
          },
          "name": {
            "default": "Untitled",
            "type": "string",
            "maxLength": 120
          },
          "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": {
              "$ref": "#/components/schemas/Node"
            }
          },
          "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
            }
          },
          "guides": {
            "maxItems": 128,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "orientation": {
                  "type": "string",
                  "enum": ["horizontal", "vertical"]
                },
                "position": {
                  "type": "number",
                  "minimum": -4096,
                  "maximum": 8192
                }
              },
              "required": ["orientation", "position"],
              "additionalProperties": false
            }
          },
          "snapshots": {
            "maxItems": 64,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "revision": {
                  "type": "string",
                  "pattern": "^rev_[1-9][0-9]*$"
                }
              },
              "required": ["name", "revision"],
              "additionalProperties": false
            }
          },
          "savedSelections": {
            "maxItems": 64,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 120,
              "pattern": "\\S"
            }
          },
          "patterns": {
            "maxItems": 64,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120,
                  "pattern": "\\S"
                },
                "width": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 512
                },
                "height": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 512
                }
              },
              "required": ["name", "width", "height"],
              "additionalProperties": false
            }
          },
          "reselectable": {
            "type": "boolean"
          },
          "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}$"
                  }
                },
                "commandTypes": {
                  "maxItems": 1024,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "maxLength": 64,
                    "pattern": "^[a-z][a-z0-9_]*$"
                  }
                },
                "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
      },
      "EditCommand": {
        "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", "fill"]
                  },
                  "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": {
                    "$ref": "#/components/schemas/Adjustment"
                  },
                  "fill": {
                    "type": "object",
                    "properties": {
                      "paint": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "solid"
                              },
                              "color": {
                                "$ref": "#/components/schemas/Color"
                              }
                            },
                            "required": ["type", "color"],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "gradient"
                              },
                              "gradient": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": ["linear", "radial"]
                                  },
                                  "start": {
                                    "type": "object",
                                    "properties": {
                                      "x": {
                                        "type": "number"
                                      },
                                      "y": {
                                        "type": "number"
                                      }
                                    },
                                    "required": ["x", "y"],
                                    "additionalProperties": false
                                  },
                                  "end": {
                                    "type": "object",
                                    "properties": {
                                      "x": {
                                        "type": "number"
                                      },
                                      "y": {
                                        "type": "number"
                                      }
                                    },
                                    "required": ["x", "y"],
                                    "additionalProperties": false
                                  },
                                  "stops": {
                                    "minItems": 2,
                                    "maxItems": 16,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "position": {
                                          "type": "number",
                                          "minimum": 0,
                                          "maximum": 1
                                        },
                                        "color": {
                                          "$ref": "#/components/schemas/Color"
                                        }
                                      },
                                      "required": ["position", "color"],
                                      "additionalProperties": false
                                    }
                                  },
                                  "dither": {
                                    "type": "boolean"
                                  }
                                },
                                "required": ["kind", "start", "end", "stops"],
                                "additionalProperties": false
                              }
                            },
                            "required": ["type", "gradient"],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "pattern"
                              },
                              "pattern": {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "enum": ["checker", "horizontal_stripes", "vertical_stripes", "dots", "grid"]
                                  },
                                  "size": {
                                    "type": "integer",
                                    "minimum": 2,
                                    "maximum": 512
                                  },
                                  "foreground": {
                                    "$ref": "#/components/schemas/Color"
                                  },
                                  "background": {
                                    "$ref": "#/components/schemas/Color"
                                  },
                                  "options": {
                                    "type": "object",
                                    "properties": {
                                      "spacingX": {
                                        "type": "integer",
                                        "minimum": -256,
                                        "maximum": 512
                                      },
                                      "spacingY": {
                                        "type": "integer",
                                        "minimum": -256,
                                        "maximum": 512
                                      },
                                      "offsetX": {
                                        "type": "integer",
                                        "minimum": -16384,
                                        "maximum": 16384
                                      },
                                      "offsetY": {
                                        "type": "integer",
                                        "minimum": -16384,
                                        "maximum": 16384
                                      },
                                      "rotation": {
                                        "type": "number",
                                        "minimum": -360,
                                        "maximum": 360
                                      },
                                      "tiling": {
                                        "type": "string",
                                        "enum": ["grid", "brick_by_row", "brick_by_column"]
                                      }
                                    },
                                    "additionalProperties": false
                                  }
                                },
                                "required": ["kind", "size", "foreground", "background"],
                                "additionalProperties": false
                              }
                            },
                            "required": ["type", "pattern"],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "swatch"
                              },
                              "swatch": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120,
                                "pattern": "\\S"
                              },
                              "options": {
                                "type": "object",
                                "properties": {
                                  "spacingX": {
                                    "type": "integer",
                                    "minimum": -256,
                                    "maximum": 512
                                  },
                                  "spacingY": {
                                    "type": "integer",
                                    "minimum": -256,
                                    "maximum": 512
                                  },
                                  "offsetX": {
                                    "type": "integer",
                                    "minimum": -16384,
                                    "maximum": 16384
                                  },
                                  "offsetY": {
                                    "type": "integer",
                                    "minimum": -16384,
                                    "maximum": 16384
                                  },
                                  "rotation": {
                                    "type": "number",
                                    "minimum": -360,
                                    "maximum": 360
                                  },
                                  "tiling": {
                                    "type": "string",
                                    "enum": ["grid", "brick_by_row", "brick_by_column"]
                                  }
                                },
                                "additionalProperties": false
                              }
                            },
                            "required": ["type", "swatch"],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "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
                      }
                    },
                    "required": ["paint"],
                    "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}$"
                  },
                  "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", "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",
                      "dissolve",
                      "darken",
                      "multiply",
                      "color_burn",
                      "linear_burn",
                      "darker_color",
                      "lighten",
                      "screen",
                      "color_dodge",
                      "linear_dodge",
                      "lighter_color",
                      "overlay",
                      "soft_light",
                      "hard_light",
                      "vivid_light",
                      "linear_light",
                      "pin_light",
                      "hard_mix",
                      "difference",
                      "exclusion",
                      "subtract",
                      "divide",
                      "hue",
                      "saturation",
                      "color",
                      "luminosity"
                    ]
                  }
                },
                "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": "set_clipping"
                  },
                  "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}$"
                  },
                  "clipped": {
                    "type": "boolean"
                  }
                },
                "required": ["type", "node", "clipped"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "set_group_isolation"
                  },
                  "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}$"
                  },
                  "isolated": {
                    "type": "boolean"
                  }
                },
                "required": ["type", "node", "isolated"],
                "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": {
                        "$ref": "#/components/schemas/Color"
                      },
                      "erase": {
                        "type": "boolean"
                      },
                      "spacing": {
                        "type": "number",
                        "minimum": 0.05,
                        "maximum": 1
                      },
                      "pressure": {
                        "type": "object",
                        "properties": {
                          "size": {
                            "type": "boolean"
                          },
                          "opacity": {
                            "type": "boolean"
                          },
                          "curve": {
                            "type": "number",
                            "minimum": 0.25,
                            "maximum": 4
                          }
                        },
                        "required": ["size", "opacity", "curve"],
                        "additionalProperties": false
                      }
                    },
                    "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
                    }
                  },
                  "source": {
                    "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}$"
                      },
                      "x": {
                        "type": "number"
                      },
                      "y": {
                        "type": "number"
                      },
                      "width": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "height": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "mode": {
                        "type": "string",
                        "enum": ["clone", "heal", "spot"]
                      }
                    },
                    "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": {
                    "$ref": "#/components/schemas/Color"
                  },
                  "useSelection": {
                    "type": "boolean"
                  }
                },
                "required": ["type", "node", "color", "useSelection"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "fill_gradient"
                  },
                  "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}$"
                  },
                  "gradient": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": ["linear", "radial"]
                      },
                      "start": {
                        "type": "object",
                        "properties": {
                          "x": {
                            "type": "number"
                          },
                          "y": {
                            "type": "number"
                          }
                        },
                        "required": ["x", "y"],
                        "additionalProperties": false
                      },
                      "end": {
                        "type": "object",
                        "properties": {
                          "x": {
                            "type": "number"
                          },
                          "y": {
                            "type": "number"
                          }
                        },
                        "required": ["x", "y"],
                        "additionalProperties": false
                      },
                      "stops": {
                        "minItems": 2,
                        "maxItems": 16,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "position": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            },
                            "color": {
                              "$ref": "#/components/schemas/Color"
                            }
                          },
                          "required": ["position", "color"],
                          "additionalProperties": false
                        }
                      },
                      "dither": {
                        "type": "boolean"
                      }
                    },
                    "required": ["kind", "start", "end", "stops"],
                    "additionalProperties": false
                  },
                  "useSelection": {
                    "type": "boolean"
                  }
                },
                "required": ["type", "node", "gradient", "useSelection"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "fill_shape"
                  },
                  "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}$"
                  },
                  "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": "rounded_rect"
                          },
                          "x": {
                            "type": "number"
                          },
                          "y": {
                            "type": "number"
                          },
                          "width": {
                            "type": "number",
                            "exclusiveMinimum": 0
                          },
                          "height": {
                            "type": "number",
                            "exclusiveMinimum": 0
                          },
                          "radius": {
                            "type": "number",
                            "minimum": 0
                          }
                        },
                        "required": ["type", "x", "y", "width", "height", "radius"],
                        "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
                      }
                    ]
                  },
                  "fill": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "solid"
                          },
                          "color": {
                            "$ref": "#/components/schemas/Color"
                          }
                        },
                        "required": ["type", "color"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "gradient"
                          },
                          "gradient": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": ["linear", "radial"]
                              },
                              "start": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "number"
                                  },
                                  "y": {
                                    "type": "number"
                                  }
                                },
                                "required": ["x", "y"],
                                "additionalProperties": false
                              },
                              "end": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "number"
                                  },
                                  "y": {
                                    "type": "number"
                                  }
                                },
                                "required": ["x", "y"],
                                "additionalProperties": false
                              },
                              "stops": {
                                "minItems": 2,
                                "maxItems": 16,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "position": {
                                      "type": "number",
                                      "minimum": 0,
                                      "maximum": 1
                                    },
                                    "color": {
                                      "$ref": "#/components/schemas/Color"
                                    }
                                  },
                                  "required": ["position", "color"],
                                  "additionalProperties": false
                                }
                              },
                              "dither": {
                                "type": "boolean"
                              }
                            },
                            "required": ["kind", "start", "end", "stops"],
                            "additionalProperties": false
                          }
                        },
                        "required": ["type", "gradient"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "swatch"
                          },
                          "swatch": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120,
                            "pattern": "\\S"
                          },
                          "options": {
                            "type": "object",
                            "properties": {
                              "spacingX": {
                                "type": "integer",
                                "minimum": -256,
                                "maximum": 512
                              },
                              "spacingY": {
                                "type": "integer",
                                "minimum": -256,
                                "maximum": 512
                              },
                              "offsetX": {
                                "type": "integer",
                                "minimum": -16384,
                                "maximum": 16384
                              },
                              "offsetY": {
                                "type": "integer",
                                "minimum": -16384,
                                "maximum": 16384
                              },
                              "rotation": {
                                "type": "number",
                                "minimum": -360,
                                "maximum": 360
                              },
                              "tiling": {
                                "type": "string",
                                "enum": ["grid", "brick_by_row", "brick_by_column"]
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": ["type", "swatch"],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "stroke": {
                    "type": "object",
                    "properties": {
                      "color": {
                        "$ref": "#/components/schemas/Color"
                      },
                      "width": {
                        "type": "number",
                        "exclusiveMinimum": 0,
                        "maximum": 512
                      }
                    },
                    "required": ["color", "width"],
                    "additionalProperties": false
                  },
                  "useSelection": {
                    "type": "boolean"
                  },
                  "antialias": {
                    "type": "boolean"
                  }
                },
                "required": ["type", "node", "shape"],
                "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": "heal_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"],
                "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", "feather", "border", "refine_edge"]
                  },
                  "amount": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 256
                  },
                  "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}$"
                  },
                  "radius": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 64
                  },
                  "smoothing": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "contrast": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  },
                  "shiftEdge": {
                    "type": "integer",
                    "minimum": -100,
                    "maximum": 100
                  },
                  "decontaminate": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 100
                  }
                },
                "required": ["type", "op"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "select_all"
                  }
                },
                "required": ["type"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "reselect"
                  }
                },
                "required": ["type"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "grow_selection"
                  },
                  "tolerance": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  }
                },
                "required": ["type"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "select_similar"
                  },
                  "tolerance": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  }
                },
                "required": ["type"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "transform_selection"
                  },
                  "transform": {
                    "$ref": "#/components/schemas/Transform"
                  }
                },
                "required": ["type", "transform"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "save_selection"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "\\S"
                  }
                },
                "required": ["type", "name"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "load_selection"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "\\S"
                  },
                  "combine": {
                    "type": "string",
                    "enum": ["replace", "add", "subtract"]
                  }
                },
                "required": ["type", "name"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "delete_saved_selection"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "\\S"
                  }
                },
                "required": ["type", "name"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "set_channel"
                  },
                  "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}$"
                  },
                  "channel": {
                    "type": "string",
                    "enum": ["r", "g", "b", "a"]
                  },
                  "source": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "constant"
                          },
                          "value": {
                            "type": "number",
                            "minimum": 0,
                            "maximum": 1
                          }
                        },
                        "required": ["kind", "value"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "invert"
                          }
                        },
                        "required": ["kind"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "channel"
                          },
                          "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}$"
                          },
                          "channel": {
                            "type": "string",
                            "enum": ["r", "g", "b", "a", "luminance"]
                          }
                        },
                        "required": ["kind", "node", "channel"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "saved_selection"
                          },
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120,
                            "pattern": "\\S"
                          }
                        },
                        "required": ["kind", "name"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "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": ["kind", "node"],
                        "additionalProperties": false
                      }
                    ]
                  }
                },
                "required": ["type", "node", "channel", "source"],
                "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": {
                    "$ref": "#/components/schemas/Color"
                  },
                  "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_selection_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}$"
                  },
                  "asset": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "channel": {
                    "type": "string",
                    "enum": ["alpha", "luminance"]
                  },
                  "combine": {
                    "type": "string",
                    "enum": ["replace", "add", "subtract"]
                  },
                  "feather": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 50
                  }
                },
                "required": ["type", "asset", "channel"],
                "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": "set_mask_from_gradient"
                  },
                  "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}$"
                  },
                  "kind": {
                    "type": "string",
                    "enum": ["linear", "radial"]
                  },
                  "start": {
                    "type": "object",
                    "properties": {
                      "x": {
                        "type": "number"
                      },
                      "y": {
                        "type": "number"
                      }
                    },
                    "required": ["x", "y"],
                    "additionalProperties": false
                  },
                  "end": {
                    "type": "object",
                    "properties": {
                      "x": {
                        "type": "number"
                      },
                      "y": {
                        "type": "number"
                      }
                    },
                    "required": ["x", "y"],
                    "additionalProperties": false
                  },
                  "invert": {
                    "type": "boolean"
                  },
                  "combine": {
                    "type": "string",
                    "enum": ["replace", "add", "subtract", "intersect"]
                  }
                },
                "required": ["type", "node", "kind", "start", "end"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "set_mask_from_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}$"
                  },
                  "source": {
                    "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": ["luminance", "distance", "hsv"]
                  },
                  "min": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "max": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "smoothness": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "target": {
                    "$ref": "#/components/schemas/Color"
                  },
                  "tolerance": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "saturationMax": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  "feather": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 50
                  },
                  "invert": {
                    "type": "boolean"
                  },
                  "combine": {
                    "type": "string",
                    "enum": ["replace", "add", "subtract", "intersect"]
                  }
                },
                "required": ["type", "node", "mode"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "set_mask_from_asset"
                  },
                  "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}$"
                  },
                  "asset": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "channel": {
                    "type": "string",
                    "enum": ["alpha", "luminance"]
                  },
                  "feather": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 50
                  },
                  "invert": {
                    "type": "boolean"
                  },
                  "combine": {
                    "type": "string",
                    "enum": ["replace", "add", "subtract", "intersect"]
                  }
                },
                "required": ["type", "node", "asset", "channel"],
                "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": {
                    "$ref": "#/components/schemas/Adjustment"
                  }
                },
                "required": ["type", "node", "adjustment"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "set_fill_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}$"
                  },
                  "paint": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "solid"
                          },
                          "color": {
                            "$ref": "#/components/schemas/Color"
                          }
                        },
                        "required": ["type", "color"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "gradient"
                          },
                          "gradient": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": ["linear", "radial"]
                              },
                              "start": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "number"
                                  },
                                  "y": {
                                    "type": "number"
                                  }
                                },
                                "required": ["x", "y"],
                                "additionalProperties": false
                              },
                              "end": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "number"
                                  },
                                  "y": {
                                    "type": "number"
                                  }
                                },
                                "required": ["x", "y"],
                                "additionalProperties": false
                              },
                              "stops": {
                                "minItems": 2,
                                "maxItems": 16,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "position": {
                                      "type": "number",
                                      "minimum": 0,
                                      "maximum": 1
                                    },
                                    "color": {
                                      "$ref": "#/components/schemas/Color"
                                    }
                                  },
                                  "required": ["position", "color"],
                                  "additionalProperties": false
                                }
                              },
                              "dither": {
                                "type": "boolean"
                              }
                            },
                            "required": ["kind", "start", "end", "stops"],
                            "additionalProperties": false
                          }
                        },
                        "required": ["type", "gradient"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "pattern"
                          },
                          "pattern": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": ["checker", "horizontal_stripes", "vertical_stripes", "dots", "grid"]
                              },
                              "size": {
                                "type": "integer",
                                "minimum": 2,
                                "maximum": 512
                              },
                              "foreground": {
                                "$ref": "#/components/schemas/Color"
                              },
                              "background": {
                                "$ref": "#/components/schemas/Color"
                              },
                              "options": {
                                "type": "object",
                                "properties": {
                                  "spacingX": {
                                    "type": "integer",
                                    "minimum": -256,
                                    "maximum": 512
                                  },
                                  "spacingY": {
                                    "type": "integer",
                                    "minimum": -256,
                                    "maximum": 512
                                  },
                                  "offsetX": {
                                    "type": "integer",
                                    "minimum": -16384,
                                    "maximum": 16384
                                  },
                                  "offsetY": {
                                    "type": "integer",
                                    "minimum": -16384,
                                    "maximum": 16384
                                  },
                                  "rotation": {
                                    "type": "number",
                                    "minimum": -360,
                                    "maximum": 360
                                  },
                                  "tiling": {
                                    "type": "string",
                                    "enum": ["grid", "brick_by_row", "brick_by_column"]
                                  }
                                },
                                "additionalProperties": false
                              }
                            },
                            "required": ["kind", "size", "foreground", "background"],
                            "additionalProperties": false
                          }
                        },
                        "required": ["type", "pattern"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "swatch"
                          },
                          "swatch": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120,
                            "pattern": "\\S"
                          },
                          "options": {
                            "type": "object",
                            "properties": {
                              "spacingX": {
                                "type": "integer",
                                "minimum": -256,
                                "maximum": 512
                              },
                              "spacingY": {
                                "type": "integer",
                                "minimum": -256,
                                "maximum": 512
                              },
                              "offsetX": {
                                "type": "integer",
                                "minimum": -16384,
                                "maximum": 16384
                              },
                              "offsetY": {
                                "type": "integer",
                                "minimum": -16384,
                                "maximum": 16384
                              },
                              "rotation": {
                                "type": "number",
                                "minimum": -360,
                                "maximum": 360
                              },
                              "tiling": {
                                "type": "string",
                                "enum": ["grid", "brick_by_row", "brick_by_column"]
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": ["type", "swatch"],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "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
                  }
                },
                "required": ["type", "node"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "define_pattern"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "\\S"
                  },
                  "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}$"
                  },
                  "rect": {
                    "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
                  }
                },
                "required": ["type", "name", "rect"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "delete_pattern"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "\\S"
                  }
                },
                "required": ["type", "name"],
                "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": {
                    "$ref": "#/components/schemas/Filter"
                  }
                },
                "required": ["type", "node", "filter"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "set_layer_styles"
                  },
                  "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}$"
                  },
                  "styles": {
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/LayerStyle"
                    }
                  }
                },
                "required": ["type", "node", "styles"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "rasterize_styles"
                  },
                  "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": "convert_to_smart_object"
                  },
                  "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": "replace_smart_object_source"
                  },
                  "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}$"
                  },
                  "asset": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  }
                },
                "required": ["type", "node", "asset"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "update_smart_object"
                  },
                  "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}$"
                  },
                  "filters": {
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Filter"
                    }
                  }
                },
                "required": ["type", "node", "filters"],
                "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": {
                    "$ref": "#/components/schemas/Transform"
                  }
                },
                "required": ["type", "node", "transform"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "auto_upright"
                  },
                  "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": ["level", "vertical", "auto", "full", "guided"]
                  },
                  "guides": {
                    "minItems": 1,
                    "maxItems": 4,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "from": {
                          "type": "object",
                          "properties": {
                            "x": {
                              "type": "number"
                            },
                            "y": {
                              "type": "number"
                            }
                          },
                          "required": ["x", "y"],
                          "additionalProperties": false
                        },
                        "to": {
                          "type": "object",
                          "properties": {
                            "x": {
                              "type": "number"
                            },
                            "y": {
                              "type": "number"
                            }
                          },
                          "required": ["x", "y"],
                          "additionalProperties": false
                        }
                      },
                      "required": ["from", "to"],
                      "additionalProperties": false
                    }
                  },
                  "constrain": {
                    "type": "boolean"
                  }
                },
                "required": ["type", "node", "mode"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "auto_align_layers"
                  },
                  "nodes": {
                    "minItems": 2,
                    "maxItems": 16,
                    "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}$"
                    }
                  },
                  "reference": {
                    "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}$"
                  },
                  "projection": {
                    "type": "string",
                    "enum": ["perspective", "similarity", "translation"]
                  }
                },
                "required": ["type", "nodes"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "auto_blend_layers"
                  },
                  "nodes": {
                    "minItems": 2,
                    "maxItems": 16,
                    "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}$"
                    }
                  },
                  "tones": {
                    "type": "boolean"
                  }
                },
                "required": ["type", "nodes"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "align_nodes"
                  },
                  "nodes": {
                    "minItems": 1,
                    "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}$"
                    }
                  },
                  "edge": {
                    "type": "string",
                    "enum": ["left", "right", "h_center", "top", "bottom", "v_center"]
                  },
                  "relativeTo": {
                    "type": "string",
                    "enum": ["selection", "key_object", "canvas"]
                  },
                  "key": {
                    "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", "nodes", "edge", "relativeTo"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "distribute_nodes"
                  },
                  "nodes": {
                    "minItems": 3,
                    "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}$"
                    }
                  },
                  "axis": {
                    "type": "string",
                    "enum": ["horizontal", "vertical"]
                  },
                  "mode": {
                    "type": "string",
                    "enum": ["spacing", "centers"]
                  }
                },
                "required": ["type", "nodes", "axis", "mode"],
                "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": {
                                      "$ref": "#/components/schemas/Color"
                                    }
                                  },
                                  "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
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "svg"
                                    }
                                  },
                                  "required": ["kind"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "psd"
                                    }
                                  },
                                  "required": ["kind"],
                                  "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": "rename_document"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120,
                    "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f]*[^\\s\\u0000-\\u001f\\u007f-\\u009f][^\\u0000-\\u001f\\u007f-\\u009f]*$"
                  }
                },
                "required": ["type", "name"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "set_guides"
                  },
                  "guides": {
                    "maxItems": 128,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "orientation": {
                          "type": "string",
                          "enum": ["horizontal", "vertical"]
                        },
                        "position": {
                          "type": "number",
                          "minimum": -4096,
                          "maximum": 8192
                        }
                      },
                      "required": ["orientation", "position"],
                      "additionalProperties": false
                    }
                  }
                },
                "required": ["type", "guides"],
                "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
                  },
                  "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", "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
                  },
                  "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}$"
                  },
                  "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": {
                        "$ref": "#/components/schemas/Color"
                      },
                      "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
                      },
                      "tracking": {
                        "type": "number",
                        "minimum": -0.5,
                        "maximum": 2
                      },
                      "baselineShift": {
                        "type": "number",
                        "minimum": -512,
                        "maximum": 512
                      },
                      "underline": {
                        "type": "boolean"
                      },
                      "strikethrough": {
                        "type": "boolean"
                      },
                      "caseTransform": {
                        "type": "string",
                        "enum": ["none", "uppercase", "small-caps"]
                      }
                    },
                    "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": "add_vector"
                  },
                  "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
                  },
                  "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}$"
                  },
                  "svg": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 65536
                  },
                  "frame": {
                    "type": "object",
                    "properties": {
                      "x": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "y": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "width": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 4096
                      },
                      "height": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 4096
                      }
                    },
                    "required": ["x", "y", "width", "height"],
                    "additionalProperties": false
                  },
                  "asset": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  }
                },
                "required": ["type", "svg", "frame"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "import_svg"
                  },
                  "svg": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 65536
                  }
                },
                "required": ["type", "svg"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "rerender_vector"
                  },
                  "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}$"
                  },
                  "frame": {
                    "type": "object",
                    "properties": {
                      "x": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "y": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "width": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 4096
                      },
                      "height": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 4096
                      }
                    },
                    "required": ["x", "y", "width", "height"],
                    "additionalProperties": false
                  },
                  "asset": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  }
                },
                "required": ["type", "node"],
                "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": {
                        "$ref": "#/components/schemas/Color"
                      },
                      "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
                      },
                      "tracking": {
                        "type": "number",
                        "minimum": -0.5,
                        "maximum": 2
                      },
                      "baselineShift": {
                        "type": "number",
                        "minimum": -512,
                        "maximum": 512
                      },
                      "underline": {
                        "type": "boolean"
                      },
                      "strikethrough": {
                        "type": "boolean"
                      },
                      "caseTransform": {
                        "type": "string",
                        "enum": ["none", "uppercase", "small-caps"]
                      }
                    },
                    "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}$"
                  },
                  "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": ["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
                    }
                  },
                  "ids": {
                    "minItems": 1,
                    "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}$"
                    }
                  }
                },
                "required": ["type", "base", "labels", "axes", "fixedConstraints"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "switch_variant"
                  },
                  "variant": {
                    "anyOf": [
                      {
                        "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}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": ["type", "variant"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "rename_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}$"
                  },
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 40
                  }
                },
                "required": ["type", "variant", "label"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "const": "delete_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", "fill"]
                            },
                            "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": {
                              "$ref": "#/components/schemas/Adjustment"
                            },
                            "fill": {
                              "type": "object",
                              "properties": {
                                "paint": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "solid"
                                        },
                                        "color": {
                                          "$ref": "#/components/schemas/Color"
                                        }
                                      },
                                      "required": ["type", "color"],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "gradient"
                                        },
                                        "gradient": {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": ["linear", "radial"]
                                            },
                                            "start": {
                                              "type": "object",
                                              "properties": {
                                                "x": {
                                                  "type": "number"
                                                },
                                                "y": {
                                                  "type": "number"
                                                }
                                              },
                                              "required": ["x", "y"],
                                              "additionalProperties": false
                                            },
                                            "end": {
                                              "type": "object",
                                              "properties": {
                                                "x": {
                                                  "type": "number"
                                                },
                                                "y": {
                                                  "type": "number"
                                                }
                                              },
                                              "required": ["x", "y"],
                                              "additionalProperties": false
                                            },
                                            "stops": {
                                              "minItems": 2,
                                              "maxItems": 16,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "position": {
                                                    "type": "number",
                                                    "minimum": 0,
                                                    "maximum": 1
                                                  },
                                                  "color": {
                                                    "$ref": "#/components/schemas/Color"
                                                  }
                                                },
                                                "required": ["position", "color"],
                                                "additionalProperties": false
                                              }
                                            },
                                            "dither": {
                                              "type": "boolean"
                                            }
                                          },
                                          "required": ["kind", "start", "end", "stops"],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": ["type", "gradient"],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "pattern"
                                        },
                                        "pattern": {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "checker",
                                                "horizontal_stripes",
                                                "vertical_stripes",
                                                "dots",
                                                "grid"
                                              ]
                                            },
                                            "size": {
                                              "type": "integer",
                                              "minimum": 2,
                                              "maximum": 512
                                            },
                                            "foreground": {
                                              "$ref": "#/components/schemas/Color"
                                            },
                                            "background": {
                                              "$ref": "#/components/schemas/Color"
                                            },
                                            "options": {
                                              "type": "object",
                                              "properties": {
                                                "spacingX": {
                                                  "type": "integer",
                                                  "minimum": -256,
                                                  "maximum": 512
                                                },
                                                "spacingY": {
                                                  "type": "integer",
                                                  "minimum": -256,
                                                  "maximum": 512
                                                },
                                                "offsetX": {
                                                  "type": "integer",
                                                  "minimum": -16384,
                                                  "maximum": 16384
                                                },
                                                "offsetY": {
                                                  "type": "integer",
                                                  "minimum": -16384,
                                                  "maximum": 16384
                                                },
                                                "rotation": {
                                                  "type": "number",
                                                  "minimum": -360,
                                                  "maximum": 360
                                                },
                                                "tiling": {
                                                  "type": "string",
                                                  "enum": ["grid", "brick_by_row", "brick_by_column"]
                                                }
                                              },
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": ["kind", "size", "foreground", "background"],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": ["type", "pattern"],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "swatch"
                                        },
                                        "swatch": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120,
                                          "pattern": "\\S"
                                        },
                                        "options": {
                                          "type": "object",
                                          "properties": {
                                            "spacingX": {
                                              "type": "integer",
                                              "minimum": -256,
                                              "maximum": 512
                                            },
                                            "spacingY": {
                                              "type": "integer",
                                              "minimum": -256,
                                              "maximum": 512
                                            },
                                            "offsetX": {
                                              "type": "integer",
                                              "minimum": -16384,
                                              "maximum": 16384
                                            },
                                            "offsetY": {
                                              "type": "integer",
                                              "minimum": -16384,
                                              "maximum": 16384
                                            },
                                            "rotation": {
                                              "type": "number",
                                              "minimum": -360,
                                              "maximum": 360
                                            },
                                            "tiling": {
                                              "type": "string",
                                              "enum": ["grid", "brick_by_row", "brick_by_column"]
                                            }
                                          },
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": ["type", "swatch"],
                                      "additionalProperties": false
                                    }
                                  ]
                                },
                                "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
                                }
                              },
                              "required": ["paint"],
                              "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}$"
                            },
                            "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", "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",
                                "dissolve",
                                "darken",
                                "multiply",
                                "color_burn",
                                "linear_burn",
                                "darker_color",
                                "lighten",
                                "screen",
                                "color_dodge",
                                "linear_dodge",
                                "lighter_color",
                                "overlay",
                                "soft_light",
                                "hard_light",
                                "vivid_light",
                                "linear_light",
                                "pin_light",
                                "hard_mix",
                                "difference",
                                "exclusion",
                                "subtract",
                                "divide",
                                "hue",
                                "saturation",
                                "color",
                                "luminosity"
                              ]
                            }
                          },
                          "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": "set_clipping"
                            },
                            "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}$"
                            },
                            "clipped": {
                              "type": "boolean"
                            }
                          },
                          "required": ["type", "node", "clipped"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "set_group_isolation"
                            },
                            "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}$"
                            },
                            "isolated": {
                              "type": "boolean"
                            }
                          },
                          "required": ["type", "node", "isolated"],
                          "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": {
                                  "$ref": "#/components/schemas/Color"
                                },
                                "erase": {
                                  "type": "boolean"
                                },
                                "spacing": {
                                  "type": "number",
                                  "minimum": 0.05,
                                  "maximum": 1
                                },
                                "pressure": {
                                  "type": "object",
                                  "properties": {
                                    "size": {
                                      "type": "boolean"
                                    },
                                    "opacity": {
                                      "type": "boolean"
                                    },
                                    "curve": {
                                      "type": "number",
                                      "minimum": 0.25,
                                      "maximum": 4
                                    }
                                  },
                                  "required": ["size", "opacity", "curve"],
                                  "additionalProperties": false
                                }
                              },
                              "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
                              }
                            },
                            "source": {
                              "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}$"
                                },
                                "x": {
                                  "type": "number"
                                },
                                "y": {
                                  "type": "number"
                                },
                                "width": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "height": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "mode": {
                                  "type": "string",
                                  "enum": ["clone", "heal", "spot"]
                                }
                              },
                              "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": {
                              "$ref": "#/components/schemas/Color"
                            },
                            "useSelection": {
                              "type": "boolean"
                            }
                          },
                          "required": ["type", "node", "color", "useSelection"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "fill_gradient"
                            },
                            "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}$"
                            },
                            "gradient": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": ["linear", "radial"]
                                },
                                "start": {
                                  "type": "object",
                                  "properties": {
                                    "x": {
                                      "type": "number"
                                    },
                                    "y": {
                                      "type": "number"
                                    }
                                  },
                                  "required": ["x", "y"],
                                  "additionalProperties": false
                                },
                                "end": {
                                  "type": "object",
                                  "properties": {
                                    "x": {
                                      "type": "number"
                                    },
                                    "y": {
                                      "type": "number"
                                    }
                                  },
                                  "required": ["x", "y"],
                                  "additionalProperties": false
                                },
                                "stops": {
                                  "minItems": 2,
                                  "maxItems": 16,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "position": {
                                        "type": "number",
                                        "minimum": 0,
                                        "maximum": 1
                                      },
                                      "color": {
                                        "$ref": "#/components/schemas/Color"
                                      }
                                    },
                                    "required": ["position", "color"],
                                    "additionalProperties": false
                                  }
                                },
                                "dither": {
                                  "type": "boolean"
                                }
                              },
                              "required": ["kind", "start", "end", "stops"],
                              "additionalProperties": false
                            },
                            "useSelection": {
                              "type": "boolean"
                            }
                          },
                          "required": ["type", "node", "gradient", "useSelection"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "fill_shape"
                            },
                            "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}$"
                            },
                            "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": "rounded_rect"
                                    },
                                    "x": {
                                      "type": "number"
                                    },
                                    "y": {
                                      "type": "number"
                                    },
                                    "width": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    },
                                    "height": {
                                      "type": "number",
                                      "exclusiveMinimum": 0
                                    },
                                    "radius": {
                                      "type": "number",
                                      "minimum": 0
                                    }
                                  },
                                  "required": ["type", "x", "y", "width", "height", "radius"],
                                  "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
                                }
                              ]
                            },
                            "fill": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "solid"
                                    },
                                    "color": {
                                      "$ref": "#/components/schemas/Color"
                                    }
                                  },
                                  "required": ["type", "color"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "gradient"
                                    },
                                    "gradient": {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": ["linear", "radial"]
                                        },
                                        "start": {
                                          "type": "object",
                                          "properties": {
                                            "x": {
                                              "type": "number"
                                            },
                                            "y": {
                                              "type": "number"
                                            }
                                          },
                                          "required": ["x", "y"],
                                          "additionalProperties": false
                                        },
                                        "end": {
                                          "type": "object",
                                          "properties": {
                                            "x": {
                                              "type": "number"
                                            },
                                            "y": {
                                              "type": "number"
                                            }
                                          },
                                          "required": ["x", "y"],
                                          "additionalProperties": false
                                        },
                                        "stops": {
                                          "minItems": 2,
                                          "maxItems": 16,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "position": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 1
                                              },
                                              "color": {
                                                "$ref": "#/components/schemas/Color"
                                              }
                                            },
                                            "required": ["position", "color"],
                                            "additionalProperties": false
                                          }
                                        },
                                        "dither": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": ["kind", "start", "end", "stops"],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": ["type", "gradient"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "swatch"
                                    },
                                    "swatch": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "\\S"
                                    },
                                    "options": {
                                      "type": "object",
                                      "properties": {
                                        "spacingX": {
                                          "type": "integer",
                                          "minimum": -256,
                                          "maximum": 512
                                        },
                                        "spacingY": {
                                          "type": "integer",
                                          "minimum": -256,
                                          "maximum": 512
                                        },
                                        "offsetX": {
                                          "type": "integer",
                                          "minimum": -16384,
                                          "maximum": 16384
                                        },
                                        "offsetY": {
                                          "type": "integer",
                                          "minimum": -16384,
                                          "maximum": 16384
                                        },
                                        "rotation": {
                                          "type": "number",
                                          "minimum": -360,
                                          "maximum": 360
                                        },
                                        "tiling": {
                                          "type": "string",
                                          "enum": ["grid", "brick_by_row", "brick_by_column"]
                                        }
                                      },
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": ["type", "swatch"],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            "stroke": {
                              "type": "object",
                              "properties": {
                                "color": {
                                  "$ref": "#/components/schemas/Color"
                                },
                                "width": {
                                  "type": "number",
                                  "exclusiveMinimum": 0,
                                  "maximum": 512
                                }
                              },
                              "required": ["color", "width"],
                              "additionalProperties": false
                            },
                            "useSelection": {
                              "type": "boolean"
                            },
                            "antialias": {
                              "type": "boolean"
                            }
                          },
                          "required": ["type", "node", "shape"],
                          "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": "heal_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"],
                          "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", "feather", "border", "refine_edge"]
                            },
                            "amount": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 256
                            },
                            "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}$"
                            },
                            "radius": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 64
                            },
                            "smoothing": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "contrast": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 100
                            },
                            "shiftEdge": {
                              "type": "integer",
                              "minimum": -100,
                              "maximum": 100
                            },
                            "decontaminate": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 100
                            }
                          },
                          "required": ["type", "op"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "select_all"
                            }
                          },
                          "required": ["type"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "reselect"
                            }
                          },
                          "required": ["type"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "grow_selection"
                            },
                            "tolerance": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            }
                          },
                          "required": ["type"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "select_similar"
                            },
                            "tolerance": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            }
                          },
                          "required": ["type"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "transform_selection"
                            },
                            "transform": {
                              "$ref": "#/components/schemas/Transform"
                            }
                          },
                          "required": ["type", "transform"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "save_selection"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120,
                              "pattern": "\\S"
                            }
                          },
                          "required": ["type", "name"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "load_selection"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120,
                              "pattern": "\\S"
                            },
                            "combine": {
                              "type": "string",
                              "enum": ["replace", "add", "subtract"]
                            }
                          },
                          "required": ["type", "name"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "delete_saved_selection"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120,
                              "pattern": "\\S"
                            }
                          },
                          "required": ["type", "name"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "set_channel"
                            },
                            "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}$"
                            },
                            "channel": {
                              "type": "string",
                              "enum": ["r", "g", "b", "a"]
                            },
                            "source": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "constant"
                                    },
                                    "value": {
                                      "type": "number",
                                      "minimum": 0,
                                      "maximum": 1
                                    }
                                  },
                                  "required": ["kind", "value"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "invert"
                                    }
                                  },
                                  "required": ["kind"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "channel"
                                    },
                                    "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}$"
                                    },
                                    "channel": {
                                      "type": "string",
                                      "enum": ["r", "g", "b", "a", "luminance"]
                                    }
                                  },
                                  "required": ["kind", "node", "channel"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "saved_selection"
                                    },
                                    "name": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "\\S"
                                    }
                                  },
                                  "required": ["kind", "name"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "const": "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": ["kind", "node"],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": ["type", "node", "channel", "source"],
                          "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": {
                              "$ref": "#/components/schemas/Color"
                            },
                            "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_selection_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}$"
                            },
                            "asset": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            "channel": {
                              "type": "string",
                              "enum": ["alpha", "luminance"]
                            },
                            "combine": {
                              "type": "string",
                              "enum": ["replace", "add", "subtract"]
                            },
                            "feather": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 50
                            }
                          },
                          "required": ["type", "asset", "channel"],
                          "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": "set_mask_from_gradient"
                            },
                            "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}$"
                            },
                            "kind": {
                              "type": "string",
                              "enum": ["linear", "radial"]
                            },
                            "start": {
                              "type": "object",
                              "properties": {
                                "x": {
                                  "type": "number"
                                },
                                "y": {
                                  "type": "number"
                                }
                              },
                              "required": ["x", "y"],
                              "additionalProperties": false
                            },
                            "end": {
                              "type": "object",
                              "properties": {
                                "x": {
                                  "type": "number"
                                },
                                "y": {
                                  "type": "number"
                                }
                              },
                              "required": ["x", "y"],
                              "additionalProperties": false
                            },
                            "invert": {
                              "type": "boolean"
                            },
                            "combine": {
                              "type": "string",
                              "enum": ["replace", "add", "subtract", "intersect"]
                            }
                          },
                          "required": ["type", "node", "kind", "start", "end"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "set_mask_from_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}$"
                            },
                            "source": {
                              "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": ["luminance", "distance", "hsv"]
                            },
                            "min": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            },
                            "max": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            },
                            "smoothness": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            },
                            "target": {
                              "$ref": "#/components/schemas/Color"
                            },
                            "tolerance": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            },
                            "saturationMax": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            },
                            "feather": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 50
                            },
                            "invert": {
                              "type": "boolean"
                            },
                            "combine": {
                              "type": "string",
                              "enum": ["replace", "add", "subtract", "intersect"]
                            }
                          },
                          "required": ["type", "node", "mode"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "set_mask_from_asset"
                            },
                            "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}$"
                            },
                            "asset": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            "channel": {
                              "type": "string",
                              "enum": ["alpha", "luminance"]
                            },
                            "feather": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 50
                            },
                            "invert": {
                              "type": "boolean"
                            },
                            "combine": {
                              "type": "string",
                              "enum": ["replace", "add", "subtract", "intersect"]
                            }
                          },
                          "required": ["type", "node", "asset", "channel"],
                          "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": {
                              "$ref": "#/components/schemas/Adjustment"
                            }
                          },
                          "required": ["type", "node", "adjustment"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "set_fill_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}$"
                            },
                            "paint": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "solid"
                                    },
                                    "color": {
                                      "$ref": "#/components/schemas/Color"
                                    }
                                  },
                                  "required": ["type", "color"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "gradient"
                                    },
                                    "gradient": {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": ["linear", "radial"]
                                        },
                                        "start": {
                                          "type": "object",
                                          "properties": {
                                            "x": {
                                              "type": "number"
                                            },
                                            "y": {
                                              "type": "number"
                                            }
                                          },
                                          "required": ["x", "y"],
                                          "additionalProperties": false
                                        },
                                        "end": {
                                          "type": "object",
                                          "properties": {
                                            "x": {
                                              "type": "number"
                                            },
                                            "y": {
                                              "type": "number"
                                            }
                                          },
                                          "required": ["x", "y"],
                                          "additionalProperties": false
                                        },
                                        "stops": {
                                          "minItems": 2,
                                          "maxItems": 16,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "position": {
                                                "type": "number",
                                                "minimum": 0,
                                                "maximum": 1
                                              },
                                              "color": {
                                                "$ref": "#/components/schemas/Color"
                                              }
                                            },
                                            "required": ["position", "color"],
                                            "additionalProperties": false
                                          }
                                        },
                                        "dither": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": ["kind", "start", "end", "stops"],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": ["type", "gradient"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "pattern"
                                    },
                                    "pattern": {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": ["checker", "horizontal_stripes", "vertical_stripes", "dots", "grid"]
                                        },
                                        "size": {
                                          "type": "integer",
                                          "minimum": 2,
                                          "maximum": 512
                                        },
                                        "foreground": {
                                          "$ref": "#/components/schemas/Color"
                                        },
                                        "background": {
                                          "$ref": "#/components/schemas/Color"
                                        },
                                        "options": {
                                          "type": "object",
                                          "properties": {
                                            "spacingX": {
                                              "type": "integer",
                                              "minimum": -256,
                                              "maximum": 512
                                            },
                                            "spacingY": {
                                              "type": "integer",
                                              "minimum": -256,
                                              "maximum": 512
                                            },
                                            "offsetX": {
                                              "type": "integer",
                                              "minimum": -16384,
                                              "maximum": 16384
                                            },
                                            "offsetY": {
                                              "type": "integer",
                                              "minimum": -16384,
                                              "maximum": 16384
                                            },
                                            "rotation": {
                                              "type": "number",
                                              "minimum": -360,
                                              "maximum": 360
                                            },
                                            "tiling": {
                                              "type": "string",
                                              "enum": ["grid", "brick_by_row", "brick_by_column"]
                                            }
                                          },
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": ["kind", "size", "foreground", "background"],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": ["type", "pattern"],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "swatch"
                                    },
                                    "swatch": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 120,
                                      "pattern": "\\S"
                                    },
                                    "options": {
                                      "type": "object",
                                      "properties": {
                                        "spacingX": {
                                          "type": "integer",
                                          "minimum": -256,
                                          "maximum": 512
                                        },
                                        "spacingY": {
                                          "type": "integer",
                                          "minimum": -256,
                                          "maximum": 512
                                        },
                                        "offsetX": {
                                          "type": "integer",
                                          "minimum": -16384,
                                          "maximum": 16384
                                        },
                                        "offsetY": {
                                          "type": "integer",
                                          "minimum": -16384,
                                          "maximum": 16384
                                        },
                                        "rotation": {
                                          "type": "number",
                                          "minimum": -360,
                                          "maximum": 360
                                        },
                                        "tiling": {
                                          "type": "string",
                                          "enum": ["grid", "brick_by_row", "brick_by_column"]
                                        }
                                      },
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": ["type", "swatch"],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            "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
                            }
                          },
                          "required": ["type", "node"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "define_pattern"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120,
                              "pattern": "\\S"
                            },
                            "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}$"
                            },
                            "rect": {
                              "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
                            }
                          },
                          "required": ["type", "name", "rect"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "delete_pattern"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120,
                              "pattern": "\\S"
                            }
                          },
                          "required": ["type", "name"],
                          "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": {
                              "$ref": "#/components/schemas/Filter"
                            }
                          },
                          "required": ["type", "node", "filter"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "set_layer_styles"
                            },
                            "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}$"
                            },
                            "styles": {
                              "maxItems": 8,
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/LayerStyle"
                              }
                            }
                          },
                          "required": ["type", "node", "styles"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "rasterize_styles"
                            },
                            "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": "convert_to_smart_object"
                            },
                            "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": "replace_smart_object_source"
                            },
                            "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}$"
                            },
                            "asset": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            }
                          },
                          "required": ["type", "node", "asset"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "update_smart_object"
                            },
                            "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}$"
                            },
                            "filters": {
                              "maxItems": 8,
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/Filter"
                              }
                            }
                          },
                          "required": ["type", "node", "filters"],
                          "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": {
                              "$ref": "#/components/schemas/Transform"
                            }
                          },
                          "required": ["type", "node", "transform"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "auto_upright"
                            },
                            "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": ["level", "vertical", "auto", "full", "guided"]
                            },
                            "guides": {
                              "minItems": 1,
                              "maxItems": 4,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "from": {
                                    "type": "object",
                                    "properties": {
                                      "x": {
                                        "type": "number"
                                      },
                                      "y": {
                                        "type": "number"
                                      }
                                    },
                                    "required": ["x", "y"],
                                    "additionalProperties": false
                                  },
                                  "to": {
                                    "type": "object",
                                    "properties": {
                                      "x": {
                                        "type": "number"
                                      },
                                      "y": {
                                        "type": "number"
                                      }
                                    },
                                    "required": ["x", "y"],
                                    "additionalProperties": false
                                  }
                                },
                                "required": ["from", "to"],
                                "additionalProperties": false
                              }
                            },
                            "constrain": {
                              "type": "boolean"
                            }
                          },
                          "required": ["type", "node", "mode"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "auto_align_layers"
                            },
                            "nodes": {
                              "minItems": 2,
                              "maxItems": 16,
                              "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}$"
                              }
                            },
                            "reference": {
                              "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}$"
                            },
                            "projection": {
                              "type": "string",
                              "enum": ["perspective", "similarity", "translation"]
                            }
                          },
                          "required": ["type", "nodes"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "auto_blend_layers"
                            },
                            "nodes": {
                              "minItems": 2,
                              "maxItems": 16,
                              "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}$"
                              }
                            },
                            "tones": {
                              "type": "boolean"
                            }
                          },
                          "required": ["type", "nodes"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "align_nodes"
                            },
                            "nodes": {
                              "minItems": 1,
                              "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}$"
                              }
                            },
                            "edge": {
                              "type": "string",
                              "enum": ["left", "right", "h_center", "top", "bottom", "v_center"]
                            },
                            "relativeTo": {
                              "type": "string",
                              "enum": ["selection", "key_object", "canvas"]
                            },
                            "key": {
                              "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", "nodes", "edge", "relativeTo"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "distribute_nodes"
                            },
                            "nodes": {
                              "minItems": 3,
                              "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}$"
                              }
                            },
                            "axis": {
                              "type": "string",
                              "enum": ["horizontal", "vertical"]
                            },
                            "mode": {
                              "type": "string",
                              "enum": ["spacing", "centers"]
                            }
                          },
                          "required": ["type", "nodes", "axis", "mode"],
                          "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": {
                                                "$ref": "#/components/schemas/Color"
                                              }
                                            },
                                            "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
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "const": "svg"
                                              }
                                            },
                                            "required": ["kind"],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "const": "psd"
                                              }
                                            },
                                            "required": ["kind"],
                                            "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": "rename_document"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120,
                              "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f]*[^\\s\\u0000-\\u001f\\u007f-\\u009f][^\\u0000-\\u001f\\u007f-\\u009f]*$"
                            }
                          },
                          "required": ["type", "name"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "set_guides"
                            },
                            "guides": {
                              "maxItems": 128,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "orientation": {
                                    "type": "string",
                                    "enum": ["horizontal", "vertical"]
                                  },
                                  "position": {
                                    "type": "number",
                                    "minimum": -4096,
                                    "maximum": 8192
                                  }
                                },
                                "required": ["orientation", "position"],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": ["type", "guides"],
                          "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
                            },
                            "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", "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
                            },
                            "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}$"
                            },
                            "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": {
                                  "$ref": "#/components/schemas/Color"
                                },
                                "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
                                },
                                "tracking": {
                                  "type": "number",
                                  "minimum": -0.5,
                                  "maximum": 2
                                },
                                "baselineShift": {
                                  "type": "number",
                                  "minimum": -512,
                                  "maximum": 512
                                },
                                "underline": {
                                  "type": "boolean"
                                },
                                "strikethrough": {
                                  "type": "boolean"
                                },
                                "caseTransform": {
                                  "type": "string",
                                  "enum": ["none", "uppercase", "small-caps"]
                                }
                              },
                              "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": "add_vector"
                            },
                            "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
                            },
                            "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}$"
                            },
                            "svg": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 65536
                            },
                            "frame": {
                              "type": "object",
                              "properties": {
                                "x": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "y": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "width": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 4096
                                },
                                "height": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 4096
                                }
                              },
                              "required": ["x", "y", "width", "height"],
                              "additionalProperties": false
                            },
                            "asset": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            }
                          },
                          "required": ["type", "svg", "frame"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "import_svg"
                            },
                            "svg": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 65536
                            }
                          },
                          "required": ["type", "svg"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "rerender_vector"
                            },
                            "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}$"
                            },
                            "frame": {
                              "type": "object",
                              "properties": {
                                "x": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "y": {
                                  "type": "integer",
                                  "minimum": -9007199254740991,
                                  "maximum": 9007199254740991
                                },
                                "width": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 4096
                                },
                                "height": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 4096
                                }
                              },
                              "required": ["x", "y", "width", "height"],
                              "additionalProperties": false
                            },
                            "asset": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            }
                          },
                          "required": ["type", "node"],
                          "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": {
                                  "$ref": "#/components/schemas/Color"
                                },
                                "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
                                },
                                "tracking": {
                                  "type": "number",
                                  "minimum": -0.5,
                                  "maximum": 2
                                },
                                "baselineShift": {
                                  "type": "number",
                                  "minimum": -512,
                                  "maximum": 512
                                },
                                "underline": {
                                  "type": "boolean"
                                },
                                "strikethrough": {
                                  "type": "boolean"
                                },
                                "caseTransform": {
                                  "type": "string",
                                  "enum": ["none", "uppercase", "small-caps"]
                                }
                              },
                              "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}$"
                            },
                            "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": ["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
                              }
                            },
                            "ids": {
                              "minItems": 1,
                              "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}$"
                              }
                            }
                          },
                          "required": ["type", "base", "labels", "axes", "fixedConstraints"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "switch_variant"
                            },
                            "variant": {
                              "anyOf": [
                                {
                                  "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}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": ["type", "variant"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "rename_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}$"
                            },
                            "label": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 40
                            }
                          },
                          "required": ["type", "variant", "label"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "delete_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
          }
        ]
      },
      "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
              },
              "radius": {
                "type": "number",
                "minimum": 0.5,
                "maximum": 6
              },
              "detail": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "masking": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": ["type", "amount"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "noise"
              },
              "amount": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "monochrome": {
                "type": "boolean"
              },
              "seed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 4294967295
              }
            },
            "required": ["type", "amount", "monochrome"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "high_pass"
              },
              "radius": {
                "type": "number",
                "minimum": 0.1,
                "maximum": 50
              }
            },
            "required": ["type", "radius"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "median"
              },
              "radius": {
                "type": "integer",
                "minimum": 1,
                "maximum": 5
              }
            },
            "required": ["type", "radius"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "dust_and_scratches"
              },
              "radius": {
                "type": "integer",
                "minimum": 1,
                "maximum": 5
              },
              "threshold": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": ["type", "radius", "threshold"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "reduce_noise"
              },
              "radius": {
                "type": "number",
                "minimum": 0.5,
                "maximum": 10
              },
              "strength": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": ["type", "radius", "strength"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "pixelate"
              },
              "cell": {
                "type": "integer",
                "minimum": 2,
                "maximum": 256
              }
            },
            "required": ["type", "cell"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "crystallize"
              },
              "cell": {
                "type": "integer",
                "minimum": 3,
                "maximum": 256
              },
              "seed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 4294967295
              }
            },
            "required": ["type", "cell"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "twirl"
              },
              "angle": {
                "type": "number",
                "minimum": -999,
                "maximum": 999
              },
              "radius": {
                "type": "number",
                "minimum": 1,
                "maximum": 8192
              },
              "cx": {
                "type": "number"
              },
              "cy": {
                "type": "number"
              }
            },
            "required": ["type", "angle"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "pinch"
              },
              "amount": {
                "type": "number",
                "minimum": -1,
                "maximum": 1
              },
              "radius": {
                "type": "number",
                "minimum": 1,
                "maximum": 8192
              },
              "cx": {
                "type": "number"
              },
              "cy": {
                "type": "number"
              }
            },
            "required": ["type", "amount"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "spherize"
              },
              "amount": {
                "type": "number",
                "minimum": -1,
                "maximum": 1
              },
              "radius": {
                "type": "number",
                "minimum": 1,
                "maximum": 8192
              },
              "cx": {
                "type": "number"
              },
              "cy": {
                "type": "number"
              }
            },
            "required": ["type", "amount"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "zigzag"
              },
              "amplitude": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "wavelength": {
                "type": "number",
                "minimum": 2,
                "maximum": 512
              },
              "radius": {
                "type": "number",
                "minimum": 1,
                "maximum": 8192
              },
              "cx": {
                "type": "number"
              },
              "cy": {
                "type": "number"
              }
            },
            "required": ["type", "amplitude", "wavelength"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "ripple"
              },
              "amplitude": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "wavelength": {
                "type": "number",
                "minimum": 2,
                "maximum": 512
              }
            },
            "required": ["type", "amplitude", "wavelength"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "wave"
              },
              "amplitude": {
                "type": "number",
                "minimum": 0,
                "maximum": 100
              },
              "wavelength": {
                "type": "number",
                "minimum": 2,
                "maximum": 512
              },
              "vertical": {
                "type": "boolean"
              }
            },
            "required": ["type", "amplitude", "wavelength"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "emboss"
              },
              "amount": {
                "type": "number",
                "minimum": 0,
                "maximum": 5
              },
              "angle": {
                "type": "number",
                "minimum": -360,
                "maximum": 360
              },
              "height": {
                "type": "integer",
                "minimum": 1,
                "maximum": 10
              }
            },
            "required": ["type", "amount"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "find_edges"
              }
            },
            "required": ["type"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "glowing_edges"
              },
              "radius": {
                "type": "number",
                "minimum": 0.5,
                "maximum": 20
              },
              "brightness": {
                "type": "number",
                "minimum": 0,
                "maximum": 4
              }
            },
            "required": ["type", "radius"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "wind"
              },
              "length": {
                "type": "integer",
                "minimum": 1,
                "maximum": 256
              },
              "direction": {
                "type": "string",
                "enum": ["left", "right"]
              },
              "seed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 4294967295
              }
            },
            "required": ["type", "length"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "lens_flare"
              },
              "brightness": {
                "type": "number",
                "minimum": 0,
                "maximum": 3
              },
              "cx": {
                "type": "number"
              },
              "cy": {
                "type": "number"
              }
            },
            "required": ["type", "brightness"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "clouds"
              },
              "scale": {
                "type": "number",
                "minimum": 2,
                "maximum": 4096
              },
              "seed": {
                "type": "integer",
                "minimum": 0,
                "maximum": 4294967295
              },
              "foreground": {
                "$ref": "#/components/schemas/Color"
              },
              "background": {
                "$ref": "#/components/schemas/Color"
              }
            },
            "required": ["type"],
            "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": {
                "$ref": "#/components/schemas/Color"
              },
              "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": {
                "$ref": "#/components/schemas/Color"
              },
              "opacity": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": ["type", "dx", "dy", "blur", "color", "opacity"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "vignette"
              },
              "amount": {
                "type": "number",
                "minimum": -1,
                "maximum": 1
              },
              "midpoint": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "roundness": {
                "type": "number",
                "minimum": -1,
                "maximum": 1
              },
              "feather": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "highlights": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": ["type", "amount", "midpoint", "roundness", "feather", "highlights"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": ["clarity", "texture", "dehaze"]
              },
              "amount": {
                "type": "number",
                "minimum": -1,
                "maximum": 1
              }
            },
            "required": ["type", "amount"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "shadows_highlights"
              },
              "shadows": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "highlights": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": ["type", "shadows", "highlights"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "equalize"
              }
            },
            "required": ["type"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "denoise_luminance"
              },
              "amount": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "detail": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "contrast": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": ["type", "amount"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "denoise_color"
              },
              "amount": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "detail": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "smoothness": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": ["type", "amount"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "lens_correction"
              },
              "k1": {
                "type": "number",
                "minimum": -1,
                "maximum": 1
              },
              "k2": {
                "type": "number",
                "minimum": -1,
                "maximum": 1
              },
              "red": {
                "type": "number",
                "minimum": -0.02,
                "maximum": 0.02
              },
              "blue": {
                "type": "number",
                "minimum": -0.02,
                "maximum": 0.02
              },
              "vignette": {
                "type": "number",
                "minimum": -1,
                "maximum": 1
              },
              "midpoint": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "constrain": {
                "type": "boolean"
              },
              "purple": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "purple_hue": {
                "type": "array",
                "prefixItems": [
                  {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 360
                  },
                  {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 360
                  }
                ],
                "items": false,
                "minItems": 2,
                "maxItems": 2
              },
              "green": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "green_hue": {
                "type": "array",
                "prefixItems": [
                  {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 360
                  },
                  {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 360
                  }
                ],
                "items": false,
                "minItems": 2,
                "maxItems": 2
              }
            },
            "required": ["type"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "field_blur"
              },
              "pins": {
                "minItems": 1,
                "maxItems": 16,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "x": {
                      "type": "number"
                    },
                    "y": {
                      "type": "number"
                    },
                    "radius": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 50
                    }
                  },
                  "required": ["x", "y", "radius"],
                  "additionalProperties": false
                }
              }
            },
            "required": ["type", "pins"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "iris_blur"
              },
              "radius": {
                "type": "number",
                "minimum": 0,
                "maximum": 50
              },
              "cx": {
                "type": "number"
              },
              "cy": {
                "type": "number"
              },
              "rx": {
                "type": "number",
                "minimum": 1,
                "maximum": 16384
              },
              "ry": {
                "type": "number",
                "minimum": 1,
                "maximum": 16384
              },
              "angle": {
                "type": "number",
                "minimum": -360,
                "maximum": 360
              },
              "focus": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": ["type", "radius"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "tilt_shift"
              },
              "radius": {
                "type": "number",
                "minimum": 0,
                "maximum": 50
              },
              "cx": {
                "type": "number"
              },
              "cy": {
                "type": "number"
              },
              "angle": {
                "type": "number",
                "minimum": -360,
                "maximum": 360
              },
              "focus": {
                "type": "number",
                "minimum": 0,
                "maximum": 16384
              },
              "falloff": {
                "type": "number",
                "minimum": 0,
                "maximum": 16384
              }
            },
            "required": ["type", "radius"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "spin_blur"
              },
              "angle": {
                "type": "number",
                "minimum": 0,
                "maximum": 360
              },
              "cx": {
                "type": "number"
              },
              "cy": {
                "type": "number"
              },
              "radius": {
                "type": "number",
                "minimum": 1,
                "maximum": 16384
              }
            },
            "required": ["type", "angle"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "path_blur"
              },
              "points": {
                "minItems": 2,
                "maxItems": 16,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "x": {
                      "type": "number"
                    },
                    "y": {
                      "type": "number"
                    }
                  },
                  "required": ["x", "y"],
                  "additionalProperties": false
                }
              },
              "length": {
                "type": "number",
                "minimum": 0,
                "maximum": 200
              }
            },
            "required": ["type", "points", "length"],
            "additionalProperties": false
          }
        ]
      },
      "Job": {
        "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", "materialize"]
          },
          "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
          },
          "output": {
            "type": "object",
            "properties": {
              "operation": {
                "type": "string",
                "enum": ["create_document", "apply_proposal", "export_bundle", "sync_develop"]
              },
              "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
                  }
                },
                "required": ["width", "height"],
                "additionalProperties": false
              },
              "compositeHash": {
                "type": "string",
                "pattern": "^[0-9a-f]{64}$"
              },
              "appliedRevision": {
                "type": "string",
                "pattern": "^rev_[1-9][0-9]*$"
              },
              "bundle": {
                "type": "object",
                "properties": {
                  "spec": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "zipHash": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "zipBytes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "files": {
                    "maxItems": 128,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 200
                        },
                        "mime": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 100
                        },
                        "bytes": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": ["name", "mime", "bytes"],
                      "additionalProperties": false
                    }
                  }
                },
                "required": ["spec", "zipHash", "zipBytes", "files"],
                "additionalProperties": false
              },
              "sync": {
                "type": "object",
                "properties": {
                  "sourceDocumentId": {
                    "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}$"
                  },
                  "from": {
                    "type": "string",
                    "pattern": "^rev_[1-9][0-9]*$"
                  },
                  "to": {
                    "type": "string",
                    "pattern": "^rev_[1-9][0-9]*$"
                  },
                  "layers": {
                    "maxItems": 64,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 120
                    }
                  },
                  "commands": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 64
                  },
                  "skipped": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": ["sourceDocumentId", "from", "to", "layers", "commands", "skipped"],
                "additionalProperties": false
              }
            },
            "required": ["operation", "documentId", "headRevision", "canvas", "compositeHash"],
            "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
      },
      "LayerStyle": {
        "oneOf": [
          {
            "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": {
                "$ref": "#/components/schemas/Color"
              },
              "opacity": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "contour": {
                "type": "string",
                "enum": ["linear", "gaussian", "half_round", "cone", "cone_inverted", "ring", "ring_double", "sawtooth"]
              },
              "noise": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": ["type", "dx", "dy", "blur", "color", "opacity"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "stroke"
              },
              "width": {
                "type": "integer",
                "minimum": 1,
                "maximum": 64
              },
              "color": {
                "$ref": "#/components/schemas/Color"
              },
              "position": {
                "type": "string",
                "enum": ["outside", "inside", "center"]
              }
            },
            "required": ["type", "width", "color", "position"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "inner_shadow"
              },
              "dx": {
                "type": "integer",
                "minimum": -256,
                "maximum": 256
              },
              "dy": {
                "type": "integer",
                "minimum": -256,
                "maximum": 256
              },
              "blur": {
                "type": "number",
                "minimum": 0,
                "maximum": 50
              },
              "color": {
                "$ref": "#/components/schemas/Color"
              },
              "opacity": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "blend": {
                "type": "string",
                "enum": [
                  "normal",
                  "dissolve",
                  "darken",
                  "multiply",
                  "color_burn",
                  "linear_burn",
                  "darker_color",
                  "lighten",
                  "screen",
                  "color_dodge",
                  "linear_dodge",
                  "lighter_color",
                  "overlay",
                  "soft_light",
                  "hard_light",
                  "vivid_light",
                  "linear_light",
                  "pin_light",
                  "hard_mix",
                  "difference",
                  "exclusion",
                  "subtract",
                  "divide",
                  "hue",
                  "saturation",
                  "color",
                  "luminosity"
                ]
              },
              "contour": {
                "type": "string",
                "enum": ["linear", "gaussian", "half_round", "cone", "cone_inverted", "ring", "ring_double", "sawtooth"]
              },
              "noise": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": ["type", "dx", "dy", "blur", "color", "opacity"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "outer_glow"
              },
              "size": {
                "type": "number",
                "minimum": 0,
                "maximum": 50
              },
              "spread": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "color": {
                "$ref": "#/components/schemas/Color"
              },
              "opacity": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "contour": {
                "type": "string",
                "enum": ["linear", "gaussian", "half_round", "cone", "cone_inverted", "ring", "ring_double", "sawtooth"]
              },
              "noise": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "gradient": {
                "minItems": 2,
                "maxItems": 16,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "position": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1
                    },
                    "color": {
                      "$ref": "#/components/schemas/Color"
                    }
                  },
                  "required": ["position", "color"],
                  "additionalProperties": false
                }
              }
            },
            "required": ["type", "size", "spread", "color", "opacity"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "inner_glow"
              },
              "size": {
                "type": "number",
                "minimum": 0,
                "maximum": 50
              },
              "choke": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "color": {
                "$ref": "#/components/schemas/Color"
              },
              "opacity": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "source": {
                "type": "string",
                "enum": ["edge", "center"]
              },
              "blend": {
                "type": "string",
                "enum": [
                  "normal",
                  "dissolve",
                  "darken",
                  "multiply",
                  "color_burn",
                  "linear_burn",
                  "darker_color",
                  "lighten",
                  "screen",
                  "color_dodge",
                  "linear_dodge",
                  "lighter_color",
                  "overlay",
                  "soft_light",
                  "hard_light",
                  "vivid_light",
                  "linear_light",
                  "pin_light",
                  "hard_mix",
                  "difference",
                  "exclusion",
                  "subtract",
                  "divide",
                  "hue",
                  "saturation",
                  "color",
                  "luminosity"
                ]
              },
              "contour": {
                "type": "string",
                "enum": ["linear", "gaussian", "half_round", "cone", "cone_inverted", "ring", "ring_double", "sawtooth"]
              },
              "noise": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "gradient": {
                "minItems": 2,
                "maxItems": 16,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "position": {
                      "type": "number",
                      "minimum": 0,
                      "maximum": 1
                    },
                    "color": {
                      "$ref": "#/components/schemas/Color"
                    }
                  },
                  "required": ["position", "color"],
                  "additionalProperties": false
                }
              }
            },
            "required": ["type", "size", "choke", "color", "opacity", "source"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "overlay"
              },
              "paint": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "solid"
                      },
                      "color": {
                        "$ref": "#/components/schemas/Color"
                      }
                    },
                    "required": ["type", "color"],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "gradient"
                      },
                      "gradient": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": ["linear", "radial"]
                          },
                          "start": {
                            "type": "object",
                            "properties": {
                              "x": {
                                "type": "number"
                              },
                              "y": {
                                "type": "number"
                              }
                            },
                            "required": ["x", "y"],
                            "additionalProperties": false
                          },
                          "end": {
                            "type": "object",
                            "properties": {
                              "x": {
                                "type": "number"
                              },
                              "y": {
                                "type": "number"
                              }
                            },
                            "required": ["x", "y"],
                            "additionalProperties": false
                          },
                          "stops": {
                            "minItems": 2,
                            "maxItems": 16,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "position": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1
                                },
                                "color": {
                                  "$ref": "#/components/schemas/Color"
                                }
                              },
                              "required": ["position", "color"],
                              "additionalProperties": false
                            }
                          },
                          "dither": {
                            "type": "boolean"
                          }
                        },
                        "required": ["kind", "start", "end", "stops"],
                        "additionalProperties": false
                      }
                    },
                    "required": ["type", "gradient"],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "pattern"
                      },
                      "pattern": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": ["checker", "horizontal_stripes", "vertical_stripes", "dots", "grid"]
                          },
                          "size": {
                            "type": "integer",
                            "minimum": 2,
                            "maximum": 512
                          },
                          "foreground": {
                            "$ref": "#/components/schemas/Color"
                          },
                          "background": {
                            "$ref": "#/components/schemas/Color"
                          },
                          "options": {
                            "type": "object",
                            "properties": {
                              "spacingX": {
                                "type": "integer",
                                "minimum": -256,
                                "maximum": 512
                              },
                              "spacingY": {
                                "type": "integer",
                                "minimum": -256,
                                "maximum": 512
                              },
                              "offsetX": {
                                "type": "integer",
                                "minimum": -16384,
                                "maximum": 16384
                              },
                              "offsetY": {
                                "type": "integer",
                                "minimum": -16384,
                                "maximum": 16384
                              },
                              "rotation": {
                                "type": "number",
                                "minimum": -360,
                                "maximum": 360
                              },
                              "tiling": {
                                "type": "string",
                                "enum": ["grid", "brick_by_row", "brick_by_column"]
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": ["kind", "size", "foreground", "background"],
                        "additionalProperties": false
                      }
                    },
                    "required": ["type", "pattern"],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "const": "swatch"
                      },
                      "swatch": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120,
                        "pattern": "\\S"
                      },
                      "options": {
                        "type": "object",
                        "properties": {
                          "spacingX": {
                            "type": "integer",
                            "minimum": -256,
                            "maximum": 512
                          },
                          "spacingY": {
                            "type": "integer",
                            "minimum": -256,
                            "maximum": 512
                          },
                          "offsetX": {
                            "type": "integer",
                            "minimum": -16384,
                            "maximum": 16384
                          },
                          "offsetY": {
                            "type": "integer",
                            "minimum": -16384,
                            "maximum": 16384
                          },
                          "rotation": {
                            "type": "number",
                            "minimum": -360,
                            "maximum": 360
                          },
                          "tiling": {
                            "type": "string",
                            "enum": ["grid", "brick_by_row", "brick_by_column"]
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "required": ["type", "swatch"],
                    "additionalProperties": false
                  }
                ]
              },
              "opacity": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "blend": {
                "type": "string",
                "enum": [
                  "normal",
                  "dissolve",
                  "darken",
                  "multiply",
                  "color_burn",
                  "linear_burn",
                  "darker_color",
                  "lighten",
                  "screen",
                  "color_dodge",
                  "linear_dodge",
                  "lighter_color",
                  "overlay",
                  "soft_light",
                  "hard_light",
                  "vivid_light",
                  "linear_light",
                  "pin_light",
                  "hard_mix",
                  "difference",
                  "exclusion",
                  "subtract",
                  "divide",
                  "hue",
                  "saturation",
                  "color",
                  "luminosity"
                ]
              }
            },
            "required": ["type", "paint", "opacity"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "bevel"
              },
              "kind": {
                "type": "string",
                "enum": ["inner", "outer", "emboss", "pillow"]
              },
              "direction": {
                "type": "string",
                "enum": ["up", "down"]
              },
              "depth": {
                "type": "number",
                "minimum": 0,
                "maximum": 10
              },
              "size": {
                "type": "number",
                "minimum": 0,
                "maximum": 50
              },
              "soften": {
                "type": "number",
                "minimum": 0,
                "maximum": 16
              },
              "angle": {
                "type": "number",
                "minimum": -360,
                "maximum": 360
              },
              "altitude": {
                "type": "number",
                "minimum": 0,
                "maximum": 90
              },
              "highlight": {
                "$ref": "#/components/schemas/Color"
              },
              "shadow": {
                "$ref": "#/components/schemas/Color"
              },
              "technique": {
                "type": "string",
                "enum": ["smooth", "chisel_hard"]
              },
              "contour": {
                "type": "string",
                "enum": ["linear", "gaussian", "half_round", "cone", "cone_inverted", "ring", "ring_double", "sawtooth"]
              },
              "highlightBlend": {
                "type": "string",
                "enum": [
                  "normal",
                  "dissolve",
                  "darken",
                  "multiply",
                  "color_burn",
                  "linear_burn",
                  "darker_color",
                  "lighten",
                  "screen",
                  "color_dodge",
                  "linear_dodge",
                  "lighter_color",
                  "overlay",
                  "soft_light",
                  "hard_light",
                  "vivid_light",
                  "linear_light",
                  "pin_light",
                  "hard_mix",
                  "difference",
                  "exclusion",
                  "subtract",
                  "divide",
                  "hue",
                  "saturation",
                  "color",
                  "luminosity"
                ]
              },
              "shadowBlend": {
                "type": "string",
                "enum": [
                  "normal",
                  "dissolve",
                  "darken",
                  "multiply",
                  "color_burn",
                  "linear_burn",
                  "darker_color",
                  "lighten",
                  "screen",
                  "color_dodge",
                  "linear_dodge",
                  "lighter_color",
                  "overlay",
                  "soft_light",
                  "hard_light",
                  "vivid_light",
                  "linear_light",
                  "pin_light",
                  "hard_mix",
                  "difference",
                  "exclusion",
                  "subtract",
                  "divide",
                  "hue",
                  "saturation",
                  "color",
                  "luminosity"
                ]
              },
              "texture": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": ["checker", "horizontal_stripes", "vertical_stripes", "dots", "grid"]
                  },
                  "size": {
                    "type": "integer",
                    "minimum": 2,
                    "maximum": 512
                  },
                  "depth": {
                    "type": "number",
                    "minimum": -10,
                    "maximum": 10
                  }
                },
                "required": ["kind", "size", "depth"],
                "additionalProperties": false
              }
            },
            "required": [
              "type",
              "kind",
              "direction",
              "depth",
              "size",
              "soften",
              "angle",
              "altitude",
              "highlight",
              "shadow"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "satin"
              },
              "color": {
                "$ref": "#/components/schemas/Color"
              },
              "opacity": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "angle": {
                "type": "number",
                "minimum": -360,
                "maximum": 360
              },
              "distance": {
                "type": "number",
                "minimum": 0,
                "maximum": 256
              },
              "size": {
                "type": "number",
                "minimum": 0,
                "maximum": 50
              },
              "invert": {
                "type": "boolean"
              },
              "blend": {
                "type": "string",
                "enum": [
                  "normal",
                  "dissolve",
                  "darken",
                  "multiply",
                  "color_burn",
                  "linear_burn",
                  "darker_color",
                  "lighten",
                  "screen",
                  "color_dodge",
                  "linear_dodge",
                  "lighter_color",
                  "overlay",
                  "soft_light",
                  "hard_light",
                  "vivid_light",
                  "linear_light",
                  "pin_light",
                  "hard_mix",
                  "difference",
                  "exclusion",
                  "subtract",
                  "divide",
                  "hue",
                  "saturation",
                  "color",
                  "luminosity"
                ]
              },
              "contour": {
                "type": "string",
                "enum": ["linear", "gaussian", "half_round", "cone", "cone_inverted", "ring", "ring_double", "sawtooth"]
              }
            },
            "required": ["type", "color", "opacity", "angle", "distance", "size", "invert"],
            "additionalProperties": false
          }
        ]
      },
      "Node": {
        "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"
              },
              "clipped": {
                "type": "boolean"
              },
              "opacity": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "blend": {
                "type": "string",
                "enum": [
                  "normal",
                  "dissolve",
                  "darken",
                  "multiply",
                  "color_burn",
                  "linear_burn",
                  "darker_color",
                  "lighten",
                  "screen",
                  "color_dodge",
                  "linear_dodge",
                  "lighter_color",
                  "overlay",
                  "soft_light",
                  "hard_light",
                  "vivid_light",
                  "linear_light",
                  "pin_light",
                  "hard_mix",
                  "difference",
                  "exclusion",
                  "subtract",
                  "divide",
                  "hue",
                  "saturation",
                  "color",
                  "luminosity"
                ]
              },
              "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": {
                "$ref": "#/components/schemas/Transform"
              },
              "source": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "svg"
                      },
                      "asset": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      },
                      "frame": {
                        "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
                      }
                    },
                    "required": ["kind", "asset", "frame"],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "const": "smart"
                      },
                      "asset": {
                        "type": "string",
                        "pattern": "^[0-9a-f]{64}$"
                      },
                      "width": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "height": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "frame": {
                        "type": "object",
                        "properties": {
                          "x": {
                            "type": "number"
                          },
                          "y": {
                            "type": "number"
                          },
                          "width": {
                            "type": "number",
                            "exclusiveMinimum": 0
                          },
                          "height": {
                            "type": "number",
                            "exclusiveMinimum": 0
                          }
                        },
                        "required": ["x", "y", "width", "height"],
                        "additionalProperties": false
                      },
                      "filters": {
                        "minItems": 1,
                        "maxItems": 8,
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/Filter"
                        }
                      }
                    },
                    "required": ["kind", "asset", "width", "height", "frame"],
                    "additionalProperties": false
                  }
                ]
              },
              "styles": {
                "maxItems": 8,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/LayerStyle"
                }
              }
            },
            "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"
              },
              "clipped": {
                "type": "boolean"
              },
              "opacity": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "blend": {
                "type": "string",
                "enum": [
                  "normal",
                  "dissolve",
                  "darken",
                  "multiply",
                  "color_burn",
                  "linear_burn",
                  "darker_color",
                  "lighten",
                  "screen",
                  "color_dodge",
                  "linear_dodge",
                  "lighter_color",
                  "overlay",
                  "soft_light",
                  "hard_light",
                  "vivid_light",
                  "linear_light",
                  "pin_light",
                  "hard_mix",
                  "difference",
                  "exclusion",
                  "subtract",
                  "divide",
                  "hue",
                  "saturation",
                  "color",
                  "luminosity"
                ]
              },
              "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"
              },
              "styles": {
                "maxItems": 8,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/LayerStyle"
                }
              }
            },
            "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"
              },
              "clipped": {
                "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": {
                "$ref": "#/components/schemas/Adjustment"
              }
            },
            "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"
              },
              "clipped": {
                "type": "boolean"
              },
              "opacity": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "blend": {
                "type": "string",
                "enum": [
                  "normal",
                  "dissolve",
                  "darken",
                  "multiply",
                  "color_burn",
                  "linear_burn",
                  "darker_color",
                  "lighten",
                  "screen",
                  "color_dodge",
                  "linear_dodge",
                  "lighter_color",
                  "overlay",
                  "soft_light",
                  "hard_light",
                  "vivid_light",
                  "linear_light",
                  "pin_light",
                  "hard_mix",
                  "difference",
                  "exclusion",
                  "subtract",
                  "divide",
                  "hue",
                  "saturation",
                  "color",
                  "luminosity"
                ]
              },
              "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": {
                "$ref": "#/components/schemas/Transform"
              },
              "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": {
                    "$ref": "#/components/schemas/Color"
                  },
                  "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
                  },
                  "tracking": {
                    "type": "number",
                    "minimum": -0.5,
                    "maximum": 2
                  },
                  "baselineShift": {
                    "type": "number",
                    "minimum": -512,
                    "maximum": 512
                  },
                  "underline": {
                    "type": "boolean"
                  },
                  "strikethrough": {
                    "type": "boolean"
                  },
                  "caseTransform": {
                    "type": "string",
                    "enum": ["none", "uppercase", "small-caps"]
                  }
                },
                "required": ["content", "family", "sizePx", "weight", "italic", "color", "align", "lineHeight", "box"],
                "additionalProperties": false
              },
              "styles": {
                "maxItems": 8,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/LayerStyle"
                }
              }
            },
            "required": ["kind", "id", "name", "parent", "visible", "locked", "opacity", "blend", "text"],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "const": "fill"
              },
              "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"
              },
              "clipped": {
                "type": "boolean"
              },
              "opacity": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "blend": {
                "type": "string",
                "enum": [
                  "normal",
                  "dissolve",
                  "darken",
                  "multiply",
                  "color_burn",
                  "linear_burn",
                  "darker_color",
                  "lighten",
                  "screen",
                  "color_dodge",
                  "linear_dodge",
                  "lighter_color",
                  "overlay",
                  "soft_light",
                  "hard_light",
                  "vivid_light",
                  "linear_light",
                  "pin_light",
                  "hard_mix",
                  "difference",
                  "exclusion",
                  "subtract",
                  "divide",
                  "hue",
                  "saturation",
                  "color",
                  "luminosity"
                ]
              },
              "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}$"
              },
              "fill": {
                "type": "object",
                "properties": {
                  "paint": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "solid"
                          },
                          "color": {
                            "$ref": "#/components/schemas/Color"
                          }
                        },
                        "required": ["type", "color"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "gradient"
                          },
                          "gradient": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": ["linear", "radial"]
                              },
                              "start": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "number"
                                  },
                                  "y": {
                                    "type": "number"
                                  }
                                },
                                "required": ["x", "y"],
                                "additionalProperties": false
                              },
                              "end": {
                                "type": "object",
                                "properties": {
                                  "x": {
                                    "type": "number"
                                  },
                                  "y": {
                                    "type": "number"
                                  }
                                },
                                "required": ["x", "y"],
                                "additionalProperties": false
                              },
                              "stops": {
                                "minItems": 2,
                                "maxItems": 16,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "position": {
                                      "type": "number",
                                      "minimum": 0,
                                      "maximum": 1
                                    },
                                    "color": {
                                      "$ref": "#/components/schemas/Color"
                                    }
                                  },
                                  "required": ["position", "color"],
                                  "additionalProperties": false
                                }
                              },
                              "dither": {
                                "type": "boolean"
                              }
                            },
                            "required": ["kind", "start", "end", "stops"],
                            "additionalProperties": false
                          }
                        },
                        "required": ["type", "gradient"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "pattern"
                          },
                          "pattern": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": ["checker", "horizontal_stripes", "vertical_stripes", "dots", "grid"]
                              },
                              "size": {
                                "type": "integer",
                                "minimum": 2,
                                "maximum": 512
                              },
                              "foreground": {
                                "$ref": "#/components/schemas/Color"
                              },
                              "background": {
                                "$ref": "#/components/schemas/Color"
                              },
                              "options": {
                                "type": "object",
                                "properties": {
                                  "spacingX": {
                                    "type": "integer",
                                    "minimum": -256,
                                    "maximum": 512
                                  },
                                  "spacingY": {
                                    "type": "integer",
                                    "minimum": -256,
                                    "maximum": 512
                                  },
                                  "offsetX": {
                                    "type": "integer",
                                    "minimum": -16384,
                                    "maximum": 16384
                                  },
                                  "offsetY": {
                                    "type": "integer",
                                    "minimum": -16384,
                                    "maximum": 16384
                                  },
                                  "rotation": {
                                    "type": "number",
                                    "minimum": -360,
                                    "maximum": 360
                                  },
                                  "tiling": {
                                    "type": "string",
                                    "enum": ["grid", "brick_by_row", "brick_by_column"]
                                  }
                                },
                                "additionalProperties": false
                              }
                            },
                            "required": ["kind", "size", "foreground", "background"],
                            "additionalProperties": false
                          }
                        },
                        "required": ["type", "pattern"],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "swatch"
                          },
                          "swatch": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120,
                            "pattern": "\\S"
                          },
                          "options": {
                            "type": "object",
                            "properties": {
                              "spacingX": {
                                "type": "integer",
                                "minimum": -256,
                                "maximum": 512
                              },
                              "spacingY": {
                                "type": "integer",
                                "minimum": -256,
                                "maximum": 512
                              },
                              "offsetX": {
                                "type": "integer",
                                "minimum": -16384,
                                "maximum": 16384
                              },
                              "offsetY": {
                                "type": "integer",
                                "minimum": -16384,
                                "maximum": 16384
                              },
                              "rotation": {
                                "type": "number",
                                "minimum": -360,
                                "maximum": 360
                              },
                              "tiling": {
                                "type": "string",
                                "enum": ["grid", "brick_by_row", "brick_by_column"]
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": ["type", "swatch"],
                        "additionalProperties": false
                      }
                    ]
                  },
                  "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
                  }
                },
                "required": ["paint", "bounds"],
                "additionalProperties": false
              },
              "styles": {
                "maxItems": 8,
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/LayerStyle"
                }
              }
            },
            "required": ["kind", "id", "name", "parent", "visible", "locked", "opacity", "blend", "fill"],
            "additionalProperties": false
          }
        ]
      },
      "Proposal": {
        "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": {
              "$ref": "#/components/schemas/EditCommand"
            }
          },
          "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)))$"
          },
          "serverTimeMs": {
            "type": "integer",
            "minimum": 0,
            "maximum": 8640000000000000
          }
        },
        "required": [
          "commandId",
          "documentId",
          "actorId",
          "actorKind",
          "baseRevision",
          "readDependencies",
          "writes",
          "edits"
        ],
        "additionalProperties": false
      },
      "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"
          },
          "skewX": {
            "type": "number",
            "minimum": -1.4835298641951802,
            "maximum": 1.4835298641951802
          },
          "skewY": {
            "type": "number",
            "minimum": -1.4835298641951802,
            "maximum": 1.4835298641951802
          },
          "perspective": {
            "type": "array",
            "prefixItems": [
              {
                "type": "object",
                "properties": {
                  "x": {
                    "type": "number"
                  },
                  "y": {
                    "type": "number"
                  }
                },
                "required": ["x", "y"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "x": {
                    "type": "number"
                  },
                  "y": {
                    "type": "number"
                  }
                },
                "required": ["x", "y"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "x": {
                    "type": "number"
                  },
                  "y": {
                    "type": "number"
                  }
                },
                "required": ["x", "y"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "x": {
                    "type": "number"
                  },
                  "y": {
                    "type": "number"
                  }
                },
                "required": ["x", "y"],
                "additionalProperties": false
              }
            ],
            "items": false,
            "minItems": 4,
            "maxItems": 4
          },
          "warp": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "style": {
                    "type": "string",
                    "const": "mesh"
                  },
                  "mesh": {
                    "minItems": 16,
                    "maxItems": 16,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "number"
                        },
                        "y": {
                          "type": "number"
                        }
                      },
                      "required": ["x", "y"],
                      "additionalProperties": false
                    }
                  }
                },
                "required": ["style", "mesh"],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "style": {
                    "type": "string",
                    "enum": ["arc", "bulge", "flag", "wave"]
                  },
                  "bend": {
                    "type": "number",
                    "minimum": -1,
                    "maximum": 1
                  }
                },
                "required": ["style", "bend"],
                "additionalProperties": false
              }
            ]
          },
          "liquify": {
            "minItems": 1,
            "maxItems": 64,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "mode": {
                  "type": "string",
                  "enum": ["push", "twirl_cw", "twirl_ccw", "pucker", "bloat", "reconstruct", "freeze", "thaw"]
                },
                "radius": {
                  "type": "number",
                  "minimum": 1,
                  "maximum": 500
                },
                "pressure": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                },
                "rate": {
                  "type": "number",
                  "minimum": 0,
                  "maximum": 1
                },
                "points": {
                  "minItems": 1,
                  "maxItems": 512,
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "x": {
                        "type": "number"
                      },
                      "y": {
                        "type": "number"
                      }
                    },
                    "required": ["x", "y"],
                    "additionalProperties": false
                  }
                }
              },
              "required": ["mode", "radius", "pressure", "rate", "points"],
              "additionalProperties": false
            }
          },
          "puppet": {
            "minItems": 1,
            "maxItems": 32,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "from": {
                  "type": "object",
                  "properties": {
                    "x": {
                      "type": "number"
                    },
                    "y": {
                      "type": "number"
                    }
                  },
                  "required": ["x", "y"],
                  "additionalProperties": false
                },
                "to": {
                  "type": "object",
                  "properties": {
                    "x": {
                      "type": "number"
                    },
                    "y": {
                      "type": "number"
                    }
                  },
                  "required": ["x", "y"],
                  "additionalProperties": false
                }
              },
              "required": ["from", "to"],
              "additionalProperties": false
            }
          },
          "perspectiveWarp": {
            "minItems": 1,
            "maxItems": 8,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "from": {
                  "type": "array",
                  "prefixItems": [
                    {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "number"
                        },
                        "y": {
                          "type": "number"
                        }
                      },
                      "required": ["x", "y"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "number"
                        },
                        "y": {
                          "type": "number"
                        }
                      },
                      "required": ["x", "y"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "number"
                        },
                        "y": {
                          "type": "number"
                        }
                      },
                      "required": ["x", "y"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "number"
                        },
                        "y": {
                          "type": "number"
                        }
                      },
                      "required": ["x", "y"],
                      "additionalProperties": false
                    }
                  ],
                  "items": false,
                  "minItems": 4,
                  "maxItems": 4
                },
                "to": {
                  "type": "array",
                  "prefixItems": [
                    {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "number"
                        },
                        "y": {
                          "type": "number"
                        }
                      },
                      "required": ["x", "y"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "number"
                        },
                        "y": {
                          "type": "number"
                        }
                      },
                      "required": ["x", "y"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "number"
                        },
                        "y": {
                          "type": "number"
                        }
                      },
                      "required": ["x", "y"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "x": {
                          "type": "number"
                        },
                        "y": {
                          "type": "number"
                        }
                      },
                      "required": ["x", "y"],
                      "additionalProperties": false
                    }
                  ],
                  "items": false,
                  "minItems": 4,
                  "maxItems": 4
                }
              },
              "required": ["from", "to"],
              "additionalProperties": false
            }
          }
        },
        "required": ["tx", "ty", "sx", "sy", "rotation", "flipX", "flipY"],
        "additionalProperties": false
      }
    }
  },
  "paths": {
    "/api/agent/critique": {
      "post": {
        "operationId": "critiqueAgentProposal",
        "summary": "Judge a render of a planned proposal with a vision model and, when it falls short, plan one repair.",
        "tags": ["Agent"],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": ["propose", "generate"]
          }
        ],
        "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
                  },
                  "interpretation": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "criticToken": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "after": {
                    "type": "object",
                    "properties": {
                      "mimeType": {
                        "type": "string",
                        "enum": ["image/png", "image/jpeg"]
                      },
                      "base64": {
                        "type": "string",
                        "minLength": 1
                      },
                      "width": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 8192
                      },
                      "height": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 8192
                      }
                    },
                    "required": ["mimeType", "base64"]
                  },
                  "before": {
                    "type": "object",
                    "properties": {
                      "mimeType": {
                        "type": "string",
                        "enum": ["image/png", "image/jpeg"]
                      },
                      "base64": {
                        "type": "string",
                        "minLength": 1
                      },
                      "width": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 8192
                      },
                      "height": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 8192
                      }
                    },
                    "required": ["mimeType", "base64"]
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "headRevision": {
                        "type": "string",
                        "pattern": "^rev_[1-9][0-9]*$"
                      },
                      "summary": {
                        "$ref": "#/components/schemas/DocumentSummary"
                      },
                      "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"]
                            }
                          ]
                        }
                      },
                      "capabilities": {
                        "type": "object",
                        "properties": {
                          "localSegmentation": {
                            "type": "boolean"
                          },
                          "localSegmentMask": {
                            "type": "boolean"
                          }
                        },
                        "required": ["localSegmentation"]
                      },
                      "presets": {
                        "maxItems": 32,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 60
                            },
                            "layers": {
                              "minItems": 1,
                              "maxItems": 16,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "adjustment": {
                                    "$ref": "#/components/schemas/Adjustment"
                                  },
                                  "opacity": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1
                                  }
                                },
                                "required": ["name", "adjustment"],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": ["name", "layers"],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": ["headRevision", "summary"]
                  }
                },
                "required": ["documentId", "utterance", "interpretation", "criticToken", "after", "context"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Judge a render of a planned proposal with a vision model and, when it falls short, plan one repair.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": ["judged", "unparsed", "failed", "aborted", "skipped"]
                    },
                    "skipped": {
                      "type": "string",
                      "enum": ["budget", "refused", "no_model"]
                    },
                    "verdict": {
                      "type": "object",
                      "properties": {
                        "achievesIntent": {
                          "type": "string",
                          "enum": ["yes", "partial", "no"]
                        },
                        "issues": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "suggestedFix": {
                          "type": "string"
                        }
                      },
                      "required": ["achievesIntent", "issues"],
                      "additionalProperties": false
                    },
                    "signal": {
                      "type": "object",
                      "properties": {
                        "advancesIntent": {
                          "type": "boolean"
                        },
                        "stepVerdict": {
                          "type": "string",
                          "enum": ["keep", "repair", "backtrack"]
                        },
                        "confidence": {
                          "type": "number",
                          "minimum": 0,
                          "maximum": 1
                        },
                        "source": {
                          "type": "string",
                          "const": "vision_critic"
                        }
                      },
                      "required": ["advancesIntent", "stepVerdict", "confidence", "source"],
                      "additionalProperties": false
                    },
                    "model": {
                      "type": "string"
                    },
                    "repaired": {
                      "type": "boolean"
                    },
                    "repairSkipped": {
                      "type": "string",
                      "enum": ["verdict_yes", "no_verdict", "budget", "failed"]
                    },
                    "repair": {
                      "type": "object",
                      "properties": {
                        "interpretation": {
                          "type": "string"
                        },
                        "proposal": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Proposal"
                            },
                            {
                              "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"
                                  }
                                ]
                              },
                              "restyle": {
                                "type": "boolean",
                                "const": true
                              }
                            },
                            "required": ["kind", "prompt", "requiresMask", "params"],
                            "additionalProperties": false
                          }
                        },
                        "localRequests": {
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "remove_background"
                                  },
                                  "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}$"
                                  },
                                  "at": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "combine": {
                                    "type": "string",
                                    "enum": ["replace", "add", "subtract"]
                                  },
                                  "feather": {
                                    "type": "number",
                                    "minimum": 0
                                  }
                                },
                                "required": ["kind", "node", "at", "combine", "feather"],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "segment_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}$"
                                  },
                                  "source": {
                                    "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}$"
                                  },
                                  "at": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "segment": {
                                    "type": "string",
                                    "enum": ["subject", "background"]
                                  },
                                  "combine": {
                                    "type": "string",
                                    "enum": ["replace", "add", "subtract", "intersect"]
                                  }
                                },
                                "required": ["kind", "node", "at", "segment", "combine"],
                                "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
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "show_channel"
                                  },
                                  "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}$"
                                  },
                                  "channel": {
                                    "type": "string",
                                    "enum": ["r", "g", "b", "a"]
                                  }
                                },
                                "required": ["type", "node", "channel"],
                                "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"
                          }
                        },
                        "lane": {
                          "type": "string",
                          "enum": ["cloud", "fast", "ollama", "browser"]
                        },
                        "route": {
                          "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
                          }
                        },
                        "criticToken": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        }
                      },
                      "required": [
                        "interpretation",
                        "proposal",
                        "jobRequests",
                        "viewChanges",
                        "questions",
                        "blocked",
                        "outcome",
                        "truncated",
                        "usage"
                      ],
                      "additionalProperties": false
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "usdCost": {
                          "type": "number"
                        }
                      },
                      "required": ["usdCost"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["status", "repaired", "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/memory": {
      "post": {
        "operationId": "rememberAgentSession",
        "summary": "Distil an ended editor session into at most three facts worth remembering about the document (one small completion), kept for the caller's later planner turns on that document only.",
        "tags": ["Agent"],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": ["propose", "generate"]
          }
        ],
        "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}$"
                  },
                  "turns": {
                    "minItems": 1,
                    "maxItems": 12,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "utterance": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 2000
                        },
                        "interpretation": {
                          "type": "string",
                          "maxLength": 2000
                        }
                      },
                      "required": ["utterance", "interpretation"]
                    }
                  }
                },
                "required": ["documentId", "turns"]
              }
            }
          }
        },
        "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": "Distil an ended editor session into at most three facts worth remembering about the document (one small completion), kept for the caller's later planner turns on that document only.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": ["extracted", "unparsed", "failed", "aborted"]
                    },
                    "remembered": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "fact": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "importance": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 10
                          },
                          "tags": {
                            "maxItems": 4,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 32
                            }
                          },
                          "at": {
                            "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))$"
                          }
                        },
                        "required": ["fact", "importance", "tags", "at"],
                        "additionalProperties": false
                      }
                    },
                    "memories": {
                      "maxItems": 24,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "fact": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          },
                          "importance": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 10
                          },
                          "tags": {
                            "maxItems": 4,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 32
                            }
                          },
                          "at": {
                            "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))$"
                          }
                        },
                        "required": ["fact", "importance", "tags", "at"],
                        "additionalProperties": false
                      }
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "usdCost": {
                          "type": "number",
                          "minimum": 0
                        }
                      },
                      "required": ["usdCost"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["status", "remembered", "memories", "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": "agent_daily_cap_exceeded: Called with an agent token whose grant's daily credit cap cannot cover this call's estimate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: Too many sessions remembered in the window; try again shortly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/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": []
          },
          {
            "oauth2": ["propose", "generate"]
          }
        ],
        "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": {
                        "$ref": "#/components/schemas/DocumentSummary"
                      },
                      "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"]
                            }
                          ]
                        }
                      },
                      "capabilities": {
                        "type": "object",
                        "properties": {
                          "localSegmentation": {
                            "type": "boolean"
                          },
                          "localSegmentMask": {
                            "type": "boolean"
                          }
                        },
                        "required": ["localSegmentation"]
                      },
                      "presets": {
                        "maxItems": 32,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 60
                            },
                            "layers": {
                              "minItems": 1,
                              "maxItems": 16,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "adjustment": {
                                    "$ref": "#/components/schemas/Adjustment"
                                  },
                                  "opacity": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1
                                  }
                                },
                                "required": ["name", "adjustment"],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": ["name", "layers"],
                          "additionalProperties": false
                        }
                      }
                    },
                    "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": [
                        {
                          "$ref": "#/components/schemas/Proposal"
                        },
                        {
                          "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"
                              }
                            ]
                          },
                          "restyle": {
                            "type": "boolean",
                            "const": true
                          }
                        },
                        "required": ["kind", "prompt", "requiresMask", "params"],
                        "additionalProperties": false
                      }
                    },
                    "localRequests": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "remove_background"
                              },
                              "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}$"
                              },
                              "at": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "combine": {
                                "type": "string",
                                "enum": ["replace", "add", "subtract"]
                              },
                              "feather": {
                                "type": "number",
                                "minimum": 0
                              }
                            },
                            "required": ["kind", "node", "at", "combine", "feather"],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "const": "segment_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}$"
                              },
                              "source": {
                                "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}$"
                              },
                              "at": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "segment": {
                                "type": "string",
                                "enum": ["subject", "background"]
                              },
                              "combine": {
                                "type": "string",
                                "enum": ["replace", "add", "subtract", "intersect"]
                              }
                            },
                            "required": ["kind", "node", "at", "segment", "combine"],
                            "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
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "show_channel"
                              },
                              "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}$"
                              },
                              "channel": {
                                "type": "string",
                                "enum": ["r", "g", "b", "a"]
                              }
                            },
                            "required": ["type", "node", "channel"],
                            "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"
                      }
                    },
                    "lane": {
                      "type": "string",
                      "enum": ["cloud", "fast", "ollama", "browser"]
                    },
                    "route": {
                      "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
                      }
                    },
                    "criticToken": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 128
                    }
                  },
                  "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"
                }
              }
            }
          },
          "422": {
            "description": "agent_daily_cap_exceeded: Called with an agent token whose grant's daily credit cap cannot cover this call's estimate.",
            "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": []
          },
          {
            "oauth2": ["propose", "generate"]
          }
        ],
        "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": {
                        "$ref": "#/components/schemas/DocumentSummary"
                      },
                      "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"]
                            }
                          ]
                        }
                      },
                      "capabilities": {
                        "type": "object",
                        "properties": {
                          "localSegmentation": {
                            "type": "boolean"
                          },
                          "localSegmentMask": {
                            "type": "boolean"
                          }
                        },
                        "required": ["localSegmentation"]
                      },
                      "presets": {
                        "maxItems": 32,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 60
                            },
                            "layers": {
                              "minItems": 1,
                              "maxItems": 16,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "adjustment": {
                                    "$ref": "#/components/schemas/Adjustment"
                                  },
                                  "opacity": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1
                                  }
                                },
                                "required": ["name", "adjustment"],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": ["name", "layers"],
                          "additionalProperties": false
                        }
                      }
                    },
                    "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"
                }
              }
            }
          },
          "422": {
            "description": "agent_daily_cap_exceeded: Called with an agent token whose grant's daily credit cap cannot cover this call's estimate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/skill": {
      "post": {
        "operationId": "runSkill",
        "summary": "Run one recorded skill against the document as one reviewable proposal, deposited in its inbox; a role that does not resolve comes back as a question.",
        "tags": ["Agent"],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": ["propose", "generate"]
          }
        ],
        "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}$"
                  },
                  "manifest": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "inputs": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  },
                  "selection": {
                    "type": "object",
                    "properties": {
                      "nodes": {
                        "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}$"
                        }
                      }
                    },
                    "required": ["nodes"]
                  },
                  "context": {
                    "type": "object",
                    "properties": {
                      "headRevision": {
                        "type": "string",
                        "pattern": "^rev_[1-9][0-9]*$"
                      },
                      "summary": {
                        "$ref": "#/components/schemas/DocumentSummary"
                      },
                      "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"]
                            }
                          ]
                        }
                      },
                      "capabilities": {
                        "type": "object",
                        "properties": {
                          "localSegmentation": {
                            "type": "boolean"
                          },
                          "localSegmentMask": {
                            "type": "boolean"
                          }
                        },
                        "required": ["localSegmentation"]
                      },
                      "presets": {
                        "maxItems": 32,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 60
                            },
                            "layers": {
                              "minItems": 1,
                              "maxItems": 16,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "adjustment": {
                                    "$ref": "#/components/schemas/Adjustment"
                                  },
                                  "opacity": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1
                                  }
                                },
                                "required": ["name", "adjustment"],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": ["name", "layers"],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": ["headRevision", "summary"]
                  }
                },
                "required": ["documentId", "manifest", "context"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Run one recorded skill against the document as one reviewable proposal, deposited in its inbox; a role that does not resolve comes back as a question.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "object",
                      "properties": {
                        "interpretation": {
                          "type": "string"
                        },
                        "proposal": {
                          "anyOf": [
                            {
                              "$ref": "#/components/schemas/Proposal"
                            },
                            {
                              "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"
                                  }
                                ]
                              },
                              "restyle": {
                                "type": "boolean",
                                "const": true
                              }
                            },
                            "required": ["kind", "prompt", "requiresMask", "params"],
                            "additionalProperties": false
                          }
                        },
                        "localRequests": {
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "remove_background"
                                  },
                                  "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}$"
                                  },
                                  "at": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "combine": {
                                    "type": "string",
                                    "enum": ["replace", "add", "subtract"]
                                  },
                                  "feather": {
                                    "type": "number",
                                    "minimum": 0
                                  }
                                },
                                "required": ["kind", "node", "at", "combine", "feather"],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "segment_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}$"
                                  },
                                  "source": {
                                    "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}$"
                                  },
                                  "at": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "segment": {
                                    "type": "string",
                                    "enum": ["subject", "background"]
                                  },
                                  "combine": {
                                    "type": "string",
                                    "enum": ["replace", "add", "subtract", "intersect"]
                                  }
                                },
                                "required": ["kind", "node", "at", "segment", "combine"],
                                "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
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "show_channel"
                                  },
                                  "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}$"
                                  },
                                  "channel": {
                                    "type": "string",
                                    "enum": ["r", "g", "b", "a"]
                                  }
                                },
                                "required": ["type", "node", "channel"],
                                "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"
                          }
                        },
                        "lane": {
                          "type": "string",
                          "enum": ["cloud", "fast", "ollama", "browser"]
                        },
                        "route": {
                          "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
                          }
                        },
                        "criticToken": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 128
                        }
                      },
                      "required": [
                        "interpretation",
                        "proposal",
                        "jobRequests",
                        "viewChanges",
                        "questions",
                        "blocked",
                        "outcome",
                        "truncated",
                        "usage"
                      ],
                      "additionalProperties": false
                    },
                    "toolFailures": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "deposited": {
                      "type": "boolean"
                    },
                    "inboxItemId": {
                      "type": ["string", "null"]
                    },
                    "spend": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "declaredMaxUsd": {
                              "type": "number",
                              "minimum": 0
                            },
                            "jobsUsd": {
                              "type": "number",
                              "minimum": 0
                            }
                          },
                          "required": ["declaredMaxUsd", "jobsUsd"],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": ["result", "toolFailures", "deposited", "inboxItemId", "spend"],
                  "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": "skill_run_duplicate: A run with this Idempotency-Key has already reserved its spend. Retry with a new key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "invalid_manifest: The manifest is not a valid SkillManifest.\nskill_spend_exceeds_declaration: The run, as compiled and priced now, would cost more than the manifest's spend.declaredMaxUsd. Refused before anything is reserved.\nagent_daily_cap_exceeded: Called with an agent token whose grant's daily credit cap cannot cover the skill's declaredMaxUsd.\nspend_cap_exceeded: The account's spending cap cannot cover the skill's declaredMaxUsd.",
            "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": []
          },
          {
            "oauth2": ["propose"]
          }
        ],
        "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": []
          },
          {
            "oauth2": ["propose"]
          }
        ],
        "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": []
          },
          {
            "oauth2": ["propose"]
          }
        ],
        "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/account": {
      "delete": {
        "operationId": "deleteAccount",
        "summary": "Delete this account: every document, backup, asset, publication, skill, preset and session it owns. Confirm with the account email. Refused while a job is running.",
        "tags": ["Auth"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "confirm": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 320
                  }
                },
                "required": ["confirm"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Delete this account: every document, backup, asset, publication, skill, preset and session it owns. Confirm with the account email. Refused while a job is running.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "deleted": {
                      "type": "boolean",
                      "const": true
                    },
                    "objects": {
                      "type": "object",
                      "properties": {
                        "assets": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "published": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": ["assets", "published"],
                      "additionalProperties": false
                    },
                    "rows": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      }
                    }
                  },
                  "required": ["deleted", "objects", "rows"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "confirmation_mismatch: The confirmation does not match the account email.",
            "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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": "account_busy: A job is in flight or a spend is held; try again once it finishes.",
            "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. The refresh token is set as the HttpOnly pb_refresh cookie.",
        "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. The refresh token is set as the HttpOnly pb_refresh cookie.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "accessToken": {
                      "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", "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"
                }
              }
            }
          },
          "403": {
            "description": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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"],
        "parameters": [
          {
            "name": "returnTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          },
          {
            "name": "nonce",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          }
        ],
        "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/logout": {
      "post": {
        "operationId": "signOut",
        "summary": "Sign out everywhere: revoke every access and refresh token issued to the account behind this refresh token. Only the current token does; a spent one ends just its own session, and a manual token only itself. A browser sends X-PaintBox-Refresh: 1 and no token, and the pb_refresh cookie is read and cleared.",
        "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
                  }
                }
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "Sign out everywhere: revoke every access and refresh token issued to the account behind this refresh token. Only the current token does; a spent one ends just its own session, and a manual token only itself. A browser sends X-PaintBox-Refresh: 1 and no token, and the pb_refresh cookie is read and cleared."
          },
          "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/manual-tokens": {
      "get": {
        "operationId": "listManualTokens",
        "summary": "List the live manual tokens on this account, with when each was minted and last used.",
        "tags": ["Auth"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "List the live manual tokens on this account, with when each was minted and last used.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "tokens": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "lastUsedAt": {
                            "type": "string"
                          },
                          "expiresAt": {
                            "type": "string"
                          }
                        },
                        "required": ["id", "label", "createdAt", "lastUsedAt", "expiresAt"],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["tokens"],
                  "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createManualToken",
        "summary": "Mint a manual token: a full-access refresh token that does not rotate, for a client that cannot sign in. Shown once; it lasts 30 days, until revoked, or until the account signs out everywhere.",
        "tags": ["Auth"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  }
                },
                "required": ["label"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Mint a manual token: a full-access refresh token that does not rotate, for a client that cannot sign in. Shown once; it lasts 30 days, until revoked, or until the account signs out everywhere.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "lastUsedAt": {
                          "type": "string"
                        },
                        "expiresAt": {
                          "type": "string"
                        }
                      },
                      "required": ["id", "label", "createdAt", "lastUsedAt", "expiresAt"],
                      "additionalProperties": false
                    },
                    "refreshToken": {
                      "type": "string"
                    }
                  },
                  "required": ["token", "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"
                }
              }
            }
          },
          "401": {
            "description": "Authentication is missing, expired, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "403": {
            "description": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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": "manual_token_limit: The account already holds 10 live manual tokens.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: More than 10 manual tokens minted in the last hour.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/manual-tokens/{id}/revoke": {
      "post": {
        "operationId": "revokeManualToken",
        "summary": "Revoke one manual token. The browser session and every other token keep working.",
        "tags": ["Auth"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoke one manual token. The browser session and every other token keep working.",
            "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"
                }
              }
            }
          },
          "403": {
            "description": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No live manual token with this id belongs to the caller.",
            "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/me": {
      "get": {
        "operationId": "getCurrentUser",
        "summary": "Return the authenticated user, including whether their account can pay for AI work.",
        "tags": ["Auth"],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": ["propose"]
          }
        ],
        "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. Each browser refresh token works once: presenting one already exchanged signs the session out. A manual token does not rotate and comes back as itself. A browser sends X-PaintBox-Refresh: 1 and gets the rotated token as the pb_refresh cookie, read from that cookie when the body has none; any other caller exchanges it in the body.",
        "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
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Exchange a refresh token for a new access/refresh pair. Each browser refresh token works once: presenting one already exchanged signs the session out. A manual token does not rotate and comes back as itself. A browser sends X-PaintBox-Refresh: 1 and gets the rotated token as the pb_refresh cookie, read from that cookie when the body has none; any other caller exchanges it in the body.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "accessToken": {
                      "type": "string"
                    },
                    "refreshToken": {
                      "type": "string"
                    }
                  },
                  "required": ["accessToken"],
                  "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}/backup": {
      "get": {
        "operationId": "getDocumentBackup",
        "summary": "Issue a short-lived presigned GET for a document backup: the newest, or the one named by sha256.",
        "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": "sha256",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^[0-9a-f]{64}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Issue a short-lived presigned GET for a document backup: the newest, or the one named by sha256.",
            "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
                    },
                    "backup": {
                      "type": "object",
                      "properties": {
                        "sha256": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "revision": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "sizeBytes": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "createdAt": {
                          "type": "string"
                        }
                      },
                      "required": ["sha256", "revision", "name", "sizeBytes", "createdAt"],
                      "additionalProperties": false
                    },
                    "backups": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "sha256": {
                            "type": "string",
                            "pattern": "^[0-9a-f]{64}$"
                          },
                          "revision": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "sizeBytes": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "createdAt": {
                            "type": "string"
                          }
                        },
                        "required": ["sha256", "revision", "name", "sizeBytes", "createdAt"],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["url", "expiresInSeconds", "backup", "backups"],
                  "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "not_found: The document belongs to another account, or has no backup.",
            "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}/backup/complete": {
      "post": {
        "operationId": "completeDocumentBackup",
        "summary": "Verify an uploaded snapshot against its sha256 and size, record it, and prune to the newest backups.",
        "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": "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": {
                  "sha256": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "sizeBytes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 67108864
                  },
                  "revision": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": ["sha256", "sizeBytes", "revision", "name"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verify an uploaded snapshot against its sha256 and size, record it, and prune to the newest backups.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "backup": {
                      "type": "object",
                      "properties": {
                        "sha256": {
                          "type": "string",
                          "pattern": "^[0-9a-f]{64}$"
                        },
                        "revision": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "sizeBytes": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "createdAt": {
                          "type": "string"
                        }
                      },
                      "required": ["sha256", "revision", "name", "sizeBytes", "createdAt"],
                      "additionalProperties": false
                    },
                    "kept": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": ["backup", "kept"],
                  "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "not_found: The document belongs to another account, or has no backup.\nobject_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.\nhash_mismatch: The stored object does not hash to the declared sha256.\nbackup_quota_exceeded: Keeping this backup would pass the account quota.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/documents/{id}/backup/upload-url": {
      "post": {
        "operationId": "createDocumentBackupUploadUrl",
        "summary": "Issue a presigned PUT for one snapshot backup, pinned to its key and byte length.",
        "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": "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": {
                  "sha256": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "sizeBytes": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 67108864
                  },
                  "revision": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": ["sha256", "sizeBytes", "revision", "name"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Issue a presigned PUT for one snapshot backup, pinned to its key and byte length.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "alreadyStored": {
                      "type": "boolean"
                    },
                    "url": {
                      "type": "string"
                    },
                    "method": {
                      "type": "string",
                      "const": "PUT"
                    },
                    "headers": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  },
                  "required": ["alreadyStored"],
                  "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "not_found: The document belongs to another account, or has no backup.",
            "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": "backup_quota_exceeded: Keeping this backup would pass the account quota.",
            "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": {
                    "$ref": "#/components/schemas/DocumentSummary"
                  },
                  "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"
                }
              }
            }
          },
          "403": {
            "description": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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"
                }
              }
            }
          },
          "403": {
            "description": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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"
                }
              }
            }
          },
          "403": {
            "description": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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": []
          },
          {
            "oauth2": ["propose"]
          }
        ],
        "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": {
                        "$ref": "#/components/schemas/Job"
                      }
                    }
                  },
                  "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/documents/backups": {
      "get": {
        "operationId": "listDocumentBackups",
        "summary": "List the backed-up documents of the caller, most recently backed up first.",
        "tags": ["Documents"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "List the backed-up documents of the caller, most recently backed up first.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "documents": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "documentId": {
                            "type": "string"
                          },
                          "latest": {
                            "type": "object",
                            "properties": {
                              "sha256": {
                                "type": "string",
                                "pattern": "^[0-9a-f]{64}$"
                              },
                              "revision": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "sizeBytes": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "createdAt": {
                                "type": "string"
                              }
                            },
                            "required": ["sha256", "revision", "name", "sizeBytes", "createdAt"],
                            "additionalProperties": false
                          },
                          "count": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": ["documentId", "latest", "count"],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["documents"],
                  "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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": []
          },
          {
            "oauth2": ["propose", "generate"]
          }
        ],
        "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",
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "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": "reservation_released: An earlier attempt with this Idempotency-Key released its reservation mid-request; retry.",
            "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": "agent_daily_cap_exceeded: Called with an agent token whose grant's daily credit cap cannot cover this call's estimate.\nspend_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": []
          },
          {
            "oauth2": ["propose"]
          }
        ],
        "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",
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "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": []
          },
          {
            "oauth2": ["propose", "generate"]
          }
        ],
        "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",
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "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",
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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/oauth/authorize/approve": {
      "post": {
        "operationId": "approveOAuthAuthorizeRequest",
        "summary": "Approve an OAuth authorization request as the signed-in user; returns the redirect carrying the code.",
        "tags": ["Oauth"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "response_type": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "client_id": {
                    "type": "string",
                    "maxLength": 256
                  },
                  "redirect_uri": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "code_challenge": {
                    "type": "string",
                    "maxLength": 256
                  },
                  "code_challenge_method": {
                    "type": "string",
                    "maxLength": 16
                  },
                  "state": {
                    "type": "string",
                    "maxLength": 4096
                  },
                  "scope": {
                    "type": "string",
                    "maxLength": 512
                  },
                  "resource": {
                    "type": "string",
                    "maxLength": 2048
                  },
                  "approvedScopes": {
                    "maxItems": 8,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 32
                    }
                  },
                  "grantName": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "dailyCapUsd": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Approve an OAuth authorization request as the signed-in user; returns the redirect carrying the code.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "redirectTo": {
                      "type": "string"
                    }
                  },
                  "required": ["redirectTo"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "invalid_request: The authorization request no longer validates.",
            "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.\nbrowser_session_required: Called with an agent token.",
            "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"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: Too many approvals from this account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/oauth/authorize/request": {
      "get": {
        "operationId": "describeOAuthAuthorizeRequest",
        "summary": "Validate an OAuth authorization request for the consent page.",
        "tags": ["Oauth"],
        "parameters": [
          {
            "name": "response_type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 64
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "redirect_uri",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "name": "code_challenge",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "code_challenge_method",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 16
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 4096
            }
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 512
            }
          },
          {
            "name": "resource",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Validate an OAuth authorization request for the consent page.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean",
                          "const": true
                        },
                        "client": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "verified": {
                              "type": "boolean"
                            },
                            "documentUrl": {
                              "type": ["string", "null"]
                            },
                            "stale": {
                              "type": "boolean"
                            }
                          },
                          "required": ["id", "name", "verified", "documentUrl", "stale"],
                          "additionalProperties": false
                        },
                        "redirect": {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": ["loopback", "https"]
                            },
                            "host": {
                              "type": "string"
                            }
                          },
                          "required": ["kind", "host"],
                          "additionalProperties": false
                        },
                        "scopes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              },
                              "requested": {
                                "type": "boolean"
                              },
                              "required": {
                                "type": "boolean"
                              }
                            },
                            "required": ["name", "description", "requested", "required"],
                            "additionalProperties": false
                          }
                        },
                        "resource": {
                          "type": "string"
                        },
                        "dailyCap": {
                          "type": "object",
                          "properties": {
                            "defaultUsd": {
                              "type": "number"
                            },
                            "presetsUsd": {
                              "type": "array",
                              "items": {
                                "type": "number"
                              }
                            },
                            "maxUsd": {
                              "type": "number"
                            }
                          },
                          "required": ["defaultUsd", "presetsUsd", "maxUsd"],
                          "additionalProperties": false
                        },
                        "denyUrl": {
                          "type": "string"
                        }
                      },
                      "required": ["ok", "client", "redirect", "scopes", "resource", "dailyCap", "denyUrl"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean",
                          "const": false
                        },
                        "redirectTo": {
                          "type": "string"
                        }
                      },
                      "required": ["ok", "redirectTo"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "ok": {
                          "type": "boolean",
                          "const": false
                        },
                        "error": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        }
                      },
                      "required": ["ok", "error", "description"],
                      "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/oauth/grants": {
      "get": {
        "operationId": "listOAuthGrants",
        "summary": "List the agents this account has authorized, with when each was created and last used.",
        "tags": ["Oauth"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "List the agents this account has authorized, with when each was created and last used.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "grants": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "clientId": {
                            "type": "string"
                          },
                          "clientName": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "verified": {
                            "type": "boolean"
                          },
                          "scopes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "resource": {
                            "type": "string"
                          },
                          "dailyCapUsd": {
                            "type": "number"
                          },
                          "spentTodayUsd": {
                            "type": "number"
                          },
                          "spendResetsAt": {
                            "type": ["string", "null"]
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "lastUsedAt": {
                            "type": "string"
                          },
                          "expiresAt": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": ["active", "revoked", "expired"]
                          },
                          "revokedAt": {
                            "type": ["string", "null"]
                          },
                          "revokedReason": {
                            "type": ["string", "null"]
                          }
                        },
                        "required": [
                          "id",
                          "clientId",
                          "clientName",
                          "name",
                          "verified",
                          "scopes",
                          "resource",
                          "dailyCapUsd",
                          "spentTodayUsd",
                          "spendResetsAt",
                          "createdAt",
                          "lastUsedAt",
                          "expiresAt",
                          "status",
                          "revokedAt",
                          "revokedReason"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["grants"],
                  "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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/oauth/grants/{id}": {
      "patch": {
        "operationId": "updateOAuthGrant",
        "summary": "Rename one authorized agent, or change the credits it may spend per day. Takes effect on its next call.",
        "tags": ["Oauth"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "dailyCapUsd": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 100
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Rename one authorized agent, or change the credits it may spend per day. Takes effect on its next call.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "grant": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "clientId": {
                          "type": "string"
                        },
                        "clientName": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "verified": {
                          "type": "boolean"
                        },
                        "scopes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "resource": {
                          "type": "string"
                        },
                        "dailyCapUsd": {
                          "type": "number"
                        },
                        "spentTodayUsd": {
                          "type": "number"
                        },
                        "spendResetsAt": {
                          "type": ["string", "null"]
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "lastUsedAt": {
                          "type": "string"
                        },
                        "expiresAt": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": ["active", "revoked", "expired"]
                        },
                        "revokedAt": {
                          "type": ["string", "null"]
                        },
                        "revokedReason": {
                          "type": ["string", "null"]
                        }
                      },
                      "required": [
                        "id",
                        "clientId",
                        "clientName",
                        "name",
                        "verified",
                        "scopes",
                        "resource",
                        "dailyCapUsd",
                        "spentTodayUsd",
                        "spendResetsAt",
                        "createdAt",
                        "lastUsedAt",
                        "expiresAt",
                        "status",
                        "revokedAt",
                        "revokedReason"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["grant"],
                  "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No grant with this id belongs to the caller.",
            "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/oauth/grants/{id}/revoke": {
      "post": {
        "operationId": "revokeOAuthGrant",
        "summary": "Revoke one authorized agent. Its refresh token and every access token it holds stop working at once.",
        "tags": ["Oauth"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoke one authorized agent. Its refresh token and every access token it holds stop working at once.",
            "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"
                }
              }
            }
          },
          "403": {
            "description": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "not_found: No grant with this id belongs to the caller.",
            "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/oauth/metadata/authorization-server": {
      "get": {
        "operationId": "getOAuthServerMetadata",
        "summary": "OAuth 2.1 authorization server metadata (RFC 8414). Also served at /.well-known/oauth-authorization-server.",
        "tags": ["Oauth"],
        "responses": {
          "200": {
            "description": "OAuth 2.1 authorization server metadata (RFC 8414). Also served at /.well-known/oauth-authorization-server.",
            "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"
                }
              }
            }
          }
        }
      }
    },
    "/api/oauth/metadata/protected-resource": {
      "get": {
        "operationId": "getOAuthResourceMetadata",
        "summary": "Protected resource metadata (RFC 9728) for the MCP endpoint or the whole API. Also served at /.well-known/oauth-protected-resource/api/mcp and /.well-known/oauth-protected-resource/api.",
        "tags": ["Oauth"],
        "parameters": [
          {
            "name": "resource",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["mcp", "api"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Protected resource metadata (RFC 9728) for the MCP endpoint or the whole API. Also served at /.well-known/oauth-protected-resource/api/mcp and /.well-known/oauth-protected-resource/api.",
            "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"
                }
              }
            }
          }
        }
      }
    },
    "/api/oauth/register": {
      "post": {
        "operationId": "registerOAuthClient",
        "summary": "Dynamic client registration (RFC 7591). JSON body with redirect_uris (https, or http on a loopback address with any port) and an optional client_name. Every client is public: PKCE, no secret.",
        "tags": ["Oauth"],
        "responses": {
          "201": {
            "description": "Dynamic client registration (RFC 7591). JSON body with redirect_uris (https, or http on a loopback address with any port) and an optional client_name. Every client is public: PKCE, no secret.",
            "content": {
              "application/octet-stream": {}
            }
          },
          "400": {
            "description": "invalid_redirect_uri: A redirect URI is neither https nor loopback http.",
            "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"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: Too many registrations from this address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/oauth/revoke": {
      "post": {
        "operationId": "revokeOAuthToken",
        "summary": "Token revocation (RFC 7009). Form-encoded token (refresh or access); revokes the whole grant. Always 200.",
        "tags": ["Oauth"],
        "responses": {
          "200": {
            "description": "Token revocation (RFC 7009). Form-encoded token (refresh or access); revokes the whole grant. Always 200.",
            "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"
                }
              }
            }
          }
        }
      }
    },
    "/api/oauth/token": {
      "post": {
        "operationId": "exchangeOAuthToken",
        "summary": "OAuth token endpoint. Form-encoded: grant_type=authorization_code with code, code_verifier, redirect_uri, client_id and resource; or grant_type=refresh_token with refresh_token and client_id. Refresh tokens rotate on every use, and replaying a rotated one revokes the grant.",
        "tags": ["Oauth"],
        "responses": {
          "200": {
            "description": "OAuth token endpoint. Form-encoded: grant_type=authorization_code with code, code_verifier, redirect_uri, client_id and resource; or grant_type=refresh_token with refresh_token and client_id. Refresh tokens rotate on every use, and replaying a rotated one revokes the grant.",
            "content": {
              "application/octet-stream": {}
            }
          },
          "400": {
            "description": "invalid_grant: The code or refresh token is invalid, used, or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "401": {
            "description": "invalid_client: client_id is missing or unknown.",
            "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"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: Too many token requests from this address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/presets": {
      "get": {
        "operationId": "listPresets",
        "summary": "List the caller's saved develop presets, oldest first.",
        "tags": ["Presets"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "List the caller's saved develop presets, oldest first.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "presets": {
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 60
                          },
                          "layers": {
                            "minItems": 1,
                            "maxItems": 16,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "adjustment": {
                                  "$ref": "#/components/schemas/Adjustment"
                                },
                                "opacity": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1
                                }
                              },
                              "required": ["name", "adjustment"],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": ["name", "layers"],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["presets"],
                  "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "savePreset",
        "summary": "Save a develop preset, replacing the caller's preset of the same name.",
        "tags": ["Presets"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "preset": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "layers": {
                        "minItems": 1,
                        "maxItems": 16,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "adjustment": {
                              "$ref": "#/components/schemas/Adjustment"
                            },
                            "opacity": {
                              "type": "number",
                              "minimum": 0,
                              "maximum": 1
                            }
                          },
                          "required": ["name", "adjustment"],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": ["name", "layers"],
                    "additionalProperties": false
                  }
                },
                "required": ["preset"]
              }
            }
          }
        },
        "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": "Save a develop preset, replacing the caller's preset of the same name.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "outcome": {
                      "type": "string",
                      "enum": ["saved", "replaced"]
                    },
                    "presets": {
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 60
                          },
                          "layers": {
                            "minItems": 1,
                            "maxItems": 16,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "adjustment": {
                                  "$ref": "#/components/schemas/Adjustment"
                                },
                                "opacity": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1
                                }
                              },
                              "required": ["name", "adjustment"],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": ["name", "layers"],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["outcome", "presets"],
                  "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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": "preset_quota_exceeded: The caller already keeps 32 presets.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deletePreset",
        "summary": "Delete one of the caller's develop presets by name; deleting a missing name is not an error.",
        "tags": ["Presets"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            }
          },
          {
            "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": "Delete one of the caller's develop presets by name; deleting a missing name is not an error.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "removed": {
                      "type": "boolean"
                    },
                    "presets": {
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 60
                          },
                          "layers": {
                            "minItems": 1,
                            "maxItems": 16,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "adjustment": {
                                  "$ref": "#/components/schemas/Adjustment"
                                },
                                "opacity": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1
                                }
                              },
                              "required": ["name", "adjustment"],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": ["name", "layers"],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["removed", "presets"],
                  "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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/presets/import": {
      "post": {
        "operationId": "importPresets",
        "summary": "Merge presets saved in a browser into the account: names the caller already has are kept as they are, and nothing past the quota is added.",
        "tags": ["Presets"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "presets": {
                    "maxItems": 32,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 60
                        },
                        "layers": {
                          "minItems": 1,
                          "maxItems": 16,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "adjustment": {
                                "$ref": "#/components/schemas/Adjustment"
                              },
                              "opacity": {
                                "type": "number",
                                "minimum": 0,
                                "maximum": 1
                              }
                            },
                            "required": ["name", "adjustment"],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": ["name", "layers"],
                      "additionalProperties": false
                    }
                  }
                },
                "required": ["presets"]
              }
            }
          }
        },
        "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": "Merge presets saved in a browser into the account: names the caller already has are kept as they are, and nothing past the quota is added.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "presets": {
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 60
                          },
                          "layers": {
                            "minItems": 1,
                            "maxItems": 16,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "name": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "adjustment": {
                                  "$ref": "#/components/schemas/Adjustment"
                                },
                                "opacity": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1
                                }
                              },
                              "required": ["name", "adjustment"],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": ["name", "layers"],
                        "additionalProperties": false
                      }
                    },
                    "imported": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "skipped": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": ["presets", "imported", "skipped"],
                  "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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/prompt/enhance": {
      "post": {
        "operationId": "enhancePrompt",
        "summary": "Rewrite a rough image prompt into a clearer, more specific one. Spends a small amount of Bike4Mind credit; the caller decides whether to use the result.",
        "tags": ["Prompt"],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": ["propose", "generate"]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                  }
                },
                "required": ["prompt"]
              }
            }
          }
        },
        "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": "Rewrite a rough image prompt into a clearer, more specific one. Spends a small amount of Bike4Mind credit; the caller decides whether to use the result.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "prompt": {
                      "type": "string"
                    },
                    "usage": {
                      "type": "object",
                      "properties": {
                        "usdCost": {
                          "type": "number"
                        }
                      },
                      "required": ["usdCost"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["prompt", "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": "agent_daily_cap_exceeded: Called with an agent token whose grant's daily credit cap cannot cover this call's estimate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "429": {
            "description": "rate_limited: Too many enhancements in the last minute.",
            "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"
                }
              }
            }
          },
          "403": {
            "description": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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"
                }
              }
            }
          },
          "403": {
            "description": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.\naction_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"
                }
              }
            }
          },
          "403": {
            "description": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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"
                }
              }
            }
          },
          "403": {
            "description": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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"
                }
              }
            }
          },
          "403": {
            "description": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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"
                }
              }
            }
          },
          "403": {
            "description": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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/skills": {
      "get": {
        "operationId": "listSkills",
        "summary": "List the caller's skills, oldest first, each at its newest version, with whether it is pinned.",
        "tags": ["Skills"],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": ["propose"]
          }
        ],
        "responses": {
          "200": {
            "description": "List the caller's skills, oldest first, each at its newest version, with whether it is pinned.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "skills": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "slug": {
                            "type": "string",
                            "maxLength": 64,
                            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                          },
                          "version": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "title": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80
                          },
                          "description": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 500
                          },
                          "tags": {
                            "maxItems": 16,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "maxLength": 64,
                              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                            }
                          },
                          "inputSchema": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          "spend": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "declaredMaxUsd": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1000
                                  }
                                },
                                "required": ["declaredMaxUsd"],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "hasAgentSteps": {
                            "type": "boolean"
                          },
                          "id": {
                            "type": "string"
                          },
                          "pinned": {
                            "type": "boolean"
                          },
                          "forked": {
                            "type": "boolean"
                          },
                          "author": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "updatedAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "slug",
                          "version",
                          "title",
                          "description",
                          "tags",
                          "inputSchema",
                          "spend",
                          "hasAgentSteps",
                          "id",
                          "pinned",
                          "forked",
                          "author",
                          "createdAt",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["skills"],
                  "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"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "saveSkillVersion",
        "summary": "Publish a manifest as the next version of the caller's skill with its slug, creating the skill if it is new. The server assigns the version; earlier versions never change.",
        "tags": ["Skills"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "manifest": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                },
                "required": ["manifest"]
              }
            }
          }
        },
        "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 a manifest as the next version of the caller's skill with its slug, creating the skill if it is new. The server assigns the version; earlier versions never change.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "skill": {
                      "type": "object",
                      "properties": {
                        "slug": {
                          "type": "string",
                          "maxLength": 64,
                          "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 9007199254740991
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "tags": {
                          "maxItems": 16,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "maxLength": 64,
                            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                          }
                        },
                        "inputSchema": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "spend": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "declaredMaxUsd": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1000
                                }
                              },
                              "required": ["declaredMaxUsd"],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "hasAgentSteps": {
                          "type": "boolean"
                        },
                        "id": {
                          "type": "string"
                        },
                        "pinned": {
                          "type": "boolean"
                        },
                        "forked": {
                          "type": "boolean"
                        },
                        "author": {
                          "type": "string"
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "slug",
                        "version",
                        "title",
                        "description",
                        "tags",
                        "inputSchema",
                        "spend",
                        "hasAgentSteps",
                        "id",
                        "pinned",
                        "forked",
                        "author",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    },
                    "manifest": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "created": {
                      "type": "boolean"
                    }
                  },
                  "required": ["skill", "manifest", "created"],
                  "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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": "skill_quota_exceeded: The caller already keeps 100 skills.\nskill_version_quota_exceeded: The skill already has 100 versions.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "invalid_manifest: The manifest is not a valid SkillManifest.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      }
    },
    "/api/skills/{slug}": {
      "get": {
        "operationId": "getSkill",
        "summary": "One of the caller's skills: the version asked for, or the newest, with its version history. A deleted skill's versions stay readable here.",
        "tags": ["Skills"],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": ["propose"]
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64,
              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
            }
          },
          {
            "name": "version",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "One of the caller's skills: the version asked for, or the newest, with its version history. A deleted skill's versions stay readable here.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "manifest": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "pinned": {
                      "type": "boolean"
                    },
                    "deleted": {
                      "type": "boolean"
                    },
                    "versions": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "version": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 9007199254740991
                          },
                          "title": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string"
                          }
                        },
                        "required": ["version", "title", "createdAt"],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["manifest", "pinned", "deleted", "versions"],
                  "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": "skill_not_found: The caller has no such skill or version.",
            "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"
                }
              }
            }
          }
        }
      },
      "patch": {
        "operationId": "updateSkill",
        "summary": "Pin or unpin one of the caller's skills. Pinned skills are offered to agents as tools of their own.",
        "tags": ["Skills"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64,
              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "pinned": {
                    "type": "boolean"
                  }
                },
                "required": ["pinned"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pin or unpin one of the caller's skills. Pinned skills are offered to agents as tools of their own.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "skill": {
                      "type": "object",
                      "properties": {
                        "slug": {
                          "type": "string",
                          "maxLength": 64,
                          "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                        },
                        "version": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 9007199254740991
                        },
                        "title": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "description": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 500
                        },
                        "tags": {
                          "maxItems": 16,
                          "type": "array",
                          "items": {
                            "type": "string",
                            "maxLength": 64,
                            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
                          }
                        },
                        "inputSchema": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        "spend": {
                          "anyOf": [
                            {
                              "type": "object",
                              "properties": {
                                "declaredMaxUsd": {
                                  "type": "number",
                                  "minimum": 0,
                                  "maximum": 1000
                                }
                              },
                              "required": ["declaredMaxUsd"],
                              "additionalProperties": false
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "hasAgentSteps": {
                          "type": "boolean"
                        },
                        "id": {
                          "type": "string"
                        },
                        "pinned": {
                          "type": "boolean"
                        },
                        "forked": {
                          "type": "boolean"
                        },
                        "author": {
                          "type": "string"
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "slug",
                        "version",
                        "title",
                        "description",
                        "tags",
                        "inputSchema",
                        "spend",
                        "hasAgentSteps",
                        "id",
                        "pinned",
                        "forked",
                        "author",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["skill"],
                  "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "404": {
            "description": "skill_not_found: The caller has no such skill.",
            "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": "skill_pin_limit: The caller already pinned 10 skills.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deleteSkill",
        "summary": "Delete one of the caller's skills from the library. Its versions stay readable for the history that names them; deleting a missing skill is not an error.",
        "tags": ["Skills"],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 64,
              "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
            }
          },
          {
            "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": "Delete one of the caller's skills from the library. Its versions stay readable for the history that names them; deleting a missing skill is not an error.",
            "content": {
              "application/json": {
                "schema": {
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
                  "type": "object",
                  "properties": {
                    "removed": {
                      "type": "boolean"
                    }
                  },
                  "required": ["removed"],
                  "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": "browser_sign_in_required: Refused to an access token minted from a manual token, as to an agent token.",
            "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/speak": {
      "post": {
        "operationId": "speakVoiceFeedback",
        "summary": "Speak one short status line back to a push-to-talk user. Returns the audio bytes; X-Tts-Provider names the provider that produced them.",
        "tags": ["Voice"],
        "security": [
          {
            "bearerAuth": []
          },
          {
            "oauth2": ["propose", "generate"]
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 160
                  },
                  "provider": {
                    "type": "string",
                    "enum": ["openai", "elevenlabs"]
                  }
                },
                "required": ["text"]
              }
            }
          }
        },
        "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": "Speak one short status line back to a push-to-talk user. Returns the audio bytes; X-Tts-Provider names the provider that produced them.",
            "content": {
              "audio/mpeg": {}
            }
          },
          "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": "agent_daily_cap_exceeded: Called with an agent token whose grant's daily credit cap cannot cover this call's estimate.\ninsufficient_credits: The Bike4Mind account has too few credits to synthesize speech.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "500": {
            "description": "Unhandled server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorEnvelope"
                }
              }
            }
          },
          "502": {
            "description": "speech_failed: Bike4Mind refused or failed the speech request.",
            "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": []
          },
          {
            "oauth2": ["propose", "generate"]
          }
        ],
        "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": "agent_daily_cap_exceeded: Called with an agent token whose grant's daily credit cap cannot cover this call's estimate.\npayload_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"
                }
              }
            }
          }
        }
      }
    }
  }
}
