{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/tool-execution-result-event.schema.json",
  "title": "Tool Execution Result Event",
  "description": "Runtime event emitted when an operating tool returns progress, result readiness, exception state, receipt issuance, callback delivery, or attestation.",
  "type": "object",
  "required": [
    "event_id",
    "binding_id",
    "work_order_id",
    "task_token",
    "tool",
    "event_type",
    "occurred_at"
  ],
  "properties": {
    "event_id": {
      "type": "string"
    },
    "binding_id": {
      "type": "string"
    },
    "work_order_id": {
      "type": "string"
    },
    "task_token": {
      "type": "string"
    },
    "tool": {
      "type": "string"
    },
    "event_type": {
      "type": "string",
      "enum": [
        "execution_started",
        "progress_recorded",
        "exception_opened",
        "result_ready",
        "settlement_receipt_linked",
        "usage_receipt_issued",
        "callback_delivered",
        "attestation_issued",
        "replay_requested"
      ]
    },
    "state_after_event": {
      "type": "string"
    },
    "result_contract_url": {
      "type": "string",
      "format": "uri"
    },
    "receipt_url": {
      "type": "string",
      "format": "uri"
    },
    "callback_status": {
      "type": "string"
    },
    "occurred_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
