Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions codex-rs/app-server-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,7 @@ mod tests {
ServerNotification::ItemCompleted(codex_app_server_protocol::ItemCompletedNotification {
thread_id: "thread".to_string(),
turn_id: "turn".to_string(),
completed_at_ms: None,
item: codex_app_server_protocol::ThreadItem::AgentMessage {
id: "item".to_string(),
text: text.to_string(),
Expand Down Expand Up @@ -2007,6 +2008,7 @@ mod tests {
codex_app_server_protocol::ItemCompletedNotification {
thread_id: "thread".to_string(),
turn_id: "turn".to_string(),
completed_at_ms: None,
item: codex_app_server_protocol::ThreadItem::AgentMessage {
id: "item".to_string(),
text: "hello".to_string(),
Expand Down
16 changes: 16 additions & 0 deletions codex-rs/app-server-protocol/schema/json/ServerNotification.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions codex-rs/app-server-protocol/src/protocol/event_mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id: response.turn_id,
item,
completed_at_ms: None,
})
}
EventMsg::McpToolCallBegin(begin_event) => {
Expand All @@ -91,6 +92,7 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id,
item,
started_at_ms: None,
})
}
EventMsg::McpToolCallEnd(end_event) => {
Expand Down Expand Up @@ -131,6 +133,7 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id,
item,
completed_at_ms: None,
})
}
EventMsg::CollabAgentSpawnBegin(begin_event) => {
Expand All @@ -149,6 +152,7 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id,
item,
started_at_ms: None,
})
}
EventMsg::CollabAgentSpawnEnd(end_event) => {
Expand Down Expand Up @@ -187,6 +191,7 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id,
item,
completed_at_ms: None,
})
}
EventMsg::CollabAgentInteractionBegin(begin_event) => {
Expand All @@ -206,6 +211,7 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id,
item,
started_at_ms: None,
})
}
EventMsg::CollabAgentInteractionEnd(end_event) => {
Expand Down Expand Up @@ -233,6 +239,7 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id,
item,
completed_at_ms: None,
})
}
EventMsg::CollabWaitingBegin(begin_event) => {
Expand All @@ -256,6 +263,7 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id,
item,
started_at_ms: None,
})
}
EventMsg::CollabWaitingEnd(end_event) => {
Expand Down Expand Up @@ -291,6 +299,7 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id,
item,
completed_at_ms: None,
})
}
EventMsg::CollabCloseBegin(begin_event) => {
Expand All @@ -309,6 +318,7 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id,
item,
started_at_ms: None,
})
}
EventMsg::CollabCloseEnd(end_event) => {
Expand Down Expand Up @@ -341,6 +351,7 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id,
item,
completed_at_ms: None,
})
}
EventMsg::CollabResumeBegin(begin_event) => {
Expand All @@ -359,6 +370,7 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id,
item,
started_at_ms: None,
})
}
EventMsg::CollabResumeEnd(end_event) => {
Expand Down Expand Up @@ -391,6 +403,7 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id,
item,
completed_at_ms: None,
})
}
EventMsg::AgentMessageContentDelta(event) => {
Expand Down Expand Up @@ -440,13 +453,15 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id,
item: item_started_event.item.into(),
started_at_ms: item_started_event.started_at_ms,
})
}
EventMsg::ItemCompleted(item_completed_event) => {
ServerNotification::ItemCompleted(ItemCompletedNotification {
thread_id,
turn_id,
item: item_completed_event.item.into(),
completed_at_ms: item_completed_event.completed_at_ms,
})
}
EventMsg::PatchApplyUpdated(event) => {
Expand All @@ -462,6 +477,7 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id,
item: build_command_execution_begin_item(&exec_command_begin_event),
started_at_ms: None,
})
}
EventMsg::ExecCommandOutputDelta(exec_command_output_delta_event) => {
Expand Down Expand Up @@ -490,6 +506,7 @@ pub fn item_event_to_server_notification(
thread_id,
turn_id,
item: build_command_execution_end_item(&exec_command_end_event),
completed_at_ms: None,
})
}
_ => unreachable!("unsupported item event"),
Expand Down Expand Up @@ -564,6 +581,7 @@ mod tests {
ItemStartedNotification {
thread_id: "thread-1".to_string(),
turn_id: "turn-1".to_string(),
started_at_ms: None,
item: ThreadItem::CollabAgentToolCall {
id: event.call_id,
tool: CollabAgentTool::ResumeAgent,
Expand Down Expand Up @@ -601,6 +619,7 @@ mod tests {
ItemCompletedNotification {
thread_id: "thread-2".to_string(),
turn_id: "turn-2".to_string(),
completed_at_ms: None,
item: ThreadItem::CollabAgentToolCall {
id: event.call_id,
tool: CollabAgentTool::ResumeAgent,
Expand Down Expand Up @@ -643,6 +662,7 @@ mod tests {
ItemStartedNotification {
thread_id: "thread-1".to_string(),
turn_id: "turn_1".to_string(),
started_at_ms: None,
item: ThreadItem::McpToolCall {
id: begin_event.call_id,
server: begin_event.invocation.server,
Expand Down Expand Up @@ -680,6 +700,7 @@ mod tests {
ItemStartedNotification {
thread_id: "thread-2".to_string(),
turn_id: "turn_2".to_string(),
started_at_ms: None,
item: ThreadItem::McpToolCall {
id: begin_event.call_id,
server: begin_event.invocation.server,
Expand Down Expand Up @@ -732,6 +753,7 @@ mod tests {
ItemCompletedNotification {
thread_id: "thread-3".to_string(),
turn_id: "turn_3".to_string(),
completed_at_ms: None,
item: ThreadItem::McpToolCall {
id: end_event.call_id,
server: end_event.invocation.server,
Expand Down Expand Up @@ -777,6 +799,7 @@ mod tests {
ItemCompletedNotification {
thread_id: "thread-4".to_string(),
turn_id: "turn_4".to_string(),
completed_at_ms: None,
item: ThreadItem::McpToolCall {
id: end_event.call_id,
server: end_event.invocation.server,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1352,6 +1352,7 @@ mod tests {
id: "user-item-id".to_string(),
content: Vec::new(),
}),
started_at_ms: None,
}),
EventMsg::TurnComplete(TurnCompleteEvent {
turn_id: turn_id.to_string(),
Expand Down
6 changes: 6 additions & 0 deletions codex-rs/app-server-protocol/src/protocol/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6874,6 +6874,9 @@ pub struct ItemStartedNotification {
pub item: ThreadItem,
pub thread_id: String,
pub turn_id: String,
/// Unix timestamp (in milliseconds) when this item lifecycle started, if known.
#[ts(type = "number | null")]
pub started_at_ms: Option<i64>,
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
Expand Down Expand Up @@ -6936,6 +6939,9 @@ pub struct ItemCompletedNotification {
pub item: ThreadItem,
pub thread_id: String,
pub turn_id: String,
/// Unix timestamp (in milliseconds) when this item lifecycle completed, if known.
#[ts(type = "number | null")]
pub completed_at_ms: Option<i64>,
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
Expand Down
Loading
Loading