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 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 PendingServerRequestOption {
51    pub label: String,
52    pub description: Option<String>,
53    pub value: Option<Value>,
54    pub is_other: bool,
55    pub raw: Value,
56}
57
58#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
59#[serde(rename_all = "camelCase")]
60#[serde(default)]
61pub struct PendingServerRequestQuestion {
62    pub id: String,
63    pub header: Option<String>,
64    pub question: Option<String>,
65    pub required: bool,
66    pub options: Vec<PendingServerRequestOption>,
67    pub raw: Value,
68}
69
70#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)]
71#[serde(rename_all = "camelCase")]
72#[serde(default)]
73pub struct PendingServerRequestRecord {
74    pub request_id: String,
75    pub runtime_id: String,
76    pub rpc_request_id: Value,
77    pub request_type: String,
78    pub request_kind: String,
79    pub thread_id: Option<String>,
80    pub turn_id: Option<String>,
81    pub item_id: Option<String>,
82    pub call_id: Option<String>,
83    pub title: Option<String>,
84    pub reason: Option<String>,
85    pub command: Option<String>,
86    pub cwd: Option<String>,
87    pub grant_root: Option<String>,
88    pub tool_name: Option<String>,
89    pub arguments: Option<Value>,
90    #[serde(default)]
91    pub questions: Vec<PendingServerRequestQuestion>,
92    pub proposed_execpolicy_amendment: Option<Value>,
93    pub network_approval_context: Option<Value>,
94    pub permissions: Option<Value>,
95    pub schema: Option<Value>,
96    #[serde(default)]
97    pub available_decisions: Vec<String>,
98    pub raw_payload: Value,
99    pub created_at_ms: i64,
100}