Skip to content

Commit dfbf5a3

Browse files
committed
add summary part added
1 parent 701eed7 commit dfbf5a3

File tree

5 files changed

+31
-4
lines changed

5 files changed

+31
-4
lines changed

codex-rs/app-server-protocol/src/protocol/common.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ server_notification_definitions! {
509509
AccountUpdated => "account/updated" (v2::AccountUpdatedNotification),
510510
AccountRateLimitsUpdated => "account/rateLimits/updated" (v2::AccountRateLimitsUpdatedNotification),
511511
ReasoningDelta => "item/reasoning/delta" (v2::ReasoningDeltaNotification),
512+
ReasoningSummaryPartAdded => "item/reasoning/summaryPartAdded" (v2::ReasoningSummaryPartAddedNotification),
512513

513514
#[serde(rename = "account/login/completed")]
514515
#[ts(rename = "account/login/completed")]

codex-rs/app-server-protocol/src/protocol/v2.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,13 @@ pub struct ReasoningDeltaNotification {
696696
pub delta: String,
697697
}
698698

699+
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
700+
#[serde(rename_all = "camelCase")]
701+
#[ts(export_to = "v2/")]
702+
pub struct ReasoningSummaryPartAddedNotification {
703+
pub item_id: String,
704+
}
705+
699706
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
700707
#[serde(rename_all = "camelCase")]
701708
#[ts(export_to = "v2/")]

codex-rs/app-server/src/codex_message_processor.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ use codex_app_server_protocol::ModelListResponse;
6464
use codex_app_server_protocol::NewConversationParams;
6565
use codex_app_server_protocol::NewConversationResponse;
6666
use codex_app_server_protocol::ReasoningDeltaNotification;
67+
use codex_app_server_protocol::ReasoningSummaryPartAddedNotification;
6768
use codex_app_server_protocol::RemoveConversationListenerParams;
6869
use codex_app_server_protocol::RemoveConversationSubscriptionResponse;
6970
use codex_app_server_protocol::RequestId;
@@ -2594,6 +2595,16 @@ async fn apply_bespoke_event_handling(
25942595
.send_server_notification(ServerNotification::ReasoningDelta(notification))
25952596
.await;
25962597
}
2598+
EventMsg::AgentReasoningSectionBreak(event) => {
2599+
let notification = ReasoningSummaryPartAddedNotification {
2600+
item_id: event.item_id,
2601+
};
2602+
outgoing
2603+
.send_server_notification(ServerNotification::ReasoningSummaryPartAdded(
2604+
notification,
2605+
))
2606+
.await;
2607+
}
25972608
EventMsg::ExecApprovalRequest(ExecApprovalRequestEvent {
25982609
call_id,
25992610
command,

codex-rs/core/src/codex.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,9 +2216,15 @@ async fn try_run_turn(
22162216
}
22172217
}
22182218
ResponseEvent::ReasoningSummaryPartAdded => {
2219-
let event =
2220-
EventMsg::AgentReasoningSectionBreak(AgentReasoningSectionBreakEvent {});
2221-
sess.send_event(&turn_context, event).await;
2219+
if let Some(active) = active_item.as_ref() {
2220+
let event =
2221+
EventMsg::AgentReasoningSectionBreak(AgentReasoningSectionBreakEvent {
2222+
item_id: active.id(),
2223+
});
2224+
sess.send_event(&turn_context, event).await;
2225+
} else {
2226+
error_or_panic("ReasoningSummaryPartAdded without active item".to_string());
2227+
}
22222228
}
22232229
ResponseEvent::ReasoningContentDelta(delta) => {
22242230
if let Some(active) = active_item.as_ref() {

codex-rs/protocol/src/protocol.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,9 @@ pub struct AgentReasoningRawContentDeltaEvent {
923923
}
924924

925925
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
926-
pub struct AgentReasoningSectionBreakEvent {}
926+
pub struct AgentReasoningSectionBreakEvent {
927+
pub item_id: String,
928+
}
927929

928930
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
929931
pub struct AgentReasoningDeltaEvent {

0 commit comments

Comments
 (0)