pub struct HookRecorder { /* private fields */ }Expand description
Records the hook events that fire, by event type name, in order.
Register it on a HookRegistry with register, or pass it to an agent as
a Plugin. Clones share the recording.
use strands::hooks::HookRegistry;
use strands::testing::HookRecorder;
let recorder = HookRecorder::new();
let hooks = HookRegistry::new();
recorder.register(&hooks);
assert_eq!(hooks.len(), 17);
assert!(recorder.events().is_empty());Implementations§
Source§impl HookRecorder
impl HookRecorder
Trait Implementations§
Source§impl Clone for HookRecorder
impl Clone for HookRecorder
Source§impl Debug for HookRecorder
impl Debug for HookRecorder
Source§impl Default for HookRecorder
impl Default for HookRecorder
Source§impl Plugin for HookRecorder
impl Plugin for HookRecorder
Source§fn init_agent<'life0, 'life1, 'async_trait>(
&'life0 self,
agent: &'life1 mut LocalAgent,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn init_agent<'life0, 'life1, 'async_trait>(
&'life0 self,
agent: &'life1 mut LocalAgent,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sets the plugin up on the agent: register hooks, read configuration. Read more
Source§fn get_tools(&self) -> Vec<ToolSource>
fn get_tools(&self) -> Vec<ToolSource>
The tools to register on the agent after
init_agent:
anything that converts into a ToolSource, such as vec![MyTool.into()]. An MCP client
is rejected; pass it to the agent’s tools instead.Auto Trait Implementations§
impl Freeze for HookRecorder
impl RefUnwindSafe for HookRecorder
impl Send for HookRecorder
impl Sync for HookRecorder
impl Unpin for HookRecorder
impl UnsafeUnpin for HookRecorder
impl UnwindSafe for HookRecorder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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.