{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/commentary-dev/json-schema/commentary-dev-project-agentexport-source-snapshot-output-schema.json",
  "title": "ProjectAgentexportSourceSnapshotOutput",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/commentary-dev-source-snapshots-api-openapi.yml#/components/schemas/ProjectAgentexportSourceSnapshotOutput",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "data": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "snapshot": {
          "$ref": "#/$defs/ProjectAgentSourceSnapshot"
        },
        "files": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "path": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1024,
                "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))[^\\\\\\u0000]+$"
              },
              "blobHash": {
                "type": "string",
                "maxLength": 128
              },
              "kind": {
                "type": "string",
                "enum": [
                  "file",
                  "directory",
                  "submodule"
                ]
              },
              "sha256": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "capture": {
                "type": "string",
                "enum": [
                  "retained",
                  "uncaptured"
                ]
              },
              "base64": {
                "anyOf": [
                  {
                    "type": "string",
                    "maxLength": 25165824
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "path",
              "blobHash",
              "kind",
              "sha256",
              "capture",
              "base64"
            ]
          },
          "maxItems": 100,
          "minItems": 0
        },
        "nextCursor": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 4096,
              "pattern": "^[^\\s]+$"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "snapshot",
        "files",
        "nextCursor"
      ]
    },
    "idempotencyReplayed": {
      "type": "boolean"
    }
  },
  "required": [
    "data"
  ],
  "$defs": {
    "ProjectAgentSourceReference": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "provider": {
          "type": "string",
          "enum": [
            "github",
            "azure_devops",
            "uploaded"
          ]
        },
        "resource": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "type": {
              "const": "repository"
            },
            "id": {
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "pattern": "^[^\\s]+$"
            }
          },
          "required": [
            "type",
            "id"
          ]
        },
        "commitSha": {
          "type": "string",
          "pattern": "^[a-fA-F0-9]{40}$"
        },
        "uploadId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512,
          "pattern": "^[^\\s]+$"
        }
      },
      "required": [
        "provider",
        "resource"
      ]
    },
    "ProjectAgentSourceSnapshot": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512,
          "pattern": "^[^\\s]+$"
        },
        "initialWorkspaceId": {
          "type": "string",
          "minLength": 1,
          "maxLength": 512,
          "pattern": "^[^\\s]+$"
        },
        "reference": {
          "$ref": "#/$defs/ProjectAgentSourceReference"
        },
        "provenance": {
          "type": "string",
          "enum": [
            "provider_confirmed",
            "uploaded"
          ]
        },
        "capturePolicy": {
          "type": "string",
          "enum": [
            "selected",
            "full"
          ]
        },
        "selectedPaths": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024,
            "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))[^\\\\\\u0000]+$"
          },
          "maxItems": 1000,
          "minItems": 0
        },
        "manifestSha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "version": {
          "type": "integer",
          "minimum": 1,
          "maximum": 9007199254740991
        },
        "state": {
          "type": "string",
          "enum": [
            "pending",
            "ready",
            "partial",
            "failed",
            "canceled",
            "purged"
          ]
        },
        "completeness": {
          "type": "string",
          "enum": [
            "pending",
            "selected_only",
            "complete",
            "incomplete",
            "purged"
          ]
        },
        "filesProcessed": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "bytesProcessed": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "failureCode": {
          "anyOf": [
            {
              "type": "string",
              "minLength": 1,
              "maxLength": 512,
              "pattern": "^[^\\s]+$"
            },
            {
              "type": "null"
            }
          ]
        },
        "retentionUntil": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})$"
        },
        "createdAt": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})$"
        },
        "collaboration": {
          "type": "object",
          "required": [
            "review",
            "settings",
            "permissions",
            "providerSync",
            "revisionKey"
          ],
          "properties": {
            "review": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "draft"
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    }
                  },
                  "required": [
                    "kind",
                    "id"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "package"
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    }
                  },
                  "required": [
                    "kind",
                    "id"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "guide"
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    }
                  },
                  "required": [
                    "kind",
                    "id"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "snapshot"
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    }
                  },
                  "required": [
                    "kind",
                    "id"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "preview"
                    },
                    "id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 1000
                    }
                  },
                  "required": [
                    "kind",
                    "id"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "pr"
                    },
                    "provider": {
                      "enum": [
                        "github",
                        "azure_devops"
                      ]
                    },
                    "owner": {
                      "type": "string"
                    },
                    "repo": {
                      "type": "string"
                    },
                    "projectName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "prNumber": {
                      "type": "integer",
                      "minimum": 1
                    }
                  },
                  "required": [
                    "kind",
                    "provider",
                    "owner",
                    "repo",
                    "prNumber"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "const": "branch"
                    },
                    "provider": {
                      "enum": [
                        "github",
                        "azure_devops"
                      ]
                    },
                    "owner": {
                      "type": "string"
                    },
                    "repo": {
                      "type": "string"
                    },
                    "projectName": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "branchRef": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "kind",
                    "provider",
                    "owner",
                    "repo",
                    "branchRef"
                  ],
                  "additionalProperties": false
                }
              ]
            },
            "settings": {
              "type": "object",
              "required": [
                "version",
                "polls",
                "consensus"
              ],
              "properties": {
                "version": {
                  "type": "integer",
                  "minimum": 0
                },
                "polls": {
                  "type": "boolean"
                },
                "consensus": {
                  "type": "object"
                }
              },
              "additionalProperties": false
            },
            "permissions": {
              "type": "object",
              "properties": {
                "comment": {
                  "type": "boolean"
                },
                "configure": {
                  "type": "boolean"
                },
                "humanSignOff": {
                  "type": "boolean"
                }
              }
            },
            "providerSync": {
              "type": "object",
              "properties": {
                "comments": {
                  "type": "boolean"
                },
                "pollSnapshots": {
                  "type": "boolean"
                },
                "liveVotes": {
                  "const": false
                },
                "decisions": {
                  "const": false
                }
              }
            },
            "revisionKey": {
              "type": [
                "string",
                "null"
              ]
            },
            "filePaths": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "participants": {
              "type": "array",
              "items": {
                "type": "object"
              }
            }
          },
          "additionalProperties": false
        }
      },
      "required": [
        "id",
        "initialWorkspaceId",
        "reference",
        "provenance",
        "capturePolicy",
        "selectedPaths",
        "manifestSha256",
        "version",
        "state",
        "completeness",
        "filesProcessed",
        "bytesProcessed",
        "failureCode",
        "retentionUntil",
        "createdAt"
      ]
    }
  }
}