95 lines
3.6 KiB
JSON
Executable File
95 lines
3.6 KiB
JSON
Executable File
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://cognitive-agent.local/schemas/function-config.schema.json",
|
|
"title": "FunctionConfig",
|
|
"$defs": {
|
|
"operation": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["id", "capability", "target", "parameters"],
|
|
"properties": {
|
|
"id": {"type": "string", "pattern": "^[a-z][a-z0-9_-]{1,63}$"},
|
|
"capability": {"type": "string", "pattern": "^[a-z][a-z0-9_]*\\.[a-z][a-z0-9_]*$"},
|
|
"target": {"$ref": "common.schema.json#/$defs/target"},
|
|
"parameters": {"type": "object"},
|
|
"parse_source": {
|
|
"type": "string",
|
|
"enum": ["local_rule", "cloud_model", "cloud_supplement", "direct_control"]
|
|
},
|
|
"motion": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["mode", "direction", "start_position_pct", "delta_position_pct"],
|
|
"properties": {
|
|
"mode": {"type": "string", "enum": ["relative", "timed"]},
|
|
"direction": {"type": "string", "enum": ["increase", "decrease"]},
|
|
"start_position_pct": {"type": "integer", "minimum": 0, "maximum": 100},
|
|
"delta_position_pct": {"type": "integer", "minimum": 0, "maximum": 100},
|
|
"start_angle_deg": {"type": "number"},
|
|
"delta_angle_deg": {"type": "number", "minimum": 0},
|
|
"requested_delta_angle_deg": {"type": "number", "minimum": 0},
|
|
"requested_delta_position_pct": {"type": "integer", "minimum": 0},
|
|
"range_clamped": {"type": "boolean"},
|
|
"requested_duration_ms": {"type": "integer", "minimum": 0},
|
|
"applied_duration_ms": {"type": "integer", "minimum": 1},
|
|
"max_duration_ms": {"type": "integer", "minimum": 1},
|
|
"min_duration_ms": {"type": "integer", "minimum": 1},
|
|
"duration_clamped": {"type": "boolean"},
|
|
"endpoint_expected": {"type": "string", "enum": ["near", "far"]}
|
|
},
|
|
"allOf": [
|
|
{
|
|
"if": {"properties": {"mode": {"const": "timed"}}},
|
|
"then": {
|
|
"required": [
|
|
"requested_duration_ms",
|
|
"applied_duration_ms",
|
|
"max_duration_ms",
|
|
"min_duration_ms",
|
|
"duration_clamped"
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"transition": {"$ref": "common.schema.json#/$defs/transition"},
|
|
"depends_on": {
|
|
"type": "array",
|
|
"uniqueItems": true,
|
|
"items": {"type": "string", "pattern": "^[a-z][a-z0-9_-]{1,63}$"},
|
|
"default": []
|
|
},
|
|
"timeout_ms": {"type": "integer", "minimum": 1, "maximum": 3600000},
|
|
"failure_policy": {"$ref": "common.schema.json#/$defs/failure_policy"}
|
|
}
|
|
}
|
|
},
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["apiVersion", "kind", "metadata", "spec"],
|
|
"properties": {
|
|
"apiVersion": {"const": "cognitive-agent/v1alpha1"},
|
|
"kind": {"const": "FunctionConfig"},
|
|
"metadata": {"$ref": "common.schema.json#/$defs/metadata"},
|
|
"spec": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["domain", "operations"],
|
|
"properties": {
|
|
"domain": {"type": "string", "pattern": "^[a-z][a-z0-9_]*$"},
|
|
"operations": {
|
|
"type": "array",
|
|
"minItems": 1,
|
|
"maxItems": 64,
|
|
"items": {"$ref": "#/$defs/operation"}
|
|
},
|
|
"assumptions": {
|
|
"type": "array",
|
|
"items": {"type": "string", "maxLength": 500},
|
|
"default": []
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|