Skip to main content

codex_mobile_bridge/bridge_protocol/
thread.rs

1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3
4#[derive(Debug, Clone, Default, Serialize, Deserialize)]
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)]
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)]
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 note: Option<String>,
34    pub preview: String,
35    pub cwd: String,
36    pub status: String,
37    pub status_info: ThreadStatusInfo,
38    pub token_usage: Option<ThreadTokenUsage>,
39    pub model_provider: String,
40    pub source: String,
41    pub created_at: i64,
42    pub updated_at: i64,
43    pub is_loaded: bool,
44    pub is_active: bool,
45    pub archived: bool,
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(rename_all = "camelCase")]
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    #[serde(default)]
61    pub metadata: Value,
62}
63
64#[derive(Debug, Clone, Default, Serialize, Deserialize)]
65#[serde(rename_all = "camelCase")]
66#[serde(default)]
67pub struct PendingServerRequestOption {
68    pub label: String,
69    pub description: Option<String>,
70    pub value: Option<Value>,
71    pub is_other: bool,
72    pub raw: Value,
73}
74
75#[derive(Debug, Clone, Default, Serialize, Deserialize)]
76#[serde(rename_all = "camelCase")]
77#[serde(default)]
78pub struct PendingServerRequestQuestion {
79    pub id: String,
80    pub header: Option<String>,
81    pub question: Option<String>,
82    pub required: bool,
83    pub options: Vec<PendingServerRequestOption>,
84    pub raw: Value,
85}
86
87#[derive(Debug, Clone, Default, Serialize, Deserialize)]
88#[serde(rename_all = "camelCase")]
89#[serde(default)]
90pub struct PendingServerRequestRecord {
91    pub request_id: String,
92    pub runtime_id: String,
93    pub rpc_request_id: Value,
94    pub request_type: String,
95    pub thread_id: Option<String>,
96    pub turn_id: Option<String>,
97    pub item_id: Option<String>,
98    pub title: Option<String>,
99    pub reason: Option<String>,
100    pub command: Option<String>,
101    pub cwd: Option<String>,
102    pub grant_root: Option<String>,
103    pub tool_name: Option<String>,
104    pub arguments: Option<Value>,
105    #[serde(default)]
106    pub questions: Vec<PendingServerRequestQuestion>,
107    pub proposed_execpolicy_amendment: Option<Value>,
108    pub network_approval_context: Option<Value>,
109    pub schema: Option<Value>,
110    #[serde(default)]
111    pub available_decisions: Vec<String>,
112    pub raw_payload: Value,
113    pub created_at_ms: i64,
114}