{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/tool-execution-command.schema.json",
  "title": "Tool Execution Command",
  "description": "Command envelope used by Wever Labs OS to send a runtime-bound Work Order into TokenOps, FinanceOps, EnergyOps, or another operating tool.",
  "type": "object",
  "required": [
    "command_id",
    "work_order_id",
    "task_token",
    "tool",
    "operation",
    "input_refs",
    "return_contract",
    "created_at"
  ],
  "properties": {
    "command_id": {
      "type": "string"
    },
    "work_order_id": {
      "type": "string"
    },
    "task_token": {
      "type": "string"
    },
    "tool": {
      "type": "string"
    },
    "operation": {
      "type": "string"
    },
    "input_refs": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        }
      }
    },
    "execution_rules": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "return_contract": {
      "type": "object",
      "properties": {
        "result_contract_url": {
          "type": "string",
          "format": "uri"
        },
        "callback_url": {
          "type": "string",
          "format": "uri"
        },
        "attestation_required": {
          "type": "boolean"
        }
      }
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}
