{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/agent-result-attestation.schema.json",
  "title": "Wever Labs Agent Result Attestation",
  "description": "A public-safe result attestation that lets a downstream agent confirm what ran, which package was produced, what evidence state applied, and where the receipt and callback records live.",
  "type": "object",
  "required": [
    "attestation_type",
    "agent_task_run_id",
    "work_order_id",
    "requested_tool",
    "result_status",
    "evidence_status",
    "generated_at"
  ],
  "additionalProperties": true,
  "properties": {
    "attestation_type": {
      "type": "string",
      "const": "agent_result_attestation"
    },
    "agent_task_run_id": {
      "type": "string"
    },
    "work_order_id": {
      "type": "string"
    },
    "trust_profile_id": {
      "type": "string"
    },
    "quote_id": {
      "type": "string"
    },
    "credit_entitlement_id": {
      "type": "string"
    },
    "requested_tool": {
      "type": "string",
      "enum": [
        "packetops",
        "distributionops",
        "tokenops",
        "wever_labs_os"
      ]
    },
    "requested_capability": {
      "type": "string"
    },
    "result_status": {
      "type": "string",
      "enum": [
        "ready",
        "partial",
        "blocked",
        "failed"
      ]
    },
    "evidence_status": {
      "type": "string",
      "enum": [
        "sufficient",
        "partial",
        "insufficient",
        "unknown"
      ]
    },
    "result_package_url": {
      "type": "string",
      "format": "uri"
    },
    "result_package_hash": {
      "type": "string",
      "description": "Optional digest or future verification hash for the result package."
    },
    "receipt_url": {
      "type": "string",
      "format": "uri"
    },
    "callback_payload_url": {
      "type": "string",
      "format": "uri"
    },
    "ledger_url": {
      "type": "string",
      "format": "uri"
    },
    "credits_debited": {
      "type": "number",
      "minimum": 0
    },
    "remaining_credits": {
      "type": "number",
      "minimum": 0
    },
    "open_items": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "next_actions": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "attested_by": {
      "type": "string"
    },
    "handshake_id": {
      "type": "string",
      "description": "Optional upstream agent handshake ID."
    },
    "preflight_id": {
      "type": "string",
      "description": "Optional upstream preflight check ID."
    },
    "contract_id": {
      "type": "string",
      "description": "Optional upstream run contract ID."
    },
    "run_contract_url": {
      "type": "string",
      "format": "uri",
      "description": "Optional URL for the run contract object."
    }
  }
}
