{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/commentary-dev/json-schema/commentary-dev-project-agent-review-artifact-context-schema.json",
  "title": "ProjectAgentReviewArtifactContext",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/commentary-dev-review-sessions-api-openapi.yml#/components/schemas/ProjectAgentReviewArtifactContext",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "sessionRevisionId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512,
      "pattern": "^[^\\s]+$"
    },
    "target": {
      "$ref": "#/$defs/ProjectAgentExactTarget"
    },
    "file": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "maxLength": 1000,
          "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))[^\\\\\\u0000]+$"
        },
        {
          "type": "null"
        }
      ]
    },
    "anchor": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 500,
          "pattern": "^[^\\u0000-\\u001f]*$"
        },
        {
          "type": "null"
        }
      ]
    },
    "lineStart": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    },
    "lineEnd": {
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    },
    "mapping": {
      "type": "string",
      "maxLength": 650,
      "minLength": 1,
      "pattern": "^[^\\u0000-\\u001f]+$"
    },
    "mappedSource": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9
    }
  },
  "required": [
    "sessionRevisionId",
    "target"
  ],
  "$defs": {
    "ProjectAgentExactTarget": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "resource": {
          "$ref": "#/$defs/ProjectAgentResource"
        },
        "revisionId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512,
          "pattern": "^[^\\s]+$"
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "purpose": {
          "type": "string",
          "maxLength": 200
        }
      },
      "required": [
        "resource",
        "revisionId",
        "sha256"
      ]
    },
    "ProjectAgentResource": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "repository",
            "pull_request",
            "document",
            "draft_review",
            "form",
            "research_study",
            "knowledge_brain",
            "web_app_review",
            "project",
            "tracker",
            "review_package",
            "project_review_session",
            "source_snapshot"
          ]
        },
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512,
          "pattern": "^[^\\s]+$"
        }
      },
      "required": [
        "type",
        "id"
      ]
    }
  }
}