{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/diagnostic-fixture.v1.json",
  "title": "Agoragentic Diagnostic Fixture v1",
  "description": "Fixture-driven governance diagnostic input for Agent OS deployments, listings, and local harness agents. A fixture declares expected roles, tools, permissions, policies, and evidence requirements; it is not proof by itself.",
  "type": "object",
  "required": [
    "schema",
    "fixture_id",
    "target_type",
    "diagnostic_pillars",
    "roles",
    "tools",
    "policies",
    "expected_behaviors",
    "evidence_requirements"
  ],
  "properties": {
    "schema": { "const": "agoragentic.diagnostic-fixture.v1" },
    "fixture_id": { "type": "string", "minLength": 1 },
    "target_type": {
      "type": "string",
      "enum": ["agent_os_deployment", "seller_listing", "x402_edge", "local_harness_agent", "ecf_context_agent"]
    },
    "deployment_contract_ref": { "type": ["string", "null"] },
    "listing_id": { "type": ["string", "null"] },
    "agent_id": { "type": ["string", "null"] },
    "exposure_mode": {
      "type": "string",
      "enum": ["private_only", "public_api", "marketplace_seller", "x402_paid_edge"]
    },
    "diagnostic_pillars": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": ["fabrication", "manipulation", "deception", "unpredictability", "opacity"]
      },
      "minItems": 1
    },
    "roles": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["role_id", "description"],
        "properties": {
          "role_id": { "type": "string", "minLength": 1 },
          "description": { "type": "string", "minLength": 1 },
          "allowed_actions": { "type": "array", "items": { "type": "string" } },
          "blocked_actions": { "type": "array", "items": { "type": "string" } }
        },
        "additionalProperties": true
      }
    },
    "tools": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["tool_id", "permission"],
        "properties": {
          "tool_id": { "type": "string", "minLength": 1 },
          "permission": { "type": "string", "enum": ["allowed", "human_gated", "blocked"] },
          "requires_receipt": { "type": "boolean" },
          "approval_required": { "type": "boolean" }
        },
        "additionalProperties": true
      }
    },
    "policies": {
      "type": "object",
      "properties": {
        "context_policy_ref": { "type": ["string", "null"] },
        "tool_policy_ref": { "type": ["string", "null"] },
        "budget_policy_ref": { "type": ["string", "null"] },
        "approval_policy_ref": { "type": ["string", "null"] },
        "memory_policy_ref": { "type": ["string", "null"] },
        "governance_source": { "type": "string", "enum": ["runtime_measured", "declared", "mixed"] }
      },
      "additionalProperties": true
    },
    "expected_behaviors": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["behavior_id", "expectation"],
        "properties": {
          "behavior_id": { "type": "string", "minLength": 1 },
          "expectation": { "type": "string", "minLength": 1 },
          "mandatory": { "type": "boolean" },
          "pillar": {
            "type": "string",
            "enum": ["fabrication", "manipulation", "deception", "unpredictability", "opacity"]
          }
        },
        "additionalProperties": true
      }
    },
    "evidence_requirements": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["method", "requirement"],
        "properties": {
          "method": { "type": "string", "enum": ["structural", "judge", "atomic_claims", "receipt_backed"] },
          "requirement": { "type": "string", "minLength": 1 },
          "mandatory": { "type": "boolean" }
        },
        "additionalProperties": true
      }
    },
    "private_context_policy": {
      "type": "object",
      "properties": {
        "public_export_allowed": { "const": false },
        "redaction_required": { "type": "boolean" }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
