asyncapi: "3.0.0"
info:
  title: "PlatPhorm BrowserOps events"
  version: "0.1.0"
  description: "Public-safe run, artifact, handoff, and integration event contract for BrowserOps browser evidence. Protected execution and remote dispatch require PLATPHORM_API_KEY."
servers:
  production:
    host: "browserops.platphormnews.com"
    protocol: "https"
    pathname: "/api/browserops/runs/{runId}/events"
channels:
  "browserops/runs/{runId}/events":
    address: "browserops/runs/{runId}/events"
    messages:
      browserops.run.queued:
        $ref: "#/components/messages/browserops.run.queued"
      browserops.run.started:
        $ref: "#/components/messages/browserops.run.started"
      browserops.run.step.started:
        $ref: "#/components/messages/browserops.run.step.started"
      browserops.run.step.completed:
        $ref: "#/components/messages/browserops.run.step.completed"
      browserops.run.completed:
        $ref: "#/components/messages/browserops.run.completed"
      browserops.run.failed:
        $ref: "#/components/messages/browserops.run.failed"
      browserops.run.degraded:
        $ref: "#/components/messages/browserops.run.degraded"
  "browserops/handoffs/{handoffId}/events":
    address: "browserops/handoffs/{handoffId}/events"
    messages:
      browserops.handoff.created:
        $ref: "#/components/messages/browserops.handoff.created"
      browserops.handoff.sent:
        $ref: "#/components/messages/browserops.handoff.sent"
      browserops.handoff.completed:
        $ref: "#/components/messages/browserops.handoff.completed"
  "browserops/integrations/{serviceId}/events":
    address: "browserops/integrations/{serviceId}/events"
    messages:
      browserops.handoff.created:
        $ref: "#/components/messages/browserops.handoff.created"
      browserops.handoff.completed:
        $ref: "#/components/messages/browserops.handoff.completed"
operations:
  receiveRunEvents:
    action: "receive"
    channel:
      $ref: "#/channels/browserops~1runs~1{runId}~1events"
    summary: "Receive Server-Sent Event or webhook-compatible BrowserOps run event payloads."
  receiveHandoffEvents:
    action: "receive"
    channel:
      $ref: "#/channels/browserops~1handoffs~1{handoffId}~1events"
    summary: "Receive BrowserOps handoff status changes."
components:
  messages:
    browserops.run.queued:
      name: "browserops.run.queued"
      title: "browserops.run.queued"
      summary: "browserops.run.queued public-safe BrowserOps event."
      contentType: "application/json"
      headers:
        type: "object"
        properties:
          traceparent:
            type: "string"
          tracestate:
            type: "string"
          x-platphorm-trace-id:
            type: "string"
      payload:
        type: "object"
        required:
          - "schemaVersion"
          - "id"
          - "type"
          - "trace"
          - "publicSafe"
          - "payload"
          - "createdAt"
        properties:
          schemaVersion:
            const: "browserops.event.v1"
          id:
            type: "string"
          type:
            const: "run.queued"
          runId:
            type: "string"
          stepId:
            type: "string"
          handoffId:
            type: "string"
          artifactId:
            type: "string"
          publicSafe:
            type: "boolean"
          trace:
            $ref: "#/components/schemas/TraceContext"
          payload:
            type: "object"
            additionalProperties: true
          createdAt:
            type: "string"
            format: "date-time"
    browserops.run.started:
      name: "browserops.run.started"
      title: "browserops.run.started"
      summary: "browserops.run.started public-safe BrowserOps event."
      contentType: "application/json"
      headers:
        type: "object"
        properties:
          traceparent:
            type: "string"
          tracestate:
            type: "string"
          x-platphorm-trace-id:
            type: "string"
      payload:
        type: "object"
        required:
          - "schemaVersion"
          - "id"
          - "type"
          - "trace"
          - "publicSafe"
          - "payload"
          - "createdAt"
        properties:
          schemaVersion:
            const: "browserops.event.v1"
          id:
            type: "string"
          type:
            const: "run.started"
          runId:
            type: "string"
          stepId:
            type: "string"
          handoffId:
            type: "string"
          artifactId:
            type: "string"
          publicSafe:
            type: "boolean"
          trace:
            $ref: "#/components/schemas/TraceContext"
          payload:
            type: "object"
            additionalProperties: true
          createdAt:
            type: "string"
            format: "date-time"
    browserops.run.step.started:
      name: "browserops.run.step.started"
      title: "browserops.run.step.started"
      summary: "browserops.run.step.started public-safe BrowserOps event."
      contentType: "application/json"
      headers:
        type: "object"
        properties:
          traceparent:
            type: "string"
          tracestate:
            type: "string"
          x-platphorm-trace-id:
            type: "string"
      payload:
        type: "object"
        required:
          - "schemaVersion"
          - "id"
          - "type"
          - "trace"
          - "publicSafe"
          - "payload"
          - "createdAt"
        properties:
          schemaVersion:
            const: "browserops.event.v1"
          id:
            type: "string"
          type:
            const: "run.step.started"
          runId:
            type: "string"
          stepId:
            type: "string"
          handoffId:
            type: "string"
          artifactId:
            type: "string"
          publicSafe:
            type: "boolean"
          trace:
            $ref: "#/components/schemas/TraceContext"
          payload:
            type: "object"
            additionalProperties: true
          createdAt:
            type: "string"
            format: "date-time"
    browserops.run.step.completed:
      name: "browserops.run.step.completed"
      title: "browserops.run.step.completed"
      summary: "browserops.run.step.completed public-safe BrowserOps event."
      contentType: "application/json"
      headers:
        type: "object"
        properties:
          traceparent:
            type: "string"
          tracestate:
            type: "string"
          x-platphorm-trace-id:
            type: "string"
      payload:
        type: "object"
        required:
          - "schemaVersion"
          - "id"
          - "type"
          - "trace"
          - "publicSafe"
          - "payload"
          - "createdAt"
        properties:
          schemaVersion:
            const: "browserops.event.v1"
          id:
            type: "string"
          type:
            const: "run.step.completed"
          runId:
            type: "string"
          stepId:
            type: "string"
          handoffId:
            type: "string"
          artifactId:
            type: "string"
          publicSafe:
            type: "boolean"
          trace:
            $ref: "#/components/schemas/TraceContext"
          payload:
            type: "object"
            additionalProperties: true
          createdAt:
            type: "string"
            format: "date-time"
    browserops.artifact.created:
      name: "browserops.artifact.created"
      title: "browserops.artifact.created"
      summary: "browserops.artifact.created public-safe BrowserOps event."
      contentType: "application/json"
      headers:
        type: "object"
        properties:
          traceparent:
            type: "string"
          tracestate:
            type: "string"
          x-platphorm-trace-id:
            type: "string"
      payload:
        type: "object"
        required:
          - "schemaVersion"
          - "id"
          - "type"
          - "trace"
          - "publicSafe"
          - "payload"
          - "createdAt"
        properties:
          schemaVersion:
            const: "browserops.event.v1"
          id:
            type: "string"
          type:
            const: "artifact.created"
          runId:
            type: "string"
          stepId:
            type: "string"
          handoffId:
            type: "string"
          artifactId:
            type: "string"
          publicSafe:
            type: "boolean"
          trace:
            $ref: "#/components/schemas/TraceContext"
          payload:
            type: "object"
            additionalProperties: true
          createdAt:
            type: "string"
            format: "date-time"
    browserops.handoff.created:
      name: "browserops.handoff.created"
      title: "browserops.handoff.created"
      summary: "browserops.handoff.created public-safe BrowserOps event."
      contentType: "application/json"
      headers:
        type: "object"
        properties:
          traceparent:
            type: "string"
          tracestate:
            type: "string"
          x-platphorm-trace-id:
            type: "string"
      payload:
        type: "object"
        required:
          - "schemaVersion"
          - "id"
          - "type"
          - "trace"
          - "publicSafe"
          - "payload"
          - "createdAt"
        properties:
          schemaVersion:
            const: "browserops.event.v1"
          id:
            type: "string"
          type:
            const: "handoff.created"
          runId:
            type: "string"
          stepId:
            type: "string"
          handoffId:
            type: "string"
          artifactId:
            type: "string"
          publicSafe:
            type: "boolean"
          trace:
            $ref: "#/components/schemas/TraceContext"
          payload:
            type: "object"
            additionalProperties: true
          createdAt:
            type: "string"
            format: "date-time"
    browserops.handoff.sent:
      name: "browserops.handoff.sent"
      title: "browserops.handoff.sent"
      summary: "browserops.handoff.sent public-safe BrowserOps event."
      contentType: "application/json"
      headers:
        type: "object"
        properties:
          traceparent:
            type: "string"
          tracestate:
            type: "string"
          x-platphorm-trace-id:
            type: "string"
      payload:
        type: "object"
        required:
          - "schemaVersion"
          - "id"
          - "type"
          - "trace"
          - "publicSafe"
          - "payload"
          - "createdAt"
        properties:
          schemaVersion:
            const: "browserops.event.v1"
          id:
            type: "string"
          type:
            const: "handoff.sent"
          runId:
            type: "string"
          stepId:
            type: "string"
          handoffId:
            type: "string"
          artifactId:
            type: "string"
          publicSafe:
            type: "boolean"
          trace:
            $ref: "#/components/schemas/TraceContext"
          payload:
            type: "object"
            additionalProperties: true
          createdAt:
            type: "string"
            format: "date-time"
    browserops.handoff.completed:
      name: "browserops.handoff.completed"
      title: "browserops.handoff.completed"
      summary: "browserops.handoff.completed public-safe BrowserOps event."
      contentType: "application/json"
      headers:
        type: "object"
        properties:
          traceparent:
            type: "string"
          tracestate:
            type: "string"
          x-platphorm-trace-id:
            type: "string"
      payload:
        type: "object"
        required:
          - "schemaVersion"
          - "id"
          - "type"
          - "trace"
          - "publicSafe"
          - "payload"
          - "createdAt"
        properties:
          schemaVersion:
            const: "browserops.event.v1"
          id:
            type: "string"
          type:
            const: "handoff.completed"
          runId:
            type: "string"
          stepId:
            type: "string"
          handoffId:
            type: "string"
          artifactId:
            type: "string"
          publicSafe:
            type: "boolean"
          trace:
            $ref: "#/components/schemas/TraceContext"
          payload:
            type: "object"
            additionalProperties: true
          createdAt:
            type: "string"
            format: "date-time"
    browserops.run.completed:
      name: "browserops.run.completed"
      title: "browserops.run.completed"
      summary: "browserops.run.completed public-safe BrowserOps event."
      contentType: "application/json"
      headers:
        type: "object"
        properties:
          traceparent:
            type: "string"
          tracestate:
            type: "string"
          x-platphorm-trace-id:
            type: "string"
      payload:
        type: "object"
        required:
          - "schemaVersion"
          - "id"
          - "type"
          - "trace"
          - "publicSafe"
          - "payload"
          - "createdAt"
        properties:
          schemaVersion:
            const: "browserops.event.v1"
          id:
            type: "string"
          type:
            const: "run.completed"
          runId:
            type: "string"
          stepId:
            type: "string"
          handoffId:
            type: "string"
          artifactId:
            type: "string"
          publicSafe:
            type: "boolean"
          trace:
            $ref: "#/components/schemas/TraceContext"
          payload:
            type: "object"
            additionalProperties: true
          createdAt:
            type: "string"
            format: "date-time"
    browserops.run.failed:
      name: "browserops.run.failed"
      title: "browserops.run.failed"
      summary: "browserops.run.failed public-safe BrowserOps event."
      contentType: "application/json"
      headers:
        type: "object"
        properties:
          traceparent:
            type: "string"
          tracestate:
            type: "string"
          x-platphorm-trace-id:
            type: "string"
      payload:
        type: "object"
        required:
          - "schemaVersion"
          - "id"
          - "type"
          - "trace"
          - "publicSafe"
          - "payload"
          - "createdAt"
        properties:
          schemaVersion:
            const: "browserops.event.v1"
          id:
            type: "string"
          type:
            const: "run.failed"
          runId:
            type: "string"
          stepId:
            type: "string"
          handoffId:
            type: "string"
          artifactId:
            type: "string"
          publicSafe:
            type: "boolean"
          trace:
            $ref: "#/components/schemas/TraceContext"
          payload:
            type: "object"
            additionalProperties: true
          createdAt:
            type: "string"
            format: "date-time"
    browserops.run.degraded:
      name: "browserops.run.degraded"
      title: "browserops.run.degraded"
      summary: "browserops.run.degraded public-safe BrowserOps event."
      contentType: "application/json"
      headers:
        type: "object"
        properties:
          traceparent:
            type: "string"
          tracestate:
            type: "string"
          x-platphorm-trace-id:
            type: "string"
      payload:
        type: "object"
        required:
          - "schemaVersion"
          - "id"
          - "type"
          - "trace"
          - "publicSafe"
          - "payload"
          - "createdAt"
        properties:
          schemaVersion:
            const: "browserops.event.v1"
          id:
            type: "string"
          type:
            const: "run.degraded"
          runId:
            type: "string"
          stepId:
            type: "string"
          handoffId:
            type: "string"
          artifactId:
            type: "string"
          publicSafe:
            type: "boolean"
          trace:
            $ref: "#/components/schemas/TraceContext"
          payload:
            type: "object"
            additionalProperties: true
          createdAt:
            type: "string"
            format: "date-time"
  schemas:
    TraceContext:
      type: "object"
      required:
        - "traceId"
      properties:
        traceId:
          type: "string"
        spanId:
          type: "string"
        parentSpanId:
          type: "string"
        traceparent:
          type: "string"
        tracestate:
          type: "string"
        traceUrl:
          type: "string"
          format: "uri"