{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/suedeai-ai/json-schema/suedeai-ai-resource-run-envelope-schema.json",
  "title": "ResourceRunEnvelope",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/agents-openapi.json#/components/schemas/ResourceRunEnvelope",
  "type": "object",
  "properties": {
    "result": {},
    "resourceReceipt": {
      "type": "object",
      "properties": {
        "resourceProductId": {
          "type": "string"
        },
        "resourceVersion": {
          "type": "string"
        },
        "semanticHash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "freshness": {
          "type": "string",
          "enum": [
            "fresh",
            "stale",
            "mixed"
          ]
        },
        "evidence": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "sourceSnapshotId": {
                "type": "string"
              },
              "locator": {
                "type": "string"
              },
              "observedAt": {
                "type": "string",
                "format": "date-time"
              },
              "fieldHash": {
                "type": "string",
                "pattern": "^[a-f0-9]{64}$"
              },
              "confidence": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "conflict": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "sourceSnapshotId",
              "locator",
              "observedAt"
            ],
            "additionalProperties": false
          }
        },
        "unknowns": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "conflicts": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "outputSchemaValid": {
          "type": "boolean",
          "const": true
        }
      },
      "required": [
        "resourceProductId",
        "resourceVersion",
        "semanticHash",
        "freshness",
        "evidence",
        "unknowns",
        "conflicts",
        "outputSchemaValid"
      ],
      "additionalProperties": false
    },
    "payment": {
      "type": "object",
      "properties": {
        "priceUsdc": {
          "type": "number",
          "minimum": 0
        },
        "state": {
          "type": "string",
          "enum": [
            "free",
            "challenged",
            "credited",
            "settled",
            "refunded",
            "failed"
          ]
        },
        "receiptId": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "priceUsdc",
        "state",
        "receiptId"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "result",
    "resourceReceipt",
    "payment"
  ],
  "additionalProperties": false
}