{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/flashdata-dev/json-schema/flashdata-dev-agent-capabilities-schema.json",
  "title": "AgentCapabilities",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/flashdata-dev-agent-connections-api-openapi.yml#/components/schemas/AgentCapabilities",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "protocolVersion": {
      "const": 2
    },
    "available": {
      "type": "boolean"
    },
    "flow": {
      "const": "temporary_account_api_key"
    },
    "dataOrigin": {
      "type": "string"
    },
    "queryPath": {
      "const": "/v1/queries/realtime"
    },
    "credentialType": {
      "const": "api_key"
    },
    "permissions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AgentPermission"
      }
    },
    "owner": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "scopes"
      ],
      "properties": {
        "scopes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "trial": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "scopes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "credits": {
          "type": "number"
        },
        "lifetimeHours": {
          "type": "integer",
          "minimum": 0
        },
        "requestsPerSecond": {
          "type": "integer",
          "minimum": 0
        },
        "maxBatchSize": {
          "type": "integer",
          "minimum": 0
        },
        "requestCounts": {}
      },
      "required": [
        "credits",
        "lifetimeHours",
        "requestsPerSecond",
        "maxBatchSize",
        "requestCounts"
      ]
    },
    "recurringRequires": {
      "const": "owned_key_installed"
    },
    "replayProtection": {
      "const": "client_local_only"
    }
  },
  "required": [
    "protocolVersion",
    "available"
  ],
  "$defs": {
    "AgentPermission": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "source",
        "name",
        "product",
        "trialEligible",
        "ownerAllowed",
        "requiresStorageDestination"
      ],
      "properties": {
        "source": {
          "type": "string",
          "pattern": "^[a-z_]{1,80}$"
        },
        "name": {
          "type": "string"
        },
        "product": {
          "type": "string"
        },
        "trialEligible": {
          "type": "boolean"
        },
        "ownerAllowed": {
          "type": "boolean"
        },
        "requiresStorageDestination": {
          "type": "boolean"
        }
      },
      "description": "Catalog-derived agent permissions. Trial eligibility is an explicit opt-in independent of owner approval. Storage and variable-price sources require owner access."
    }
  }
}