mirror of
https://github.com/openai/codex.git
synced 2026-10-21 17:48:44 +00:00
## Why `codex-rs/app-server-protocol/src/protocol/v2.rs` had grown into a single ~12k-line definition file for the entire app-server v2 API. This is purely a mechanical refactor to break up the monolithic `v2.rs` file that contains all app-server API v2 types into more modular files, grouped by resource (e.g. account, thread, turn, etc.). `just write-app-server-schema` shows no real changes, so we can be sure that this is purely an internal organizational change. ## What changed - Replaced the monolithic `protocol/v2.rs` with a `protocol/v2/` module tree and a small `mod.rs` that only declares and reexports modules. - Grouped v2 API definitions by conceptual owner, including `account`, `apps`, `collaboration_mode`, `command_exec`, `config`, `device_key`, `experimental_feature`, `feedback`, `fs`, `hook`, `item`, `mcp`, `model`, `notification`, `permissions`, `plugin`, `process`, `realtime`, `review`, `thread`, `thread_data`, `turn`, and `windows_sandbox`. - Moved v2 tests into `protocol/v2/tests.rs` so `mod.rs` stays small. - Kept shared protocol helpers in `protocol/v2/shared.rs`, including the enum mirroring macro and common cross-resource types. - Co-located resource-specific notifications and server-request payloads with the modules that own those resources. - Regenerated app-server protocol schema fixtures. The schema diffs are non-semantic newline-only changes after the refactor. ## Verification - `cargo check -p codex-app-server-protocol` - `cargo test -p codex-app-server-protocol` - `just write-app-server-schema`
46 lines
1.5 KiB
Rust
46 lines
1.5 KiB
Rust
use codex_protocol::config_types::CollaborationModeMask as CoreCollaborationModeMask;
|
|
use codex_protocol::config_types::ModeKind;
|
|
use codex_protocol::openai_models::ReasoningEffort;
|
|
use schemars::JsonSchema;
|
|
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
use ts_rs::TS;
|
|
|
|
/// EXPERIMENTAL - list collaboration mode presets.
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct CollaborationModeListParams {}
|
|
|
|
/// EXPERIMENTAL - collaboration mode preset metadata for clients.
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct CollaborationModeMask {
|
|
pub name: String,
|
|
pub mode: Option<ModeKind>,
|
|
pub model: Option<String>,
|
|
#[serde(rename = "reasoning_effort")]
|
|
#[ts(rename = "reasoning_effort")]
|
|
pub reasoning_effort: Option<Option<ReasoningEffort>>,
|
|
}
|
|
|
|
impl From<CoreCollaborationModeMask> for CollaborationModeMask {
|
|
fn from(value: CoreCollaborationModeMask) -> Self {
|
|
Self {
|
|
name: value.name,
|
|
mode: value.mode,
|
|
model: value.model,
|
|
reasoning_effort: value.reasoning_effort,
|
|
}
|
|
}
|
|
}
|
|
|
|
/// EXPERIMENTAL - collaboration mode presets response.
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct CollaborationModeListResponse {
|
|
pub data: Vec<CollaborationModeMask>,
|
|
}
|