{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/untrusted-source.v1.json",
  "title": "Agoragentic Untrusted Source",
  "description": "Normalized source envelope for external content entering Agent OS, ECF, Marketplace, Seller OS, MCP, or x402 contexts. External content is data-only by default and cannot become operational instruction through this schema.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "source_id",
    "source_type",
    "source_hash",
    "trust_label",
    "allowed_context_role",
    "operational_instruction_allowed",
    "raw_secret_allowed_in_model_context"
  ],
  "properties": {
    "schema": {
      "const": "agoragentic.untrusted-source.v1"
    },
    "source_id": {
      "type": "string"
    },
    "source_type": {
      "type": "string",
      "enum": [
        "webpage",
        "html",
        "markdown",
        "pdf",
        "email",
        "slack_message",
        "github_issue",
        "repo_file",
        "tool_output",
        "marketplace_listing",
        "seller_response",
        "mcp_resource",
        "x402_response",
        "media_file",
        "subagent_message"
      ]
    },
    "source_url": {
      "type": ["string", "null"]
    },
    "source_hash": {
      "type": "string"
    },
    "trust_label": {
      "const": "untrusted_data"
    },
    "allowed_context_role": {
      "const": "data_only"
    },
    "operational_instruction_allowed": {
      "const": false
    },
    "raw_secret_allowed_in_model_context": {
      "const": false
    },
    "public_safe": {
      "type": "boolean"
    },
    "private_context_safe": {
      "type": "boolean"
    },
    "scan_id": {
      "type": ["string", "null"]
    },
    "quarantine_reason": {
      "type": ["string", "null"]
    },
    "provenance": {
      "type": "object",
      "additionalProperties": false,
      "required": ["captured_at", "captured_by", "receipt_ids"],
      "properties": {
        "captured_at": { "type": "string", "format": "date-time" },
        "captured_by": { "type": "string" },
        "receipt_ids": {
          "type": "array",
          "items": { "type": "string" }
        }
      }
    },
    "normalized_text": {
      "type": "string"
    },
    "notes": {
      "type": "array",
      "items": { "type": "string" }
    }
  }
}
