Skip to main content

codex_mobile_contracts/
thread.rs

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 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, Default, Serialize, Deserialize, PartialEq)]
49#[serde(rename_all = "camelCase")]
50#[serde(default)]
51pub struct TimelineEntry {
52    pub id: String,
53    pub runtime_id: String,
54    pub thread_id: String,
55    pub turn_id: Option<String>,
56    pub item_id: Option<String>,
57    pub entry_type: String,
58    pub title: Option<String>,
59    pub text: String,
60    pub status: Option<String>,
61    pub metadata: Value,
62}
63
64#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
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, PartialEq)]
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, PartialEq)]
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 request_kind: String,
96    pub thread_id: Option<String>,
97    pub turn_id: Option<String>,
98    pub item_id: Option<String>,
99    pub call_id: Option<String>,
100    pub title: Option<String>,
101    pub reason: Option<String>,
102    pub command: Option<String>,
103    pub cwd: Option<String>,
104    pub grant_root: Option<String>,
105    pub tool_name: Option<String>,
106    pub arguments: Option<Value>,
107    #[serde(default)]
108    pub questions: Vec<PendingServerRequestQuestion>,
109    pub proposed_execpolicy_amendment: Option<Value>,
110    pub network_approval_context: Option<Value>,
111    pub permissions: Option<Value>,
112    pub schema: Option<Value>,
113    #[serde(default)]
114    pub available_decisions: Vec<String>,
115    pub raw_payload: Value,
116    pub created_at_ms: i64,
117}