pub struct HookGateRecord {
pub v: u32,
pub ts: DateTime<Utc>,
pub gate: String,
pub hook_event: String,
pub tool: String,
pub subject: String,
pub verdict: String,
pub detail: Option<String>,
pub session_id: Option<String>,
pub tool_use_id: Option<String>,
}Expand description
One structured hook outcome, appended as one JSON line to
record_file by kranz hook-guard. Session-writable evidence —
parsed tolerantly, never trusted (see module docs).
Fields§
§v: u32SPEC_VERSION at write time.
ts: DateTime<Utc>§gate: StringGate identity (HOOK_GATE_ID).
hook_event: StringThe lifecycle event that fired ("PreToolUse").
tool: StringThe tool whose call was judged (Write, Edit, …).
subject: StringThe judged target: the repo-relative path when it resolved inside
the checkout, else the raw path / (unresolved).
verdict: String"blocked" (the write was refused in-process) or "error" (the
guard itself failed open — the action proceeded and only the
engine-side sweep can judge it).
detail: Option<String>The guard’s reason / error note.
session_id: Option<String>The CLI’s session id from the hook payload, when present.
tool_use_id: Option<String>The CLI’s tool-use id from the hook payload, when present.
Implementations§
Source§impl HookGateRecord
impl HookGateRecord
Sourcepub fn blocked(
spec: &HookGateSpec,
hook_event: &str,
tool: &str,
subject: &str,
reason: &str,
session_id: Option<&str>,
tool_use_id: Option<&str>,
) -> Self
pub fn blocked( spec: &HookGateSpec, hook_event: &str, tool: &str, subject: &str, reason: &str, session_id: Option<&str>, tool_use_id: Option<&str>, ) -> Self
A blocked record for one refused tool call.
Sourcepub fn error(spec: &HookGateSpec, note: &str) -> Self
pub fn error(spec: &HookGateSpec, note: &str) -> Self
An error record: the guard loaded its spec but could not judge
(unparseable hook payload, missing tool name) and failed open.
Trait Implementations§
Source§impl Clone for HookGateRecord
impl Clone for HookGateRecord
Source§fn clone(&self) -> HookGateRecord
fn clone(&self) -> HookGateRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more