asyncapi: 3.0.0
info:
  title: PlatPhorm Sandbox Lifecycle Events
  version: 2.0.0-phase2
  description: "Public-safe lifecycle, command, artifact, validation, and handoff events for bounded Sandbox execution evidence."
servers:
  production:
    host: sandbox.platphormnews.com
    pathname: "/api/sandbox/runs/{sandboxId}/events"
    protocol: https
channels:
  sandbox/runs/{sandboxId}/events:
    address: "sandbox/runs/{sandboxId}/events"
    messages:
      sandbox.create.requested:
        $ref: "#/components/messages/sandbox_create_requested"
      sandbox.created:
        $ref: "#/components/messages/sandbox_created"
      file.write.started:
        $ref: "#/components/messages/file_write_started"
      file.write.completed:
        $ref: "#/components/messages/file_write_completed"
      command.queued:
        $ref: "#/components/messages/command_queued"
      command.started:
        $ref: "#/components/messages/command_started"
      command.log:
        $ref: "#/components/messages/command_log"
      command.completed:
        $ref: "#/components/messages/command_completed"
      command.failed:
        $ref: "#/components/messages/command_failed"
      artifact.created:
        $ref: "#/components/messages/artifact_created"
      validation.started:
        $ref: "#/components/messages/validation_started"
      validation.completed:
        $ref: "#/components/messages/validation_completed"
      handoff.created:
        $ref: "#/components/messages/handoff_created"
      handoff.sent:
        $ref: "#/components/messages/handoff_sent"
      handoff.completed:
        $ref: "#/components/messages/handoff_completed"
      sandbox.completed:
        $ref: "#/components/messages/sandbox_completed"
      sandbox.failed:
        $ref: "#/components/messages/sandbox_failed"
      sandbox.degraded:
        $ref: "#/components/messages/sandbox_degraded"
  sandbox/commands/{commandId}/logs:
    address: "sandbox/commands/{commandId}/logs"
    messages:
      command_log:
        $ref: "#/components/messages/command_log"
  sandbox/handoffs/{handoffId}/events:
    address: "sandbox/handoffs/{handoffId}/events"
    messages:
      handoff_created:
        $ref: "#/components/messages/handoff_created"
      handoff_completed:
        $ref: "#/components/messages/handoff_completed"
  sandbox/integrations/{serviceId}/events:
    address: "sandbox/integrations/{serviceId}/events"
    messages:
      handoff_sent:
        $ref: "#/components/messages/handoff_sent"
operations:
  publish_sandbox_create_requested:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/sandbox_create_requested"
  publish_sandbox_created:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/sandbox_created"
  publish_file_write_started:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/file_write_started"
  publish_file_write_completed:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/file_write_completed"
  publish_command_queued:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/command_queued"
  publish_command_started:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/command_started"
  publish_command_log:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/command_log"
  publish_command_completed:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/command_completed"
  publish_command_failed:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/command_failed"
  publish_artifact_created:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/artifact_created"
  publish_validation_started:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/validation_started"
  publish_validation_completed:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/validation_completed"
  publish_handoff_created:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/handoff_created"
  publish_handoff_sent:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/handoff_sent"
  publish_handoff_completed:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/handoff_completed"
  publish_sandbox_completed:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/sandbox_completed"
  publish_sandbox_failed:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/sandbox_failed"
  publish_sandbox_degraded:
    action: send
    channel:
      $ref: "#/channels/sandbox~1runs~1{sandboxId}~1events"
    messages:
      - $ref: "#/components/messages/sandbox_degraded"
components:
  messages:
    sandbox_create_requested:
      name: sandbox.create.requested
      title: sandbox.create.requested
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    sandbox_created:
      name: sandbox.created
      title: sandbox.created
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    file_write_started:
      name: file.write.started
      title: file.write.started
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    file_write_completed:
      name: file.write.completed
      title: file.write.completed
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    command_queued:
      name: command.queued
      title: command.queued
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    command_started:
      name: command.started
      title: command.started
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    command_log:
      name: command.log
      title: command.log
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    command_completed:
      name: command.completed
      title: command.completed
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    command_failed:
      name: command.failed
      title: command.failed
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    artifact_created:
      name: artifact.created
      title: artifact.created
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    validation_started:
      name: validation.started
      title: validation.started
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    validation_completed:
      name: validation.completed
      title: validation.completed
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    handoff_created:
      name: handoff.created
      title: handoff.created
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    handoff_sent:
      name: handoff.sent
      title: handoff.sent
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    handoff_completed:
      name: handoff.completed
      title: handoff.completed
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    sandbox_completed:
      name: sandbox.completed
      title: sandbox.completed
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    sandbox_failed:
      name: sandbox.failed
      title: sandbox.failed
      payload:
        $ref: "#/components/schemas/SandboxEvent"
    sandbox_degraded:
      name: sandbox.degraded
      title: sandbox.degraded
      payload:
        $ref: "#/components/schemas/SandboxEvent"
  schemas:
    SandboxEvent:
      type: object
      required:
        - schemaVersion
        - id
        - type
        - trace
        - publicSafe
        - payload
        - createdAt
      properties:
        schemaVersion:
          const: platphorm.sandbox.event.v1
        id:
          type: string
        type:
          type: string
          enum:
            - sandbox.create.requested
            - sandbox.created
            - file.write.started
            - file.write.completed
            - command.queued
            - command.started
            - command.log
            - command.completed
            - command.failed
            - artifact.created
            - validation.started
            - validation.completed
            - handoff.created
            - handoff.sent
            - handoff.completed
            - sandbox.completed
            - sandbox.failed
            - sandbox.degraded
        sandboxId:
          type: string
        commandId:
          type: string
        handoffId:
          type: string
        publicSafe:
          type: boolean
        trace:
          type: object
        payload:
          type: object
        createdAt:
          type: string
          format: date-time