Skip to main content

acp_cli/bridge/
events.rs

1use tokio::sync::oneshot;
2
3#[derive(Debug, Clone)]
4pub struct PromptResult {
5    pub content: String,
6    pub stop_reason: String,
7}
8
9#[derive(Debug, Clone)]
10pub struct ToolCallInfo {
11    pub name: String,
12    pub description: Option<String>,
13}
14
15#[derive(Debug, Clone)]
16pub struct PermissionOption {
17    pub option_id: String,
18    pub name: String,
19    pub kind: PermissionKind,
20}
21
22#[derive(Debug, Clone, PartialEq)]
23pub enum PermissionKind {
24    Allow,
25    Deny,
26}
27
28#[derive(Debug)]
29pub enum PermissionOutcome {
30    Selected { option_id: String },
31    Cancelled,
32}
33
34pub enum BridgeEvent {
35    TextChunk {
36        text: String,
37    },
38    ToolUse {
39        name: String,
40    },
41    /// Emitted when a tool call completes and returns output.
42    ToolResult {
43        name: String,
44        output: String,
45    },
46    PermissionRequest {
47        tool: ToolCallInfo,
48        options: Vec<PermissionOption>,
49        reply: oneshot::Sender<PermissionOutcome>,
50    },
51    SessionCreated {
52        session_id: String,
53    },
54    PromptDone {
55        stop_reason: String,
56    },
57    Error {
58        message: String,
59    },
60    AgentExited {
61        code: Option<i32>,
62    },
63}