{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://obliteratus.dev/schemas/trusted-worker-message-v1.schema.json", "title": "OBLITERATUS Trusted Worker Message v1", "type": "object", "additionalProperties": false, "required": ["schema_id", "schema_version", "message_type", "sequence", "source_inventory_digest", "adapter_digest", "policy_digest", "payload"], "properties": { "schema_id": {"const": "obliteratus.trusted-worker-message"}, "schema_version": {"const": "1.0.0"}, "message_type": {"enum": ["metadata_record", "tensor_fragment_record", "error", "complete"]}, "sequence": {"type": "integer", "minimum": 0, "maximum": 100000000}, "source_inventory_digest": {"$ref": "#/$defs/digest"}, "adapter_digest": {"$ref": "#/$defs/digest"}, "policy_digest": {"$ref": "#/$defs/digest"}, "payload": {"type": "object"} }, "allOf": [ {"if": {"properties": {"message_type": {"const": "metadata_record"}}}, "then": {"properties": {"payload": {"$ref": "#/$defs/metadata"}}}}, {"if": {"properties": {"message_type": {"const": "tensor_fragment_record"}}}, "then": {"properties": {"payload": {"$ref": "#/$defs/fragment"}}}}, {"if": {"properties": {"message_type": {"const": "error"}}}, "then": {"properties": {"payload": {"$ref": "#/$defs/error"}}}}, {"if": {"properties": {"message_type": {"const": "complete"}}}, "then": {"properties": {"payload": {"$ref": "#/$defs/complete"}}}} ], "$defs": { "id": {"type": "string", "minLength": 1, "maxLength": 512}, "digest": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"}, "metadata": { "type": "object", "additionalProperties": false, "required": ["record_id", "record_type", "subject", "value", "evidence_refs"], "properties": { "record_id": {"$ref": "#/$defs/id"}, "record_type": {"enum": ["producer", "topology", "state_scope", "tensor_metadata"]}, "subject": {"type": "string", "pattern": "^/", "maxLength": 1024}, "value": {"type": ["string", "integer", "boolean", "null"], "maxLength": 4096}, "evidence_refs": {"type": "array", "maxItems": 1024, "uniqueItems": true, "items": {"$ref": "#/$defs/id"}} } }, "fragment": { "type": "object", "additionalProperties": false, "required": ["fragment_id", "tensor_name", "dtype", "shape", "source_file_id", "source_byte_offset", "source_byte_length", "source_digest", "logical_axis", "logical_start", "logical_end"], "properties": { "fragment_id": {"$ref": "#/$defs/id"}, "tensor_name": {"$ref": "#/$defs/id"}, "dtype": {"$ref": "#/$defs/id"}, "shape": {"type": "array", "maxItems": 64, "items": {"type": "integer", "minimum": 0, "maximum": 9223372036854775807}}, "source_file_id": {"$ref": "#/$defs/id"}, "source_byte_offset": {"type": "integer", "minimum": 0, "maximum": 9223372036854775807}, "source_byte_length": {"type": "integer", "minimum": 1, "maximum": 9223372036854775807}, "source_digest": {"$ref": "#/$defs/digest"}, "logical_axis": {"type": ["integer", "null"], "minimum": 0, "maximum": 63}, "logical_start": {"type": "integer", "minimum": 0, "maximum": 9223372036854775807}, "logical_end": {"type": "integer", "minimum": 0, "maximum": 9223372036854775807} } }, "error": { "type": "object", "additionalProperties": false, "required": ["code", "phase", "category", "subject_ids", "limit", "actual"], "properties": { "code": {"type": "string", "pattern": "^DCI_[A-Z0-9_]+$"}, "phase": {"enum": ["policy", "preflight", "reader", "protocol", "validation", "materialization", "promotion", "evidence", "cleanup"]}, "category": {"enum": ["unsupported", "trust", "source", "runtime", "resource", "protocol", "validation", "output", "evidence", "cleanup"]}, "subject_ids": {"type": "array", "maxItems": 128, "uniqueItems": true, "items": {"$ref": "#/$defs/id"}}, "limit": {"type": ["integer", "null"], "minimum": 0}, "actual": {"type": ["integer", "null"], "minimum": 0} } }, "complete": { "type": "object", "additionalProperties": false, "required": ["record_count", "encoded_bytes", "transcript_digest"], "properties": { "record_count": {"type": "integer", "minimum": 0, "maximum": 100000000}, "encoded_bytes": {"type": "integer", "minimum": 0, "maximum": 9223372036854775807}, "transcript_digest": {"$ref": "#/$defs/digest"} } } } }