Skip to main content

cyril_core/
event.rs

1use agent_client_protocol as acp;
2use tokio::sync::oneshot;
3
4use crate::kiro_ext::KiroExtCommand;
5
6/// Protocol-level events from ACP session notifications.
7#[derive(Debug)]
8pub enum ProtocolEvent {
9    AgentMessage {
10        session_id: acp::SessionId,
11        chunk: acp::ContentChunk,
12    },
13    AgentThought {
14        session_id: acp::SessionId,
15        chunk: acp::ContentChunk,
16    },
17    ToolCallStarted {
18        session_id: acp::SessionId,
19        tool_call: acp::ToolCall,
20    },
21    ToolCallUpdated {
22        session_id: acp::SessionId,
23        update: acp::ToolCallUpdate,
24    },
25    PlanUpdated {
26        session_id: acp::SessionId,
27        plan: acp::Plan,
28    },
29    ModeChanged {
30        session_id: acp::SessionId,
31        mode: acp::CurrentModeUpdate,
32    },
33    ConfigOptionsUpdated {
34        session_id: acp::SessionId,
35        config_options: Vec<acp::SessionConfigOption>,
36    },
37    CommandsUpdated {
38        session_id: acp::SessionId,
39        commands: acp::AvailableCommandsUpdate,
40    },
41}
42
43/// Requests from the agent that need a user response.
44#[derive(Debug)]
45pub enum InteractionRequest {
46    Permission {
47        request: acp::RequestPermissionRequest,
48        responder: oneshot::Sender<acp::RequestPermissionResponse>,
49    },
50}
51
52/// Kiro-specific extension events via ext_notification.
53#[derive(Debug)]
54pub enum ExtensionEvent {
55    KiroCommandsAvailable {
56        commands: Vec<KiroExtCommand>,
57    },
58    KiroMetadata {
59        session_id: String,
60        context_usage_pct: f64,
61    },
62}
63
64/// Internal application events (not from the agent).
65#[derive(Debug)]
66pub enum InternalEvent {
67    HookFeedback { text: String },
68}
69
70/// Top-level event sent from KiroClient to the TUI.
71#[derive(Debug)]
72pub enum AppEvent {
73    Protocol(ProtocolEvent),
74    Interaction(InteractionRequest),
75    Extension(ExtensionEvent),
76    Internal(InternalEvent),
77}