@@ -7,9 +7,9 @@ use codex_app_server_protocol::AccountRateLimitsUpdatedNotification;
77use codex_app_server_protocol:: AgentMessageDeltaNotification ;
88use codex_app_server_protocol:: ApplyPatchApprovalParams ;
99use codex_app_server_protocol:: ApplyPatchApprovalResponse ;
10- use codex_app_server_protocol:: ApprovalDecision ;
1110use codex_app_server_protocol:: CodexErrorInfo as V2CodexErrorInfo ;
1211use codex_app_server_protocol:: CommandAction as V2ParsedCommand ;
12+ use codex_app_server_protocol:: CommandExecutionApprovalDecision ;
1313use codex_app_server_protocol:: CommandExecutionOutputDeltaNotification ;
1414use codex_app_server_protocol:: CommandExecutionRequestApprovalParams ;
1515use codex_app_server_protocol:: CommandExecutionRequestApprovalResponse ;
@@ -20,6 +20,7 @@ use codex_app_server_protocol::ErrorNotification;
2020use codex_app_server_protocol:: ExecCommandApprovalParams ;
2121use codex_app_server_protocol:: ExecCommandApprovalResponse ;
2222use codex_app_server_protocol:: ExecPolicyAmendment as V2ExecPolicyAmendment ;
23+ use codex_app_server_protocol:: FileChangeApprovalDecision ;
2324use codex_app_server_protocol:: FileChangeOutputDeltaNotification ;
2425use codex_app_server_protocol:: FileChangeRequestApprovalParams ;
2526use codex_app_server_protocol:: FileChangeRequestApprovalResponse ;
@@ -1084,14 +1085,17 @@ fn format_file_change_diff(change: &CoreFileChange) -> String {
10841085}
10851086
10861087fn map_file_change_approval_decision (
1087- decision : ApprovalDecision ,
1088+ decision : FileChangeApprovalDecision ,
10881089) -> ( ReviewDecision , Option < PatchApplyStatus > ) {
10891090 match decision {
1090- ApprovalDecision :: Accept => ( ReviewDecision :: Approved , None ) ,
1091- ApprovalDecision :: AcceptForSession => ( ReviewDecision :: ApprovedForSession , None ) ,
1092- ApprovalDecision :: AcceptWithExecpolicyAmendment { .. } => ( ReviewDecision :: Approved , None ) ,
1093- ApprovalDecision :: Decline => ( ReviewDecision :: Denied , Some ( PatchApplyStatus :: Declined ) ) ,
1094- ApprovalDecision :: Cancel => ( ReviewDecision :: Abort , Some ( PatchApplyStatus :: Declined ) ) ,
1091+ FileChangeApprovalDecision :: Accept => ( ReviewDecision :: Approved , None ) ,
1092+ FileChangeApprovalDecision :: AcceptForSession => ( ReviewDecision :: ApprovedForSession , None ) ,
1093+ FileChangeApprovalDecision :: Decline => {
1094+ ( ReviewDecision :: Denied , Some ( PatchApplyStatus :: Declined ) )
1095+ }
1096+ FileChangeApprovalDecision :: Cancel => {
1097+ ( ReviewDecision :: Abort , Some ( PatchApplyStatus :: Declined ) )
1098+ }
10951099 }
10961100}
10971101
@@ -1113,7 +1117,7 @@ async fn on_file_change_request_approval_response(
11131117 . unwrap_or_else ( |err| {
11141118 error ! ( "failed to deserialize FileChangeRequestApprovalResponse: {err}" ) ;
11151119 FileChangeRequestApprovalResponse {
1116- decision : ApprovalDecision :: Decline ,
1120+ decision : FileChangeApprovalDecision :: Decline ,
11171121 }
11181122 } ) ;
11191123
@@ -1172,28 +1176,30 @@ async fn on_command_execution_request_approval_response(
11721176 . unwrap_or_else ( |err| {
11731177 error ! ( "failed to deserialize CommandExecutionRequestApprovalResponse: {err}" ) ;
11741178 CommandExecutionRequestApprovalResponse {
1175- decision : ApprovalDecision :: Decline ,
1179+ decision : CommandExecutionApprovalDecision :: Decline ,
11761180 }
11771181 } ) ;
11781182
11791183 let decision = response. decision ;
11801184
11811185 let ( decision, completion_status) = match decision {
1182- ApprovalDecision :: Accept => ( ReviewDecision :: Approved , None ) ,
1183- ApprovalDecision :: AcceptForSession => ( ReviewDecision :: ApprovedForSession , None ) ,
1184- ApprovalDecision :: AcceptWithExecpolicyAmendment {
1186+ CommandExecutionApprovalDecision :: Accept => ( ReviewDecision :: Approved , None ) ,
1187+ CommandExecutionApprovalDecision :: AcceptForSession => {
1188+ ( ReviewDecision :: ApprovedForSession , None )
1189+ }
1190+ CommandExecutionApprovalDecision :: AcceptWithExecpolicyAmendment {
11851191 execpolicy_amendment,
11861192 } => (
11871193 ReviewDecision :: ApprovedExecpolicyAmendment {
11881194 proposed_execpolicy_amendment : execpolicy_amendment. into_core ( ) ,
11891195 } ,
11901196 None ,
11911197 ) ,
1192- ApprovalDecision :: Decline => (
1198+ CommandExecutionApprovalDecision :: Decline => (
11931199 ReviewDecision :: Denied ,
11941200 Some ( CommandExecutionStatus :: Declined ) ,
11951201 ) ,
1196- ApprovalDecision :: Cancel => (
1202+ CommandExecutionApprovalDecision :: Cancel => (
11971203 ReviewDecision :: Abort ,
11981204 Some ( CommandExecutionStatus :: Declined ) ,
11991205 ) ,
@@ -1336,7 +1342,7 @@ mod tests {
13361342 #[ test]
13371343 fn file_change_accept_for_session_maps_to_approved_for_session ( ) {
13381344 let ( decision, completion_status) =
1339- map_file_change_approval_decision ( ApprovalDecision :: AcceptForSession ) ;
1345+ map_file_change_approval_decision ( FileChangeApprovalDecision :: AcceptForSession ) ;
13401346 assert_eq ! ( decision, ReviewDecision :: ApprovedForSession ) ;
13411347 assert_eq ! ( completion_status, None ) ;
13421348 }
0 commit comments