mirror of
https://github.com/openai/codex.git
synced 2026-08-23 13:09:46 +00:00
Add async delivery metadata to agent messages (#39312)
## What changed - Add an optional `delivery` field to agent message events and app-server `agentMessage` items, with `"async"` identifying a user-visible message sent without ending the current turn. - Preserve the marker through legacy event conversion, thread history materialization, replay, and generated JSON and TypeScript schemas. - Require delivery of async agent message completion notifications on the in-process app-server transport. ## Testing - Cover preservation of async delivery metadata in thread history. - Cover delivery-required classification for async agent messages. GitOrigin-RevId: f92ba25de1293ee271404badfdf0d117d6530329
This commit is contained in:
@@ -113,6 +113,14 @@ pub enum AgentMessageContent {
|
||||
Text { text: String },
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Deserialize, Serialize, TS, JsonSchema, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub enum AgentMessageDelivery {
|
||||
Async,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema)]
|
||||
/// Assistant-authored message payload used in turn-item streams.
|
||||
///
|
||||
@@ -132,6 +140,9 @@ pub struct AgentMessageItem {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub memory_citation: Option<MemoryCitation>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub delivery: Option<AgentMessageDelivery>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema)]
|
||||
|
||||
@@ -105,6 +105,7 @@ impl AgentMessageItem {
|
||||
message: text.clone(),
|
||||
phase: self.phase.clone(),
|
||||
memory_citation: self.memory_citation.clone(),
|
||||
delivery: self.delivery,
|
||||
}),
|
||||
})
|
||||
.collect()
|
||||
|
||||
@@ -32,6 +32,7 @@ use crate::dynamic_tools::DynamicToolCallRequest;
|
||||
use crate::dynamic_tools::DynamicToolResponse;
|
||||
use crate::dynamic_tools::DynamicToolSpec;
|
||||
use crate::error::Result as CodexResult;
|
||||
use crate::items::AgentMessageDelivery;
|
||||
use crate::items::TurnItem;
|
||||
use crate::mcp::CallToolResult;
|
||||
use crate::mcp::RequestId;
|
||||
@@ -2336,6 +2337,9 @@ pub struct AgentMessageEvent {
|
||||
pub phase: Option<MessagePhase>,
|
||||
#[serde(default)]
|
||||
pub memory_citation: Option<MemoryCitation>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub delivery: Option<AgentMessageDelivery>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Deserialize, Serialize, PartialEq, JsonSchema, TS)]
|
||||
|
||||
Reference in New Issue
Block a user