Skip to main content

ProgressSource

Trait ProgressSource 

Source
pub trait ProgressSource: Send + Sync {
    // Provided methods
    fn goal_progress<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _run: &'life1 RunRecord,
    ) -> Pin<Box<dyn Future<Output = Result<Option<GoalProgress>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn loop_guard<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _run: &'life1 RunRecord,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn usage<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _run: &'life1 RunRecord,
    ) -> Pin<Box<dyn Future<Output = Result<Option<RunUsage>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn attach(&self, _processes: ProcessHandle) { ... }
    fn attach_ledger(&self, _ledger: Arc<dyn LedgerSink>) { ... }
}
Expand description

Reports what only the hosted agent knows about a process: a goal’s progress, the loop guard’s verdict and the session’s usage (spec 3.2 §7.3, §10 HK3).

adk-kernel depends on no harness type (§6 D-1); the kernel feature of adk-harness implements this over its goal store, loop guard and spend accounts and registers it with KernelBuilder::progress_source. Every method has a default that reports nothing.

§Example

use adk_core::RunRecord;
use adk_kernel::{GoalProgress, ProgressSource};
use async_trait::async_trait;

struct FixedProgress;

#[async_trait]
impl ProgressSource for FixedProgress {
    async fn goal_progress(&self, _run: &RunRecord) -> adk_kernel::Result<Option<GoalProgress>> {
        Ok(Some(GoalProgress::new(2, 10)))
    }
}

Provided Methods§

Source

fn goal_progress<'life0, 'life1, 'async_trait>( &'life0 self, _run: &'life1 RunRecord, ) -> Pin<Box<dyn Future<Output = Result<Option<GoalProgress>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The progress of the goal run executes, or None when it runs no goal.

§Errors

Returns the source’s store error; the view then omits the goal.

Source

fn loop_guard<'life0, 'life1, 'async_trait>( &'life0 self, _run: &'life1 RunRecord, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The loop guard’s last verdict for run, or None when it has none.

§Errors

Returns the source’s store error; the view then omits the verdict.

Source

fn usage<'life0, 'life1, 'async_trait>( &'life0 self, _run: &'life1 RunRecord, ) -> Pin<Box<dyn Future<Output = Result<Option<RunUsage>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The RunUsage counter of the session run continues, or None when the agent keeps none. The kernel reads it when a claim starts and on every scheduler tick, and attributes the cost between readings to the process (ProcessStore::add_spend). For a claim this returns None for, the kernel counts the usage the agent turn’s events carry instead, so a plain Runner is accounted without a source.

§Errors

Returns the source’s error; the kernel then attributes nothing for that reading.

Source

fn attach(&self, _processes: ProcessHandle)

Called by Kernel::start with a handle on the kernel’s processes, so a source that detects a condition that should park a process — a goal that stopped making progress (spec 3.2 §7.3, §10 HK3) — can suspend it at once.

Source

fn attach_ledger(&self, _ledger: Arc<dyn LedgerSink>)

Called by Kernel::start with the kernel’s ledger when it keeps one (spec 3.2 §7.10, feature proc), so the hosted runtime writes its own activity: the harness writes its tool events and audit records through it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§