pub enum HookShape {
Asks,
DenyOnly,
CamelCase,
Context,
Steps,
CursorShell,
Cursor,
}Expand description
The hook contract a call arrived in, told apart by its stdin. It decides which field carries the answer. A rule that fired is an allow with one warning line in every shape, and a rule that blocks is that shape’s deny on a tool call.
Variants§
Asks
snake_case stdin; the warning goes in additionalContext.
DenyOnly
snake_case stdin carrying turn_id, the command harness PreToolUse; the
warning goes in additionalContext.
CamelCase
camelCase stdin (hookEventName, toolInput), the build harness; the
warning goes in additionalContext.
Context
lower-case event names (pre_llm_call, pre_tool_call) with the
prompt under extra.user_message; a top-level context is
injected and carries the warning.
Steps
camelCase stdin with conversationId, no event name (the hook is
told it with --event), the command under toolCall.args, the
prompt only in the transcript. A tool gate answers decision: allow with the warning as its reason; context goes in as
injectSteps; a Stop is held with decision: continue.
CursorShell
The editor harness’s beforeShellExecution: snake_case stdin carrying
cursor_version, the command at the top level. Answers
permission: allow with the warning in user_message and
agent_message. The editor harness blocks the command when the answer is not
JSON.
Cursor
Every other editor harness event. Context reaches the model as
additional_context only on postToolUse, postToolUseFailure
and sessionStart. A stop is held with followup_message.
preToolUse answers as beforeShellExecution does, which is
the shell shape.
Implementations§
Trait Implementations§
impl Copy for HookShape
impl Eq for HookShape
impl StructuralPartialEq for HookShape
Auto Trait Implementations§
impl Forget for HookShape
impl Freeze for HookShape
impl RefUnwindSafe for HookShape
impl Send for HookShape
impl Sync for HookShape
impl Unpin for HookShape
impl UnsafeUnpin for HookShape
impl UnwindSafe for HookShape
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,
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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> ErasedDestructor for Twhere
T: 'static,
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