1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, Default)]
5pub enum OutputFormat {
6 #[default]
8 Text,
9 Json,
11 StreamJson,
13}
14
15impl OutputFormat {
16 pub(crate) fn as_arg(&self) -> &'static str {
17 match self {
18 Self::Text => "text",
19 Self::Json => "json",
20 Self::StreamJson => "stream-json",
21 }
22 }
23}
24
25#[derive(Debug, Clone, Copy, Default)]
27pub enum PermissionMode {
28 #[default]
30 Default,
31 AcceptEdits,
33 BypassPermissions,
35 DontAsk,
37 Plan,
39 Auto,
41}
42
43impl PermissionMode {
44 pub(crate) fn as_arg(&self) -> &'static str {
45 match self {
46 Self::Default => "default",
47 Self::AcceptEdits => "acceptEdits",
48 Self::BypassPermissions => "bypassPermissions",
49 Self::DontAsk => "dontAsk",
50 Self::Plan => "plan",
51 Self::Auto => "auto",
52 }
53 }
54}
55
56#[derive(Debug, Clone, Copy, Default)]
58pub enum InputFormat {
59 #[default]
61 Text,
62 StreamJson,
64}
65
66impl InputFormat {
67 pub(crate) fn as_arg(&self) -> &'static str {
68 match self {
69 Self::Text => "text",
70 Self::StreamJson => "stream-json",
71 }
72 }
73}
74
75#[derive(Debug, Clone, Copy)]
77pub enum Effort {
78 Low,
79 Medium,
80 High,
81}
82
83impl Effort {
84 pub(crate) fn as_arg(&self) -> &'static str {
85 match self {
86 Self::Low => "low",
87 Self::Medium => "medium",
88 Self::High => "high",
89 }
90 }
91}
92
93#[derive(Debug, Clone, Copy, Default)]
95pub enum Scope {
96 #[default]
98 Local,
99 User,
101 Project,
103}
104
105impl Scope {
106 pub(crate) fn as_arg(&self) -> &'static str {
107 match self {
108 Self::Local => "local",
109 Self::User => "user",
110 Self::Project => "project",
111 }
112 }
113}
114
115#[cfg(feature = "json")]
117#[derive(Debug, Clone, Deserialize, Serialize)]
118pub struct AuthStatus {
119 #[serde(default)]
120 pub authenticated: bool,
121 #[serde(default)]
122 pub account_type: Option<String>,
123 #[serde(default)]
124 pub email: Option<String>,
125 #[serde(flatten)]
127 pub extra: std::collections::HashMap<String, serde_json::Value>,
128}
129
130#[cfg(feature = "json")]
132#[derive(Debug, Clone, Deserialize, Serialize)]
133pub struct QueryMessage {
134 #[serde(default)]
135 pub role: String,
136 #[serde(default)]
137 pub content: serde_json::Value,
138 #[serde(flatten)]
139 pub extra: std::collections::HashMap<String, serde_json::Value>,
140}
141
142#[cfg(feature = "json")]
144#[derive(Debug, Clone, Deserialize, Serialize)]
145pub struct QueryResult {
146 #[serde(default)]
147 pub result: String,
148 #[serde(default)]
149 pub session_id: String,
150 #[serde(default)]
151 pub cost_usd: Option<f64>,
152 #[serde(default)]
153 pub duration_ms: Option<u64>,
154 #[serde(default)]
155 pub is_error: bool,
156 #[serde(flatten)]
157 pub extra: std::collections::HashMap<String, serde_json::Value>,
158}