codewhale_command_contract/
types.rs1#[derive(Debug, Clone, PartialEq, Eq)]
9pub struct CommandProviderId(pub String);
10
11#[derive(Debug, Clone, Copy, PartialEq, Eq)]
17pub enum CommandMode {
18 Agent,
19 Plan,
20 Operate,
21}
22
23impl CommandMode {
24 #[must_use]
26 pub fn parse(value: &str) -> Option<Self> {
27 match value.trim().to_ascii_lowercase().as_str() {
28 "agent" | "act" | "work" | "auto" | "1" => Some(Self::Agent),
29 "plan" | "2" => Some(Self::Plan),
30 "operate" | "operation" | "ops" | "3" => Some(Self::Operate),
31 other if Self::is_legacy_bypass_alias(other) => Some(Self::Agent),
32 _ => None,
33 }
34 }
35
36 #[must_use]
38 pub fn is_legacy_bypass_alias(value: &str) -> bool {
39 matches!(
40 value.trim().to_ascii_lowercase().as_str(),
41 "yolo" | "4" | "bypass" | "bypass-permissions" | "bypasspermissions"
42 )
43 }
44
45 #[must_use]
47 pub fn display_name(self) -> &'static str {
48 match self {
49 Self::Agent => "Work",
50 Self::Plan => "Plan",
51 Self::Operate => "Operate",
52 }
53 }
54}
55
56#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
58pub enum CommandApprovalMode {
59 Auto,
60 Bypass,
61 #[default]
62 Suggest,
63 Never,
64}
65
66#[derive(Debug, Clone, Copy, PartialEq, Eq)]
68pub enum CommandCurrency {
69 Usd,
70 Cny,
71}
72
73#[derive(Debug, Clone, Copy, PartialEq, Eq)]
76pub enum CommandScreenMode {
77 Fullscreen,
79 Inline,
81}
82
83#[derive(Debug, Clone, Copy, PartialEq, Eq)]
85pub enum CommandWorkSurfacePlacement {
86 Bottom,
87 Top,
88 Left,
89 Right,
90 Off,
91}
92
93impl CommandWorkSurfacePlacement {
94 #[must_use]
96 pub const fn as_setting(self) -> &'static str {
97 match self {
98 Self::Bottom => "bottom",
99 Self::Top => "top",
100 Self::Left => "left",
101 Self::Right => "right",
102 Self::Off => "off",
103 }
104 }
105}
106
107#[derive(Debug, Clone, Copy, PartialEq, Eq)]
109pub enum CommandRailPanel {
110 Agents,
111 Tasks,
112 Background,
113 Terminal,
114 Files,
115 Notepad,
116 Context,
117 Git,
118 Price,
119}