Skip to main content

Module script_provider

Module script_provider 

Source
Expand description

Lazy, hot-reloading resolution of Rhai script providers.

Native providers are built eagerly at daemon startup. Script providers are not: a .rhai file in the providers directory becomes a live provider only when an agent references its name, and it is reloaded automatically when the file changes. ScriptProviderLayer is the seam the ProviderRegistry consults for any name it doesn’t have natively; it caches compiled providers keyed by file mtime, so:

  • first reference to <name> → compile + initialize + cache;
  • unchanged file → cached instance (no recompile);
  • edited file (newer mtime) → rebuild;
  • a brand-new file that didn’t exist at startup → loads on first reference;
  • a deleted file → evicted, the provider disappears;
  • a broken script → not resolved (logged), so selection falls through.

Structs§

ScriptProviderLayer
Lazy, hot-reloading resolver for script providers.
ScriptProviderSpec
Per-provider configuration from [model_providers.<name>]. All fields are optional overrides - a script activates by an agent referencing its name and the file existing, not by having an entry here.