causa_runtime/lib.rs
1//! Optional execution components over the Causa material kernel.
2//!
3//! [`TurnRunner`] owns only a gateway and [`ToolExecutor`]. Each run consumes
4//! a context and returns it in [`TurnOutcome`], with any uncommitted tool batch.
5//! Model identity, generation, limits, optional preparation and observation
6//! are explicit per-run choices. Both entry points share the same loop.
7//!
8//! [`ToolExecutor::bind`] fixes the actual tool surface and targets before
9//! preparation. Processing owns controlled collection of started calls;
10//! the runner validates and atomically appends results only after success.
11//! Unknown results are committed and stop further model rounds.
12//!
13//! # Policy surface
14//!
15//! | Choice | Default and owner |
16//! |---|---|
17//! | Model rounds / tool declarations | [`TurnLimits`]: 10 / 64 |
18//! | Model retries | Gateway implementation or caller wrapper |
19//! | Material preparation | None; use the current context frame |
20//! | Observation | None; an optional synchronous borrowed callback |
21//! | Tool processing | Executor-owned ordered before/after processors |
22//! | Tool dispatch | Concurrent pending calls; panic becomes failed result |
23//! | Tool timeout | None; local timeout becomes unknown outcome |
24//! | Unknown outcomes | Commit the successful batch, then stop |
25//! | Output retention and persistence | Caller-owned policies and storage |
26//!
27//! The runner does not interpret imported tool declarations as work to resume.
28//! It creates work only from the current model output. Session admission,
29//! history, input queues, retries, budget strategies and observation storage
30//! belong to callers. Dropping a run future or panicking bypasses the normal
31//! material-return guarantee; stopping local waits cannot undo remote effects.
32
33#![deny(unsafe_code)]
34#![deny(missing_docs)]
35
36pub mod composition;
37pub mod config;
38pub mod control;
39pub mod driver;
40pub mod event;
41pub mod executor;
42pub mod ids;
43mod processors;
44
45pub use composition::ToolBridge;
46pub use config::{TurnLimits, TurnRunOptions};
47pub use control::RunControl;
48pub use driver::{TurnInterruption, TurnOutcome, TurnResult, TurnRunner};
49pub use event::{RunEvent, RunObserver};
50pub use executor::{
51 BoundTools, ToolCatalogError, ToolExecutor, ToolExecutorOptions, ToolProcessingError,
52 ToolProcessorPhase, ToolRegistryError,
53};
54pub use ids::new_block_id;