use rskit_hook::{Event, EventType};
use rskit_llm::types::{AssistantMessage, CompletionRequest, CompletionResponse};
use rskit_tool::{ToolInput, ToolResult};
use super::{
on_error_type, on_event_type, on_mcp_call_type, on_mcp_result_type, post_llm_call_type,
post_tool_call_type, pre_llm_call_type, pre_tool_call_type, turn_end_type, turn_start_type,
};
#[derive(Debug, Clone)]
pub struct OnEvent {
pub event: rskit_ai::StreamEventRef,
}
impl Event for OnEvent {
fn event_type(&self) -> EventType {
on_event_type()
}
}
#[derive(Debug, Clone)]
pub struct OnMCPCall {
pub method: String,
}
impl Event for OnMCPCall {
fn event_type(&self) -> EventType {
on_mcp_call_type()
}
}
#[derive(Debug, Clone)]
pub struct OnMCPResult {
pub method: String,
pub result: Option<serde_json::Value>,
pub error: Option<String>,
}
impl Event for OnMCPResult {
fn event_type(&self) -> EventType {
on_mcp_result_type()
}
}
#[derive(Debug, Clone)]
pub struct PreToolCall {
pub name: String,
pub input: ToolInput,
}
impl Event for PreToolCall {
fn event_type(&self) -> EventType {
pre_tool_call_type()
}
}
#[derive(Debug, Clone)]
pub struct PostToolCall {
pub name: String,
pub input: ToolInput,
pub result: Option<ToolResult>,
pub error: Option<String>,
}
impl Event for PostToolCall {
fn event_type(&self) -> EventType {
post_tool_call_type()
}
}
#[derive(Debug, Clone)]
pub struct PreLLMCall {
pub request: CompletionRequest,
}
impl Event for PreLLMCall {
fn event_type(&self) -> EventType {
pre_llm_call_type()
}
}
#[derive(Debug, Clone)]
pub struct PostLLMCall {
pub response: CompletionResponse,
pub error: Option<String>,
}
impl Event for PostLLMCall {
fn event_type(&self) -> EventType {
post_llm_call_type()
}
}
#[derive(Debug, Clone)]
pub struct OnError {
pub error: String,
pub source: String,
}
impl Event for OnError {
fn event_type(&self) -> EventType {
on_error_type()
}
}
#[derive(Debug, Clone)]
pub struct TurnStart {
pub turn: u32,
}
impl Event for TurnStart {
fn event_type(&self) -> EventType {
turn_start_type()
}
}
#[derive(Debug, Clone)]
pub struct TurnEnd {
pub turn: u32,
pub message: AssistantMessage,
}
impl Event for TurnEnd {
fn event_type(&self) -> EventType {
turn_end_type()
}
}