use std::time::Duration;
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum ClientFrame {
Prompt { content: Vec<Content> },
AskUserAnswer { ask_id: String, value: serde_json::Value },
PermissionResponse { req_id: String, decision: PermissionDecision },
Cancel,
}
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum Content {
Text(String),
Image { mime: String, data: Vec<u8> },
}
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum AgentEvent {
Ready { session_id: String, model: Option<String> },
TextChunk { msg_id: String, text: String, channel: TextChannel },
Thought { msg_id: String, text: String },
ToolCallStart { call_id: String, name: String, input: serde_json::Value },
ToolCallEnd { call_id: String, output: String, is_error: bool },
Plan { entries: Vec<PlanEntry> },
AskUser { ask_id: String, prompt: String, kind: AskKind, options: Vec<AskOption> },
PermissionRequest {
req_id: String,
tool: String,
intent: serde_json::Value,
scope: PermissionScope,
},
Done { stop_reason: StopReason, usage: Usage },
Error { code: String, message: String },
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum TextChannel {
Assistant,
System,
}
#[derive(Debug, Clone)]
pub struct PlanEntry {
pub id: String,
pub content: String,
pub status: PlanStatus,
pub priority: PlanPriority,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum PlanStatus { Pending, InProgress, Completed, Cancelled, Blocked }
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum PlanPriority { High, Medium, Low }
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum AskKind { YesNo, Options, FreeText }
#[derive(Debug, Clone)]
pub struct AskOption {
pub id: String,
pub label: String,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum PermissionScope { Read, Write, Execute, Network }
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum PermissionDecision { AllowOnce, AllowAlways, Deny }
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum StopReason {
EndTurn,
MaxTokens,
ToolUse,
StopSequence,
Cancelled,
Error,
}
#[derive(Debug, Clone, Default)]
pub struct Usage {
pub input_tokens: u64,
pub output_tokens: u64,
pub cache_read_tokens: u64,
pub cache_creation_tokens: u64,
pub cost_usd_estimate: Option<f64>,
pub duration: Option<Duration>,
pub model_id: Option<String>,
}