diff --git a/schemas/solution.schema.json b/schemas/solution.schema.json new file mode 100644 index 0000000..9b905fa --- /dev/null +++ b/schemas/solution.schema.json @@ -0,0 +1,239 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://git.machinemachine.ai/m2/market-registry/schemas/solution.schema.json", + "title": "Solution", + "description": "The installable bundle manifest for the m2 marketplace. Frozen v1 contract (specs/001-market-first-wedge/data-model.md, research.md R3).", + "type": "object", + "properties": { + "schema_version": { + "const": "m2.solution.v1" + }, + "solution_id": { + "type": "string", + "pattern": "^sol_[a-z0-9-]+$" + }, + "name": { + "type": "string", + "minLength": 1 + }, + "summary": { + "type": "string", + "minLength": 1 + }, + "description": { + "type": "string" + }, + "intent": { + "type": "string", + "minLength": 1 + }, + "behavior": { + "type": "object" + }, + "tools": { + "type": "array", + "items": { + "type": "object" + } + }, + "runtime": { + "type": "object" + }, + "memory_schema": { + "type": "object" + }, + "permissions": { + "type": "array", + "items": { + "type": "object" + } + }, + "deployment": { + "type": "object", + "description": "recipe.yaml ref + entrypoint + verify command", + "properties": { + "recipe_ref": { + "type": "string", + "minLength": 1 + }, + "entrypoint": { + "type": "string", + "minLength": 1 + }, + "verify_command": { + "type": "string", + "minLength": 1 + } + }, + "required": ["recipe_ref", "entrypoint", "verify_command"], + "additionalProperties": false + }, + "applicability": { + "type": "object", + "description": "fedlearn-compatible applicability constraints", + "properties": { + "image_classes": { + "type": "array", + "items": { + "type": "string" + } + }, + "roles": { + "type": "array", + "items": { + "type": "string" + } + }, + "tool_requirements": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "additionalProperties": false + }, + "tenant_scope": { + "type": "string", + "minLength": 1, + "description": "'m2-core' for shared/free, or a tenant id for tenant-scoped work" + }, + "owner_initiated": { + "type": "boolean" + }, + "scrub_status": { + "type": "object", + "properties": { + "double_scrubbed": { + "type": "boolean" + } + }, + "additionalProperties": true + }, + "evidence": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "source": { + "type": "string", + "minLength": 1 + }, + "excerpt": { + "type": "string" + }, + "machine": { + "type": "string" + }, + "session": { + "type": "string" + }, + "tokens": { + "type": "integer", + "minimum": 0 + }, + "wall_time": { + "type": "number", + "minimum": 0 + } + }, + "required": ["source"], + "additionalProperties": false + } + }, + "content_hash": { + "type": "string", + "pattern": "^sha256:[a-f0-9]{64}$" + }, + "price": { + "type": "object", + "properties": { + "amount": { + "type": "integer", + "minimum": 1 + }, + "currency": { + "const": "m2cr" + }, + "model": { + "type": "string", + "enum": ["fixed"] + } + }, + "required": ["amount", "currency", "model"], + "additionalProperties": false + }, + "seller": { + "type": "string", + "minLength": 1, + "description": "operator_id" + }, + "license": { + "type": "object", + "properties": { + "terms": { + "type": "string", + "minLength": 1 + }, + "major_version_coverage": { + "const": true + } + }, + "required": ["terms", "major_version_coverage"], + "additionalProperties": false + }, + "revenue_split": { + "type": "object", + "properties": { + "platform_pct": { + "type": "number", + "minimum": 0, + "maximum": 100 + } + }, + "additionalProperties": false + } + }, + "required": [ + "schema_version", + "solution_id", + "name", + "summary", + "intent", + "deployment", + "applicability", + "tenant_scope", + "evidence", + "content_hash", + "price", + "seller", + "license" + ], + "additionalProperties": false, + "if": { + "properties": { + "tenant_scope": { + "const": "m2-core" + } + }, + "required": ["tenant_scope"] + }, + "else": { + "properties": { + "owner_initiated": { + "const": true + }, + "scrub_status": { + "type": "object", + "properties": { + "double_scrubbed": { + "const": true + } + }, + "required": ["double_scrubbed"] + } + }, + "required": ["owner_initiated", "scrub_status"] + } +}