{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/agentstack-tech/json-schema/agentstack-tech-plugin-telemetry-batch-schema.json",
  "title": "PluginTelemetryBatch",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/agentstack-tech-analytics-api-openapi.yml#/components/schemas/PluginTelemetryBatch",
  "properties": {
    "plugin": {
      "type": "string",
      "title": "Plugin",
      "description": "Plugin name, e.g. cursor-plugin"
    },
    "version": {
      "type": "string",
      "title": "Version"
    },
    "events": {
      "items": {
        "$ref": "#/$defs/PluginTelemetryEvent"
      },
      "type": "array",
      "title": "Events"
    }
  },
  "type": "object",
  "required": [
    "plugin",
    "version",
    "events"
  ],
  "$defs": {
    "PluginTelemetryEvent": {
      "properties": {
        "ts": {
          "type": "integer",
          "title": "Ts",
          "description": "Unix millis when the event happened"
        },
        "tool": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Tool"
        },
        "action": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Action"
        },
        "success": {
          "type": "boolean",
          "title": "Success",
          "default": true
        },
        "duration_ms": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Duration Ms"
        },
        "trace_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Trace Id"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Error"
        },
        "plugin_version": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Plugin Version",
          "description": "cursor-plugin semver"
        },
        "layer": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Layer",
          "description": "hook | command | mcp"
        },
        "gene_tag": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Gene Tag",
          "description": "Genetic tag for routing analytics"
        }
      },
      "type": "object",
      "required": [
        "ts"
      ],
      "title": "PluginTelemetryEvent"
    }
  }
}