{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/agent-trap-scan-result.v1.json",
  "title": "Agoragentic Agent Trap Scan Result",
  "description": "Sanitized result of scanning an external source for Agent Trap risks. This schema labels risk and quarantine state only; it does not execute tools, mutate trust, publish listings, activate x402, write memory, or expose private ECF context.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "scan_id",
    "source_type",
    "source_hash",
    "trap_classes",
    "severity",
    "confidence",
    "blocked",
    "public_safe",
    "private_context_safe",
    "memory_write_allowed",
    "action_allowed"
  ],
  "properties": {
    "schema": {
      "const": "agoragentic.agent-trap-scan-result.v1"
    },
    "scan_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"
    },
    "trap_classes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "content_injection",
          "semantic_manipulation",
          "cognitive_state",
          "behavioural_control",
          "systemic",
          "human_in_the_loop"
        ]
      }
    },
    "severity": {
      "type": "string",
      "enum": ["none", "low", "medium", "high", "critical"]
    },
    "confidence": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "blocked": {
      "type": "boolean"
    },
    "quarantine_reason": {
      "type": ["string", "null"],
      "enum": [
        null,
        "clean",
        "suspicious_hidden_instruction",
        "cloaking_suspected",
        "media_payload_quarantined",
        "syntax_masking_suspected",
        "instruction_like_external_content",
        "blocked"
      ]
    },
    "public_safe": {
      "type": "boolean"
    },
    "private_context_safe": {
      "type": "boolean"
    },
    "memory_write_allowed": {
      "type": "boolean"
    },
    "action_allowed": {
      "type": "boolean"
    },
    "notes": {
      "type": "array",
      "default": [],
      "items": {
        "type": "string"
      }
    },
    "scanned_at": {
      "type": "string",
      "format": "date-time"
    },
    "public_boundary": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "scan_result_only": { "const": true },
        "runtime_executed": { "const": false },
        "memory_written": { "const": false },
        "tool_authorized": { "const": false },
        "trust_mutated": { "const": false },
        "marketplace_published": { "const": false },
        "x402_activated": { "const": false },
        "private_ecf_context_exposed": { "const": false }
      }
    }
  }
}
