WithHooksRegistry plugs a pre-populated [hooks.Registry] into the runtime instead of letting it allocate a fresh one. Embedders use this to pre-register builtins they own (today snapshot, tomorrow any custom builtin) so the auto-injection chain set up by [WithAutoInjector] resolves against the same
(reg *hooks.Registry)
| 544 | // unload, ...) on top of the supplied registry, so the embedder only |
| 545 | // needs to install entries that the runtime can't construct itself. |
| 546 | func WithHooksRegistry(reg *hooks.Registry) Opt { |
| 547 | return func(r *LocalRuntime) { |
| 548 | if reg != nil { |
| 549 | r.hooksRegistry = reg |
| 550 | } |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | // New creates a runtime ready to drive an agent loop. It is a thin |
| 555 | // alias for [NewLocalRuntime] returning the [Runtime] interface, kept |