Download codex-rs/app-server-protocol/src/protocol/v1.rs from SaylorTwift/codex: direct link, hf CLI and curl.
- Browser
- Download file 8.64 kB
-
https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/app-server-protocol/src/protocol/v1.rs
- Command line
-
hf download hf://SaylorTwift/codex/codex-rs/app-server-protocol/src/protocol/v1.rs
-
curl -L -o v1.rs https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/app-server-protocol/src/protocol/v1.rs
8.64 kB
| use std::collections::HashMap; | |
| use std::path::PathBuf; | |
| use crate::JsonSchema; | |
| use crate::TS; | |
| use codex_protocol::ThreadId; | |
| use codex_protocol::config_types::ForcedLoginMethod; | |
| use codex_protocol::config_types::ReasoningSummary; | |
| use codex_protocol::config_types::SandboxMode; | |
| use codex_protocol::config_types::Verbosity; | |
| use codex_protocol::openai_models::ReasoningEffort; | |
| use codex_protocol::parse_command::ParsedCommand; | |
| use codex_protocol::protocol::AskForApproval; | |
| use codex_protocol::protocol::FileChange; | |
| pub use codex_protocol::protocol::GitSha; | |
| use codex_protocol::protocol::ReviewDecision; | |
| use codex_protocol::protocol::SandboxPolicy; | |
| use codex_protocol::protocol::SessionSource; | |
| use codex_protocol::protocol::TurnAbortReason; | |
| use codex_utils_absolute_path::AbsolutePathBuf; | |
| use serde::Deserialize; | |
| use serde::Serialize; | |
| use crate::protocol::common::AuthMode; | |
| use crate::protocol::v2::ForcedChatgptWorkspaceIds; | |
| pub struct InitializeParams { | |
| pub client_info: ClientInfo, | |
| pub capabilities: Option<InitializeCapabilities>, | |
| } | |
| pub struct ClientInfo { | |
| pub name: String, | |
| pub title: Option<String>, | |
| pub version: String, | |
| } | |
| /// Client-declared capabilities negotiated during initialize. | |
| pub struct InitializeCapabilities { | |
| /// Opt into receiving experimental API methods and fields. | |
| pub experimental_api: bool, | |
| /// Opt into `attestation/generate` requests for upstream `x-oai-attestation`. | |
| pub request_attestation: bool, | |
| /// Legacy opt-in for the `openai/form` MCP extension. | |
| /// | |
| /// New clients should declare `openai/form` in [`Self::extensions`]. | |
| pub mcp_server_openai_form_elicitation: bool, | |
| /// Exact notification method names that should be suppressed for this | |
| /// connection (for example `thread/started`). | |
| pub opt_out_notification_methods: Option<Vec<String>>, | |
| /// MCP extension settings declared by the app-server client. | |
| pub extensions: Option<HashMap<String, serde_json::Value>>, | |
| } | |
| pub struct InitializeResponse { | |
| pub user_agent: String, | |
| /// Absolute path to the server's $CODEX_HOME directory. | |
| pub codex_home: AbsolutePathBuf, | |
| /// Platform family for the running app-server target, for example | |
| /// `"unix"` or `"windows"`. | |
| pub platform_family: String, | |
| /// Operating system for the running app-server target, for example | |
| /// `"macos"`, `"linux"`, or `"windows"`. | |
| pub platform_os: String, | |
| } | |
| pub enum GetConversationSummaryParams { | |
| RolloutPath { | |
| rollout_path: PathBuf, | |
| }, | |
| ThreadId { | |
| conversation_id: ThreadId, | |
| }, | |
| } | |
| pub struct GetConversationSummaryResponse { | |
| pub summary: ConversationSummary, | |
| } | |
| pub struct ConversationSummary { | |
| pub conversation_id: ThreadId, | |
| pub path: PathBuf, | |
| pub preview: String, | |
| pub timestamp: Option<String>, | |
| pub updated_at: Option<String>, | |
| pub model_provider: String, | |
| pub cwd: PathBuf, | |
| pub cli_version: String, | |
| pub source: SessionSource, | |
| pub git_info: Option<ConversationGitInfo>, | |
| } | |
| pub struct ConversationGitInfo { | |
| pub sha: Option<String>, | |
| pub branch: Option<String>, | |
| pub origin_url: Option<String>, | |
| } | |
| pub struct LoginApiKeyParams { | |
| pub api_key: String, | |
| } | |
| pub struct GitDiffToRemoteResponse { | |
| pub sha: GitSha, | |
| pub diff: String, | |
| } | |
| pub struct ApplyPatchApprovalParams { | |
| pub conversation_id: ThreadId, | |
| /// Use to correlate this with [codex_protocol::protocol::PatchApplyBeginEvent] | |
| /// and [codex_protocol::protocol::PatchApplyEndEvent]. | |
| pub call_id: String, | |
| pub file_changes: HashMap<PathBuf, FileChange>, | |
| /// Optional explanatory reason (e.g. request for extra write access). | |
| pub reason: Option<String>, | |
| /// When set, the agent is asking the user to allow writes under this root | |
| /// for the remainder of the session (unclear if this is honored today). | |
| pub grant_root: Option<PathBuf>, | |
| } | |
| pub struct ApplyPatchApprovalResponse { | |
| pub decision: ReviewDecision, | |
| } | |
| pub struct ExecCommandApprovalParams { | |
| pub conversation_id: ThreadId, | |
| /// Use to correlate this with [codex_protocol::protocol::ExecCommandBeginEvent] | |
| /// and [codex_protocol::protocol::ExecCommandEndEvent]. | |
| pub call_id: String, | |
| /// Identifier for this specific approval callback. | |
| pub approval_id: Option<String>, | |
| pub command: Vec<String>, | |
| pub cwd: PathBuf, | |
| pub reason: Option<String>, | |
| pub parsed_cmd: Vec<ParsedCommand>, | |
| } | |
| pub struct ExecCommandApprovalResponse { | |
| pub decision: ReviewDecision, | |
| } | |
| pub struct GitDiffToRemoteParams { | |
| pub cwd: PathBuf, | |
| } | |
| pub struct GetAuthStatusParams { | |
| pub include_token: Option<bool>, | |
| pub refresh_token: Option<bool>, | |
| } | |
| pub struct ExecOneOffCommandParams { | |
| pub command: Vec<String>, | |
| pub timeout_ms: Option<u64>, | |
| pub cwd: Option<PathBuf>, | |
| pub sandbox_policy: Option<SandboxPolicy>, | |
| } | |
| pub struct GetAuthStatusResponse { | |
| pub auth_method: Option<AuthMode>, | |
| pub auth_token: Option<String>, | |
| pub requires_openai_auth: Option<bool>, | |
| } | |
| pub struct UserSavedConfig { | |
| pub approval_policy: Option<AskForApproval>, | |
| pub sandbox_mode: Option<SandboxMode>, | |
| pub sandbox_settings: Option<SandboxSettings>, | |
| pub forced_chatgpt_workspace_id: Option<ForcedChatgptWorkspaceIds>, | |
| pub forced_login_method: Option<ForcedLoginMethod>, | |
| pub model: Option<String>, | |
| pub model_reasoning_effort: Option<ReasoningEffort>, | |
| pub model_reasoning_summary: Option<ReasoningSummary>, | |
| pub model_verbosity: Option<Verbosity>, | |
| pub tools: Option<Tools>, | |
| } | |
| pub struct Tools { | |
| pub web_search: Option<bool>, | |
| } | |
| pub struct SandboxSettings { | |
| pub writable_roots: Vec<AbsolutePathBuf>, | |
| pub network_access: Option<bool>, | |
| pub exclude_tmpdir_env_var: Option<bool>, | |
| pub exclude_slash_tmp: Option<bool>, | |
| } | |
| pub struct InterruptConversationResponse { | |
| pub abort_reason: TurnAbortReason, | |
| } | |