Surface interactive requests in realtime conversations (#39113)

## What changed

- Mirror execution, permission, and patch approval requests into active realtime conversations with a prompt to review them in the app.
- Mirror user-input and elicitation requests with a prompt to respond in the app.
- Include the serialized request event so the realtime handoff retains the request details.

GitOrigin-RevId: 56fefa70b9ecaaad2fcf83592f20e8b4514a004a
This commit is contained in:
guinness-oai
2026-08-17 23:54:51 +00:00
committed by copyberry
parent 319b2f72b1
commit 13dfaab446
+17 -5
View File
@@ -1736,6 +1736,23 @@ pub(super) fn realtime_text_for_event(msg: &EventMsg) -> Option<(String, Option<
TurnItem::AgentMessage(item) => Some((agent_message_text(item), item.phase.clone())),
_ => None,
},
EventMsg::ExecApprovalRequest(_)
| EventMsg::RequestPermissions(_)
| EventMsg::ApplyPatchApprovalRequest(_)
| EventMsg::RequestUserInput(_)
| EventMsg::ElicitationRequest(_) => {
let message = if matches!(
msg,
EventMsg::RequestUserInput(_) | EventMsg::ElicitationRequest(_)
) {
"I need your input. Please respond in the app."
} else {
"I need your approval to continue. Please review the request in the app."
};
serde_json::to_string(msg)
.ok()
.map(|request| (format!("{message}\n\n{request}"), None))
}
EventMsg::Error(_)
| EventMsg::Warning(_)
| EventMsg::GuardianWarning(_)
@@ -1778,14 +1795,9 @@ pub(super) fn realtime_text_for_event(msg: &EventMsg) -> Option<(String, Option<
| EventMsg::ImageGenerationBegin(_)
| EventMsg::ImageGenerationEnd(_)
| EventMsg::ViewImageToolCall(_)
| EventMsg::ExecApprovalRequest(_)
| EventMsg::RequestPermissions(_)
| EventMsg::RequestUserInput(_)
| EventMsg::DynamicToolCallRequest(_)
| EventMsg::DynamicToolCallResponse(_)
| EventMsg::GuardianAssessment(_)
| EventMsg::ElicitationRequest(_)
| EventMsg::ApplyPatchApprovalRequest(_)
| EventMsg::DeprecationNotice(_)
| EventMsg::StreamError(_)
| EventMsg::TurnDiff(_)