/**
* Explicit transport guarantees for a custom `llm_caller`.
*
* Harn cannot inspect an arbitrary caller closure, so recovery mechanisms stay
* fail-closed unless the caller declares that it forwards the supplied
* assistant prefill unchanged to the provider transport. This says nothing
* about provider support; the resolved provider capability remains a separate
* required gate.
*/
pub type LlmCallerTransport = {forwards_assistant_prefill?: bool}
pub fn __validate_llm_caller(value) -> nil {
if value == nil {
return
}
if type_of(value) != "closure" {
throw "agent_loop: `llm_caller` must be a closure or nil; got " + type_of(value)
}
}
pub fn __normalize_llm_caller_transport(value) -> LlmCallerTransport {
if value == nil {
return {forwards_assistant_prefill: false}
}
if type_of(value) != "dict" {
throw "agent_loop: `llm_caller_transport` must be a dict or nil; got " + type_of(value)
}
const forwards_assistant_prefill = value?.forwards_assistant_prefill ?? false
if type_of(forwards_assistant_prefill) != "bool" {
throw "agent_loop: `llm_caller_transport.forwards_assistant_prefill` must be a bool; got "
+ type_of(
forwards_assistant_prefill,
)
}
return {forwards_assistant_prefill: forwards_assistant_prefill}
}