Add app-server v2 thread realtime API (#12715)

Add experimental `thread/realtime/*` v2 requests and notifications, then
route app-server realtime events through that thread-scoped surface with
integration coverage.

---------

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Ahmed Ibrahim
2026-02-25 09:59:10 -08:00
committed by GitHub
parent 0543d0a022
commit 947092283a
25 changed files with 1706 additions and 2 deletions

View File

@@ -57,6 +57,10 @@ use codex_app_server_protocol::ThreadForkParams;
use codex_app_server_protocol::ThreadListParams;
use codex_app_server_protocol::ThreadLoadedListParams;
use codex_app_server_protocol::ThreadReadParams;
use codex_app_server_protocol::ThreadRealtimeAppendAudioParams;
use codex_app_server_protocol::ThreadRealtimeAppendTextParams;
use codex_app_server_protocol::ThreadRealtimeStartParams;
use codex_app_server_protocol::ThreadRealtimeStopParams;
use codex_app_server_protocol::ThreadResumeParams;
use codex_app_server_protocol::ThreadRollbackParams;
use codex_app_server_protocol::ThreadSetNameParams;
@@ -584,6 +588,44 @@ impl McpProcess {
self.send_request("turn/interrupt", params).await
}
/// Send a `thread/realtime/start` JSON-RPC request (v2).
pub async fn send_thread_realtime_start_request(
&mut self,
params: ThreadRealtimeStartParams,
) -> anyhow::Result<i64> {
let params = Some(serde_json::to_value(params)?);
self.send_request("thread/realtime/start", params).await
}
/// Send a `thread/realtime/appendAudio` JSON-RPC request (v2).
pub async fn send_thread_realtime_append_audio_request(
&mut self,
params: ThreadRealtimeAppendAudioParams,
) -> anyhow::Result<i64> {
let params = Some(serde_json::to_value(params)?);
self.send_request("thread/realtime/appendAudio", params)
.await
}
/// Send a `thread/realtime/appendText` JSON-RPC request (v2).
pub async fn send_thread_realtime_append_text_request(
&mut self,
params: ThreadRealtimeAppendTextParams,
) -> anyhow::Result<i64> {
let params = Some(serde_json::to_value(params)?);
self.send_request("thread/realtime/appendText", params)
.await
}
/// Send a `thread/realtime/stop` JSON-RPC request (v2).
pub async fn send_thread_realtime_stop_request(
&mut self,
params: ThreadRealtimeStopParams,
) -> anyhow::Result<i64> {
let params = Some(serde_json::to_value(params)?);
self.send_request("thread/realtime/stop", params).await
}
/// Deterministically clean up an intentionally in-flight turn.
///
/// Some tests assert behavior while a turn is still running. Returning from those tests