Skip to main content

base/telemetry/
hook.rs

1//! Hook events.
2
3use serde::Serialize;
4
5/// One run of an event's hooks: how long the model's step waited on them,
6/// and whether they stopped something.
7#[derive(Debug, Clone, Serialize, schemars::JsonSchema)]
8pub struct HookRunPayload {
9    /// The hook event's name, e.g. `PreToolUse`.
10    pub event: String,
11    pub hook_count: usize,
12    pub duration_ms: u64,
13    pub blocked: bool,
14    /// Hooks that failed, timed out or were stopped.
15    pub errors: usize,
16    /// The tool call the run was about, for the tool events.
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub tool_use_id: Option<String>,
19}