hylo.core.contract¶
Package: hylo-core · Core contracts
contract ¶
Base class and field types for data contracts.
Rules:
- Data that crosses a boundary (process, file, version, plugin) is a frozen pydantic model with
extra="forbid", so typos fail loudly and every contract has a JSON Schema.
- Runtime objects that hold callables or live handles (EpisodeContext, SafetyContext) stay plain
dataclasses; they are never serialized.
- numpy arrays use NDArray; free-form payloads that may contain arrays use JsonAny. Both
round-trip through JSON via core.codec, so model_dump(mode="json") / model_validate is the
whole wire format.
- Formats written before the rename to Hylo (2026-11-01) carry wc.<name>/v<x> schema ids and refer to
worldcurrent.* modules. They are read as hylo.<name>/v<x> and hylo.* (current_schema,
current_module), so recorded runs, artifacts, configs and profiles stay readable; nothing is rewritten on disk.
LEGACY_MODULE_PREFIXES
module-attribute
¶
NDArray
module-attribute
¶
NDArray = Annotated[np.ndarray, PlainValidator(_to_array), PlainSerializer(codec.encode_array, when_used='json'), WithJsonSchema({'type': 'object', 'description': 'numpy array {__nd__, dtype, shape, b64}', 'required': ['__nd__', 'dtype', 'shape', 'b64']})]
JsonAny
module-attribute
¶
JsonAny = Annotated[Any, PlainValidator(codec.decode), PlainSerializer(codec.encode, when_used='json'), WithJsonSchema({})]
current_schema ¶
A schema id as it is named now: "wc.critic/v0.1" -> "hylo.critic/v0.1" (anything else unchanged).
current_module ¶
A module or module:attr reference as it is named now: "worldcurrent.agents.x:Y" -> "hylo.agents.x:Y".