{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agenticwebwatch.org/schemas/taar-agent-manifest.schema.json",
  "title": "TAAR Agent Manifest",
  "type": "object",
  "required": [
    "schema_version",
    "product_id",
    "agent_start",
    "latest_daily_run_id",
    "freshness_guidance",
    "action_permission",
    "blocked_uses",
    "entrypoints",
    "protocol",
    "artifacts"
  ],
  "properties": {
    "schema_version": {
      "type": "string"
    },
    "schema_url": {
      "type": "string",
      "format": "uri-reference"
    },
    "product_id": {
      "type": "string"
    },
    "agent_start": {
      "type": "string",
      "format": "uri-reference"
    },
    "html_index": {
      "type": "string",
      "format": "uri-reference"
    },
    "latest_daily_run_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "artifact_count": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 0
    },
    "verification_statuses": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "monitoring_status": {
      "type": [
        "string",
        "null"
      ]
    },
    "freshness_guidance": {
      "type": "object",
      "required": [
        "preferred_poll_url",
        "archive_url",
        "update_cadence",
        "max_age_seconds",
        "stale_after_utc",
        "live_source_verification_required_before_external_decision"
      ],
      "properties": {
        "preferred_poll_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri-reference"
        },
        "archive_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri-reference"
        },
        "update_cadence": {
          "type": "string"
        },
        "max_age_seconds": {
          "type": "integer",
          "minimum": 1
        },
        "stale_after_utc": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "live_source_verification_required_before_external_decision": {
          "const": true
        }
      },
      "additionalProperties": true
    },
    "action_permission": {
      "enum": [
        "blocked",
        null
      ]
    },
    "allowed_use": {
      "type": [
        "string",
        "null"
      ]
    },
    "blocked_uses": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "entrypoints": {
      "type": "object",
      "required": [
        "agent_manifest",
        "artifact_index",
        "latest_daily_run",
        "latest_export_manifest"
      ],
      "properties": {
        "agent_manifest": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri-reference"
        },
        "artifact_index": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri-reference"
        },
        "latest_daily_run": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri-reference"
        },
        "latest_export_manifest": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri-reference"
        },
        "markdown_index": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri-reference"
        }
      },
      "additionalProperties": true
    },
    "protocol": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "step",
          "method",
          "expect"
        ],
        "properties": {
          "step": {
            "type": "integer",
            "minimum": 1
          },
          "method": {
            "enum": [
              "GET"
            ]
          },
          "url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri-reference"
          },
          "url_template": {
            "type": "string"
          },
          "loop_over": {
            "type": "string"
          },
          "example_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri-reference"
            }
          },
          "expect": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": true
      }
    },
    "action_gate_examples": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "uri-reference"
      }
    },
    "artifacts": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "question_id",
          "daily_run_id",
          "verification_status",
          "canonical_package_hash",
          "action_gate_json_url",
          "instance_spec_json_url",
          "overview_markdown_url"
        ],
        "properties": {
          "question_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "artifact_run_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "daily_run_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "date": {
            "type": [
              "string",
              "null"
            ]
          },
          "verification_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "canonical_package_hash": {
            "type": [
              "string",
              "null"
            ],
            "pattern": "^(sha256:)?[0-9a-f]{64}$"
          },
          "bundle_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri-reference"
          },
          "overview_markdown_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri-reference"
          },
          "action_gate_json_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri-reference"
          },
          "instance_spec_json_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri-reference"
          }
        },
        "additionalProperties": true
      }
    }
  },
  "additionalProperties": true
}
