Files
codex/codex-rs/cloud-client/src/turns_wire.rs
T
Benjamin Carlsson b279cfb170 Enable conversation-scoped speed selection for Cloud turns (#61178)
## What changed

- Stage Cloud speed choices for the next new turn in the conversation, alongside pending model and effort selections. Update the displayed conversation speed after admission without changing the local default.
- Offer speed commands supported by the pending model. Clear an incompatible pending speed change with a warning when switching models.
- Carry `service_tier` through Cloud message requests, preserving omission to inherit the thread tier and explicit null to clear it. Translate `default` to null and reject tier overrides on queued requests.

## Testing

Add tests for Cloud speed toggling, model-dependent speed choices, admission-time updates, and preserving the conversation tier when selecting a model. Extend request and wire tests to cover service-tier values, explicit clearing, and queue rejection.

GitOrigin-RevId: b4daa701f1fe29593d90a938e60cc20cb980298a
2026-11-12 20:56:33 +00:00

125 lines
3.7 KiB
Rust

//! Native text/image submission and interruption envelopes; omitted settings inherit thread config.
use prost::Message;
#[derive(Clone, Message)]
pub(super) struct AddRequest {
#[prost(string, tag = "4")]
pub client_user_message_id: String,
#[prost(string, optional, tag = "9")]
pub effort: Option<String>,
#[prost(message, optional, tag = "11")]
pub input: Option<Input>,
#[prost(string, optional, tag = "12")]
pub model: Option<String>,
#[prost(message, optional, tag = "20")]
pub service_tier: Option<crate::activation_wire::NullableString>,
#[prost(string, tag = "23")]
pub thread_id: String,
#[prost(string, optional, tag = "25")]
pub turn_trigger: Option<String>,
#[prost(int32, optional, tag = "26")]
pub access: Option<i32>,
#[prost(int32, optional, tag = "30")]
pub mode: Option<i32>,
}
#[derive(Clone, Message)]
pub(super) struct Input {
#[prost(message, repeated, tag = "1")]
pub values: Vec<UserInput>,
}
#[derive(Clone, Message)]
pub(super) struct UserInput {
#[prost(oneof = "Value", tags = "1, 2, 3, 4, 5, 6, 7")]
pub value: Option<Value>,
}
#[derive(Clone, prost::Oneof)]
pub(super) enum Value {
#[prost(message, tag = "1")]
Text(Text),
#[prost(message, tag = "2")]
Image(Image),
#[prost(bytes, tag = "3")]
LocalImage(Vec<u8>),
#[prost(bytes, tag = "4")]
Audio(Vec<u8>),
#[prost(bytes, tag = "5")]
LocalAudio(Vec<u8>),
#[prost(bytes, tag = "6")]
Skill(Vec<u8>),
#[prost(bytes, tag = "7")]
Mention(Vec<u8>),
}
#[derive(Clone, Message)]
pub(super) struct Text {
#[prost(string, optional, tag = "1")]
pub text: Option<String>,
#[prost(message, optional, tag = "2")]
pub text_elements: Option<TextElements>,
}
#[derive(Clone, Message)]
pub(super) struct TextElements {
#[prost(message, repeated, tag = "1")]
pub values: Vec<TextElement>,
}
#[derive(Clone, Message)]
pub(super) struct TextElement {
#[prost(message, optional, tag = "1")]
pub byte_range: Option<ByteRange>,
#[prost(string, optional, tag = "2")]
pub placeholder: Option<String>,
}
#[derive(Clone, Message)]
pub(super) struct ByteRange {
#[prost(uint64, optional, tag = "1")]
pub end: Option<u64>,
#[prost(uint64, optional, tag = "2")]
pub start: Option<u64>,
}
#[derive(Clone, Message)]
pub(super) struct Image {
#[prost(oneof = "ImageValue", tags = "1, 2")]
pub value: Option<ImageValue>,
}
#[derive(Clone, prost::Oneof)]
pub(super) enum ImageValue {
#[prost(message, tag = "1")]
Url(ImageReference),
#[prost(message, tag = "2")]
FileId(ImageReference),
}
// Both native image alternatives have the same field layout.
#[derive(Clone, Message)]
pub(super) struct ImageReference {
#[prost(int32, optional, tag = "1")]
pub detail: Option<i32>,
#[prost(string, optional, tag = "2")]
pub value: Option<String>,
}
#[derive(Clone, Message)]
pub(super) struct AddResponse {
#[prost(message, optional, tag = "1")]
pub turn: Option<crate::transcript_wire::Turn>,
#[prost(int32, optional, tag = "2")]
pub outcome: Option<i32>,
#[prost(string, optional, tag = "3")]
pub client_user_message_id: Option<String>,
#[prost(message, optional, tag = "5")]
pub queued_submission: Option<QueuedSubmission>,
}
#[derive(Clone, Message)]
pub(super) struct QueuedSubmission {
#[prost(string, optional, tag = "1")]
pub id: Option<String>,
#[prost(string, optional, tag = "3")]
pub client_user_message_id: Option<String>,
}
#[derive(Clone, Message)]
pub(super) struct InterruptRequest {
#[prost(string, tag = "1")]
pub thread_id: String,
#[prost(string, tag = "2")]
pub turn_id: String,
#[prost(int32, optional, tag = "3")]
pub access: Option<i32>,
}