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:
Builtin { name }→ looks upBuiltinRegistryby name; unknown name triggersHookEngineBuildError::UnknownBuiltinfail-fastCommand(_)→CommandHandler::new(either direct argv spawn or explicit shell)Prompt(_)→PromptHandler::new; during CLI assembly the current default provider/model is injected (whenHookPromptSpec.model = None, falls back to the session default model)
Structs§
- Hook
Engine Ctx - Runtime context needed when assembling the hook engine.
Enums§
- Hook
Engine Build Error - Build errors.
Functions§
- build_
engine_ arc - Wraps a hook engine in an
Arcso that the session/turn main loop can uniformly hold anArc<dyn HookEngine>. WhenHooksConfig::is_empty, usesdefect_agent::hooks::NoopHookEnginefor a zero-overhead path. - build_
hook_ engine - Build a
DefaultHookEnginefrom 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) —