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    PermissionRequest {
42        tool: ToolCallInfo,
43        options: Vec<PermissionOption>,
44        reply: oneshot::Sender<PermissionOutcome>,
45    },
46    SessionCreated {
47        session_id: String,
48    },
49    PromptDone {
50        stop_reason: String,
51    },
52    Error {
53        message: String,
54    },
55    AgentExited {
56        code: Option<i32>,
57    },
58}