{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/agent-rail-binding.schema.json",
  "title": "Agent Rail Binding",
  "description": "A binding object that connects a requested agent run to the Wever Labs OS rails that support it: handshake, preflight, run contract, trust, quote, credit, settlement receipt, lifecycle, ledger, attestation, result contract, usage receipt, callback, exception, replay, and console state.",
  "type": "object",
  "required": [
    "object_type",
    "binding_id",
    "task_token",
    "requested_tool",
    "rails",
    "operating_contract",
    "result_contract",
    "issued_at"
  ],
  "additionalProperties": true,
  "properties": {
    "object_type": {
      "type": "string",
      "const": "agent_rail_binding"
    },
    "binding_id": {
      "type": "string"
    },
    "task_token": {
      "type": "string"
    },
    "requested_tool": {
      "type": "string",
      "enum": [
        "tokenops",
        "packetops",
        "distributionops",
        "wever_labs_os",
        "custom_workflow"
      ]
    },
    "rails": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "handshake": {
          "type": "string"
        },
        "preflight": {
          "type": "string"
        },
        "run_contract": {
          "type": "string"
        },
        "trust_profile": {
          "type": "string"
        },
        "quote": {
          "type": "string"
        },
        "credit_entitlement": {
          "type": "string"
        },
        "settlement_receipt": {
          "type": "string"
        },
        "task_lifecycle": {
          "type": "string"
        },
        "task_ledger": {
          "type": "string"
        },
        "result_attestation": {
          "type": "string"
        },
        "result_contract": {
          "type": "string"
        },
        "usage_receipt": {
          "type": "string"
        },
        "callback_payload": {
          "type": "string"
        },
        "exception_ticket": {
          "type": "string"
        },
        "replay_package": {
          "type": "string"
        },
        "console_snapshot": {
          "type": "string"
        }
      }
    },
    "operating_contract": {
      "type": "object",
      "additionalProperties": true
    },
    "settlement_contract": {
      "type": "object",
      "additionalProperties": true
    },
    "result_contract": {
      "type": "object",
      "additionalProperties": true
    },
    "issued_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
