{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/agent-operating-console-snapshot.schema.json",
  "title": "Wever Labs Agent Operating Console Snapshot",
  "description": "Public-safe operator cockpit snapshot for agent-paid OS usage, task lifecycle, credits, settlements, exceptions, callbacks, receipts, and settlement rail state.",
  "type": "object",
  "required": [
    "object_type",
    "snapshot_id",
    "generated_at",
    "environment",
    "summary",
    "lifecycle_counts",
    "live_rail_readiness"
  ],
  "additionalProperties": true,
  "properties": {
    "object_type": {
      "const": "agent_operating_console_snapshot"
    },
    "snapshot_id": {
      "type": "string"
    },
    "generated_at": {
      "type": "string",
      "format": "date-time"
    },
    "environment": {
      "type": "string",
      "enum": [
        "public_demo",
        "sandbox",
        "production"
      ]
    },
    "settlement_mode": {
      "type": "string",
      "enum": [
        "manual",
        "provider_controlled",
        "provider_auto_funded",
        "paused"
      ]
    },
    "summary": {
      "type": "object",
      "properties": {
        "latest_successful_run_id": {
          "type": "string"
        },
        "pending_runs": {
          "type": "integer",
          "minimum": 0
        },
        "failed_callbacks": {
          "type": "integer",
          "minimum": 0
        },
        "open_exceptions": {
          "type": "integer",
          "minimum": 0
        },
        "replay_ready_runs": {
          "type": "integer",
          "minimum": 0
        },
        "active_contracts": {
          "type": "integer",
          "minimum": 0
        },
        "credits_available": {
          "type": "number",
          "minimum": 0
        },
        "settlement_intents_pending": {
          "type": "integer",
          "minimum": 0
        },
        "result_packages_ready": {
          "type": "integer",
          "minimum": 0
        },
        "receipts_issued": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": true
    },
    "lifecycle_counts": {
      "type": "object",
      "additionalProperties": {
        "type": "integer",
        "minimum": 0
      }
    },
    "runs": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "agent_task_run_id",
          "canonical_state",
          "requested_tool"
        ],
        "properties": {
          "agent_task_run_id": {
            "type": "string"
          },
          "work_order_id": {
            "type": "string"
          },
          "contract_id": {
            "type": "string"
          },
          "requested_tool": {
            "type": "string",
            "enum": [
              "packetops",
              "distributionops",
              "tokenops",
              "wever_labs_os"
            ]
          },
          "canonical_state": {
            "type": "string",
            "enum": [
              "created",
              "preflight_checked",
              "contract_ready",
              "contract_accepted",
              "trust_pending",
              "trusted",
              "quoted",
              "credit_pending",
              "credit_funded",
              "queued",
              "operating",
              "evidence_partial",
              "result_ready",
              "attested",
              "receipt_issued",
              "callback_pending",
              "callback_delivered",
              "exception_open",
              "replay_ready",
              "failed",
              "closed"
            ]
          },
          "evidence_status": {
            "type": "string",
            "enum": [
              "sufficient",
              "partial",
              "insufficient",
              "unknown"
            ]
          },
          "callback_status": {
            "type": "string",
            "enum": [
              "not_required",
              "pending",
              "ready",
              "delivered",
              "retrying",
              "failed"
            ]
          },
          "result_url": {
            "type": "string",
            "format": "uri"
          },
          "receipt_url": {
            "type": "string",
            "format": "uri"
          },
          "ledger_url": {
            "type": "string",
            "format": "uri"
          },
          "exception_url": {
            "type": "string",
            "format": "uri"
          },
          "replay_package_url": {
            "type": "string",
            "format": "uri"
          },
          "next_operator_action": {
            "type": "string"
          }
        },
        "additionalProperties": true
      }
    },
    "queue_health": {
      "type": "object",
      "properties": {
        "last_runner_heartbeat_at": {
          "type": "string",
          "format": "date-time"
        },
        "next_expected_runner_at": {
          "type": "string",
          "format": "date-time"
        },
        "stuck_tasks": {
          "type": "integer",
          "minimum": 0
        },
        "manual_retry_available": {
          "type": "boolean"
        }
      },
      "additionalProperties": true
    },
    "live_rail_readiness": {
      "$ref": "https://weverlabs.com/schemas/agent-live-rail-readiness.schema.json"
    },
    "os_support_matrix_url": {
      "type": "string",
      "format": "uri"
    },
    "rail_binding_url": {
      "type": "string",
      "format": "uri"
    },
    "runtime_execution_plan_url": {
      "type": "string",
      "format": "uri"
    }
  }
}
