{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://getzero.dev/contracts/zero.hosted_operator_launch_receipt.v1.schema.json",
  "title": "ZERO Hosted Operator Launch Receipt",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "schema_version",
    "kind",
    "public",
    "status",
    "receipt_id",
    "issued_at",
    "expires_at",
    "canonical_url",
    "launch_path_url",
    "evidence_bundle",
    "freshness_gate",
    "safety_boundary"
  ],
  "properties": {
    "schema_version": {
      "const": "zero.hosted_operator_launch_receipt.v1"
    },
    "kind": {
      "const": "hosted_operator_launch_receipt"
    },
    "public": {
      "const": true
    },
    "status": {
      "enum": ["fresh", "stale"]
    },
    "receipt_id": {
      "type": "string",
      "minLength": 1
    },
    "issued_at": {
      "type": "string",
      "format": "date-time"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time"
    },
    "canonical_url": {
      "const": "https://getzero.dev/api/deployments/hosted-operator-launch-receipt"
    },
    "launch_path_url": {
      "const": "https://getzero.dev/api/deployments/hosted-operator-launch-path"
    },
    "operator_route": {
      "const": "/u/{handle}"
    },
    "agent_route": {
      "const": "/a/{shortId}"
    },
    "q1_public_proof_dependency": {
      "const": "complete"
    },
    "evidence_bundle": {
      "type": "object",
      "required": [
        "deployment_id",
        "operator_class",
        "api_wallet",
        "production_smoke_run_id",
        "hyperliquid_approval",
        "active_lease_signing",
        "expired_lease_refusals"
      ],
      "properties": {
        "deployment_id": {
          "type": "string",
          "minLength": 1
        },
        "operator_class": {
          "const": "non_foundation_privy_operator"
        },
        "main_wallet": {
          "type": "string",
          "pattern": "^0x[a-fA-F0-9]{4}\\.\\.\\.[a-fA-F0-9]{4}$"
        },
        "api_wallet": {
          "type": "string",
          "pattern": "^0x[a-fA-F0-9]{4}\\.\\.\\.[a-fA-F0-9]{4}$"
        },
        "production_smoke_run_id": {
          "type": "integer"
        },
        "hyperliquid_approval": {
          "type": "object",
          "required": ["status", "method", "valid_until"],
          "properties": {
            "status": {
              "const": "verified"
            },
            "method": {
              "const": "browser_hyperliquid_approve_agent_readback"
            },
            "valid_until": {
              "type": "string",
              "format": "date-time"
            }
          }
        },
        "active_lease_signing": {
          "type": "array",
          "minItems": 2,
          "items": {
            "type": "object",
            "required": ["kind", "status", "request_id", "submitted_to_hyperliquid"],
            "properties": {
              "kind": {
                "enum": ["order", "cancel"]
              },
              "status": {
                "const": "passed"
              },
              "request_id": {
                "type": "string",
                "minLength": 1
              },
              "submitted_to_hyperliquid": {
                "const": false
              }
            }
          }
        },
        "expired_lease_refusals": {
          "type": "array",
          "minItems": 2,
          "items": {
            "type": "object",
            "required": ["kind", "status", "replay_id", "sentinel_drill", "replay_url"],
            "properties": {
              "kind": {
                "enum": ["order", "cancel"]
              },
              "status": {
                "const": "passed"
              },
              "replay_id": {
                "type": "string",
                "minLength": 1
              },
              "sentinel_drill": {
                "const": "lease_expiry_signing_refusal"
              },
              "replay_url": {
                "type": "string",
                "pattern": "^https://getzero\\.dev/replay/refusal-hl-[a-f0-9]+$"
              }
            }
          }
        }
      }
    },
    "freshness_gate": {
      "type": "object",
      "required": ["schema_version", "status", "enforced_by", "stale_after", "fails_when", "next_refresh_requires"],
      "properties": {
        "schema_version": {
          "const": "zero.hosted_operator_launch_freshness_gate.v1"
        },
        "status": {
          "const": "active"
        },
        "enforced_by": {
          "type": "array",
          "minItems": 2,
          "items": {
            "type": "string"
          }
        },
        "stale_after": {
          "type": "string",
          "format": "date-time"
        },
        "fails_when": {
          "type": "array",
          "minItems": 3,
          "items": {
            "type": "string"
          }
        },
        "next_refresh_requires": {
          "type": "array",
          "minItems": 3,
          "items": {
            "type": "string"
          }
        }
      }
    },
    "safety_boundary": {
      "type": "object",
      "required": [
        "private_key_custody",
        "signatures_printed_or_committed",
        "exchange_orders_submitted",
        "auto_execution_before_eligibility_gating",
        "allowed_actions"
      ],
      "properties": {
        "private_key_custody": {
          "const": false
        },
        "signatures_printed_or_committed": {
          "const": false
        },
        "exchange_orders_submitted": {
          "const": false
        },
        "auto_execution_before_eligibility_gating": {
          "const": false
        },
        "allowed_actions": {
          "type": "array",
          "items": {
            "enum": ["order", "cancel", "scheduleCancel"]
          }
        }
      }
    }
  }
}
