use std::sync::Arc;
pub trait AuditSink: Send + Sync + 'static {
fn record_sub_agent_invoked(&self, agent_id: &str, sub_thread_id: &str);
fn record_agent_handoff(&self, from: Option<&str>, to: &str);
fn record_interrupted(
&self,
kind: &crate::interruption::InterruptionKind,
payload: &serde_json::Value,
);
fn record_resumed(&self, from_checkpoint: &str);
fn record_memory_recall(&self, tier: &str, namespace_key: &str, hits: usize);
fn record_usage_limit_exceeded(&self, breach: &crate::run_budget::UsageLimitBreach);
fn record_context_compacted(&self, dropped_chars: usize, retained_chars: usize);
fn record_tool_error_terminal(&self, kind: crate::tools::ToolErrorKind, tool_name: &str);
}
#[derive(Clone)]
pub struct AuditSinkHandle(Arc<dyn AuditSink>);
impl AuditSinkHandle {
#[must_use]
pub const fn new(sink: Arc<dyn AuditSink>) -> Self {
Self(sink)
}
#[must_use]
pub fn as_sink(&self) -> &dyn AuditSink {
&*self.0
}
#[must_use]
pub fn clone_arc(&self) -> Arc<dyn AuditSink> {
Arc::clone(&self.0)
}
}
impl std::fmt::Debug for AuditSinkHandle {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("AuditSinkHandle").finish_non_exhaustive()
}
}