capsule AI-native Unix-like composition layer

capsule.yaml

2,053 bytes · 60 lines · capsule://quake0day/[email protected] raw on github

apiVersion: capsule.dev/v0.1
kind: Capsule
name: cverse-webrtc-direct-peer
version: 0.1.0
type: subsystem
purpose:
  summary: 'Manages direct WebRTC peer-to-peer connections within the Go backend,
    including TURN server setup, RTP packet handling, and media processing. This capsule
    provides the low-level WebRTC capabilities for direct streaming.

    '
  owns:
  - Direct WebRTC peer connection establishment
  - TURN server configuration and relay
  - RTP packet processing and media segmentation
  - Audio/video delay and pacing logic
  does_not_own:
  - LiveKit integration
  - Go orchestration server business logic
  - Frontend WebRTC client
interfaces:
  provides:
  - kind: library
    name: webrtc-direct-peer
    description: Go library for managing direct WebRTC peer connections and media.
  requires:
  - kind: env
    name: ICE_PUBLIC_IP
    description: Public IP or domain for ICE candidates.
  - kind: env
    name: TURN_PORT
    description: Port for the TURN server.
  - kind: env
    name: TURN_USERNAME
    description: Username for TURN server authentication.
  - kind: env
    name: TURN_PASSWORD
    description: Password for TURN server authentication.
agent:
  summary_for_ai: 'An AI agent working on this capsule would focus on optimizing WebRTC
    media pipeline, improving NAT traversal (TURN/STUN), or enhancing media synchronization.
    It requires deep knowledge of WebRTC protocols, RTP, and Go programming.

    '
  avoid:
  - Implementing high-level application logic or AI inference.
verification:
  invariants:
  - WebRTC connections must be stable and low-latency.
  - Media streams must be correctly transmitted and received.
  - TURN server must be correctly configured and accessible.
x-reuse:
  notes: '`server/internal/direct/turn.go` requires configuration for TURN server
    credentials and public IP (`ICE_PUBLIC_IP`, `TURN_PORT`, `TURN_USERNAME`, `TURN_PASSWORD`).
    These values need to be parameterized for deployment in different environments.

    '
x-reconstruct:
  install: install.json