Files
XZBT/schema/xzbt-0.1.schema.json
T

554 lines
13 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://xzbt.org/schemas/0.1/exhibit.json",
"title": "XZBT Exhibit Schema 0.1",
"description": "Authoritative structural schema for XZBT 0.1 declarative exhibits.",
"type": "object",
"required": [
"xzbt",
"meta"
],
"additionalProperties": false,
"properties": {
"xzbt": {
"type": "string",
"const": "0.1",
"description": "XZBT format specification version. Must be '0.1'."
},
"meta": {
"type": "object",
"description": "Exhibit metadata and descriptive properties.",
"required": [
"id",
"name"
],
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"pattern": "^[a-z][a-z0-9_-]*$",
"maxLength": 64,
"description": "Unique exhibit identifier."
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"description": "Human-readable exhibit title."
},
"version": {
"type": "string",
"description": "Exhibit author semantic version string."
},
"author": {
"type": "string",
"maxLength": 128,
"description": "Author or entity attribution."
},
"description": {
"type": "string",
"maxLength": 1024,
"description": "Short description of exhibit behavior and theme."
},
"license": {
"type": "string",
"description": "License or rights attribution."
},
"tags": {
"type": "array",
"maxItems": 16,
"items": {
"type": "string",
"maxLength": 32
}
}
}
},
"runtime": {
"type": "object",
"additionalProperties": false,
"properties": {
"seed": {
"oneOf": [
{
"type": "integer"
},
{
"type": "string",
"const": "random"
}
],
"description": "PRNG seed: integer for deterministic reproduction, or 'random'."
}
}
},
"parameters": {
"type": "object",
"description": "User-tunable exhibit parameters.",
"patternProperties": {
"^[a-z][a-z0-9_-]*$": {
"$ref": "#/definitions/ParameterSpec"
}
},
"additionalProperties": false
},
"state": {
"type": "object",
"description": "Simulation-owned runtime state variables.",
"patternProperties": {
"^[a-z][a-z0-9_-]*$": {
"$ref": "#/definitions/StateSpec"
}
},
"additionalProperties": false
},
"signals": {
"type": "object",
"description": "Read-only environmental and input signals.",
"patternProperties": {
"^[a-z][a-z0-9_-]*$": {
"type": "object"
}
},
"additionalProperties": false
},
"ui": {
"type": "object",
"description": "Generated UI grouping and presentation preferences.",
"additionalProperties": true
},
"components": {
"type": "object",
"description": "Modular audio and visual reusable components.",
"additionalProperties": false,
"properties": {
"audio": {
"type": "object"
},
"visual": {
"type": "object"
}
}
},
"visuals": {
"type": "object",
"description": "Procedural rendering systems, canvas, and cameras.",
"additionalProperties": false,
"properties": {
"camera": {
"type": "object"
},
"systems": {
"type": "object"
},
"passes": {
"type": "array"
}
}
},
"audio": {
"type": "object",
"description": "Synthesizer graphs, buses, and routing.",
"additionalProperties": false,
"properties": {
"master": {
"type": "object"
},
"buses": {
"type": "object"
},
"recipes": {
"type": "object"
}
}
},
"sounds": {
"type": "object",
"description": "One-shot sound event templates.",
"patternProperties": {
"^[a-z][a-z0-9_-]*$": {
"type": "object"
}
},
"additionalProperties": false
},
"cadence": {
"type": "object",
"description": "Procedural rhythm clocks and pulse pools.",
"additionalProperties": false,
"properties": {
"clocks": {
"type": "object"
},
"pools": {
"type": "object"
}
}
},
"modulators": {
"type": "object",
"description": "Continuous LFOs, noise generators, and sample-and-hold signals.",
"patternProperties": {
"^[a-z][a-z0-9_-]*$": {
"type": "object"
}
},
"additionalProperties": false
},
"bindings": {
"type": "array",
"description": "Directed value propagation links.",
"items": {
"$ref": "#/definitions/BindingSpec"
}
},
"events": {
"type": "object",
"description": "Discrete lifecycle and state change event triggers.",
"patternProperties": {
"^[a-z][a-z0-9_-]*$": {
"type": "object"
}
},
"additionalProperties": false
},
"scenarios": {
"type": "object",
"description": "Autonomous orchestrated scenarios and timelines.",
"patternProperties": {
"^[a-z][a-z0-9_-]*$": {
"type": "object"
}
},
"additionalProperties": false
}
},
"definitions": {
"ParameterSpec": {
"type": "object",
"required": [
"type",
"default"
],
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"enum": [
"number",
"integer",
"boolean",
"string",
"color",
"enum"
]
},
"default": {},
"min": {
"type": "number"
},
"max": {
"type": "number"
},
"step": {
"type": "number",
"exclusiveMinimum": 0
},
"values": {
"type": "array",
"items": {
"type": "string"
}
},
"label": {
"type": "string",
"maxLength": 128
},
"unit": {
"type": "string",
"maxLength": 16
}
}
},
"StateSpec": {
"type": "object",
"required": [
"type",
"initial"
],
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"enum": [
"number",
"integer",
"boolean",
"string"
]
},
"initial": {},
"min": {
"type": "number"
},
"max": {
"type": "number"
}
}
},
"BindingSpec": {
"type": "object",
"required": [
"source",
"target"
],
"additionalProperties": false,
"properties": {
"source": {
"type": "string",
"description": "Source reference path (e.g. 'parameters.activity')."
},
"target": {
"type": "string",
"description": "Target reference path (e.g. 'audio.buses.ambient.gain')."
},
"scale": {
"type": "number",
"description": "Numeric source multiplier. Defaults to 1."
},
"offset": {
"type": "number",
"description": "Numeric offset applied after scaling. Defaults to 0."
},
"clamp": {
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": {
"type": "number"
},
"description": "Inclusive [minimum, maximum] clamp applied to the transformed binding value."
},
"smoothing": {
"$ref": "#/definitions/DurationSpec",
"description": "Optional smoothing low-pass duration."
},
"when": {
"$ref": "#/definitions/ConditionSpec",
"description": "Optional condition; defaults to true."
}
}
},
"ValueSpec": {
"description": "Universal value expression (literal, reference, random, weighted choice, or operation).",
"oneOf": [
{
"type": "number",
"description": "Literal numeric constant."
},
{
"type": "boolean",
"description": "Literal boolean constant."
},
{
"type": "string",
"description": "Literal string or color constant."
},
{
"type": "object",
"required": [
"ref"
],
"additionalProperties": false,
"properties": {
"ref": {
"type": "string",
"pattern": "^[a-z][a-z0-9_-]*(\\.[a-z][a-z0-9_-]*)+$",
"description": "Dot-separated reference path."
}
}
},
{
"type": "object",
"required": [
"random"
],
"additionalProperties": false,
"properties": {
"random": {
"type": "object",
"required": [
"min",
"max"
],
"additionalProperties": false,
"properties": {
"min": {
"type": "number"
},
"max": {
"type": "number"
},
"integer": {
"type": "boolean"
},
"distribution": {
"type": "string",
"enum": [
"uniform",
"gaussian"
]
}
}
}
}
},
{
"type": "object",
"required": [
"choose"
],
"additionalProperties": false,
"properties": {
"choose": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": [
"value",
"weight"
],
"additionalProperties": false,
"properties": {
"value": {},
"weight": {
"type": "number",
"exclusiveMinimum": 0
}
}
}
}
}
},
{
"type": "object",
"required": [
"op",
"args"
],
"additionalProperties": false,
"properties": {
"op": {
"type": "string",
"enum": [
"abs",
"negate",
"round",
"floor",
"ceil",
"add",
"subtract",
"multiply",
"divide",
"min",
"max",
"clamp",
"lerp"
]
},
"args": {
"type": "array",
"items": {
"$ref": "#/definitions/ValueSpec"
}
}
}
}
]
},
"ConditionSpec": {
"description": "Boolean condition expression (comparison, and, or, not).",
"oneOf": [
{
"type": "object",
"required": [
"op",
"left",
"right"
],
"additionalProperties": false,
"properties": {
"op": {
"type": "string",
"enum": [
"eq",
"ne",
"gt",
"gte",
"lt",
"lte"
]
},
"left": {
"$ref": "#/definitions/ValueSpec"
},
"right": {
"$ref": "#/definitions/ValueSpec"
}
}
},
{
"type": "object",
"required": [
"and"
],
"additionalProperties": false,
"properties": {
"and": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/ConditionSpec"
}
}
}
},
{
"type": "object",
"required": [
"or"
],
"additionalProperties": false,
"properties": {
"or": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/ConditionSpec"
}
}
}
},
{
"type": "object",
"required": [
"not"
],
"additionalProperties": false,
"properties": {
"not": {
"$ref": "#/definitions/ConditionSpec"
}
}
}
]
},
"DurationSpec": {
"type": "string",
"pattern": "^([0-9]+(\\.[0-9]+)?)(ms|s|m|h)$",
"description": "Normalized duration literal string (e.g. '250ms', '4s', '1.5m', '1h')."
}
}
}