1use serde::{Deserialize, Serialize};
4
5pub use crate::credentials::Source as KeySource;
6pub use crate::team::TeamSettings;
7
8#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct Settings {
11 pub config_path: String,
12 pub index_dir: Option<String>,
13 pub index_effective: String,
14 pub author_name: Option<String>,
15 pub author_effective: Option<String>,
16 pub record_names: bool,
17 pub llm_model: String,
18 pub defaults: Defaults,
19 pub llm_key: KeySource,
20 pub cache_ttl_secs: u64,
21}
22
23#[derive(Debug, Clone, Serialize, Deserialize)]
25pub struct Defaults {
26 pub llm_model: String,
27 pub llm_base_url: String,
28 pub embed_model: String,
29 pub llm_concurrency: usize,
30 pub format: String,
31}
32
33#[derive(Debug, Clone, Default, Serialize, Deserialize)]
35pub struct SettingsChange {
36 #[serde(default, skip_serializing_if = "Option::is_none")]
37 pub index_dir: Option<String>,
38 #[serde(default, skip_serializing_if = "Option::is_none")]
39 pub author_name: Option<String>,
40 #[serde(default, skip_serializing_if = "Option::is_none")]
41 pub record_names: Option<bool>,
42 #[serde(default, skip_serializing_if = "Option::is_none")]
43 pub cache_ttl_secs: Option<u64>,
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48pub struct IndexDirRequest {
49 pub index_dir: String,
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54pub struct Team {
55 pub settings: TeamSettings,
56 pub key_source: KeySource,
57 pub version: Option<u64>,
58 pub changed_by: Option<String>,
59 pub changed_at: Option<String>,
60 pub defaults: Defaults,
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize)]
65pub struct TeamSave {
66 pub settings: TeamSettings,
67 pub version: Option<u64>,
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
72pub struct TeamsSave {
73 pub teams: Vec<crate::team::TeamDef>,
74 pub version: Option<u64>,
75}
76
77#[derive(Debug, Clone, Serialize, Deserialize)]
79pub struct RepoTeams {
80 pub repo: String,
81 pub teams: Vec<String>,
82}
83
84#[derive(Debug, Clone, Serialize, Deserialize)]
86pub struct MyTeams {
87 pub teams: Vec<String>,
88}
89
90#[derive(Debug, Clone, Serialize, Deserialize)]
92pub struct KeyRequest {
93 pub key: String,
94}
95
96#[derive(Debug, Clone, Serialize, Deserialize)]
98pub struct JoinRequest {
99 pub index: String,
100}
101
102#[derive(Debug, Clone, Serialize, Deserialize)]
104pub struct CreateTeam {
105 pub name: String,
106 pub index: String,
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111pub struct Prompts {
112 pub tasks: Vec<PromptTask>,
113 pub version: Option<u64>,
114 pub changed_by: Option<String>,
115 pub changed_at: Option<String>,
116}
117
118#[derive(Debug, Clone, Serialize, Deserialize)]
119pub struct PromptTask {
120 pub task: crate::prompts::Task,
121 pub builtin: String,
122 pub format: String,
124 pub active: Option<u32>,
126 pub builtin_changed: Option<u32>,
128 pub sections: Vec<GuideSectionText>,
130 pub versions: Vec<crate::prompts::Version>,
131}
132
133#[derive(Debug, Clone, Serialize, Deserialize)]
134pub struct GuideSectionText {
135 pub title: String,
136 pub guidance: String,
137}
138
139#[derive(Debug, Clone, Serialize, Deserialize)]
141pub struct PromptChange {
142 pub version: Option<u64>,
143 #[serde(flatten)]
144 pub action: PromptAction,
145}
146
147#[derive(Debug, Clone, Serialize, Deserialize)]
148#[serde(tag = "action", rename_all = "lowercase")]
149pub enum PromptAction {
150 Save {
152 task: crate::prompts::Task,
153 text: String,
154 #[serde(default)]
156 sections: std::collections::BTreeMap<String, String>,
157 #[serde(default)]
158 note: Option<String>,
159 },
160 Activate {
161 task: crate::prompts::Task,
162 n: u32,
163 },
164 Deactivate {
166 task: crate::prompts::Task,
167 },
168 Delete {
169 task: crate::prompts::Task,
170 n: u32,
171 },
172}
173
174#[derive(Debug, Clone, Serialize, Deserialize)]
176pub struct PromptTry {
177 pub task: crate::prompts::Task,
178 pub text: String,
179 #[serde(default)]
180 pub sections: std::collections::BTreeMap<String, String>,
181 #[serde(default)]
184 pub sample: Option<String>,
185 #[serde(default)]
187 pub section: Option<String>,
188}
189
190#[derive(Debug, Clone, Serialize, Deserialize)]
191pub struct PromptTried {
192 pub sample: String,
193 pub output: String,
194 pub current: Option<String>,
196}
197
198#[derive(Debug, Clone, Serialize, Deserialize)]
200pub struct Logging {
201 pub access: bool,
203 pub tool: bool,
205}