feat: complete Epic 1 production foundation

This commit is contained in:
2026-08-25 01:24:11 +03:00
parent 767428436d
commit 182bde8ac0
298 changed files with 35719 additions and 5299 deletions
@@ -0,0 +1,81 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://crank.local/schemas/operation-export-v2.schema.json",
"title": "Crank portable Operation export v2",
"type": "object",
"additionalProperties": false,
"required": ["format_version", "kind", "operation"],
"properties": {
"format_version": { "const": "2" },
"kind": { "const": "operation" },
"operation": { "$ref": "#/$defs/portable_operation" }
},
"$defs": {
"portable_operation": {
"type": "object",
"additionalProperties": false,
"required": ["name", "display_name", "category", "protocol", "security_level", "target", "input_schema", "output_schema", "input_mapping", "output_mapping", "execution_config", "tool_description"],
"properties": {
"name": { "type": "string", "minLength": 1, "maxLength": 64 },
"display_name": { "type": "string", "minLength": 1, "maxLength": 256 },
"category": { "type": "string", "minLength": 1, "maxLength": 128 },
"protocol": { "const": "rest" },
"security_level": { "enum": ["standard"] },
"target": { "$ref": "#/$defs/rest_target" },
"input_schema": { "$ref": "#/$defs/schema" },
"output_schema": { "$ref": "#/$defs/schema" },
"input_mapping": { "$ref": "#/$defs/mapping_set" },
"output_mapping": { "$ref": "#/$defs/mapping_set" },
"execution_config": { "$ref": "#/$defs/execution_config" },
"tool_description": { "$ref": "#/$defs/tool_description" }
}
},
"string_map": { "type": "object", "propertyNames": { "minLength": 1, "maxLength": 256 }, "additionalProperties": { "type": "string", "maxLength": 65536 } },
"rest_target": {
"type": "object", "additionalProperties": false,
"required": ["kind", "base_url", "method", "path_template"],
"properties": {
"kind": { "const": "rest" }, "base_url": { "type": "string", "minLength": 1, "maxLength": 4096 },
"method": { "enum": ["get", "post", "put", "patch", "delete"] },
"path_template": { "type": "string", "minLength": 1, "maxLength": 4096 },
"static_headers": { "$ref": "#/$defs/string_map" }
}
},
"schema": {
"type": "object", "additionalProperties": false, "required": ["type"],
"properties": {
"type": { "enum": ["object", "array", "string", "integer", "number", "boolean", "enum", "null", "oneof"] },
"description": { "type": "string", "maxLength": 65536 }, "required": { "type": "boolean" }, "nullable": { "type": "boolean" },
"default_value": {}, "fields": { "type": "object", "maxProperties": 4096, "additionalProperties": { "$ref": "#/$defs/schema" } },
"items": { "$ref": "#/$defs/schema" }, "enum_values": { "type": "array", "maxItems": 4096, "items": { "type": "string", "maxLength": 65536 } },
"variants": { "type": "array", "maxItems": 4096, "items": { "$ref": "#/$defs/schema" } }
}
},
"mapping_set": { "type": "object", "additionalProperties": false, "properties": { "rules": { "type": "array", "maxItems": 4096, "items": { "$ref": "#/$defs/mapping_rule" } } } },
"mapping_rule": {
"type": "object", "additionalProperties": false, "required": ["source", "target"],
"properties": {
"source": { "type": "string", "maxLength": 4096 }, "target": { "type": "string", "maxLength": 4096 }, "required": { "type": "boolean" }, "default_value": {},
"transform": { "type": "object", "additionalProperties": false, "required": ["kind"], "properties": { "kind": { "enum": ["identity", "to_string", "to_number", "to_boolean", "join", "split", "wrap_array", "unwrap_singleton"] } } },
"condition": { "type": "object", "additionalProperties": false, "required": ["source", "equals"], "properties": { "source": { "type": "string", "maxLength": 4096 }, "equals": {} } },
"notes": { "type": "string", "maxLength": 65536 }
}
},
"execution_config": {
"type": "object", "additionalProperties": false, "required": ["timeout_ms"],
"properties": {
"timeout_ms": { "type": "integer", "minimum": 1 },
"retry_policy": { "type": "object", "additionalProperties": false, "required": ["max_attempts"], "properties": { "max_attempts": { "type": "integer", "minimum": 0 } } },
"response_cache": { "type": "object", "additionalProperties": false, "required": ["ttl_ms"], "properties": { "ttl_ms": { "type": "integer", "minimum": 1 } } },
"idempotency": { "type": "object", "additionalProperties": false, "required": ["mode", "ttl_ms"], "properties": { "mode": { "enum": ["disabled", "optional", "required"] }, "ttl_ms": { "type": "integer", "minimum": 1 }, "input_field": { "type": "string" }, "header_name": { "type": "string" } } },
"safety": { "type": "object", "additionalProperties": false, "required": ["class"], "properties": { "class": { "enum": ["read", "write", "destructive", "external_message", "financial_or_irreversible"] }, "confirmation": { "type": "object", "additionalProperties": false, "required": ["ttl_ms"], "properties": { "ttl_ms": { "type": "integer", "minimum": 1 } } } } },
"approval_policy": { "type": "object", "additionalProperties": false, "required": ["required", "ttl_seconds", "show_payload_preview", "payload_preview_mode"], "properties": { "required": { "type": "boolean" }, "mode": { "enum": ["custom", "elicitation"] }, "risk_level": { "enum": ["normal", "dangerous", "financial", "irreversible"] }, "ttl_seconds": { "type": "integer", "minimum": 1 }, "show_payload_preview": { "type": "boolean" }, "payload_preview_mode": { "enum": ["summary", "masked_json"] }, "elicitation_message": { "type": "string" } } },
"auth_profile_ref": { "type": "string", "minLength": 1, "maxLength": 256 }, "headers": { "$ref": "#/$defs/string_map" }
}
},
"tool_description": {
"type": "object", "additionalProperties": false, "required": ["title", "description"],
"properties": { "title": { "type": "string", "maxLength": 256 }, "description": { "type": "string", "maxLength": 65536 }, "tags": { "type": "array", "maxItems": 4096, "items": { "type": "string", "maxLength": 256 } }, "examples": { "type": "array", "maxItems": 4096, "items": { "type": "object", "additionalProperties": false, "required": ["input"], "properties": { "input": {} } } } }
}
}
}