mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Add experimental thread prediction protocol types (#49480)
## What changed Define `thread/prediction/request` with `threadId` and `sourceTurnId`, and `thread/prediction/updated` with a `completed` result containing optional text or a `failed` result. Update generated JSON schemas, TypeScript types, and Python notification models. Route prediction notifications to their thread in the TUI and ignore them in the chat widget. The request remains unimplemented and returns a method-not-found error. GitOrigin-RevId: 09922f583d5c56f808d018121c651dcd92734515
This commit is contained in:
@@ -605,6 +605,12 @@ client_request_definitions! {
|
||||
serialization: thread_id(params.thread_id),
|
||||
response: v2::ThreadSetNameResponse,
|
||||
},
|
||||
#[experimental("thread/prediction/request")]
|
||||
ThreadPredictionRequest => "thread/prediction/request" {
|
||||
params: v2::ThreadPredictionRequestParams,
|
||||
serialization: thread_id(params.thread_id),
|
||||
response: v2::ThreadPredictionRequestResponse,
|
||||
},
|
||||
ThreadGoalSet => "thread/goal/set" {
|
||||
params: v2::ThreadGoalSetParams,
|
||||
serialization: thread_id(params.thread_id),
|
||||
@@ -1927,6 +1933,8 @@ server_notification_definitions! {
|
||||
ThreadNameUpdated => "thread/name/updated" (v2::ThreadNameUpdatedNotification),
|
||||
ThreadAttachmentUpdated => "thread/attachment/updated" (v2::ThreadAttachmentUpdatedNotification),
|
||||
ThreadGoalUpdated => "thread/goal/updated" (v2::ThreadGoalUpdatedNotification),
|
||||
#[experimental("thread/prediction/updated")]
|
||||
ThreadPredictionUpdated => "thread/prediction/updated" (v2::ThreadPredictionUpdatedNotification),
|
||||
ThreadGoalCleared => "thread/goal/cleared" (v2::ThreadGoalClearedNotification),
|
||||
#[experimental("thread/queue/changed")]
|
||||
ThreadQueueChanged => "thread/queue/changed" (v2::ThreadQueueChangedNotification),
|
||||
|
||||
@@ -34,6 +34,7 @@ mod rollout;
|
||||
mod thread;
|
||||
mod thread_attachment;
|
||||
mod thread_data;
|
||||
mod thread_prediction;
|
||||
mod thread_usage;
|
||||
mod turn;
|
||||
mod user_verification;
|
||||
@@ -74,6 +75,7 @@ pub use shared::*;
|
||||
pub use thread::*;
|
||||
pub use thread_attachment::*;
|
||||
pub use thread_data::*;
|
||||
pub use thread_prediction::*;
|
||||
pub use thread_usage::*;
|
||||
pub use turn::*;
|
||||
pub use user_verification::*;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
//! App-server API types for predictions.
|
||||
|
||||
use crate::JsonSchema;
|
||||
use crate::TS;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadPredictionRequestParams {
|
||||
pub thread_id: String,
|
||||
pub source_turn_id: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadPredictionRequestResponse {}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ThreadPredictionUpdatedNotification {
|
||||
pub thread_id: String,
|
||||
pub source_turn_id: String,
|
||||
pub result: ThreadPredictionResult,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(tag = "type", rename_all = "camelCase")]
|
||||
#[ts(tag = "type", rename_all = "camelCase", export_to = "v2/")]
|
||||
pub enum ThreadPredictionResult {
|
||||
Completed { text: Option<String> },
|
||||
Failed,
|
||||
}
|
||||
Reference in New Issue
Block a user