m2-market/schemas/solution.schema.json

256 lines
8.3 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://git.machinemachine.ai/m2/m2-market/schemas/solution.schema.json",
"title": "m2.solution.v1",
"description": "Commercial Solution manifest. v1 is a marketplace superset of the fedlearn core fields: applicability, tenant_scope, evidence, content_hash, and scrub_status for tenant-derived work.",
"type": "object",
"required": [
"schema_version",
"solution_id",
"name",
"summary",
"intent",
"deployment",
"applicability",
"tenant_scope",
"evidence",
"content_hash",
"price",
"seller",
"license"
],
"properties": {
"schema_version": { "const": "m2.solution.v1" },
"solution_id": {
"type": "string",
"pattern": "^sol_[a-z0-9][a-z0-9-]*$"
},
"name": { "type": "string", "minLength": 1 },
"summary": { "type": "string", "minLength": 1 },
"description": { "type": "string" },
"intent": { "type": "string", "minLength": 1 },
"behavior": { "type": "object", "additionalProperties": true },
"tools": {
"type": "array",
"items": { "type": "object", "additionalProperties": true },
"default": []
},
"runtime": { "type": "object", "additionalProperties": true },
"memory_schema": { "type": "object", "additionalProperties": true },
"permissions": {
"type": "array",
"items": { "$ref": "#/$defs/permission" },
"default": []
},
"deployment": {
"type": "object",
"required": ["recipe_ref", "entrypoint", "verify_command"],
"properties": {
"recipe_ref": { "type": "string", "minLength": 1 },
"entrypoint": { "type": "string", "minLength": 1 },
"verify_command": { "type": "string", "minLength": 1 }
},
"additionalProperties": false
},
"applicability": { "$ref": "#/$defs/applicability" },
"tenant_scope": {
"type": "string",
"minLength": 1,
"description": "Canonical tenant id from contracts/tenants.md. Use m2-core for shared commons/evidence."
},
"owner_initiated": { "type": "boolean" },
"scrub_status": {
"type": "object",
"properties": {
"double_scrubbed": { "type": "boolean" },
"reviewers": {
"type": "array",
"items": { "type": "string", "minLength": 1 }
}
},
"additionalProperties": true
},
"evidence": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/evidence" }
},
"content_hash": { "$ref": "#/$defs/sha256" },
"price": { "$ref": "#/$defs/price" },
"seller": { "$ref": "#/$defs/seller" },
"license": { "$ref": "#/$defs/license" },
"revenue_split": { "$ref": "#/$defs/revenue_split" }
},
"additionalProperties": false,
"allOf": [
{
"if": {
"properties": { "tenant_scope": { "const": "m2-core" } },
"required": ["tenant_scope"]
},
"else": {
"properties": {
"owner_initiated": { "const": true },
"scrub_status": {
"type": "object",
"required": ["double_scrubbed"],
"properties": {
"double_scrubbed": { "const": true }
},
"additionalProperties": true
}
},
"required": ["owner_initiated", "scrub_status"]
}
}
],
"$defs": {
"sha256": {
"type": "string",
"pattern": "^sha256:[a-f0-9]{64}$"
},
"applicability": {
"type": "object",
"required": ["image_classes", "roles", "tool_requirements"],
"properties": {
"image_classes": {
"type": "array",
"items": { "type": "string", "minLength": 1 }
},
"roles": {
"type": "array",
"items": { "type": "string", "minLength": 1 }
},
"tool_requirements": {
"type": "array",
"items": { "type": "string", "minLength": 1 }
}
},
"additionalProperties": false
},
"evidence": {
"type": "object",
"required": ["source"],
"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 },
"content_hash": { "$ref": "#/$defs/sha256" }
},
"additionalProperties": true
},
"price": {
"oneOf": [
{
"type": "object",
"required": ["model", "amount", "currency"],
"properties": {
"model": { "const": "fixed" },
"amount": { "type": "integer", "minimum": 1 },
"currency": { "const": "m2cr" }
},
"additionalProperties": false
},
{
"type": "object",
"required": ["model", "currency", "quote", "settlement"],
"properties": {
"model": { "const": "job" },
"currency": { "const": "m2cr" },
"quote": {
"type": "object",
"required": ["min_amount", "max_amount", "expires_after_hours", "requires_acceptance"],
"properties": {
"min_amount": { "type": "integer", "minimum": 1 },
"max_amount": { "type": "integer", "minimum": 1 },
"expires_after_hours": { "type": "integer", "minimum": 1 },
"requires_acceptance": { "type": "boolean" }
},
"additionalProperties": false
},
"settlement": {
"type": "object",
"required": ["ledger_reason", "escrow_required"],
"properties": {
"ledger_reason": { "const": "job" },
"escrow_required": { "type": "boolean" }
},
"additionalProperties": false
}
},
"additionalProperties": false
}
]
},
"seller": {
"type": "object",
"required": ["operator_id", "display_name"],
"properties": {
"operator_id": {
"type": "string",
"pattern": "^op_[a-z0-9][a-z0-9-]*$"
},
"display_name": { "type": "string", "minLength": 1 },
"contact_ref": { "type": "string", "minLength": 1 },
"tenant_id": { "type": "string", "minLength": 1 }
},
"additionalProperties": false
},
"license": {
"type": "object",
"required": ["license_id", "terms", "scope", "major_version_coverage", "allows_internal_modification", "allows_redistribution", "support"],
"properties": {
"license_id": { "const": "lic_m2_market_standard_v1" },
"terms": { "const": "m2-market-standard-v1" },
"scope": { "const": "operator" },
"major_version_coverage": { "const": true },
"allows_internal_modification": { "const": true },
"allows_redistribution": { "const": false },
"support": { "const": "best_effort" }
},
"additionalProperties": false
},
"revenue_split": {
"type": "object",
"required": ["platform_pct", "seller_pct"],
"properties": {
"platform_pct": { "type": "integer", "minimum": 0, "maximum": 100 },
"seller_pct": { "type": "integer", "minimum": 0, "maximum": 100 },
"contributors": {
"type": "array",
"items": {
"type": "object",
"required": ["operator_id", "pct"],
"properties": {
"operator_id": {
"type": "string",
"pattern": "^op_[a-z0-9][a-z0-9-]*$"
},
"pct": { "type": "integer", "minimum": 1, "maximum": 100 }
},
"additionalProperties": false
},
"default": []
}
},
"additionalProperties": false
},
"permission": {
"type": "object",
"required": ["permission_id", "kind", "access", "scope", "target"],
"properties": {
"permission_id": { "type": "string", "minLength": 1 },
"kind": { "type": "string", "minLength": 1 },
"access": { "type": "string", "minLength": 1 },
"scope": { "type": "string", "minLength": 1 },
"target": { "type": "string", "minLength": 1 },
"reason": { "type": "string" },
"secret_ref": { "type": "string" }
},
"additionalProperties": true
}
}
}