{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://wildflower.computer/schemas/sandbox-operation-event-v2.schema.json",
  "title": "Wildflower sandbox operation event v2",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "eventName",
    "eventId",
    "occurredAtUnixMs",
    "measurementKind",
    "accountId",
    "projectId",
    "requestId",
    "operationAttemptId",
    "provider",
    "operation",
    "outcome",
    "errorCode",
    "httpStatus",
    "bytes",
    "durations",
    "apiRegion",
    "sandboxAgeBucket",
    "serviceRevision",
    "benchmarkVersion"
  ],
  "properties": {
    "schemaVersion": {
      "const": "wildflower.telemetry.sandbox-operation.v2"
    },
    "eventName": {
      "const": "wildflower.sandbox.operation.completed"
    },
    "eventId": {
      "type": "string",
      "format": "uuid"
    },
    "occurredAtUnixMs": {
      "type": "integer"
    },
    "measurementKind": {
      "enum": [
        "observed_traffic",
        "controlled_benchmark"
      ]
    },
    "accountId": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 1
    },
    "projectId": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 1
    },
    "requestId": {
      "type": "string",
      "format": "uuid"
    },
    "operationAttemptId": {
      "type": "string",
      "format": "uuid"
    },
    "provider": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "agentcore",
        "blaxel",
        "box",
        "cloudflare",
        "e2b",
        "novita",
        "daytona",
        "modal",
        "runloop",
        "smol",
        "sprites",
        "vercel",
        null
      ]
    },
    "operation": {
      "enum": [
        "create",
        "list",
        "get",
        "exec",
        "read_file",
        "write_file",
        "delete"
      ]
    },
    "outcome": {
      "enum": [
        "succeeded",
        "failed"
      ]
    },
    "errorCode": {
      "type": [
        "string",
        "null"
      ]
    },
    "httpStatus": {
      "type": "integer",
      "minimum": 100,
      "maximum": 599
    },
    "bytes": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "requestBodyBytes",
        "stdoutBytes",
        "stderrBytes",
        "fileBytes"
      ],
      "properties": {
        "requestBodyBytes": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "stdoutBytes": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "stderrBytes": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "fileBytes": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        }
      }
    },
    "durations": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "totalMicroseconds",
        "nonProviderMicroseconds",
        "providerMicroseconds"
      ],
      "properties": {
        "totalMicroseconds": {
          "type": "integer",
          "minimum": 0
        },
        "nonProviderMicroseconds": {
          "type": "integer",
          "minimum": 0
        },
        "providerMicroseconds": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        }
      }
    },
    "apiRegion": {
      "type": "string",
      "minLength": 1,
      "maxLength": 32,
      "pattern": "^[A-Za-z0-9_-]+$"
    },
    "sandboxAgeBucket": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "lt_1m",
        "1m_to_5m",
        "5m_to_30m",
        "30m_to_2h",
        "2h_to_24h",
        "gte_24h",
        null
      ]
    },
    "serviceRevision": {
      "type": [
        "string",
        "null"
      ]
    },
    "benchmarkVersion": {
      "type": [
        "string",
        "null"
      ]
    }
  }
}
