pub struct HookConfig {
pub event: HookEvent,
pub command: PathBuf,
pub priority: i32,
pub timeout_ms: u32,
pub mode: HookMode,
pub enabled: bool,
pub namespace: String,
pub fail_mode: FailMode,
}Expand description
One [[hook]] block from hooks.toml.
v0.7.0 R3-S3 — mode is now optional in TOML; missing values are
resolved via default_mode_for_event (daemon for hot-path
events, exec otherwise). The struct field stays required so the
in-memory representation is unambiguous; only the wire shape is
relaxed.
Fields§
§event: HookEvent§command: PathBuf§priority: i32§timeout_ms: u32§mode: HookMode§enabled: bool§namespace: String§fail_mode: FailModeG5 — chain crash-handling posture. Defaults to
FailMode::Open so existing G3-era configs keep firing
fail-open even after G5 wires the chain runner in. Hooks
that gate compliance-critical paths set
fail_mode = "closed" to convert executor errors into a
chain-level Deny.
Implementations§
Source§impl HookConfig
impl HookConfig
Sourcepub fn load_from_file(path: &Path) -> Result<Vec<HookConfig>, HooksConfigError>
pub fn load_from_file(path: &Path) -> Result<Vec<HookConfig>, HooksConfigError>
Load and validate the hook config file at path.
Returns the hook entries in their original on-disk order; G5’s chain ordering pass is responsible for the priority-descending sort.
Sourcepub fn load_from_str(
contents: &str,
) -> Result<Vec<HookConfig>, HooksConfigError>
pub fn load_from_str( contents: &str, ) -> Result<Vec<HookConfig>, HooksConfigError>
Parse + validate from a TOML string. Split out from
Self::load_from_file so unit tests can exercise the
parser without touching disk.
Sourcepub fn default_path() -> Option<PathBuf>
pub fn default_path() -> Option<PathBuf>
dirs::config_dir().join("ai-memory/hooks.toml") — the
platform-correct default location.
Trait Implementations§
Source§impl Clone for HookConfig
impl Clone for HookConfig
Source§fn clone(&self) -> HookConfig
fn clone(&self) -> HookConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HookConfig
impl Debug for HookConfig
Source§impl<'de> Deserialize<'de> for HookConfig
Adapter shape implementing Deserialize via [HookConfigRaw].
Kept separate from HookConfig so the public type stays
derive-Deserialize-able (callers that build a HookConfig
in-memory and then serde_json::from_value still work).
impl<'de> Deserialize<'de> for HookConfig
Adapter shape implementing Deserialize via [HookConfigRaw].
Kept separate from HookConfig so the public type stays
derive-Deserialize-able (callers that build a HookConfig
in-memory and then serde_json::from_value still work).
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>,
impl Eq for HookConfig
Source§impl PartialEq for HookConfig
impl PartialEq for HookConfig
Source§fn eq(&self, other: &HookConfig) -> bool
fn eq(&self, other: &HookConfig) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for HookConfig
impl Serialize for HookConfig
impl StructuralPartialEq for HookConfig
Auto Trait Implementations§
impl Freeze for HookConfig
impl RefUnwindSafe for HookConfig
impl Send for HookConfig
impl Sync for HookConfig
impl Unpin for HookConfig
impl UnsafeUnpin for HookConfig
impl UnwindSafe for HookConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more