pub mod api;
pub mod backend;
pub mod budgets;
pub mod claude;
pub mod error;
mod http;
mod platform;
mod stdio_mcp;
pub mod verdict;
use std::future::Future;
use artifactize_provider::{llm::delivery::Delivery, names::ModelId};
use rig_core::{completion::ToolDefinition, message::Message};
use serde_json::Value;
use tokio_util::sync::CancellationToken;
use budgets::Limits;
use error::Attempt;
use verdict::Priority;
pub use http::{FollowUp, follow_up as follow_up_http, review as review_http};
pub struct Review<'a> {
pub model: &'a ModelId,
pub reasoning: Option<&'a str>,
pub cache_key: &'a str,
pub system: String,
pub prompt: String,
pub tools: Vec<ToolDefinition>,
pub red_at: Option<Priority>,
pub limits: Limits,
pub cancellation: &'a CancellationToken,
}
pub enum Event<'a> {
Started {
parameters: Value,
tools: &'a [ToolDefinition],
},
Message {
turn: usize,
message: &'a Message,
repair: bool,
},
ToolResults {
turn: usize,
results: &'a Message,
failed: &'a [bool],
},
Delivery(Delivery),
Attempt(Attempt),
}
pub trait Io: Send {
fn event(&mut self, event: Event<'_>);
fn invoke(
&mut self,
name: &str,
arguments: Value,
cancellation: CancellationToken,
) -> impl Future<Output = ToolOutput> + Send;
}
pub struct ToolOutput {
pub failed: bool,
pub content: Vec<Content>,
}
impl ToolOutput {
fn error(message: impl Into<String>) -> Self {
Self {
failed: true,
content: vec![Content::Text(message.into())],
}
}
}
pub enum Content {
Text(String),
Json(Value),
Image { data: String, mime: ImageMime },
}
#[derive(Clone, Copy)]
pub enum ImageMime {
Png,
Jpeg,
Webp,
}