pub struct SessionAuditSink { /* private fields */ }Expand description
Adapter that fans AuditSink::record_* calls into a durable
SessionLog.
Cloning is cheap (Arc-shared backend handle). One adapter per
agent run is the typical pattern — operators construct it next to
the SessionLog itself and stash it on every spawned
entelix_core::context::ExecutionContext via
ExecutionContext::with_audit_sink.
Implementations§
Source§impl SessionAuditSink
impl SessionAuditSink
Sourcepub const fn new(log: Arc<dyn SessionLog>, key: ThreadKey) -> Self
pub const fn new(log: Arc<dyn SessionLog>, key: ThreadKey) -> Self
Build an adapter pinned to one (tenant_id, thread_id) pair.
Multi-thread runs allocate one adapter per thread; the
adapter is stateless beyond the Arc handle so cloning a
sink and re-keying via Self::with_thread_key is also a
valid pattern.
Sourcepub fn with_thread_key(self, key: ThreadKey) -> Self
pub fn with_thread_key(self, key: ThreadKey) -> Self
Re-target an existing adapter at a different ThreadKey.
Useful when a parent run spawns a sub-thread and wants the
sub-thread’s events to land under a distinct audit scope.
Trait Implementations§
Source§impl AuditSink for SessionAuditSink
impl AuditSink for SessionAuditSink
Source§fn record_sub_agent_invoked(&self, agent_id: &str, sub_thread_id: &str)
fn record_sub_agent_invoked(&self, agent_id: &str, sub_thread_id: &str)
Record that a sub-agent was dispatched from the parent run.
Source§fn record_agent_handoff(&self, from: Option<&str>, to: &str)
fn record_agent_handoff(&self, from: Option<&str>, to: &str)
Record that a supervisor recipe handed control between
named agents.
from = None on the first turn.Source§fn record_resumed(&self, from_checkpoint: &str)
fn record_resumed(&self, from_checkpoint: &str)
Record that the run resumed from a prior checkpoint.
from_checkpoint is the empty string when the resume
happened from a fresh state.Source§fn record_memory_recall(&self, tier: &str, namespace_key: &str, hits: usize)
fn record_memory_recall(&self, tier: &str, namespace_key: &str, hits: usize)
Record that a long-term memory tier returned
hits records
for namespace_key. The hits themselves stay outside the
audit channel — the model-facing content already lands in
AssistantMessage / ToolResult, and storing the full
retrieved corpus inline would balloon the audit trail.Source§fn record_usage_limit_exceeded(&self, breach: &UsageLimitBreach)
fn record_usage_limit_exceeded(&self, breach: &UsageLimitBreach)
Record that a
crate::RunBudget axis hit its cap and
short-circuited the run with Error::UsageLimitExceeded.
The typed crate::run_budget::UsageLimitBreach carries
both the breaching axis (variant) and the magnitude (typed
per variant: u64 count for tokens / requests / tool
calls, Decimal USD for the cost axis), so emit sites
pass the breach value straight through from the matching
Error::UsageLimitExceeded(breach) arm.Source§fn record_context_compacted(&self, dropped_chars: usize, retained_chars: usize)
fn record_context_compacted(&self, dropped_chars: usize, retained_chars: usize)
Record that an auto-compaction adapter trimmed the working
message slice.
dropped_chars is the character cost of the
turns the compactor dropped (or summarised away);
retained_chars is the cost of the turns the post-compaction
slice carries forward. Operators correlate the pair against
the threshold they wired to detect drift between configured
budget and actual trim — production observability for the
RunnableCompacting path (lives in entelix-agents).Auto Trait Implementations§
impl Freeze for SessionAuditSink
impl !RefUnwindSafe for SessionAuditSink
impl Send for SessionAuditSink
impl Sync for SessionAuditSink
impl Unpin for SessionAuditSink
impl UnsafeUnpin for SessionAuditSink
impl !UnwindSafe for SessionAuditSink
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