Skip to main content

HarnessAdapter

Trait HarnessAdapter 

Source
pub trait HarnessAdapter: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn session_root(&self) -> PathBuf;
    fn plan<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 PlanCtx,
    ) -> Pin<Box<dyn Future<Output = Result<SpawnPlan>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn after_exit<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 PlanCtx,
        plan: &'life2 SpawnPlan,
    ) -> Pin<Box<dyn Future<Output = Result<IngestReport>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided methods
    fn before_spawn<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _ctx: &'life1 PlanCtx,
        _plan: &'life2 SpawnPlan,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn start_watcher(
        &self,
        _ctx: &PlanCtx,
        _on_report: ReportSink,
    ) -> Option<WatcherController> { ... }
}
Expand description

HarnessAdapter — five-method contract every harness implements. The TS sibling lives at packages/cli/src/harnesses/types.ts and the shape mirrors it; see the module docs for what each step does.

Adapters are zero-sized (or near-zero-sized) stateless types that the registry hands out as &'static dyn HarnessAdapter. State that lives across before_spawnafter_exit rides on PlanCtx / SpawnPlan, or in the pending-stamps directory on disk.

Required Methods§

Source

fn name(&self) -> &'static str

Lowercase identifier — claude, codex, opencode, … — used as the dispatch key and as the harness label in log lines.

Source

fn session_root(&self) -> PathBuf

Per-harness session-store root. Today this is a fixed path resolved against the user’s home directory; future iterations may thread BurnConfig through so the root is configurable.

Source

fn plan<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 PlanCtx, ) -> Pin<Box<dyn Future<Output = Result<SpawnPlan>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Compute the spawn plan. Inject session ids or transport-level args here. Populate SpawnPlan::session_id when known so before_spawn / after_exit can stamp eagerly.

Source

fn after_exit<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 PlanCtx, plan: &'life2 SpawnPlan, ) -> Pin<Box<dyn Future<Output = Result<IngestReport>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Final ingest pass after the child exits. Returns an IngestReport the driver folds into its summary line.

Provided Methods§

Source

fn before_spawn<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 PlanCtx, _plan: &'life2 SpawnPlan, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Pre-spawn side effects. Stamp now if the session id is in plan, otherwise drop a pending-stamp manifest the post-spawn ingest can resolve. Default impl is a no-op so simple adapters don’t have to spell it out.

Source

fn start_watcher( &self, _ctx: &PlanCtx, _on_report: ReportSink, ) -> Option<WatcherController>

Optional. Return a WatcherController from relayburn_sdk::start_watch_loop to drain a session store while the child runs; return None for adapters that ingest a single pre-known file at exit.

on_report is a callback the driver routes into its summary accumulator so the final [burn] <name> ingest: line reflects every tick that fired during the run, not just after_exit.

Implementors§