Skip to main content

to_legacy

Function to_legacy 

Source
pub fn to_legacy(
    hook_name: &str,
    payload: &dyn PluginPayload,
) -> Result<ShimmedPayload, HostError>
Expand description

Translate a cmf.* hook invocation into the legacy hook a worker without cmf_hooks support understands.

Fails closed for the LLM hooks (no legacy equivalent), for a payload that is not a MessagePayload, and for a message that does not hold exactly one content part of the kind the hook’s legacy payload is built from.