Files
agent/examples/frame-processor/MQTT.md

2.1 KiB

MQTT control contract

The Frame Processor publishes control messages to kerberos/agent/<hubKey>. Each message targets one Agent through the envelope's device_id. It subscribes to kerberos/hub/<hubKey> for correlated status events.

MQTT transports control data only. JPEG frames use POST /v1/frames and full recordings use the Agent's existing Vault upload path.

Envelope

{
  "mid": "0c556fc7-637b-4b2a-8a90-2d1cf8450956",
  "device_id": "camera-1",
  "timestamp": 1789380000,
  "encrypted": false,
  "hidden": false,
  "public_key": "",
  "fingerprint": "",
  "payload": {
    "version": "1.0",
    "action": "capture-frame",
    "device_id": "camera-1",
    "signature": "",
    "encrypted_value": "",
    "hidden_value": "",
    "value": {}
  }
}

The reference service publishes plaintext envelopes for local contract testing. Production deployment must use a trusted broker and should adopt the Agent's encrypted-message packaging before commands cross an untrusted broker.

capture-frame

{
  "schemaVersion": "1.0",
  "requestId": "request-1",
  "processingProfile": "always-trigger",
  "expiresAt": 1789380030000,
  "traceId": "optional-trace-id"
}

request-recording-window

{
  "schemaVersion": "1.0",
  "requestId": "request-1",
  "frameId": "frame-1",
  "capturedAt": 1789380000123,
  "preRollSeconds": 10,
  "eventClipSeconds": 30,
  "expiresAt": 1789380030000,
  "processingProfile": "always-trigger",
  "traceId": "optional-trace-id"
}

capturedAt is generated by the Agent and must be echoed unchanged. The Agent uses requestId for command idempotency and selects the local recording that contains capturedAt.

frame-processing-status

{
  "schemaVersion": "1.0",
  "requestId": "request-1",
  "frameId": "frame-1",
  "deviceId": "camera-1",
  "status": "queued",
  "occurredAt": 1789380001000,
  "retryable": false,
  "message": "",
  "traceId": "optional-trace-id"
}

Expected statuses are accepted, captured, submitted, no-event, event, pending-finalisation, queued, uploaded, expired, not-found, rejected, and failed.