{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/commentary-dev/json-schema/commentary-dev-project-agent-publication-manifest-schema.json",
  "title": "ProjectAgentPublicationManifest",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/commentary-dev-openapi.yml#/components/schemas/ProjectAgentPublicationManifest",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "sourceMappings": {
      "$ref": "#/$defs/ProjectAgentPackageSourceMappings"
    },
    "kind": {
      "type": "string",
      "enum": [
        "commentary_review_package"
      ]
    },
    "manifestVersion": {
      "const": 1
    },
    "title": {
      "type": "string",
      "maxLength": 200
    },
    "entryPage": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024,
      "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))[^\\\\\\u0000]+$"
    },
    "entryPageId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 512,
      "pattern": "^[^\\s]+$"
    },
    "pages": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "pattern": "^[^\\s]+$"
          },
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))[^\\\\\\u0000]+$"
          },
          "title": {
            "type": "string",
            "maxLength": 200
          },
          "uploadId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "pattern": "^[^\\s]+$"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "mime": {
            "type": "string",
            "maxLength": 200
          },
          "bytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 2097152
          }
        },
        "required": [
          "id",
          "path"
        ]
      },
      "maxItems": 10000,
      "minItems": 1
    },
    "assets": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))[^\\\\\\u0000]+$"
          },
          "uploadId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 512,
            "pattern": "^[^\\s]+$"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "mime": {
            "type": "string",
            "maxLength": 200
          },
          "bytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 26214400
          }
        },
        "required": [
          "path"
        ]
      },
      "maxItems": 10000,
      "minItems": 0
    },
    "trustTier": {
      "type": "string",
      "enum": [
        "static",
        "executable_bundle"
      ]
    },
    "purpose": {
      "type": "string",
      "maxLength": 2000
    },
    "navigation": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ProjectAgentPackageNavigation"
      },
      "maxItems": 10000,
      "minItems": 0
    },
    "relatedResources": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ProjectAgentPackageReference"
      },
      "maxItems": 1000,
      "minItems": 0
    },
    "sourceReferences": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ProjectAgentPackageSourceReference"
      },
      "maxItems": 1000,
      "minItems": 0
    },
    "evidenceReferences": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ProjectAgentPackageReference"
      },
      "maxItems": 1000,
      "minItems": 0
    },
    "deletePaths": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 1024,
        "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))[^\\\\\\u0000]+$"
      },
      "maxItems": 10000,
      "minItems": 0,
      "uniqueItems": true
    }
  },
  "required": [
    "kind",
    "manifestVersion"
  ],
  "$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"
      ]
    },
    "ProjectAgentPackageNavigation": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "pageId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512,
          "pattern": "^[^\\s]+$"
        },
        "label": {
          "type": "string",
          "maxLength": 200
        },
        "children": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ProjectAgentPackageNavigation"
          },
          "maxItems": 10000,
          "minItems": 0
        }
      },
      "required": [
        "pageId",
        "label"
      ]
    },
    "ProjectAgentPackageReference": {
      "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]+$"
        },
        "revisionId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512,
          "pattern": "^[^\\s]+$"
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "purpose": {
          "type": "string",
          "maxLength": 2000
        }
      },
      "required": [
        "type",
        "id"
      ]
    },
    "ProjectAgentPackageSourceMapping": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "component",
            "api_operation",
            "api_schema"
          ]
        },
        "id": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$"
        },
        "occurrenceId": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$"
        },
        "pageId": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$"
        },
        "anchorId": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$"
        },
        "pageSha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "title": {
          "type": "string",
          "maxLength": 200,
          "minLength": 1
        },
        "explanation": {
          "type": "string",
          "maxLength": 2000
        },
        "provenance": {
          "type": "string",
          "enum": [
            "human_authored",
            "agent_suggestion"
          ]
        },
        "visualBinding": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "mermaid_node",
                "markup_marker"
              ]
            },
            "key": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,199}$"
            }
          },
          "required": [
            "kind",
            "key"
          ]
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "target": {
                "$ref": "#/$defs/ProjectAgentExactTarget"
              },
              "path": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1024,
                "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))[^\\\\\\u0000]+$"
              },
              "blobHash": {
                "type": "string",
                "pattern": "^[a-f0-9]{40,64}$"
              },
              "sha256": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "lineStart": {
                "type": "integer",
                "minimum": 1,
                "maximum": 10000000
              },
              "lineEnd": {
                "type": "integer",
                "minimum": 1,
                "maximum": 10000000
              }
            },
            "required": [
              "target",
              "path",
              "blobHash",
              "sha256",
              "lineStart",
              "lineEnd"
            ]
          },
          "maxItems": 10,
          "minItems": 0
        },
        "relations": {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "requirement",
                      "claim",
                      "evidence"
                    ]
                  },
                  "revisionId": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 512,
                    "pattern": "^[^\\s]+$"
                  }
                },
                "required": [
                  "kind",
                  "revisionId"
                ]
              },
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "resource"
                    ]
                  },
                  "target": {
                    "$ref": "#/$defs/ProjectAgentExactTarget"
                  }
                },
                "required": [
                  "kind",
                  "target"
                ]
              }
            ]
          },
          "maxItems": 10,
          "minItems": 0
        }
      },
      "required": [
        "kind",
        "id",
        "occurrenceId",
        "pageId",
        "anchorId",
        "pageSha256",
        "title",
        "explanation",
        "provenance",
        "sources",
        "relations"
      ]
    },
    "ProjectAgentPackageSourceMappings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ProjectAgentPackageSourceMapping"
      },
      "maxItems": 100,
      "minItems": 0
    },
    "ProjectAgentPackageSourceReference": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "provider": {
          "type": "string",
          "enum": [
            "github",
            "azure_devops"
          ]
        },
        "resource": {
          "$ref": "#/$defs/ProjectAgentResource"
        },
        "commitSha": {
          "type": "string",
          "pattern": "^[a-f0-9]{40,64}$"
        },
        "path": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024,
          "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))[^\\\\\\u0000]+$"
        },
        "blobHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{40,64}$"
        }
      },
      "required": [
        "provider",
        "resource",
        "commitSha"
      ]
    },
    "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"
      ]
    }
  }
}