Skip to main content

Capturer

Trait Capturer 

Source
pub trait Capturer:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &'static str;
    fn tool_name(&self) -> &'static str;
    fn render_pre(
        &self,
        ctx: &HookContext,
        input: &Value,
    ) -> Option<DisplayEntry>;

    // Provided methods
    fn subscribes_to(&self) -> &'static [HookEvent] { ... }
    fn pre_rewrite(&self, _ctx: &HookContext, _input: &Value) -> RewriteDecision { ... }
    fn render_post(
        &self,
        _ctx: &HookContext,
        _input: &Value,
        _response: &Value,
    ) -> Option<DisplayEntryUpdate> { ... }
}
Expand description

The contribution API. Every observed CC tool gets one Capturer impl in this crate’s source tree.

Required Methods§

Source

fn name(&self) -> &'static str

Stable identifier; matches [capture.<name>] in config and the filter UI label.

Source

fn tool_name(&self) -> &'static str

CC tool name to match (e.g. "Bash", "Read").

Source

fn render_pre(&self, ctx: &HookContext, input: &Value) -> Option<DisplayEntry>

Render a PreToolUse event. Return None to suppress (e.g. for noisy calls).

Provided Methods§

Source

fn subscribes_to(&self) -> &'static [HookEvent]

Which hook events this capturer wants. Default: both Pre and Post.

Source

fn pre_rewrite(&self, _ctx: &HookContext, _input: &Value) -> RewriteDecision

Optional rewrite. Default: passthrough. Only the Bash capturer overrides this in v0.1.

Source

fn render_post( &self, _ctx: &HookContext, _input: &Value, _response: &Value, ) -> Option<DisplayEntryUpdate>

Render a PostToolUse event. Default: no update (Pre-only capturers). The wrapper correlates Pre↔Post by tool_use_id and applies this update.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§