{
  "$defs": {
    "DiffSource": {
      "enum": [
        "github",
        "local-git"
      ],
      "type": "string"
    },
    "StackContextMemberOut": {
      "additionalProperties": false,
      "description": "One ``stack[]`` per-member section (bottom\u2192top order); text fields are file references\nunder ``context_dir/stack/<pr>/``.",
      "properties": {
        "pr": {
          "title": "Pr",
          "type": "integer"
        },
        "base_ref": {
          "title": "Base Ref",
          "type": "string"
        },
        "head_ref": {
          "title": "Head Ref",
          "type": "string"
        },
        "title": {
          "title": "Title",
          "type": "string"
        },
        "body": {
          "$ref": "#/$defs/TextFileRefOut"
        },
        "diff": {
          "$ref": "#/$defs/TextFileRefOut"
        },
        "plan_body": {
          "anyOf": [
            {
              "$ref": "#/$defs/TextFileRefOut"
            },
            {
              "type": "null"
            }
          ]
        },
        "diff_source": {
          "$ref": "#/$defs/DiffSource"
        }
      },
      "required": [
        "pr",
        "base_ref",
        "head_ref",
        "title",
        "body",
        "diff",
        "plan_body",
        "diff_source"
      ],
      "title": "StackContextMemberOut",
      "type": "object"
    },
    "TextFileRefOut": {
      "additionalProperties": false,
      "description": "One materialized text section: its absolute ``path`` plus the sizes a reviewer pages\nagainst \u2014 ``max_line_bytes`` is the longest line's UTF-8 length (compared against Pi's\nper-line ``read`` bound to pick the byte-slice fallback).",
      "properties": {
        "path": {
          "title": "Path",
          "type": "string"
        },
        "bytes": {
          "title": "Bytes",
          "type": "integer"
        },
        "lines": {
          "title": "Lines",
          "type": "integer"
        },
        "max_line_bytes": {
          "title": "Max Line Bytes",
          "type": "integer"
        }
      },
      "required": [
        "path",
        "bytes",
        "lines",
        "max_line_bytes"
      ],
      "title": "TextFileRefOut",
      "type": "object"
    }
  },
  "additionalProperties": false,
  "description": "The ``--stack`` envelope: the single-PR fields (describing the top PR) plus the\nadditive per-member sections and the combined-diff reference. A separate model so\nnon-stack calls stay byte-identical (no null stack keys).",
  "properties": {
    "success": {
      "title": "Success",
      "type": "boolean"
    },
    "error_type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Error Type"
    },
    "message": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Message"
    },
    "branch": {
      "title": "Branch",
      "type": "string"
    },
    "pr": {
      "title": "Pr",
      "type": "integer"
    },
    "base_ref": {
      "title": "Base Ref",
      "type": "string"
    },
    "head_ref": {
      "title": "Head Ref",
      "type": "string"
    },
    "title": {
      "title": "Title",
      "type": "string"
    },
    "context_dir": {
      "title": "Context Dir",
      "type": "string"
    },
    "body": {
      "$ref": "#/$defs/TextFileRefOut"
    },
    "diff": {
      "$ref": "#/$defs/TextFileRefOut"
    },
    "plan_body": {
      "anyOf": [
        {
          "$ref": "#/$defs/TextFileRefOut"
        },
        {
          "type": "null"
        }
      ]
    },
    "diff_source": {
      "$ref": "#/$defs/DiffSource"
    },
    "stack": {
      "items": {
        "$ref": "#/$defs/StackContextMemberOut"
      },
      "title": "Stack",
      "type": "array"
    },
    "combined_diff": {
      "$ref": "#/$defs/TextFileRefOut"
    }
  },
  "required": [
    "success",
    "error_type",
    "message",
    "branch",
    "pr",
    "base_ref",
    "head_ref",
    "title",
    "context_dir",
    "body",
    "diff",
    "plan_body",
    "diff_source",
    "stack",
    "combined_diff"
  ],
  "title": "PrReviewStackContextOut",
  "type": "object"
}
