1use std::path::PathBuf;
5
6use serde::{Deserialize, Serialize};
7
8#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct CreateNamespace {
10 pub kind: String,
11 pub slug: String,
12 #[serde(default)]
13 pub parent_path: Option<String>,
14 #[serde(default)]
15 pub display_name: Option<String>,
16}
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct ListHostedNamespaces {}
20
21#[derive(Debug, Clone, Serialize, Deserialize)]
22pub struct HostedNamespaceInfo {
23 pub namespace_id: String,
24 pub kind: String,
25 pub slug: String,
26 pub parent_id: Option<String>,
27 pub display_name: Option<String>,
28 pub full_path: String,
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize)]
32pub struct NamespaceCreated {
33 pub namespace: HostedNamespaceInfo,
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize)]
37pub struct UpdateNamespace {
38 pub full_path: String,
39 #[serde(default)]
40 pub new_slug: Option<String>,
41 #[serde(default)]
42 pub display_name: Option<Option<String>>,
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
46pub struct DeleteNamespace {
47 pub full_path: String,
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
51pub struct NamespaceUpdated {
52 pub namespace: HostedNamespaceInfo,
53}
54
55#[derive(Debug, Clone, Serialize, Deserialize)]
56pub struct NamespaceDeleted {
57 pub full_path: String,
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
61pub struct NamespacesList {
62 pub namespaces: Vec<HostedNamespaceInfo>,
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
66pub struct CreateHostedRepository {
67 pub namespace_path: String,
68 pub slug: String,
69}
70
71#[derive(Debug, Clone, Serialize, Deserialize)]
72pub struct ListHostedRepositories {}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
75pub struct HostedRepositoryInfo {
76 pub repo_id: String,
77 pub namespace_id: String,
78 pub slug: String,
79 pub path: PathBuf,
80 pub full_path: String,
81}
82
83#[derive(Debug, Clone, Serialize, Deserialize)]
84pub struct RepositoryCreated {
85 pub repository: HostedRepositoryInfo,
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
89pub struct UpdateHostedRepository {
90 pub full_path: String,
91 pub new_slug: String,
92}
93
94#[derive(Debug, Clone, Serialize, Deserialize)]
95pub struct DeleteHostedRepository {
96 pub full_path: String,
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize)]
100pub struct RepositoryUpdated {
101 pub repository: HostedRepositoryInfo,
102}
103
104#[derive(Debug, Clone, Serialize, Deserialize)]
105pub struct RepositoryDeleted {
106 pub full_path: String,
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
110pub struct RepositoriesList {
111 pub repositories: Vec<HostedRepositoryInfo>,
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize)]
115pub struct CreateHostedGrant {
116 pub subject: String,
117 pub role: String,
118 #[serde(default)]
119 pub namespace_path: Option<String>,
120 #[serde(default)]
121 pub repo_path: Option<String>,
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize)]
125pub struct DeleteHostedGrant {
126 pub subject: String,
127 #[serde(default)]
128 pub namespace_path: Option<String>,
129 #[serde(default)]
130 pub repo_path: Option<String>,
131}
132
133#[derive(Debug, Clone, Serialize, Deserialize)]
134pub struct UpdateHostedGrant {
135 pub subject: String,
136 pub role: String,
137 #[serde(default)]
138 pub namespace_path: Option<String>,
139 #[serde(default)]
140 pub repo_path: Option<String>,
141}
142
143#[derive(Debug, Clone, Serialize, Deserialize)]
144pub struct ListHostedGrants {}
145
146#[derive(Debug, Clone, Serialize, Deserialize)]
147pub struct HostedGrantInfo {
148 pub subject: String,
149 pub role: String,
150 #[serde(default)]
151 pub namespace_path: Option<String>,
152 #[serde(default)]
153 pub repo_path: Option<String>,
154}
155
156#[derive(Debug, Clone, Serialize, Deserialize)]
157pub struct HostedGrantCreated {
158 pub grant: HostedGrantInfo,
159}
160
161#[derive(Debug, Clone, Serialize, Deserialize)]
162pub struct HostedGrantDeleted {
163 pub subject: String,
164 #[serde(default)]
165 pub namespace_path: Option<String>,
166 #[serde(default)]
167 pub repo_path: Option<String>,
168}
169
170#[derive(Debug, Clone, Serialize, Deserialize)]
171pub struct HostedGrantUpdated {
172 pub grant: HostedGrantInfo,
173}
174
175#[derive(Debug, Clone, Serialize, Deserialize)]
176pub struct HostedGrantsList {
177 pub grants: Vec<HostedGrantInfo>,
178}
179
180#[derive(Debug, Clone, Default, Serialize, Deserialize)]
181pub struct HarnessIdentity {
182 #[serde(default)]
183 pub harness: Option<String>,
184 #[serde(default)]
185 pub provider: Option<String>,
186 #[serde(default)]
187 pub model: Option<String>,
188 #[serde(default)]
189 pub thinking_level: Option<String>,
190 #[serde(default)]
191 pub policy: Option<String>,
192}
193
194#[derive(Debug, Clone, Default, Serialize, Deserialize)]
195pub struct UsageTotals {
196 #[serde(default)]
197 pub input_tokens: Option<u64>,
198 #[serde(default)]
199 pub output_tokens: Option<u64>,
200 #[serde(default)]
201 pub reasoning_tokens: Option<u64>,
202 #[serde(default)]
203 pub cache_creation_tokens: Option<u64>,
204 #[serde(default)]
205 pub cache_read_tokens: Option<u64>,
206 #[serde(default)]
207 pub tool_calls: Option<u32>,
208 #[serde(default)]
209 pub cost_micros_usd: Option<u64>,
210}
211
212#[derive(Debug, Clone, Default, Serialize, Deserialize)]
213pub struct ProgressCheckpoint {
214 #[serde(default)]
215 pub status: Option<String>,
216 #[serde(default)]
217 pub message: Option<String>,
218 #[serde(default)]
219 pub completed_steps: Option<u32>,
220 #[serde(default)]
221 pub total_steps: Option<u32>,
222 #[serde(default)]
223 pub touched_paths: Vec<String>,
224 pub recorded_at: String,
225}
226
227#[derive(Debug, Clone, Default, Serialize, Deserialize)]
228pub struct TranscriptAttachmentRef {
229 pub attachment_id: String,
230 #[serde(default)]
231 pub kind: Option<String>,
232 #[serde(default)]
233 pub summary: Option<String>,
234}
235
236#[derive(Debug, Clone, Default, Serialize, Deserialize)]
237pub struct SessionDiffSummary {
238 #[serde(default)]
239 pub changed_file_count: u32,
240 #[serde(default)]
241 pub added_files: u32,
242 #[serde(default)]
243 pub modified_files: u32,
244 #[serde(default)]
245 pub deleted_files: u32,
246}
247
248#[derive(Debug, Clone, Serialize, Deserialize)]
249pub struct WorktreeChangeBaseline {
250 pub path: String,
251 pub kind: String,
252}
253
254#[derive(Debug, Clone, Serialize, Deserialize)]
255pub struct SessionReportEnvelope {
256 pub version: u32,
257 pub heddle_session_id: String,
258 #[serde(default)]
259 pub heddle_segment_id: Option<String>,
260 #[serde(default)]
261 pub agent_session_id: Option<String>,
262 #[serde(default)]
263 pub client_instance_id: Option<String>,
264 #[serde(default)]
265 pub native_actor_key: Option<String>,
266 #[serde(default)]
267 pub native_parent_actor_key: Option<String>,
268 #[serde(default)]
269 pub native_instance_key: Option<String>,
270 pub repo_root: String,
271 #[serde(default)]
272 pub thread: Option<String>,
273 #[serde(default)]
274 pub thread_id: Option<String>,
275 #[serde(default)]
276 pub task: Option<String>,
277 #[serde(default)]
278 pub summary: Option<String>,
279 pub opened_at: String,
280 #[serde(default)]
281 pub closed_at: Option<String>,
282 #[serde(default)]
283 pub base_state_at_open: Option<String>,
284 #[serde(default)]
285 pub worktree_changes_at_open: Vec<WorktreeChangeBaseline>,
286 #[serde(default)]
287 pub head_state_at_close: Option<String>,
288 pub transport_mode: String,
289 pub transcript_mode: String,
290 #[serde(default)]
291 pub outcome: Option<String>,
292 #[serde(default)]
293 pub owns_session: bool,
294 pub harness: HarnessIdentity,
295 #[serde(default)]
296 pub progress: Vec<ProgressCheckpoint>,
297 #[serde(default)]
298 pub usage: UsageTotals,
299 #[serde(default)]
300 pub touched_paths: Vec<String>,
301 #[serde(default)]
302 pub changed_paths: Vec<String>,
303 #[serde(default)]
304 pub diff_summary: Option<SessionDiffSummary>,
305 #[serde(default)]
306 pub transcript_refs: Vec<TranscriptAttachmentRef>,
307 #[serde(default)]
308 pub last_progress_at: Option<String>,
309 #[serde(default)]
310 pub report_flush_state: Option<String>,
311 #[serde(default)]
312 pub attach_reason: Option<String>,
313 #[serde(default)]
314 pub attach_precedence: Vec<String>,
315 #[serde(default)]
316 pub winning_attach_rule: Option<String>,
317 #[serde(default)]
318 pub probe_source: Option<String>,
319 #[serde(default)]
320 pub probe_confidence: Option<f32>,
321 #[serde(default)]
322 pub pending_flush: bool,
323 #[serde(default)]
324 pub last_flushed_at: Option<String>,
325}