{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/multi-agent-ecosystem/multi-agent-pipeline/pipeline/schemas/office-credentials.schema.json",
  "title": "Key cabinet",
  "description": "What GET /v1/credentials returns and `office-credentials.mjs --json` prints: for each credential the pipeline knows by logical name, whether the store holds it and, with probe, whether its service accepted it. Never a value: lib/credential-inventory.sh reads each through the store with stdout discarded. Renewal stays in the terminal (/multi-agent:setup).",
  "type": "object",
  "additionalProperties": false,
  "required": ["contractVersion", "generatedAt", "probed", "available", "credentials"],
  "properties": {
    "contractVersion": {
      "type": "string",
      "pattern": "^1\\.[0-9]+\\.[0-9]+$",
      "x-sensitivity": "none"
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time",
      "x-sensitivity": "none"
    },
    "probed": {
      "type": "boolean",
      "x-sensitivity": "none"
    },
    "available": {
      "type": "boolean",
      "x-sensitivity": "none",
      "description": "False when the inventory could not run on this host."
    },
    "credentials": {
      "type": "array",
      "x-sensitivity": "local",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["logical", "state", "reachability", "capability"],
        "properties": {
          "logical": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,60}$"
          },
          "state": {
            "enum": ["present", "mapped-but-missing", "unmapped"]
          },
          "reachability": {
            "enum": [
              "not-probed",
              "reachable",
              "auth-rejected",
              "unreachable",
              "no-host-configured",
              "well-formed",
              "not-probeable",
              "malformed",
              "no-credential",
              "probe-error",
              "server-error",
              "tier-1-ready",
              "tier-2-ready",
              "tier-1-no-grant",
              "unknown"
            ]
          },
          "capability": {
            "type": ["string", "null"],
            "maxLength": 160
          }
        }
      }
    }
  }
}
