Skip to main content

causa_kernel/
lib.rs

1//! causa-kernel — ContextBlock conversation kernel.
2//! No dependency on a host application, a UI shell, or another agent framework.
3//!
4//! The kernel holds ordered material and atomic identity-preserving edits, plus
5//! third-party model, preparation, tool and cancellation contracts. It performs
6//! no I/O, execution policy or conversation management. Reference execution
7//! lives in causa-runtime; concrete transports live in edge crates.
8
9#![deny(unsafe_code)]
10#![deny(missing_docs)]
11
12mod context;
13mod ports;
14
15// --- context: the external rule interface ------------------------------------
16pub use context::block::{
17    BlockContent, BlockMeta, ContentPart, ContextBlock, MediaRef, TextPayload, ToolCallPayload,
18};
19pub use context::ids::{BlockId, InvocationId, RoundId, TurnId};
20pub use context::material::{
21    Context, ContextEdit, ContextFrame, EditError, EditFailure, Replacement, ToolResultError,
22    validate_tool_result_append,
23};
24pub use context::model::{ModelBlockError, ModelResponse, ModelStopReason, ToolCallDraft};
25pub use context::tool_data::{
26    ArtifactKind, ArtifactRef, ToolCallId, ToolOutput, ToolOutputMeta, ToolResultPayload,
27    ToolResultStatus, Truncation,
28};
29
30// --- ports: behavior seams for external implementors ------------------------
31pub use ports::batch::{
32    BatchError, ProcessorContext, ProcessorError, ToolBatch, ToolBatchProcessor, ToolCallEntry,
33};
34pub use ports::control::{CallControl, ControlError};
35pub use ports::gateway::{
36    CacheDirective, GenerationOptions, ModelGateway, ModelInvokeError, ModelInvokeErrorKind,
37    ModelOutput, ModelRef, ModelRequest, ModelStream, ModelUsage, ReasoningPayload, StreamDelta,
38    ToolSurface, completed_model_stream,
39};
40pub use ports::prepare::{ContextPreparer, PrepareError, RoundInfo};
41pub use ports::source::{DynamicToolSource, SourceError, ToolExecutionError};
42pub use ports::tool::{
43    ArtifactHint, ArtifactStore, StoreError, Tool, ToolCallContext, ToolDefinition,
44};
45/// The cancellation primitive behind the control planes, re-exported so the
46/// port is self-contained for external drivers.
47pub use tokio_util::sync::CancellationToken;