kian_loop/lib.rs
1//! `kian-loop` — LoopDriver seam, built-in ReAct loop.
2//!
3//! DESIGN §7 assigns this crate the key interface `LoopDriver`. The agent
4//! loop is just a control flow inside a drain (AGENTS.md preamble): this
5//! crate implements the [`LoopDriver`] seam and the built-in async ReAct
6//! loop; it is a passenger inside the orchestrator's drain and never
7//! drives engine semantics itself.
8//!
9//! Termination is honest (AGENTS.md constraint 7): an empty model response
10//! is a soft failure routed to the recovery policy, never `completed`.
11//!
12//! Modules:
13//! - [`react`] — the built-in ReAct LoopDriver
14//! - [`tools`] — the built-in local fs/exec `ToolProvider` + `ExecBackend`
15//! local exec runs via `spawn_blocking` so a sleeping tool
16//! cannot stall concurrent drains
17//! - [`evidence`] — the evidence gate v1: bounded, declarative,
18//! pure predicates over the event stream; wired into [`react`]'s stop
19//! path, default-off
20
21pub mod evidence;
22pub mod react;
23pub mod tools;
24
25#[cfg(test)]
26mod evidence_gate_tests;
27#[cfg(test)]
28mod integration_tests;
29#[cfg(test)]
30mod test_support;
31
32pub use evidence::{
33 BUILTIN_GATE_NAME, CheckOutcome, CheckSpec, EvidenceGateConfig, EvidenceGateCounters,
34 GateVerdict, VerdictCounters, evaluate_evidence_gate, verdict_payload,
35};
36pub use kian_core::seams::{LoopDriver, LoopOutcome};
37pub use react::{
38 BudgetScope, CLASS_EMPTY_RESPONSE, DEFAULT_MAX_ITERATIONS, LoopError, ReActConfig, ReActLoop,
39 to_chat_message,
40};
41pub use tools::{
42 DEFAULT_EXEC_TIMEOUT_MS, FilteredTools, LocalExecBackend, LocalTools, unmatched_tool_names,
43};