124 lines
5.6 KiB
JSON
Executable File
124 lines
5.6 KiB
JSON
Executable File
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://cognitive-agent.local/schemas/command-plan.schema.json",
|
|
"title": "CommandPlan",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["apiVersion", "kind", "metadata", "spec"],
|
|
"properties": {
|
|
"apiVersion": {"const": "cognitive-agent/v1alpha1"},
|
|
"kind": {"const": "CommandPlan"},
|
|
"metadata": {"$ref": "common.schema.json#/$defs/metadata"},
|
|
"spec": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["domain", "platform", "source", "commands"],
|
|
"properties": {
|
|
"domain": {"type": "string", "pattern": "^[a-z][a-z0-9_]*$"},
|
|
"platform": {"type": "string", "pattern": "^[a-z][a-z0-9_-]*$"},
|
|
"source": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["config_id", "config_version", "compiler_version", "mapping_version"],
|
|
"properties": {
|
|
"config_id": {"type": "string", "minLength": 3},
|
|
"config_version": {"type": "string", "minLength": 1},
|
|
"config_sha256": {"type": "string", "pattern": "^[a-f0-9]{64}$"},
|
|
"compiler_version": {"type": "string", "minLength": 1},
|
|
"mapping_version": {"type": "string", "minLength": 1}
|
|
}
|
|
},
|
|
"commands": {
|
|
"type": "array",
|
|
"minItems": 1,
|
|
"maxItems": 512,
|
|
"items": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["id", "operation_ref", "bus", "message", "signals"],
|
|
"properties": {
|
|
"id": {"type": "string", "pattern": "^[a-z][a-z0-9_-]{1,63}$"},
|
|
"operation_ref": {"type": "string", "minLength": 2},
|
|
"bus": {"type": "string", "pattern": "^[a-z][a-z0-9_-]*$"},
|
|
"message": {"type": "string", "minLength": 1},
|
|
"signals": {
|
|
"type": "object",
|
|
"minProperties": 1,
|
|
"additionalProperties": {"type": ["number", "integer", "boolean", "string"]}
|
|
},
|
|
"send_offset_ms": {"type": "integer", "minimum": 0, "maximum": 3600000},
|
|
"repeat": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["count", "period_ms"],
|
|
"properties": {
|
|
"count": {"type": "integer", "minimum": 1, "maximum": 10000},
|
|
"period_ms": {"type": "integer", "minimum": 1, "maximum": 60000}
|
|
}
|
|
},
|
|
"completion": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["message", "signal", "operator", "value", "timeout_ms"],
|
|
"properties": {
|
|
"message": {"type": "string", "minLength": 1},
|
|
"signal": {"type": "string", "minLength": 1},
|
|
"operator": {"type": "string", "enum": ["eq", "neq", "gte", "lte", "within"]},
|
|
"value": {"type": ["number", "integer", "boolean", "string"]},
|
|
"tolerance": {"type": "number", "minimum": 0},
|
|
"state_signal": {"type": "string", "minLength": 1},
|
|
"accepted_states": {
|
|
"type": "array",
|
|
"minItems": 1,
|
|
"uniqueItems": true,
|
|
"items": {"type": "integer", "minimum": 0, "maximum": 255}
|
|
},
|
|
"timeout_ms": {"type": "integer", "minimum": 1, "maximum": 3600000}
|
|
}
|
|
},
|
|
"relative_fallback": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["id", "operation_ref", "bus", "message", "signals", "completion"],
|
|
"properties": {
|
|
"id": {"type": "string", "pattern": "^[a-z][a-z0-9_-]{1,63}$"},
|
|
"operation_ref": {"type": "string", "minLength": 2},
|
|
"bus": {"type": "string", "pattern": "^[a-z][a-z0-9_-]*$"},
|
|
"message": {"type": "string", "minLength": 1},
|
|
"signals": {
|
|
"type": "object",
|
|
"minProperties": 1,
|
|
"additionalProperties": {"type": ["number", "integer", "boolean", "string"]}
|
|
},
|
|
"send_offset_ms": {"type": "integer", "minimum": 0, "maximum": 3600000},
|
|
"completion": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["message", "signal", "operator", "value", "timeout_ms"],
|
|
"properties": {
|
|
"message": {"type": "string", "minLength": 1},
|
|
"signal": {"type": "string", "minLength": 1},
|
|
"operator": {"type": "string", "enum": ["eq", "neq", "gte", "lte", "within"]},
|
|
"value": {"type": ["number", "integer", "boolean", "string"]},
|
|
"tolerance": {"type": "number", "minimum": 0},
|
|
"state_signal": {"type": "string", "minLength": 1},
|
|
"accepted_states": {
|
|
"type": "array",
|
|
"minItems": 1,
|
|
"uniqueItems": true,
|
|
"items": {"type": "integer", "minimum": 0, "maximum": 255}
|
|
},
|
|
"timeout_ms": {"type": "integer", "minimum": 1, "maximum": 3600000}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|