pub struct HookDirDef {
pub events: Vec<HookEvent>,
pub type: HookType,
pub command: Option<String>,
pub prompt: Option<String>,
pub model: Option<String>,
pub timeout: u64,
pub retry: u32,
pub on_error: OnError,
pub filter: HookFilter,
}Expand description
HOOK.yaml / HOOK.yml 定义(目录布局下的格式)
与 HookDef 的区别:events 为列表(一个 hook 可绑定多个事件),无 command/prompt 以外的不必要字段。
目录布局下 command 中的相对路径以 hook 目录为 cwd 解析。
Fields§
§events: Vec<HookEvent>绑定的事件列表
type: HookTypeHook 类型
command: Option<String>Shell 命令(type=bash 时必填,通过 sh -c 执行,cwd 为 hook 目录)
prompt: Option<String>LLM prompt 模板(type=llm 时必填,支持 {{variable}} 模板变量)
model: Option<String>LLM 模型名覆盖
timeout: u64超时秒数(bash 默认 10,llm 默认 30)
retry: u32重试次数(仅 Err 路径生效)
on_error: OnError失败策略
filter: HookFilter条件过滤
Implementations§
Trait Implementations§
Source§impl Clone for HookDirDef
impl Clone for HookDirDef
Source§fn clone(&self) -> HookDirDef
fn clone(&self) -> HookDirDef
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HookDirDef
impl Debug for HookDirDef
Source§impl<'de> Deserialize<'de> for HookDirDef
impl<'de> Deserialize<'de> for HookDirDef
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for HookDirDef
impl RefUnwindSafe for HookDirDef
impl Send for HookDirDef
impl Sync for HookDirDef
impl Unpin for HookDirDef
impl UnsafeUnpin for HookDirDef
impl UnwindSafe for HookDirDef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.