{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "state": {
      "type": "object",
      "properties": {
        "level": {
          "type": "string",
          "enum": [
            "ok",
            "info",
            "warn",
            "bad"
          ]
        },
        "label": {
          "type": "string"
        },
        "detail": {
          "type": "string"
        }
      },
      "required": [
        "level"
      ],
      "additionalProperties": false
    },
    "health": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "level": {
            "type": "string",
            "enum": [
              "ok",
              "info",
              "warn",
              "bad"
            ]
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "level"
        ],
        "additionalProperties": false
      }
    },
    "active": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string"
          },
          "model": {
            "type": "string"
          },
          "started": {
            "type": "number"
          },
          "steps": {
            "type": "number"
          },
          "detail": {
            "type": "string"
          },
          "subjects": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "share": {
                  "type": "number"
                }
              },
              "required": [
                "title"
              ],
              "additionalProperties": false
            }
          },
          "log": {
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    },
    "gauges": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "used": {
            "type": "number"
          },
          "mark": {
            "type": "number"
          },
          "detail": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "used"
        ],
        "additionalProperties": false
      }
    },
    "runs": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 190
          },
          "started": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "ended": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "kind": {
            "type": "string",
            "maxLength": 40
          },
          "status": {
            "type": "string",
            "maxLength": 20
          },
          "cost_usd": {
            "type": "number",
            "minimum": 0
          },
          "output_tokens": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
          },
          "models": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "number",
              "minimum": 0
            }
          },
          "subjects": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "title": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                },
                "share": {
                  "type": "number"
                }
              },
              "required": [
                "title"
              ],
              "additionalProperties": false
            }
          },
          "log": {
            "type": "string",
            "maxLength": 190
          }
        },
        "required": [
          "id"
        ],
        "additionalProperties": false
      }
    },
    "panels": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "list"
              },
              "title": {
                "type": "string"
              },
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "title": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "meta": {
                      "type": "string"
                    },
                    "badge": {
                      "type": "string"
                    },
                    "level": {
                      "type": "string",
                      "enum": [
                        "ok",
                        "info",
                        "warn",
                        "bad"
                      ]
                    }
                  },
                  "required": [
                    "title"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "type",
              "title",
              "items"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "table"
              },
              "title": {
                "type": "string"
              },
              "columns": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "rows": {
                "type": "array",
                "items": {
                  "type": "array",
                  "items": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "text": {
                            "type": "string"
                          },
                          "url": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "text"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  }
                }
              }
            },
            "required": [
              "type",
              "title",
              "columns",
              "rows"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "kv"
              },
              "title": {
                "type": "string"
              },
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "label",
                    "value"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "type",
              "title",
              "items"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "const": "text"
              },
              "title": {
                "type": "string"
              },
              "lines": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "type",
              "title",
              "lines"
            ],
            "additionalProperties": false
          }
        ]
      }
    },
    "agent": {
      "type": "object",
      "properties": {
        "version": {
          "type": "string",
          "maxLength": 60
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false,
  "title": "adapter status",
  "description": "Output of a Caldera adapter (ADR-0045 D3)."
}
