Skip to main content

Module hook

Module hook 

Source
Expand description

The tool-use filter seam.

ToolUseHook is THE extension point for the tool-use batch between model output and tool dispatch: TurnRunner calls it here, and the concrete filter policies (DedupFilter, DenyAllFilter, FilterChain) in this crate implement it directly. Defining the trait next to both its consumer (the driver) and its policies (the filters) keeps the seam, its only consumer, and its implementations together.

§Minimum invariant, not a policy

This crate ships no opinion in the trait: the only built-in impl is PassthroughHook — a zero-sized type that admits every call unchanged. That is the literal absence of behavior, the minimum the trait requires to be callable.

Specific filter policies (dedup by (tool_name, arguments), approval-rewrites-amount, kill-switch denial, etc.) are host concerns; the driver applies whatever hook the caller plugged via TurnRunner::with_hook(_, _, your_hook); TurnRunner::new() defaults to PassthroughHook.

Structs§

HookCtx
Context supplied to every hook invocation.
HookOutcome
Result of a hook pass.
PassthroughHook
Zero-sized hook that admits every call unchanged — the literal absence of behavior, not a policy.
UnknownDecision
One explicit per-call unknown-outcome decision — host decision / checkpoint data attached to a precomputed result whose status is UnknownOutcome, not a result envelope: the recorded result is committed verbatim either way. Where a decision set is a new host input (hook, BatchDecision::Reject, resume), entries may be omitted — the missing ones resolve through UnknownOutcomeConfig by the executed tool name. Where it is a checkpoint (PreparedApproval), it must exactly cover the saved UnknownOutcome results.

Traits§

ToolUseHook
The tool-use filter seam this component exposes.