1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3
4#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
5#[serde(rename_all = "camelCase")]
6#[serde(default)]
7pub struct ThreadStatusInfo {
8 pub kind: String,
9 pub reason: Option<String>,
10 pub raw: Value,
11}
12
13#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
14#[serde(rename_all = "camelCase")]
15#[serde(default)]
16pub struct ThreadTokenUsage {
17 pub input_tokens: Option<i64>,
18 pub cached_input_tokens: Option<i64>,
19 pub output_tokens: Option<i64>,
20 pub reasoning_tokens: Option<i64>,
21 pub total_tokens: Option<i64>,
22 pub raw: Value,
23 pub updated_at_ms: i64,
24}
25
26#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
27#[serde(rename_all = "camelCase")]
28#[serde(default)]
29pub struct ThreadSummary {
30 pub id: String,
31 pub runtime_id: String,
32 pub name: Option<String>,
33 pub preview: String,
34 pub cwd: String,
35 pub status: String,
36 pub status_info: ThreadStatusInfo,
37 pub token_usage: Option<ThreadTokenUsage>,
38 pub model_provider: String,
39 pub source: String,
40 pub created_at: i64,
41 pub updated_at: i64,
42 pub is_loaded: bool,
43 pub is_active: bool,
44 pub archived: bool,
45}
46
47#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
48#[serde(rename_all = "camelCase")]
49#[serde(default)]
50pub struct TimelineEntry {
51 pub id: String,
52 pub runtime_id: String,
53 pub thread_id: String,
54 pub turn_id: Option<String>,
55 pub item_id: Option<String>,
56 pub entry_type: String,
57 pub title: Option<String>,
58 pub text: String,
59 pub status: Option<String>,
60 pub metadata: Value,
61}
62
63#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
64#[serde(rename_all = "camelCase")]
65#[serde(default)]
66pub struct PendingServerRequestOption {
67 pub label: String,
68 pub description: Option<String>,
69 pub value: Option<Value>,
70 pub is_other: bool,
71 pub raw: Value,
72}
73
74#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
75#[serde(rename_all = "camelCase")]
76#[serde(default)]
77pub struct PendingServerRequestQuestion {
78 pub id: String,
79 pub header: Option<String>,
80 pub question: Option<String>,
81 pub required: bool,
82 pub options: Vec<PendingServerRequestOption>,
83 pub raw: Value,
84}
85
86#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
87#[serde(rename_all = "camelCase")]
88#[serde(default)]
89pub struct PendingServerRequestRecord {
90 pub request_id: String,
91 pub runtime_id: String,
92 pub rpc_request_id: Value,
93 pub request_type: String,
94 pub request_kind: String,
95 pub thread_id: Option<String>,
96 pub turn_id: Option<String>,
97 pub item_id: Option<String>,
98 pub call_id: Option<String>,
99 pub title: Option<String>,
100 pub reason: Option<String>,
101 pub command: Option<String>,
102 pub cwd: Option<String>,
103 pub grant_root: Option<String>,
104 pub tool_name: Option<String>,
105 pub arguments: Option<Value>,
106 #[serde(default)]
107 pub questions: Vec<PendingServerRequestQuestion>,
108 pub proposed_execpolicy_amendment: Option<Value>,
109 pub network_approval_context: Option<Value>,
110 pub permissions: Option<Value>,
111 pub schema: Option<Value>,
112 #[serde(default)]
113 pub available_decisions: Vec<String>,
114 pub raw_payload: Value,
115 pub created_at_ms: i64,
116}