rhema-core 0.4.0

A small, embeddable, generic step engine for one exchange with a model
Documentation
//! rhema-core, a small, embeddable, generic step engine for model exchanges.
//!
//! The primitive is [`Agent::step`]: ONE exchange with a model. Build the
//! request from the caller-owned [`Session`], stream it through a
//! [`ModelProvider`], append the assistant message to the session, resolve
//! any tool calls through a [`ToolResolver`], and append the results. The
//! engine never loops, never dispatches, never persists, those belong to
//! drivers (SPEC.md §0, §5).
//!
//! Layout:
//! - [`message`]: `Role`, `Content`, `Message`, the `Image` block
//! - [`paste`]: paste spans in message text: the chip record, and the
//!   legacy embedded-form migration
//! - [`session`]: the caller-owned, serializable `Session`
//! - [`workspace`]: the checkout's directory conventions: `.rhema`
//!   and the tiers under it
//! - [`request`]: `ModelRequest`, `ChatParams`, `ToolSpec`
//! - [`output`]: `ModelOutput`, `StopReason`, `Usage`, `Step`
//! - [`provider`]: the `ModelProvider` seam
//! - [`tool`]: the `ToolResolver` seam
//! - [`event`]: `Event`, `EventSink`
//! - [`engine`]: the `Agent` step engine, `AgentBuilder`, `run_turn`,
//!   the dangling-call close/revive pair
//! - [`overlay`]: `Overlay`, one resolver over built-ins plus an
//!   extension set
//! - [`mock`]: scripted `MockProvider` (behind the `mock` feature)

#![forbid(unsafe_code)]

pub mod engine;
pub mod event;
pub mod message;
#[cfg(feature = "mock")]
pub mod mock;
pub mod output;
pub mod overlay;
pub mod paste;
pub mod provider;
pub mod request;
pub mod session;
pub mod tool;
pub mod workspace;

// Re-exported so implementors of the async seams can apply #[async_trait]
// without adding the crate themselves.
pub use async_trait::async_trait;
pub use engine::{
    Agent, AgentBuilder, AgentError, CommitError, CommitHook, close_orphaned_calls,
    revive_dangling_calls, run_turn,
};
pub use event::{Event, EventSink};
pub use message::{Content, Image, ImageMediaType, Message, Role};
#[cfg(feature = "mock")]
pub use mock::MockProvider;
pub use output::{ModelOutput, Step, StopReason, Usage};
pub use overlay::Overlay;
pub use provider::{ModelProvider, ProviderError};
pub use request::{ChatParams, ModelRequest, ToolSpec};
pub use session::Session;
pub use tool::{
    OutputOnly, ReplaySafety, ToolCall, ToolContext, ToolProgress, ToolResolver, ToolResult,
    ToolStatus,
};
pub use workspace::{rhema_dir, runs_dir, skills_dir, subagents_dir};