Skip to main content

Module hooks

Module hooks 

Source
Expand description

Translates defect-config hook configuration into the agent’s DefaultHookEngine.

Hook assembly — the agent crate does not depend on the config crate, so translation happens during CLI assembly; this is also where we fail-fast with “unknown builtin name”.

All three handler variants are wired up:

Structs§

HookEngineCtx
Runtime context needed when assembling the hook engine.

Enums§

HookEngineBuildError
Build errors.

Functions§

build_engine_arc
Wraps a hook engine in an Arc so that the session/turn main loop can uniformly hold an Arc<dyn HookEngine>. When HooksConfig::is_empty, uses defect_agent::hooks::NoopHookEngine for a zero-overhead path.
build_hook_engine
Build a DefaultHookEngine from the [hooks] section and the builtin registry.
build_main_session_engine
Hook engine for the main session: automatically mounts two skill builtins on top of the user’s [hooks] configuration (when any skill is discovered) —