pub fn serialize_payload(
payload: &dyn PluginPayload,
) -> Result<Value, HostError>Expand description
Serialize an erased payload to the JSON shape the worker reconstructs.
The downcast chain covers every type this host can hand out, in rough
frequency order. MessagePayload comes first, mirroring cpex-ffi’s
serialize_payload.
An unrecognized concrete type is an error rather than a silent null: it
means some other host handed this adapter a payload it cannot forward, and
sending null would surface inside the worker as a confusing Pydantic
validation failure instead.