| use super::ActivePermissionProfile; |
| use super::ApprovalsReviewer; |
| use super::AskForApproval; |
| use super::SandboxMode; |
| use super::SandboxPolicy; |
| use super::Thread; |
| use super::ThreadHistoryMode; |
| use super::ThreadItem; |
| use super::ThreadRealtimeItem; |
| use super::ThreadSection; |
| use super::ThreadSectionAppearance; |
| use super::ThreadSource; |
| use super::Turn; |
| use super::TurnEnvironmentParams; |
| use super::TurnError; |
| use super::TurnItemsView; |
| use super::TurnStatus; |
| use super::UserInput; |
| use super::shared::v2_enum_from_core; |
| use crate::JsonSchema; |
| use crate::TS; |
| use codex_experimental_api_macros::ExperimentalApi; |
| pub use codex_protocol::capabilities::CapabilityRootLocation; |
| pub use codex_protocol::capabilities::SelectedCapabilityRoot; |
| use codex_protocol::config_types::CollaborationMode; |
| use codex_protocol::config_types::MultiAgentMode; |
| use codex_protocol::config_types::Personality; |
| use codex_protocol::config_types::ReasoningSummary; |
| pub use codex_protocol::dynamic_tools::DynamicToolFunctionSpec; |
| pub use codex_protocol::dynamic_tools::DynamicToolNamespaceSpec; |
| pub use codex_protocol::dynamic_tools::DynamicToolNamespaceTool; |
| pub use codex_protocol::dynamic_tools::DynamicToolSpec; |
| use codex_protocol::models::ResponseItem; |
| use codex_protocol::openai_models::ReasoningEffort; |
| use codex_protocol::protocol::ThreadGoalStatus as CoreThreadGoalStatus; |
| use codex_protocol::protocol::TokenUsage as CoreTokenUsage; |
| use codex_protocol::protocol::TokenUsageInfo as CoreTokenUsageInfo; |
| use codex_utils_absolute_path::AbsolutePathBuf; |
| use codex_utils_path_uri::LegacyAppPathString; |
| use codex_utils_path_uri::PathUri; |
| use serde::Deserialize; |
| use serde::Serialize; |
| use serde_json::Value as JsonValue; |
| use std::collections::HashMap; |
| use std::path::PathBuf; |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(rename_all = "camelCase", export_to = "v2/")] |
| pub enum ThreadStartSource { |
| Startup, |
| Clear, |
| } |
|
|
| |
| |
| #[derive( |
| Serialize, Deserialize, Debug, Clone, PartialEq, Default, JsonSchema, TS, ExperimentalApi, |
| )] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadStartParams { |
| #[ts(optional = nullable)] |
| pub model: Option<String>, |
| #[ts(optional = nullable)] |
| pub model_provider: Option<String>, |
| |
| |
| #[experimental("thread/start.allowProviderModelFallback")] |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
| pub allow_provider_model_fallback: bool, |
| #[serde( |
| default, |
| deserialize_with = "crate::protocol::serde_helpers::deserialize_double_option", |
| serialize_with = "crate::protocol::serde_helpers::serialize_double_option", |
| skip_serializing_if = "Option::is_none" |
| )] |
| #[ts(optional = nullable)] |
| pub service_tier: Option<Option<String>>, |
| #[ts(optional = nullable)] |
| pub cwd: Option<String>, |
| |
| #[experimental("thread/start.runtimeWorkspaceRoots")] |
| #[ts(optional = nullable)] |
| pub runtime_workspace_roots: Option<Vec<AbsolutePathBuf>>, |
| #[experimental(nested)] |
| #[ts(optional = nullable)] |
| pub approval_policy: Option<AskForApproval>, |
| |
| |
| #[ts(optional = nullable)] |
| pub approvals_reviewer: Option<ApprovalsReviewer>, |
| #[ts(optional = nullable)] |
| pub sandbox: Option<SandboxMode>, |
| |
| #[experimental("thread/start.permissions")] |
| #[ts(optional = nullable)] |
| pub permissions: Option<String>, |
| #[ts(optional = nullable)] |
| pub config: Option<HashMap<String, JsonValue>>, |
| #[ts(optional = nullable)] |
| pub service_name: Option<String>, |
| #[ts(optional = nullable)] |
| pub base_instructions: Option<String>, |
| #[ts(optional = nullable)] |
| pub developer_instructions: Option<String>, |
| |
| #[ts(optional = nullable)] |
| pub personality: Option<Personality>, |
| |
| #[experimental("thread/start.multiAgentMode")] |
| #[ts(optional = nullable)] |
| pub multi_agent_mode: Option<MultiAgentMode>, |
| #[ts(optional = nullable)] |
| pub ephemeral: Option<bool>, |
| |
| #[experimental("thread/start.historyMode")] |
| #[ts(optional = nullable)] |
| pub history_mode: Option<ThreadHistoryMode>, |
| #[ts(optional = nullable)] |
| pub session_start_source: Option<ThreadStartSource>, |
| |
| #[ts(optional = nullable)] |
| pub thread_source: Option<ThreadSource>, |
| |
| |
| #[experimental("thread/start.projectId")] |
| #[ts(optional = nullable)] |
| pub project_id: Option<String>, |
| |
| |
| |
| #[experimental("thread/start.daybreakEnabled")] |
| #[ts(optional = nullable)] |
| pub daybreak_enabled: Option<bool>, |
| |
| |
| |
| |
| |
| |
| #[experimental("thread/start.environments")] |
| #[ts(optional = nullable)] |
| pub environments: Option<Vec<TurnEnvironmentParams>>, |
| #[experimental("thread/start.dynamicTools")] |
| #[serde( |
| default, |
| deserialize_with = "codex_protocol::dynamic_tools::deserialize_dynamic_tool_specs" |
| )] |
| #[ts(optional = nullable)] |
| pub dynamic_tools: Option<Vec<DynamicToolSpec>>, |
| |
| #[experimental("thread/start.selectedCapabilityRoots")] |
| #[ts(optional = nullable)] |
| pub selected_capability_roots: Option<Vec<SelectedCapabilityRoot>>, |
| |
| |
| #[experimental("thread/start.mockExperimentalField")] |
| #[ts(optional = nullable)] |
| pub mock_experimental_field: Option<String>, |
| |
| |
| #[experimental("thread/start.experimentalRawEvents")] |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
| pub experimental_raw_events: bool, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct MockExperimentalMethodParams { |
| |
| #[ts(optional = nullable)] |
| pub value: Option<String>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct MockExperimentalMethodResponse { |
| |
| pub echoed: Option<String>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, ExperimentalApi)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadStartResponse { |
| pub thread: Thread, |
| pub model: String, |
| pub model_provider: String, |
| pub service_tier: Option<String>, |
| |
| #[serde(default)] |
| pub disabled_plugin_ids: Vec<String>, |
| pub cwd: AbsolutePathBuf, |
| |
| |
| #[experimental("thread/start.runtimeWorkspaceRoots")] |
| #[serde(default)] |
| pub runtime_workspace_roots: Vec<AbsolutePathBuf>, |
| |
| #[serde(default)] |
| pub instruction_sources: Vec<LegacyAppPathString>, |
| #[experimental(nested)] |
| pub approval_policy: AskForApproval, |
| |
| pub approvals_reviewer: ApprovalsReviewer, |
| |
| |
| pub sandbox: SandboxPolicy, |
| |
| |
| #[experimental("thread/start.activePermissionProfile")] |
| #[serde(default)] |
| pub active_permission_profile: Option<ActivePermissionProfile>, |
| pub reasoning_effort: Option<ReasoningEffort>, |
| |
| #[experimental("thread/start.multiAgentMode")] |
| #[serde(default)] |
| pub multi_agent_mode: MultiAgentMode, |
| } |
|
|
| impl ThreadStartResponse { |
| |
| pub fn instruction_source_path_uris(&self) -> Vec<PathUri> { |
| instruction_source_path_uris(&self.instruction_sources) |
| } |
| } |
|
|
| #[derive( |
| Serialize, Deserialize, Debug, Default, Clone, PartialEq, JsonSchema, TS, ExperimentalApi, |
| )] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSettingsUpdateParams { |
| pub thread_id: String, |
| |
| |
| #[ts(optional = nullable)] |
| pub disabled_plugin_ids: Option<Vec<String>>, |
| |
| #[ts(optional = nullable)] |
| pub cwd: Option<PathBuf>, |
| |
| #[experimental(nested)] |
| #[ts(optional = nullable)] |
| pub approval_policy: Option<AskForApproval>, |
| |
| #[ts(optional = nullable)] |
| pub approvals_reviewer: Option<ApprovalsReviewer>, |
| |
| #[ts(optional = nullable)] |
| pub sandbox_policy: Option<SandboxPolicy>, |
| |
| |
| #[experimental("thread/settings/update.permissions")] |
| #[ts(optional = nullable)] |
| pub permissions: Option<String>, |
| |
| #[ts(optional = nullable)] |
| pub model: Option<String>, |
| |
| |
| #[serde( |
| default, |
| deserialize_with = "crate::protocol::serde_helpers::deserialize_double_option", |
| serialize_with = "crate::protocol::serde_helpers::serialize_double_option", |
| skip_serializing_if = "Option::is_none" |
| )] |
| #[ts(optional = nullable)] |
| pub service_tier: Option<Option<String>>, |
| |
| #[ts(optional = nullable)] |
| pub effort: Option<ReasoningEffort>, |
| |
| #[ts(optional = nullable)] |
| pub summary: Option<ReasoningSummary>, |
| |
| |
| |
| |
| #[experimental("thread/settings/update.collaborationMode")] |
| #[ts(optional = nullable)] |
| pub collaboration_mode: Option<CollaborationMode>, |
| |
| #[experimental("thread/settings/update.multiAgentMode")] |
| #[ts(optional = nullable)] |
| pub multi_agent_mode: Option<MultiAgentMode>, |
| |
| |
| #[ts(optional = nullable)] |
| pub personality: Option<Personality>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSettingsUpdateResponse {} |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, ExperimentalApi)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSettings { |
| |
| #[serde(default)] |
| pub disabled_plugin_ids: Vec<String>, |
| pub cwd: AbsolutePathBuf, |
| pub approval_policy: AskForApproval, |
| pub approvals_reviewer: ApprovalsReviewer, |
| pub sandbox_policy: SandboxPolicy, |
| pub active_permission_profile: Option<ActivePermissionProfile>, |
| pub model: String, |
| pub model_provider: String, |
| pub service_tier: Option<String>, |
| pub effort: Option<ReasoningEffort>, |
| pub summary: Option<ReasoningSummary>, |
| pub collaboration_mode: CollaborationMode, |
| |
| #[experimental("thread/settings.multiAgentMode")] |
| #[serde(default)] |
| pub multi_agent_mode: MultiAgentMode, |
| |
| pub personality: Option<Personality>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSettingsUpdatedNotification { |
| pub thread_id: String, |
| pub thread_settings: ThreadSettings, |
| } |
|
|
| #[derive( |
| Serialize, Deserialize, Debug, Default, Clone, PartialEq, JsonSchema, TS, ExperimentalApi, |
| )] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| pub struct ThreadResumeParams { |
| pub thread_id: String, |
|
|
| |
| |
| |
| #[experimental("thread/resume.history")] |
| #[ts(optional = nullable)] |
| pub history: Option<Vec<ResponseItem>>, |
|
|
| |
| |
| |
| |
| #[experimental("thread/resume.path")] |
| #[serde( |
| default, |
| deserialize_with = "crate::protocol::serde_helpers::deserialize_empty_path_as_none" |
| )] |
| #[ts(optional = nullable)] |
| pub path: Option<PathBuf>, |
|
|
| |
| #[ts(optional = nullable)] |
| pub model: Option<String>, |
| #[ts(optional = nullable)] |
| pub model_provider: Option<String>, |
| #[serde( |
| default, |
| deserialize_with = "crate::protocol::serde_helpers::deserialize_double_option", |
| serialize_with = "crate::protocol::serde_helpers::serialize_double_option", |
| skip_serializing_if = "Option::is_none" |
| )] |
| #[ts(optional = nullable)] |
| pub service_tier: Option<Option<String>>, |
| #[ts(optional = nullable)] |
| pub cwd: Option<String>, |
| |
| #[experimental("thread/resume.runtimeWorkspaceRoots")] |
| #[ts(optional = nullable)] |
| pub runtime_workspace_roots: Option<Vec<AbsolutePathBuf>>, |
| #[experimental(nested)] |
| #[ts(optional = nullable)] |
| pub approval_policy: Option<AskForApproval>, |
| |
| |
| #[ts(optional = nullable)] |
| pub approvals_reviewer: Option<ApprovalsReviewer>, |
| #[ts(optional = nullable)] |
| pub sandbox: Option<SandboxMode>, |
| |
| |
| #[experimental("thread/resume.permissions")] |
| #[ts(optional = nullable)] |
| pub permissions: Option<String>, |
| #[ts(optional = nullable)] |
| pub config: Option<HashMap<String, serde_json::Value>>, |
| #[ts(optional = nullable)] |
| pub base_instructions: Option<String>, |
| #[ts(optional = nullable)] |
| pub developer_instructions: Option<String>, |
| |
| |
| #[ts(optional = nullable)] |
| pub personality: Option<Personality>, |
| |
| |
| |
| |
| |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
| pub exclude_turns: bool, |
| |
| |
| #[experimental("thread/resume.initialTurnsPage")] |
| #[ts(optional = nullable)] |
| pub initial_turns_page: Option<ThreadResumeInitialTurnsPageParams>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, ExperimentalApi)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadResumeResponse { |
| pub thread: Thread, |
| pub model: String, |
| pub model_provider: String, |
| pub service_tier: Option<String>, |
| |
| #[serde(default)] |
| pub disabled_plugin_ids: Vec<String>, |
| pub cwd: AbsolutePathBuf, |
| |
| |
| #[experimental("thread/resume.runtimeWorkspaceRoots")] |
| #[serde(default)] |
| pub runtime_workspace_roots: Vec<AbsolutePathBuf>, |
| |
| #[serde(default)] |
| pub instruction_sources: Vec<LegacyAppPathString>, |
| #[experimental(nested)] |
| pub approval_policy: AskForApproval, |
| |
| pub approvals_reviewer: ApprovalsReviewer, |
| |
| |
| pub sandbox: SandboxPolicy, |
| |
| |
| #[experimental("thread/resume.activePermissionProfile")] |
| #[serde(default)] |
| pub active_permission_profile: Option<ActivePermissionProfile>, |
| pub reasoning_effort: Option<ReasoningEffort>, |
| |
| pub collaboration_mode: Option<CollaborationMode>, |
| |
| #[experimental("thread/resume.multiAgentMode")] |
| #[serde(default)] |
| pub multi_agent_mode: MultiAgentMode, |
| |
| #[experimental("thread/resume.initialTurnsPage")] |
| #[serde(default)] |
| pub initial_turns_page: Option<TurnsPage>, |
| |
| |
| |
| |
| #[serde(default)] |
| pub turns_backwards_cursor: Option<String>, |
| |
| |
| |
| |
| #[serde(default)] |
| pub items_backwards_cursor: Option<String>, |
| } |
|
|
| impl ThreadResumeResponse { |
| |
| pub fn instruction_source_path_uris(&self) -> Vec<PathUri> { |
| instruction_source_path_uris(&self.instruction_sources) |
| } |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadResumeInitialTurnsPageParams { |
| |
| #[ts(optional = nullable)] |
| pub limit: Option<u32>, |
| |
| #[ts(optional = nullable)] |
| pub sort_direction: Option<SortDirection>, |
| |
| #[ts(optional = nullable)] |
| pub items_view: Option<TurnItemsView>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct TurnsPage { |
| pub data: Vec<Turn>, |
| pub next_cursor: Option<String>, |
| pub backwards_cursor: Option<String>, |
| } |
|
|
| impl From<ThreadTurnsListResponse> for TurnsPage { |
| fn from(response: ThreadTurnsListResponse) -> Self { |
| Self { |
| data: response.data, |
| next_cursor: response.next_cursor, |
| backwards_cursor: response.backwards_cursor, |
| } |
| } |
| } |
|
|
| #[derive( |
| Serialize, Deserialize, Debug, Default, Clone, PartialEq, JsonSchema, TS, ExperimentalApi, |
| )] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| |
| |
| |
| |
| |
| |
| |
| |
| pub struct ThreadForkParams { |
| pub thread_id: String, |
|
|
| |
| |
| |
| |
| #[ts(optional = nullable)] |
| pub last_turn_id: Option<String>, |
|
|
| |
| |
| #[experimental("thread/fork.beforeTurnId")] |
| #[ts(optional = nullable)] |
| pub before_turn_id: Option<String>, |
|
|
| |
| |
| #[experimental("thread/fork.path")] |
| #[serde( |
| default, |
| deserialize_with = "crate::protocol::serde_helpers::deserialize_empty_path_as_none" |
| )] |
| #[ts(optional = nullable)] |
| pub path: Option<PathBuf>, |
|
|
| |
| #[ts(optional = nullable)] |
| pub model: Option<String>, |
| #[ts(optional = nullable)] |
| pub model_provider: Option<String>, |
| #[serde( |
| default, |
| deserialize_with = "crate::protocol::serde_helpers::deserialize_double_option", |
| serialize_with = "crate::protocol::serde_helpers::serialize_double_option", |
| skip_serializing_if = "Option::is_none" |
| )] |
| #[ts(optional = nullable)] |
| pub service_tier: Option<Option<String>>, |
| #[ts(optional = nullable)] |
| pub cwd: Option<String>, |
| |
| #[experimental("thread/fork.runtimeWorkspaceRoots")] |
| #[ts(optional = nullable)] |
| pub runtime_workspace_roots: Option<Vec<AbsolutePathBuf>>, |
| #[experimental(nested)] |
| #[ts(optional = nullable)] |
| pub approval_policy: Option<AskForApproval>, |
| |
| |
| #[ts(optional = nullable)] |
| pub approvals_reviewer: Option<ApprovalsReviewer>, |
| #[ts(optional = nullable)] |
| pub sandbox: Option<SandboxMode>, |
| |
| |
| #[experimental("thread/fork.permissions")] |
| #[ts(optional = nullable)] |
| pub permissions: Option<String>, |
| #[ts(optional = nullable)] |
| pub config: Option<HashMap<String, serde_json::Value>>, |
| #[ts(optional = nullable)] |
| pub base_instructions: Option<String>, |
| #[ts(optional = nullable)] |
| pub developer_instructions: Option<String>, |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
| pub ephemeral: bool, |
| |
| #[ts(optional = nullable)] |
| pub thread_source: Option<ThreadSource>, |
| |
| |
| |
| |
| |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
| pub exclude_turns: bool, |
| |
| |
| |
| #[experimental("thread/fork.deferGoalContinuation")] |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
| pub defer_goal_continuation: bool, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, ExperimentalApi)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadForkResponse { |
| pub thread: Thread, |
| pub model: String, |
| pub model_provider: String, |
| pub service_tier: Option<String>, |
| |
| #[serde(default)] |
| pub disabled_plugin_ids: Vec<String>, |
| pub cwd: AbsolutePathBuf, |
| |
| |
| #[experimental("thread/fork.runtimeWorkspaceRoots")] |
| #[serde(default)] |
| pub runtime_workspace_roots: Vec<AbsolutePathBuf>, |
| |
| #[serde(default)] |
| pub instruction_sources: Vec<LegacyAppPathString>, |
| #[experimental(nested)] |
| pub approval_policy: AskForApproval, |
| |
| pub approvals_reviewer: ApprovalsReviewer, |
| |
| |
| pub sandbox: SandboxPolicy, |
| |
| |
| #[experimental("thread/fork.activePermissionProfile")] |
| #[serde(default)] |
| pub active_permission_profile: Option<ActivePermissionProfile>, |
| pub reasoning_effort: Option<ReasoningEffort>, |
| |
| #[experimental("thread/fork.multiAgentMode")] |
| #[serde(default)] |
| pub multi_agent_mode: MultiAgentMode, |
| } |
|
|
| impl ThreadForkResponse { |
| |
| pub fn instruction_source_path_uris(&self) -> Vec<PathUri> { |
| instruction_source_path_uris(&self.instruction_sources) |
| } |
| } |
|
|
| fn instruction_source_path_uris(sources: &[LegacyAppPathString]) -> Vec<PathUri> { |
| |
| |
| sources |
| .iter() |
| .filter_map(|source| { |
| source.to_inferred_path_uri().or_else(|| { |
| tracing::warn!( |
| path = source.as_str(), |
| "ignoring invalid instruction source path from app-server" |
| ); |
| None |
| }) |
| }) |
| .collect() |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadArchiveParams { |
| pub thread_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadArchiveResponse {} |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadDeleteParams { |
| pub thread_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadDeleteResponse {} |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadUnsubscribeParams { |
| pub thread_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadUnsubscribeResponse { |
| pub status: ThreadUnsubscribeStatus, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub enum ThreadUnsubscribeStatus { |
| NotLoaded, |
| NotSubscribed, |
| Unsubscribed, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadIncrementElicitationParams { |
| |
| pub thread_id: String, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadIncrementElicitationResponse { |
| |
| pub count: i64, |
| |
| pub paused: bool, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadDecrementElicitationParams { |
| |
| pub thread_id: String, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadDecrementElicitationResponse { |
| |
| pub count: i64, |
| |
| pub paused: bool, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSetNameParams { |
| pub thread_id: String, |
| pub name: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadUnarchiveParams { |
| pub thread_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSetNameResponse {} |
|
|
| v2_enum_from_core! { |
| pub enum ThreadGoalStatus from CoreThreadGoalStatus { |
| Active, |
| Paused, |
| Blocked, |
| UsageLimited, |
| BudgetLimited, |
| Complete, |
| } |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadGoal { |
| pub thread_id: String, |
| pub objective: String, |
| pub status: ThreadGoalStatus, |
| #[ts(type = "number | null")] |
| pub token_budget: Option<i64>, |
| #[ts(type = "number")] |
| pub tokens_used: i64, |
| #[ts(type = "number")] |
| pub time_used_seconds: i64, |
| #[ts(type = "number")] |
| pub created_at: i64, |
| #[ts(type = "number")] |
| pub updated_at: i64, |
| } |
|
|
| impl From<codex_protocol::protocol::ThreadGoal> for ThreadGoal { |
| fn from(value: codex_protocol::protocol::ThreadGoal) -> Self { |
| Self { |
| thread_id: value.thread_id.to_string(), |
| objective: value.objective, |
| status: value.status.into(), |
| token_budget: value.token_budget, |
| tokens_used: value.tokens_used, |
| time_used_seconds: value.time_used_seconds, |
| created_at: value.created_at, |
| updated_at: value.updated_at, |
| } |
| } |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadGoalSetParams { |
| pub thread_id: String, |
| #[ts(optional = nullable)] |
| pub objective: Option<String>, |
| #[ts(optional = nullable)] |
| pub status: Option<ThreadGoalStatus>, |
| #[serde( |
| default, |
| deserialize_with = "crate::protocol::serde_helpers::deserialize_double_option", |
| serialize_with = "crate::protocol::serde_helpers::serialize_double_option", |
| skip_serializing_if = "Option::is_none" |
| )] |
| #[ts(optional = nullable, type = "number | null")] |
| pub token_budget: Option<Option<i64>>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadGoalSetResponse { |
| pub goal: ThreadGoal, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadGoalGetParams { |
| pub thread_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadGoalGetResponse { |
| pub goal: Option<ThreadGoal>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadGoalClearParams { |
| pub thread_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadGoalClearResponse { |
| pub cleared: bool, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, ExperimentalApi)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct QueuedSubmission { |
| pub id: String, |
| pub input: Vec<UserInput>, |
| pub client_user_message_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadQueueAddParams { |
| pub thread_id: String, |
| pub input: Vec<UserInput>, |
| pub client_user_message_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadQueueAddResponse { |
| pub queued_submission: QueuedSubmission, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadQueueListParams { |
| pub thread_id: String, |
| |
| #[ts(optional = nullable)] |
| pub cursor: Option<String>, |
| |
| #[ts(optional = nullable)] |
| pub limit: Option<u32>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadQueueListResponse { |
| pub data: Vec<QueuedSubmission>, |
| |
| pub next_cursor: Option<String>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadQueueUpdateParams { |
| pub thread_id: String, |
| pub queued_submission_id: String, |
| pub input: Vec<UserInput>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadQueueUpdateResponse { |
| pub queued_submission: QueuedSubmission, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadQueueDeleteParams { |
| pub thread_id: String, |
| pub queued_submission_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadQueueDeleteResponse { |
| pub deleted: bool, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadQueueReorderParams { |
| pub thread_id: String, |
| pub queued_submission_ids: Vec<String>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadQueueReorderResponse {} |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadQueueStartParams { |
| pub thread_id: String, |
| #[ts(optional = nullable)] |
| pub queued_submission_id: Option<String>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadQueueStartResponse { |
| pub turn: Turn, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, ExperimentalApi)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadMetadataUpdateParams { |
| pub thread_id: String, |
| |
| |
| #[experimental("thread/metadata/update.projectId")] |
| #[ts(optional = nullable)] |
| pub project_id: Option<String>, |
| |
| |
| |
| #[ts(optional = nullable)] |
| pub git_info: Option<ThreadMetadataGitInfoUpdateParams>, |
| |
| |
| |
| #[experimental("thread/metadata/update.daybreakEnabled")] |
| #[ts(optional = nullable)] |
| pub daybreak_enabled: Option<bool>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadMetadataGitInfoUpdateParams { |
| |
| |
| #[serde( |
| default, |
| skip_serializing_if = "Option::is_none", |
| serialize_with = "crate::protocol::serde_helpers::serialize_double_option", |
| deserialize_with = "crate::protocol::serde_helpers::deserialize_double_option" |
| )] |
| #[ts(optional = nullable, type = "string | null")] |
| pub sha: Option<Option<String>>, |
| |
| |
| #[serde( |
| default, |
| skip_serializing_if = "Option::is_none", |
| serialize_with = "crate::protocol::serde_helpers::serialize_double_option", |
| deserialize_with = "crate::protocol::serde_helpers::deserialize_double_option" |
| )] |
| #[ts(optional = nullable, type = "string | null")] |
| pub branch: Option<Option<String>>, |
| |
| |
| #[serde( |
| default, |
| skip_serializing_if = "Option::is_none", |
| serialize_with = "crate::protocol::serde_helpers::serialize_double_option", |
| deserialize_with = "crate::protocol::serde_helpers::deserialize_double_option" |
| )] |
| #[ts(optional = nullable, type = "string | null")] |
| pub origin_url: Option<Option<String>>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadMetadataUpdateResponse { |
| pub thread: Thread, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSectionMoveParams { |
| |
| pub thread_id: String, |
| |
| #[serde(deserialize_with = "Option::deserialize")] |
| #[schemars( |
| required, |
| schema_with = "crate::protocol::serde_helpers::nullable_string_schema" |
| )] |
| #[ts(type = "string | null")] |
| pub section_id: Option<String>, |
| |
| #[ts(optional = nullable)] |
| pub before_thread_id: Option<String>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSectionMoveResponse {} |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "lowercase")] |
| #[ts(rename_all = "lowercase")] |
| pub enum ThreadMemoryMode { |
| Enabled, |
| Disabled, |
| } |
|
|
| impl ThreadMemoryMode { |
| pub fn as_str(self) -> &'static str { |
| match self { |
| Self::Enabled => "enabled", |
| Self::Disabled => "disabled", |
| } |
| } |
|
|
| pub fn to_core(self) -> codex_protocol::protocol::ThreadMemoryMode { |
| match self { |
| Self::Enabled => codex_protocol::protocol::ThreadMemoryMode::Enabled, |
| Self::Disabled => codex_protocol::protocol::ThreadMemoryMode::Disabled, |
| } |
| } |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadMemoryModeSetParams { |
| pub thread_id: String, |
| pub mode: ThreadMemoryMode, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadMemoryModeSetResponse {} |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct MemoryResetResponse {} |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadUnarchiveResponse { |
| pub thread: Thread, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadCompactStartParams { |
| pub thread_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadCompactStartResponse {} |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadShellCommandParams { |
| pub thread_id: String, |
| |
| |
| |
| |
| pub command: String, |
| |
| |
| |
| #[ts(type = "number | null")] |
| #[ts(optional = nullable)] |
| pub timeout_ms: Option<i64>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadShellCommandResponse {} |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadApproveGuardianDeniedActionParams { |
| pub thread_id: String, |
| |
| pub event: JsonValue, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadApproveGuardianDeniedActionResponse {} |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadBackgroundTerminalsCleanParams { |
| pub thread_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadBackgroundTerminalsCleanResponse {} |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadBackgroundTerminalsListParams { |
| pub thread_id: String, |
| |
| #[ts(optional = nullable)] |
| pub cursor: Option<String>, |
| |
| #[ts(optional = nullable)] |
| pub limit: Option<u32>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadBackgroundTerminal { |
| pub item_id: String, |
| pub process_id: String, |
| pub command: String, |
| pub cwd: LegacyAppPathString, |
| pub os_pid: Option<u32>, |
| pub cpu_percent: Option<f64>, |
| pub rss_kb: Option<u64>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadBackgroundTerminalsListResponse { |
| pub data: Vec<ThreadBackgroundTerminal>, |
| |
| |
| pub next_cursor: Option<String>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadBackgroundTerminalsTerminateParams { |
| pub thread_id: String, |
| pub process_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadBackgroundTerminalsTerminateResponse { |
| pub terminated: bool, |
| } |
|
|
| |
| |
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadRevertParams { |
| pub thread_id: String, |
| |
| pub before_turn_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadRevertResponse { |
| |
| |
| pub thread: Thread, |
| |
| |
| |
| |
| pub turns_backwards_cursor: Option<String>, |
| |
| |
| |
| |
| pub items_backwards_cursor: Option<String>, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSectionListParams { |
| |
| #[ts(optional = nullable)] |
| pub cursor: Option<String>, |
| |
| #[ts(optional = nullable)] |
| pub limit: Option<u32>, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSectionListResponse { |
| pub data: Vec<ThreadSection>, |
| |
| pub next_cursor: Option<String>, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSectionCreateParams { |
| |
| pub name: String, |
| #[serde(default)] |
| #[ts(optional = nullable)] |
| pub appearance: Option<ThreadSectionAppearance>, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSectionCreateResponse { |
| pub section: ThreadSection, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSectionUpdateParams { |
| |
| pub section_id: String, |
| |
| pub name: String, |
| |
| #[serde( |
| default, |
| skip_serializing_if = "Option::is_none", |
| serialize_with = "crate::protocol::serde_helpers::serialize_double_option", |
| deserialize_with = "crate::protocol::serde_helpers::deserialize_double_option" |
| )] |
| #[schemars(with = "Option<ThreadSectionAppearance>")] |
| #[ts(optional = nullable, as = "Option<ThreadSectionAppearance>")] |
| pub appearance: Option<Option<ThreadSectionAppearance>>, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSectionUpdateResponse { |
| pub section: ThreadSection, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSectionDeleteParams { |
| |
| pub section_id: String, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSectionDeleteResponse {} |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS, ExperimentalApi)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadListParams { |
| |
| #[ts(optional = nullable)] |
| pub cursor: Option<String>, |
| |
| #[ts(optional = nullable)] |
| pub limit: Option<u32>, |
| |
| #[ts(optional = nullable)] |
| pub sort_key: Option<ThreadSortKey>, |
| |
| #[ts(optional = nullable)] |
| pub sort_direction: Option<SortDirection>, |
| |
| |
| #[ts(optional = nullable)] |
| pub model_providers: Option<Vec<String>>, |
| |
| |
| #[ts(optional = nullable)] |
| pub source_kinds: Option<Vec<ThreadSourceKind>>, |
| |
| |
| |
| #[ts(optional = nullable)] |
| pub originators: Option<Vec<String>>, |
| |
| |
| #[ts(optional = nullable)] |
| pub archived: Option<bool>, |
| |
| |
| #[serde( |
| default, |
| skip_serializing_if = "Option::is_none", |
| serialize_with = "crate::protocol::serde_helpers::serialize_double_option", |
| deserialize_with = "crate::protocol::serde_helpers::deserialize_double_option" |
| )] |
| #[ts(optional = nullable, type = "string | null")] |
| pub section_id: Option<Option<String>>, |
| |
| |
| #[experimental("thread/list.projectId")] |
| #[serde( |
| default, |
| skip_serializing_if = "Option::is_none", |
| serialize_with = "crate::protocol::serde_helpers::serialize_double_option", |
| deserialize_with = "crate::protocol::serde_helpers::deserialize_double_option" |
| )] |
| #[ts(optional = nullable, type = "string | null")] |
| pub project_id: Option<Option<String>>, |
| |
| |
| #[ts(optional = nullable, type = "string | Array<string> | null")] |
| pub cwd: Option<ThreadListCwdFilter>, |
| |
| |
| |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
| pub use_state_db_only: bool, |
| |
| #[ts(optional = nullable)] |
| pub search_term: Option<String>, |
| |
| #[experimental("thread/list.parentThreadId")] |
| #[ts(optional = nullable)] |
| pub parent_thread_id: Option<String>, |
| |
| |
| #[experimental("thread/list.ancestorThreadId")] |
| #[ts(optional = nullable)] |
| pub ancestor_thread_id: Option<String>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSearchParams { |
| |
| #[ts(optional = nullable)] |
| pub cursor: Option<String>, |
| |
| #[ts(optional = nullable)] |
| pub limit: Option<u32>, |
| |
| #[ts(optional = nullable)] |
| pub sort_key: Option<ThreadSearchSortKey>, |
| |
| #[ts(optional = nullable)] |
| pub sort_direction: Option<SortDirection>, |
| |
| |
| #[ts(optional = nullable)] |
| pub source_kinds: Option<Vec<ThreadSourceKind>>, |
| |
| |
| #[ts(optional = nullable)] |
| pub archived: Option<bool>, |
| |
| pub search_term: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema)] |
| #[serde(untagged)] |
| pub enum ThreadListCwdFilter { |
| One(String), |
| Many(Vec<String>), |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(rename_all = "camelCase", export_to = "v2/")] |
| pub enum ThreadSourceKind { |
| Cli, |
| #[serde(rename = "vscode")] |
| #[ts(rename = "vscode")] |
| VsCode, |
| Exec, |
| AppServer, |
| SubAgent, |
| SubAgentReview, |
| SubAgentCompact, |
| SubAgentThreadSpawn, |
| SubAgentOther, |
| Unknown, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "snake_case")] |
| #[ts(export_to = "v2/")] |
| pub enum ThreadSortKey { |
| CreatedAt, |
| UpdatedAt, |
| RecencyAt, |
| SectionPosition, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "snake_case")] |
| #[ts(export_to = "v2/")] |
| pub enum ThreadSearchSortKey { |
| CreatedAt, |
| UpdatedAt, |
| RecencyAt, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "snake_case")] |
| #[ts(export_to = "v2/")] |
| pub enum SortDirection { |
| Asc, |
| Desc, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadListResponse { |
| pub data: Vec<Thread>, |
| |
| |
| pub next_cursor: Option<String>, |
| |
| |
| |
| |
| pub backwards_cursor: Option<String>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSearchResult { |
| pub thread: Thread, |
| pub snippet: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSearchResponse { |
| pub data: Vec<ThreadSearchResult>, |
| |
| |
| pub next_cursor: Option<String>, |
| |
| |
| |
| |
| pub backwards_cursor: Option<String>, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSearchOccurrencesParams { |
| pub thread_id: String, |
| |
| |
| pub search_term: String, |
| |
| #[ts(optional = nullable)] |
| pub cursor: Option<String>, |
| |
| #[ts(optional = nullable)] |
| pub limit: Option<u32>, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSearchTextRange { |
| |
| pub start: u32, |
| |
| pub end: u32, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSearchOccurrence { |
| pub turn_id: String, |
| pub item_id: String, |
| pub snippet: String, |
| |
| pub snippet_match_range: ThreadSearchTextRange, |
| |
| pub turn_cursor: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadSearchOccurrencesResponse { |
| |
| pub data: Vec<ThreadSearchOccurrence>, |
| |
| pub next_cursor: Option<String>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadLoadedListParams { |
| |
| #[ts(optional = nullable)] |
| pub cursor: Option<String>, |
| |
| #[ts(optional = nullable)] |
| pub limit: Option<u32>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadLoadedListResponse { |
| |
| pub data: Vec<String>, |
| |
| |
| pub next_cursor: Option<String>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(tag = "type", rename_all = "camelCase")] |
| #[ts(tag = "type")] |
| #[ts(export_to = "v2/")] |
| pub enum ThreadStatus { |
| NotLoaded, |
| Idle, |
| SystemError, |
| #[serde(rename_all = "camelCase")] |
| #[ts(rename_all = "camelCase")] |
| Active { |
| active_flags: Vec<ThreadActiveFlag>, |
| }, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub enum ThreadActiveFlag { |
| WaitingOnApproval, |
| WaitingOnUserInput, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadReadParams { |
| pub thread_id: String, |
| |
| |
| |
| |
| #[serde(default, skip_serializing_if = "std::ops::Not::not")] |
| pub include_turns: bool, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadReadResponse { |
| pub thread: Thread, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadInjectItemsParams { |
| pub thread_id: String, |
| |
| pub items: Vec<JsonValue>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadInjectItemsResponse {} |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadTurnsListParams { |
| pub thread_id: String, |
| |
| #[ts(optional = nullable)] |
| pub cursor: Option<String>, |
| |
| #[ts(optional = nullable)] |
| pub limit: Option<u32>, |
| |
| #[ts(optional = nullable)] |
| pub sort_direction: Option<SortDirection>, |
| |
| #[ts(optional = nullable)] |
| pub items_view: Option<TurnItemsView>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadTurnsListResponse { |
| pub data: Vec<Turn>, |
| |
| |
| pub next_cursor: Option<String>, |
| |
| |
| |
| |
| pub backwards_cursor: Option<String>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadItemsListParams { |
| pub thread_id: String, |
| |
| #[ts(optional = nullable)] |
| pub turn_id: Option<String>, |
| |
| #[ts(optional = nullable)] |
| pub cursor: Option<String>, |
| |
| #[ts(optional = nullable)] |
| pub limit: Option<u32>, |
| |
| #[ts(optional = nullable)] |
| pub sort_direction: Option<SortDirection>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadItemEntry { |
| |
| pub turn_id: String, |
| pub item: ThreadItem, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadItemsListResponse { |
| pub data: Vec<ThreadItemEntry>, |
| |
| |
| pub next_cursor: Option<String>, |
| |
| |
| pub backwards_cursor: Option<String>, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadTimelineListParams { |
| pub thread_id: String, |
| #[ts(optional = nullable)] |
| pub cursor: Option<String>, |
| #[ts(optional = nullable)] |
| pub limit: Option<u32>, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde( |
| tag = "type", |
| rename_all = "camelCase", |
| rename_all_fields = "camelCase" |
| )] |
| #[ts(tag = "type", rename_all = "camelCase", export_to = "v2/")] |
| pub enum ThreadTimelineEntry { |
| Item { |
| #[ts(type = "number")] |
| position: u64, |
| #[schemars(rename = "turnId")] |
| #[serde(rename = "turnId")] |
| #[ts(rename = "turnId")] |
| turn_id: String, |
| item: Box<ThreadItem>, |
| }, |
| Realtime { |
| #[ts(type = "number")] |
| position: u64, |
| item: ThreadRealtimeItem, |
| }, |
| TurnStarted { |
| #[ts(type = "number")] |
| position: u64, |
| #[ts(rename = "turnId")] |
| turn_id: String, |
| #[ts(rename = "startedAt", type = "number | null")] |
| started_at: Option<i64>, |
| }, |
| TurnCompleted { |
| #[ts(type = "number")] |
| position: u64, |
| #[ts(rename = "turnId")] |
| turn_id: String, |
| status: TurnStatus, |
| error: Option<TurnError>, |
| #[ts(rename = "startedAt", type = "number | null")] |
| started_at: Option<i64>, |
| #[ts(rename = "completedAt", type = "number | null")] |
| completed_at: Option<i64>, |
| #[ts(rename = "durationMs", type = "number | null")] |
| duration_ms: Option<i64>, |
| }, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadTimelineListResponse { |
| pub data: Vec<ThreadTimelineEntry>, |
| pub next_cursor: Option<String>, |
| pub active_realtime_session_at_page_start: Option<String>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadTokenUsageUpdatedNotification { |
| pub thread_id: String, |
| pub turn_id: String, |
| pub token_usage: ThreadTokenUsage, |
| } |
|
|
| |
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct RawResponseCompletedNotification { |
| pub thread_id: String, |
| pub turn_id: String, |
| pub response_id: String, |
| pub usage: Option<TokenUsageBreakdown>, |
| pub usage_metadata: Option<ResponseUsageMetadata>, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ResponseUsageMetadata { |
| pub amount: Option<String>, |
| pub metadata: Option<JsonValue>, |
| } |
|
|
| impl From<codex_protocol::ResponseUsageMetadata> for ResponseUsageMetadata { |
| fn from(value: codex_protocol::ResponseUsageMetadata) -> Self { |
| Self { |
| amount: value.amount, |
| metadata: value.metadata, |
| } |
| } |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadTokenUsage { |
| pub total: TokenUsageBreakdown, |
| pub last: TokenUsageBreakdown, |
| |
| #[ts(type = "number | null")] |
| pub model_context_window: Option<i64>, |
| } |
|
|
| impl From<CoreTokenUsageInfo> for ThreadTokenUsage { |
| fn from(value: CoreTokenUsageInfo) -> Self { |
| Self { |
| total: value.total_token_usage.into(), |
| last: value.last_token_usage.into(), |
| model_context_window: value.model_context_window, |
| } |
| } |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct TokenUsageBreakdown { |
| #[ts(type = "number")] |
| pub total_tokens: i64, |
| #[ts(type = "number")] |
| pub input_tokens: i64, |
| #[ts(type = "number")] |
| pub cached_input_tokens: i64, |
| #[serde(default)] |
| #[ts(type = "number")] |
| pub cache_write_input_tokens: i64, |
| #[ts(type = "number")] |
| pub output_tokens: i64, |
| #[ts(type = "number")] |
| pub reasoning_output_tokens: i64, |
| } |
|
|
| impl From<CoreTokenUsage> for TokenUsageBreakdown { |
| fn from(value: CoreTokenUsage) -> Self { |
| Self { |
| total_tokens: value.total_tokens, |
| input_tokens: value.input_tokens, |
| cached_input_tokens: value.cached_input_tokens, |
| cache_write_input_tokens: value.cache_write_input_tokens, |
| output_tokens: value.output_tokens, |
| reasoning_output_tokens: value.reasoning_output_tokens, |
| } |
| } |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadStartedNotification { |
| pub thread: Thread, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadStatusChangedNotification { |
| pub thread_id: String, |
| pub status: ThreadStatus, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadArchivedNotification { |
| pub thread_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadDeletedNotification { |
| pub thread_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadUnarchivedNotification { |
| pub thread_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadClosedNotification { |
| pub thread_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadRevertedNotification { |
| pub thread_id: String, |
| } |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadNameUpdatedNotification { |
| pub thread_id: String, |
| #[serde(default, skip_serializing_if = "Option::is_none")] |
| #[ts(optional)] |
| pub thread_name: Option<String>, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadGoalUpdatedNotification { |
| pub thread_id: String, |
| pub turn_id: Option<String>, |
| pub goal: ThreadGoal, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadGoalClearedNotification { |
| pub thread_id: String, |
| } |
|
|
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ThreadQueueChangedNotification { |
| pub thread_id: String, |
| } |
|
|
| |
| #[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)] |
| #[serde(rename_all = "camelCase")] |
| #[ts(export_to = "v2/")] |
| pub struct ContextCompactedNotification { |
| pub thread_id: String, |
| pub turn_id: String, |
| } |
|
|