{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://opentine.com/schemas/tine-cli-oversight-1.schema.json",
  "title": "tine oversight ... --json",
  "description": "The oversight queue. `policy`/`sign-policy` report whether `.tine/oversight.toml` is pinned by a policy-role key; `request`/`approve`/`reject` write one signed, held decision annotation (`opentine.oversight-decision/1`); `queue` lists every routed item with its k-of-n tally per tier and the decisions that do not count, plus a `digest` that `tine ui --repo` serves unchanged; `fatigue` is the advisory approver-fatigue report (time to decision from record timestamps).",
  "anyOf": [
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "command",
        "schema",
        "policy"
      ],
      "properties": {
        "schema": {
          "const": "tine-cli-oversight/1"
        },
        "command": {
          "enum": [
            "oversight policy",
            "oversight sign-policy"
          ]
        },
        "policy": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "status",
            "why",
            "floors",
            "sha256",
            "tiers",
            "routes"
          ],
          "properties": {
            "status": {
              "enum": [
                "pinned",
                "unpinned",
                "absent"
              ]
            },
            "why": {
              "type": "string"
            },
            "sha256": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "floors": {
              "type": "boolean"
            },
            "tiers": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "tier",
                  "k",
                  "n"
                ],
                "properties": {
                  "tier": {
                    "type": "string"
                  },
                  "k": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "n": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              }
            },
            "routes": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "source",
                  "tier",
                  "label"
                ],
                "properties": {
                  "source": {
                    "enum": [
                      "promotion",
                      "integrity",
                      "monitor",
                      "eval",
                      "budget",
                      "containment",
                      "organism",
                      "custody",
                      "transcript"
                    ]
                  },
                  "tier": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "metric": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "above": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "below": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "actions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "command",
        "schema",
        "decisions"
      ],
      "properties": {
        "schema": {
          "const": "tine-cli-oversight/1"
        },
        "command": {
          "enum": [
            "oversight request",
            "oversight approve",
            "oversight reject"
          ]
        },
        "decisions": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "decision",
              "item",
              "action",
              "signer"
            ],
            "properties": {
              "decision": {
                "type": "string",
                "pattern": "^annotation:sha256:[0-9a-f]{64}$"
              },
              "item": {
                "type": "string",
                "pattern": "^(promotion|monitor|integrity|budget|containment|organism|custody|transcript):.+$"
              },
              "action": {
                "enum": [
                  "request",
                  "approve",
                  "reject"
                ]
              },
              "signer": {
                "type": "string",
                "pattern": "^sha256:[0-9a-f]{64}$"
              }
            }
          }
        }
      }
    },
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "command",
        "schema",
        "policy",
        "counts",
        "items",
        "digest"
      ],
      "properties": {
        "schema": {
          "const": "tine-cli-oversight/1"
        },
        "command": {
          "const": "oversight queue"
        },
        "policy": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "status",
            "why",
            "sha256",
            "floors"
          ],
          "properties": {
            "status": {
              "enum": [
                "pinned",
                "unpinned",
                "absent"
              ]
            },
            "why": {
              "type": "string"
            },
            "sha256": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "floors": {
              "type": "boolean"
            }
          }
        },
        "counts": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "pending",
            "approved",
            "rejected",
            "unrouted"
          ],
          "properties": {
            "pending": {
              "type": "integer",
              "minimum": 0
            },
            "approved": {
              "type": "integer",
              "minimum": 0
            },
            "rejected": {
              "type": "integer",
              "minimum": 0
            },
            "unrouted": {
              "type": "integer",
              "minimum": 0
            }
          }
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "item",
              "source",
              "opened_at",
              "tiers",
              "state",
              "rejected_by",
              "uncounted",
              "decisions"
            ],
            "properties": {
              "item": {
                "type": "string",
                "pattern": "^(promotion|monitor|integrity|budget|containment|organism|custody|transcript):.+$"
              },
              "source": {
                "enum": [
                  "promotion",
                  "integrity",
                  "monitor",
                  "budget",
                  "containment",
                  "organism",
                  "custody",
                  "transcript"
                ]
              },
              "opened_at": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "tiers": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "tier",
                    "k",
                    "n",
                    "approvals",
                    "approvers"
                  ],
                  "properties": {
                    "tier": {
                      "type": "string"
                    },
                    "k": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "n": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "approvals": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "approvers": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "state": {
                "enum": [
                  "pending",
                  "approved",
                  "rejected",
                  "unrouted"
                ]
              },
              "rejected_by": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "uncounted": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "decision",
                    "signer",
                    "why"
                  ],
                  "properties": {
                    "decision": {
                      "type": "string",
                      "pattern": "^annotation:sha256:[0-9a-f]{64}$"
                    },
                    "signer": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "why": {
                      "enum": [
                        "unsigned",
                        "key-separation",
                        "stale",
                        "policy-unpinned",
                        "not-an-approver"
                      ]
                    }
                  }
                }
              },
              "decisions": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "id",
                    "decision",
                    "signer",
                    "decided_at",
                    "counted",
                    "viewed"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "pattern": "^annotation:sha256:[0-9a-f]{64}$"
                    },
                    "decision": {
                      "anyOf": [
                        {
                          "enum": [
                            "request",
                            "approve",
                            "reject"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "signer": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "decided_at": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "counted": {
                      "type": "boolean"
                    },
                    "viewed": {
                      "anyOf": [
                        {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "evidence",
                            "at"
                          ],
                          "properties": {
                            "evidence": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "at": {
                              "type": "string"
                            }
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "digest": {
          "type": "string",
          "pattern": "^sha256:[0-9a-f]{64}$"
        }
      }
    },
    {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "command",
        "schema",
        "advisory",
        "min_review_seconds",
        "queue",
        "decisions",
        "approvals",
        "rubber_stamps",
        "rubber_stamp_rate",
        "median_seconds_to_decision",
        "max_seconds_to_decision",
        "pending",
        "oldest_pending_seconds",
        "approvers"
      ],
      "properties": {
        "schema": {
          "const": "tine-cli-oversight/1"
        },
        "command": {
          "const": "oversight fatigue"
        },
        "advisory": {
          "const": true
        },
        "min_review_seconds": {
          "type": "integer",
          "minimum": 0
        },
        "queue": {
          "type": "string",
          "pattern": "^sha256:[0-9a-f]{64}$"
        },
        "decisions": {
          "type": "integer",
          "minimum": 0
        },
        "approvals": {
          "type": "integer",
          "minimum": 0
        },
        "rubber_stamps": {
          "type": "integer",
          "minimum": 0
        },
        "rubber_stamp_rate": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "median_seconds_to_decision": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "max_seconds_to_decision": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "pending": {
          "type": "integer",
          "minimum": 0
        },
        "oldest_pending_seconds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "approvers": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "signer",
              "approvals",
              "rejections",
              "rubber_stamps",
              "median_seconds_to_decision"
            ],
            "properties": {
              "signer": {
                "type": "string"
              },
              "approvals": {
                "type": "integer",
                "minimum": 0
              },
              "rejections": {
                "type": "integer",
                "minimum": 0
              },
              "rubber_stamps": {
                "type": "integer",
                "minimum": 0
              },
              "median_seconds_to_decision": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        }
      }
    }
  ]
}
