use crate::{
effect::{EffectId, EffectKind, HandlerDescriptor, HandlerKey, Outcome},
error::ErrorReport,
streaming::{Item, StreamEvent},
wasm_compat::{WasmCompatSend, WasmCompatSync},
};
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct Origin {
pub parent: Option<EffectId>,
pub scope: Option<std::sync::Arc<str>>,
}
pub trait Recorder: WasmCompatSend + WasmCompatSync + 'static {
fn adapter_context(&self, _id: EffectId) -> Option<crate::observe::AdapterContext> {
None
}
fn begin_delivery_tracking(&self) {}
fn delivery(&self, _delivery: crate::effect::Delivery) {}
fn unsupported_delivery(&self, _reason: &str) {}
fn handlers(&self, handlers: Vec<HandlerDescriptor>);
fn begin(&self, id: EffectId, key: HandlerKey, kind: EffectKind, origin: Origin);
fn discard(&self, id: EffectId);
fn patch(&self, id: EffectId, kind: EffectKind);
fn keep_events(&self) -> bool;
fn event(&self, id: EffectId, item: &Item<StreamEvent>);
fn stream_error(&self, _id: EffectId, _error: &ErrorReport) {}
fn origin(&self, id: EffectId, origin: &crate::message::Origin);
fn tool_output(&self, id: EffectId, output: crate::tool::ToolResultContext);
fn resolve(&self, id: EffectId, outcome: Result<Outcome, ErrorReport>);
}