pub enum HookInput {
Show 18 variants
PreToolUse {
base: BaseHookInput,
tool_name: String,
tool_input: Value,
tool_use_id: String,
},
PostToolUse {
base: BaseHookInput,
tool_name: String,
tool_input: Value,
tool_response: Value,
tool_use_id: String,
},
PostToolUseFailure {
base: BaseHookInput,
tool_name: String,
tool_input: Value,
tool_use_id: String,
error: String,
is_interrupt: Option<bool>,
},
Notification {
base: BaseHookInput,
message: String,
title: Option<String>,
notification_type: String,
},
UserPromptSubmit {
base: BaseHookInput,
prompt: String,
},
SessionStart {
base: BaseHookInput,
source: SessionStartSource,
model: Option<String>,
},
SessionEnd {
base: BaseHookInput,
reason: String,
},
Stop {
base: BaseHookInput,
stop_hook_active: bool,
last_assistant_message: Option<String>,
},
SubagentStart {
base: BaseHookInput,
agent_id: String,
agent_type: String,
},
SubagentStop {
base: BaseHookInput,
stop_hook_active: bool,
agent_id: String,
agent_transcript_path: String,
agent_type: String,
last_assistant_message: Option<String>,
},
PreCompact {
base: BaseHookInput,
trigger: CompactTriggerType,
custom_instructions: Option<String>,
},
PermissionRequest {
base: BaseHookInput,
tool_name: String,
tool_input: Value,
permission_suggestions: Option<Vec<PermissionUpdate>>,
},
Setup {
base: BaseHookInput,
trigger: SetupTrigger,
},
TeammateIdle {
base: BaseHookInput,
teammate_name: String,
team_name: String,
},
TaskCompleted {
base: BaseHookInput,
task_id: String,
task_subject: String,
task_description: Option<String>,
teammate_name: Option<String>,
team_name: Option<String>,
},
ConfigChange {
base: BaseHookInput,
source: ConfigChangeSource,
file_path: Option<String>,
},
WorktreeCreate {
base: BaseHookInput,
name: String,
},
WorktreeRemove {
base: BaseHookInput,
worktree_path: String,
},
}Expand description
Union of all hook input types, tagged by event name.
Each variant carries the BaseHookInput plus event-specific fields.
§Example
use starpod_hooks::{HookInput, BaseHookInput};
let input = HookInput::UserPromptSubmit {
base: BaseHookInput {
session_id: "sess-1".into(),
transcript_path: String::new(),
cwd: "/tmp".into(),
permission_mode: None,
agent_id: None,
agent_type: None,
},
prompt: "Hello!".into(),
};
assert_eq!(input.event_name(), "UserPromptSubmit");
assert!(input.tool_name().is_none());Variants§
PreToolUse
PostToolUse
Fields
§
base: BaseHookInputPostToolUseFailure
Fields
§
base: BaseHookInputNotification
UserPromptSubmit
SessionStart
SessionEnd
Stop
SubagentStart
SubagentStop
Fields
§
base: BaseHookInputPreCompact
PermissionRequest
Setup
TeammateIdle
TaskCompleted
Fields
§
base: BaseHookInputConfigChange
WorktreeCreate
WorktreeRemove
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for HookInput
impl<'de> Deserialize<'de> for HookInput
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<HookInput, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<HookInput, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for HookInput
impl Serialize for HookInput
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for HookInput
impl RefUnwindSafe for HookInput
impl Send for HookInput
impl Sync for HookInput
impl Unpin for HookInput
impl UnsafeUnpin for HookInput
impl UnwindSafe for HookInput
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> 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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.