Files
BACKBEAT/contracts/schemas/beatframe-v1.schema.json
2025-10-17 08:56:25 +11:00

121 lines
3.5 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://chorus.services/schemas/backbeat/beatframe/v1.0.0",
"title": "BACKBEAT BeatFrame (INT-A)",
"description": "Beat synchronization message broadcast from Pulse service to all BACKBEAT-enabled services",
"version": "1.0.0",
"type": "object",
"required": [
"type",
"cluster_id",
"beat_index",
"downbeat",
"phase",
"hlc",
"deadline_at",
"tempo_bpm",
"window_id"
],
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"const": "backbeat.beatframe.v1",
"description": "Message type identifier for BeatFrame v1"
},
"cluster_id": {
"type": "string",
"pattern": "^[a-zA-Z0-9_-]+$",
"minLength": 1,
"maxLength": 64,
"description": "Unique identifier for the BACKBEAT cluster"
},
"beat_index": {
"type": "integer",
"minimum": 0,
"maximum": 9223372036854775807,
"description": "Monotonically increasing beat counter since cluster start"
},
"downbeat": {
"type": "boolean",
"description": "True if this is the first beat of a new bar (every 120 beats by default)"
},
"phase": {
"type": "string",
"enum": ["plan", "execute", "review"],
"description": "Current phase within the beat cycle"
},
"hlc": {
"type": "string",
"pattern": "^[0-9a-fA-F]{4}:[0-9a-fA-F]{4}:[0-9a-fA-F]{4}$",
"description": "Hybrid Logical Clock timestamp for causal ordering (format: wall:logical:node)"
},
"deadline_at": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp when this beat phase must complete"
},
"tempo_bpm": {
"type": "number",
"minimum": 0.1,
"maximum": 1000,
"multipleOf": 0.1,
"description": "Current tempo in beats per minute (default: 2.0 for 30-second beats)"
},
"window_id": {
"type": "string",
"pattern": "^[0-9a-fA-F]{32}$",
"description": "Unique identifier for the current reporting window (changes every bar)"
},
"metadata": {
"type": "object",
"description": "Optional metadata for extensions and debugging",
"additionalProperties": true,
"properties": {
"pulse_version": {
"type": "string",
"description": "Version of the Pulse service generating this beat"
},
"cluster_health": {
"type": "string",
"enum": ["healthy", "degraded", "critical"],
"description": "Overall cluster health status"
},
"expected_agents": {
"type": "integer",
"minimum": 0,
"description": "Number of agents expected to participate in this beat"
}
}
}
},
"examples": [
{
"type": "backbeat.beatframe.v1",
"cluster_id": "chorus-prod",
"beat_index": 1337,
"downbeat": false,
"phase": "execute",
"hlc": "7ffd:0001:abcd",
"deadline_at": "2025-09-05T12:30:00Z",
"tempo_bpm": 2.0,
"window_id": "7e9b0e6c4c9a4e59b7f2d9a3c1b2e4d5",
"metadata": {
"pulse_version": "1.2.3",
"cluster_health": "healthy",
"expected_agents": 150
}
},
{
"type": "backbeat.beatframe.v1",
"cluster_id": "dev-cluster",
"beat_index": 0,
"downbeat": true,
"phase": "plan",
"hlc": "0001:0000:cafe",
"deadline_at": "2025-09-05T12:00:30Z",
"tempo_bpm": 4.0,
"window_id": "a1b2c3d4e5f6789012345678901234ab"
}
]
}