pub trait Source: Send + Sync {
// Required methods
fn id(&self) -> SourceId;
fn priority(&self) -> Priority;
fn contribute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 BriefContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<Contribution>, SourceError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
A pluggable contributor to the per-turn crate::types::Brief.
id is the stable label that ends up on every emitted
crate::types::BriefMessage / crate::types::ToolSchema and in the
crate::receipt::BriefReceipt. priority drives the budget floor
pre-pruning. contribute is the work — read from ctx, return zero or
more Contributions.
Implementations should:
- Keep
contributedeterministic givenctxwhere possible. - Honour
ctx.budgetas a hint but not a hard cap — pruning is the builder’s job. - Return cheap, pre-rendered text; don’t perform heavy formatting per turn.
Required Methods§
Sourcefn id(&self) -> SourceId
fn id(&self) -> SourceId
Stable identifier for this source. Receipts and message attribution key off this value.
Sourcefn contribute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 BriefContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<Contribution>, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn contribute<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 BriefContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<Contribution>, SourceError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Produce zero or more Contributions for this turn.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".