mirror of
https://github.com/openai/codex.git
synced 2026-11-02 19:43:24 +00:00
core-only metadata emission; drop app-server/v2 surface changes
This commit is contained in:
@@ -1286,7 +1286,6 @@ mod tests {
|
||||
item: CoreTurnItem::UserMessage(CoreUserMessageItem {
|
||||
id: "user-item-id".to_string(),
|
||||
content: Vec::new(),
|
||||
metadata: None,
|
||||
}),
|
||||
}),
|
||||
EventMsg::TurnComplete(TurnCompleteEvent {
|
||||
|
||||
@@ -7409,7 +7409,6 @@ mod tests {
|
||||
path: "app://demo-app".to_string(),
|
||||
},
|
||||
],
|
||||
metadata: None,
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
@@ -7450,7 +7449,6 @@ mod tests {
|
||||
},
|
||||
],
|
||||
phase: None,
|
||||
metadata: None,
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
@@ -7468,7 +7466,6 @@ mod tests {
|
||||
text: "final".to_string(),
|
||||
}],
|
||||
phase: Some(MessagePhase::FinalAnswer),
|
||||
metadata: None,
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
@@ -7484,7 +7481,6 @@ mod tests {
|
||||
id: "reasoning-1".to_string(),
|
||||
summary_text: vec!["line one".to_string(), "line two".to_string()],
|
||||
raw_content: vec![],
|
||||
metadata: None,
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
@@ -7503,7 +7499,6 @@ mod tests {
|
||||
query: Some("docs".to_string()),
|
||||
queries: None,
|
||||
},
|
||||
metadata: None,
|
||||
});
|
||||
|
||||
assert_eq!(
|
||||
|
||||
@@ -85,10 +85,10 @@ use codex_protocol::dynamic_tools::DynamicToolSpec;
|
||||
use codex_protocol::items::PlanItem;
|
||||
use codex_protocol::items::TurnItem;
|
||||
use codex_protocol::items::UserMessageItem;
|
||||
use codex_protocol::items::UserMessageType;
|
||||
use codex_protocol::mcp::CallToolResult;
|
||||
use codex_protocol::models::BaseInstructions;
|
||||
use codex_protocol::models::PermissionProfile;
|
||||
use codex_protocol::models::UserMessageType;
|
||||
use codex_protocol::models::format_allow_prefixes;
|
||||
use codex_protocol::openai_models::ModelInfo;
|
||||
use codex_protocol::permissions::FileSystemSandboxPolicy;
|
||||
@@ -6699,7 +6699,6 @@ impl ProposedPlanItemState {
|
||||
let item = TurnItem::Plan(PlanItem {
|
||||
id: self.item_id.clone(),
|
||||
text: String::new(),
|
||||
metadata: None,
|
||||
});
|
||||
sess.emit_turn_item_started(turn_context, &item).await;
|
||||
}
|
||||
@@ -6734,7 +6733,6 @@ impl ProposedPlanItemState {
|
||||
let item = TurnItem::Plan(PlanItem {
|
||||
id: self.item_id.clone(),
|
||||
text,
|
||||
metadata: None,
|
||||
});
|
||||
sess.emit_turn_item_completed(turn_context, item).await;
|
||||
}
|
||||
@@ -7048,7 +7046,6 @@ async fn emit_agent_message_in_plan_mode(
|
||||
id: agent_message_id.clone(),
|
||||
content: Vec::new(),
|
||||
phase: None,
|
||||
metadata: None,
|
||||
})
|
||||
});
|
||||
sess.emit_turn_item_started(turn_context, &start_item).await;
|
||||
|
||||
@@ -3885,7 +3885,7 @@ async fn task_finish_emits_prompt_queued_metadata_for_injected_user_input_when_f
|
||||
metadata: Some(metadata),
|
||||
..
|
||||
} if metadata.user_message_type
|
||||
== Some(codex_protocol::items::UserMessageType::PromptQueued)
|
||||
== Some(codex_protocol::models::UserMessageType::PromptQueued)
|
||||
)
|
||||
));
|
||||
|
||||
@@ -4007,7 +4007,7 @@ async fn steer_input_returns_active_turn_id() {
|
||||
pending_input
|
||||
.first()
|
||||
.and_then(|(_, user_message_type)| user_message_type.as_ref()),
|
||||
Some(&codex_protocol::items::UserMessageType::PromptSteering)
|
||||
Some(&codex_protocol::models::UserMessageType::PromptSteering)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,12 +83,7 @@ fn parse_agent_message(
|
||||
}
|
||||
}
|
||||
let id = id.cloned().unwrap_or_else(|| Uuid::new_v4().to_string());
|
||||
AgentMessageItem {
|
||||
id,
|
||||
content,
|
||||
phase,
|
||||
metadata: None,
|
||||
}
|
||||
AgentMessageItem { id, content, phase }
|
||||
}
|
||||
|
||||
pub fn parse_turn_item(item: &ResponseItem) -> Option<TurnItem> {
|
||||
@@ -134,7 +129,6 @@ pub fn parse_turn_item(item: &ResponseItem) -> Option<TurnItem> {
|
||||
id: id.clone(),
|
||||
summary_text,
|
||||
raw_content,
|
||||
metadata: None,
|
||||
}))
|
||||
}
|
||||
ResponseItem::WebSearchCall { id, action, .. } => {
|
||||
@@ -146,7 +140,6 @@ pub fn parse_turn_item(item: &ResponseItem) -> Option<TurnItem> {
|
||||
id: id.clone().unwrap_or_default(),
|
||||
query,
|
||||
action,
|
||||
metadata: None,
|
||||
}))
|
||||
}
|
||||
ResponseItem::ImageGenerationCall {
|
||||
@@ -161,7 +154,6 @@ pub fn parse_turn_item(item: &ResponseItem) -> Option<TurnItem> {
|
||||
revised_prompt: revised_prompt.clone(),
|
||||
result: result.clone(),
|
||||
saved_path: None,
|
||||
metadata: None,
|
||||
},
|
||||
)),
|
||||
_ => None,
|
||||
|
||||
@@ -330,7 +330,6 @@ fn parses_web_search_call() {
|
||||
query: Some("weather".to_string()),
|
||||
queries: None,
|
||||
},
|
||||
metadata: None,
|
||||
}
|
||||
),
|
||||
other => panic!("expected TurnItem::WebSearch, got {other:?}"),
|
||||
@@ -358,7 +357,6 @@ fn parses_web_search_open_page_call() {
|
||||
action: WebSearchAction::OpenPage {
|
||||
url: Some("https://example.com".to_string()),
|
||||
},
|
||||
metadata: None,
|
||||
}
|
||||
),
|
||||
other => panic!("expected TurnItem::WebSearch, got {other:?}"),
|
||||
@@ -388,7 +386,6 @@ fn parses_web_search_find_in_page_call() {
|
||||
url: Some("https://example.com".to_string()),
|
||||
pattern: Some("needle".to_string()),
|
||||
},
|
||||
metadata: None,
|
||||
}
|
||||
),
|
||||
other => panic!("expected TurnItem::WebSearch, got {other:?}"),
|
||||
@@ -411,7 +408,6 @@ fn parses_partial_web_search_call_without_action_as_other() {
|
||||
id: "ws_partial".to_string(),
|
||||
query: String::new(),
|
||||
action: WebSearchAction::Other,
|
||||
metadata: None,
|
||||
}
|
||||
),
|
||||
other => panic!("expected TurnItem::WebSearch, got {other:?}"),
|
||||
|
||||
@@ -9,8 +9,8 @@ use tokio_util::sync::CancellationToken;
|
||||
use tokio_util::task::AbortOnDropHandle;
|
||||
|
||||
use codex_protocol::dynamic_tools::DynamicToolResponse;
|
||||
use codex_protocol::items::UserMessageType;
|
||||
use codex_protocol::models::ResponseInputItem;
|
||||
use codex_protocol::models::UserMessageType;
|
||||
use codex_protocol::request_permissions::RequestPermissionsResponse;
|
||||
use codex_protocol::request_user_input::RequestUserInputResponse;
|
||||
use codex_rmcp_client::ElicitationResponse;
|
||||
|
||||
@@ -58,7 +58,6 @@ async fn turn_timing_state_records_ttfm_independently_of_ttft() {
|
||||
id: "msg-1".to_string(),
|
||||
content: Vec::new(),
|
||||
phase: None,
|
||||
metadata: None,
|
||||
}))
|
||||
.await
|
||||
.is_some()
|
||||
@@ -69,7 +68,6 @@ async fn turn_timing_state_records_ttfm_independently_of_ttft() {
|
||||
id: "msg-2".to_string(),
|
||||
content: Vec::new(),
|
||||
phase: None,
|
||||
metadata: None,
|
||||
}))
|
||||
.await,
|
||||
None
|
||||
|
||||
@@ -29,29 +29,10 @@ pub enum TurnItem {
|
||||
ContextCompaction(ContextCompactionItem),
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema, PartialEq, Eq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[ts(rename_all = "snake_case")]
|
||||
pub enum UserMessageType {
|
||||
Prompt,
|
||||
PromptSteering,
|
||||
PromptQueued,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Deserialize, Serialize, TS, JsonSchema, PartialEq, Eq)]
|
||||
pub struct TurnItemMetadata {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub user_message_type: Option<UserMessageType>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema)]
|
||||
pub struct UserMessageItem {
|
||||
pub id: String,
|
||||
pub content: Vec<UserInput>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub metadata: Option<TurnItemMetadata>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema)]
|
||||
@@ -77,18 +58,12 @@ pub struct AgentMessageItem {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub phase: Option<MessagePhase>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub metadata: Option<TurnItemMetadata>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema)]
|
||||
pub struct PlanItem {
|
||||
pub id: String,
|
||||
pub text: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub metadata: Option<TurnItemMetadata>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema)]
|
||||
@@ -97,9 +72,6 @@ pub struct ReasoningItem {
|
||||
pub summary_text: Vec<String>,
|
||||
#[serde(default)]
|
||||
pub raw_content: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub metadata: Option<TurnItemMetadata>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema, PartialEq)]
|
||||
@@ -107,9 +79,6 @@ pub struct WebSearchItem {
|
||||
pub id: String,
|
||||
pub query: String,
|
||||
pub action: WebSearchAction,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub metadata: Option<TurnItemMetadata>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema, PartialEq)]
|
||||
@@ -123,24 +92,17 @@ pub struct ImageGenerationItem {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub saved_path: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub metadata: Option<TurnItemMetadata>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema)]
|
||||
pub struct ContextCompactionItem {
|
||||
pub id: String,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
pub metadata: Option<TurnItemMetadata>,
|
||||
}
|
||||
|
||||
impl ContextCompactionItem {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
id: uuid::Uuid::new_v4().to_string(),
|
||||
metadata: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,14 +119,9 @@ impl Default for ContextCompactionItem {
|
||||
|
||||
impl UserMessageItem {
|
||||
pub fn new(content: &[UserInput]) -> Self {
|
||||
Self::new_with_metadata(content, None)
|
||||
}
|
||||
|
||||
pub fn new_with_metadata(content: &[UserInput], metadata: Option<TurnItemMetadata>) -> Self {
|
||||
Self {
|
||||
id: uuid::Uuid::new_v4().to_string(),
|
||||
content: content.to_vec(),
|
||||
metadata,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,7 +201,6 @@ impl AgentMessageItem {
|
||||
id: uuid::Uuid::new_v4().to_string(),
|
||||
content: content.to_vec(),
|
||||
phase: None,
|
||||
metadata: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ use ts_rs::TS;
|
||||
|
||||
use crate::config_types::CollaborationMode;
|
||||
use crate::config_types::SandboxMode;
|
||||
use crate::items::UserMessageType;
|
||||
use crate::protocol::AskForApproval;
|
||||
use crate::protocol::COLLABORATION_MODE_CLOSE_TAG;
|
||||
use crate::protocol::COLLABORATION_MODE_OPEN_TAG;
|
||||
@@ -254,6 +253,15 @@ pub enum ResponseInputItem {
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[ts(rename_all = "snake_case")]
|
||||
pub enum UserMessageType {
|
||||
Prompt,
|
||||
PromptSteering,
|
||||
PromptQueued,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, JsonSchema, TS)]
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
pub enum ContentItem {
|
||||
|
||||
Reference in New Issue
Block a user