Skip to main content

scv_core/
lib.rs

1//! SCV's provider-independent agent loop and the traits it is built from.
2//!
3//! [`AgentRuntime::run_turn`] runs one user turn: it selects the history the
4//! model sees, asks the [`Provider`] for a response, runs the requested
5//! [`Tool`]s in order through the [`ApprovalGate`], and repeats until the model
6//! answers without tool calls, reporting everything to an [`EventSink`].
7//! [`ContextPolicy`] decides what history fits. This crate knows no concrete
8//! provider, tool, transport, or user interface; those live in the crates
9//! that depend on it.
10
11#![forbid(unsafe_code)]
12
13mod approval;
14mod context;
15mod event;
16mod history;
17mod message;
18mod progress;
19mod provider;
20mod runtime;
21mod tool;
22
23pub use approval::{ApprovalGate, ApprovalRequest};
24pub use context::{
25    BudgetContextPolicy, ContextConfig, ContextError, ContextPolicy, ContextSelection,
26};
27pub use event::{CoreEvent, EventSink};
28pub use history::HistoryLimits;
29pub use message::{ImageInput, Message, ToolCall, TurnInput};
30pub(crate) use progress::PROGRESS_INTERVAL;
31pub use progress::{MAX_PROGRESS_EVENT_BYTES, MAX_PROGRESS_LINE_BYTES, ProgressSink};
32pub use provider::{
33    AssistantResponse, Provider, ProviderError, ProviderErrorKind, ProviderRequest, TextDeltaSink,
34    Usage,
35};
36pub use runtime::{AgentConfig, AgentError, AgentRuntime, TurnOutcome};
37pub use tool::{
38    Tool, ToolApprovals, ToolContext, ToolError, ToolFailure, ToolOutput, ToolRegistry, ToolRisk,
39    ToolSpec,
40};