Skip to main content

Module custom_region

Module custom_region 

Source
Expand description

Runtime side of script-backed custom regions (RegionKind::Custom).

The scripting layer (leviath_scripting::region_hook) compiles and runs the hooks; this module owns everything on the runtime side of that JSON boundary: building the ctx objects a hook receives, interpreting each hook’s returned value, and every fallback. The contract is that a hook failure can never fail an inference or lose a write:

  • render failure → the region renders as a Temporary-style block ([{name}]:\n…, Never cache hint) and a warning names the script.
  • on_write failure → the entry is accepted unchanged.
  • on_overflow failure or invalid indices → oldest-first eviction.

Structs§

AssembleMeta
Stage-level metadata threaded into render(ctx). Default (empty name, zero iterations, empty model) is used by callers with no stage context - the transition-choice request and plain assemble() in tests.