mirror of
https://github.com/openai/codex.git
synced 2026-11-03 16:23:51 +00:00
TUI: Remove core protocol dependency [3/7] (#20174)
## Why This is part 3 of a 7-PR stack to remove direct `codex_protocol::protocol` usage from `codex-tui` while keeping each layer reviewable and shippable. With `AppCommand` now explicit, the internal app event bus can carry TUI commands directly instead of bouncing through core `Op` values. ## What changed - Changed `AppEvent::CodexOp` and `AppEvent::SubmitThreadOp` to carry `AppCommand`. - Updated app-event senders and direct emitters to submit `AppCommand` values. - Adjusted tests to match `AppCommand` or convert back through `into_core()` where they intentionally assert legacy payload equality. ## Verification - `cargo test -p codex-tui --no-run`
This commit is contained in:
1 parent
445629815c
commit
d0204c3dcc
19 files changed
+165
-152
No files matched your search
@@ -351,8 +351,8 @@ impl App {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
let windows_sandbox_level = WindowsSandboxLevel::from_config(&self.config);
|
||||
self.app_event_tx.send(AppEvent::CodexOp(
|
||||
AppCommand::override_turn_context(
|
||||
self.app_event_tx
|
||||
.send(AppEvent::CodexOp(AppCommand::override_turn_context(
|
||||
/*cwd*/ None,
|
||||
/*approval_policy*/ None,
|
||||
/*approvals_reviewer*/ None,
|
||||
@@ -365,9 +365,7 @@ impl App {
|
||||
/*service_tier*/ None,
|
||||
/*collaboration_mode*/ None,
|
||||
/*personality*/ None,
|
||||
)
|
||||
.into_core(),
|
||||
));
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -313,15 +313,14 @@ impl App {
|
||||
return Ok(AppRunControl::Exit(ExitReason::Fatal(message)));
|
||||
}
|
||||
AppEvent::CodexOp(op) => {
|
||||
self.submit_active_thread_op(app_server, op.into()).await?;
|
||||
self.submit_active_thread_op(app_server, op).await?;
|
||||
}
|
||||
AppEvent::ApproveRecentAutoReviewDenial { thread_id, id } => {
|
||||
self.chat_widget
|
||||
.approve_recent_auto_review_denial(thread_id, id);
|
||||
}
|
||||
AppEvent::SubmitThreadOp { thread_id, op } => {
|
||||
self.submit_thread_op(app_server, thread_id, op.into())
|
||||
.await?;
|
||||
self.submit_thread_op(app_server, thread_id, op).await?;
|
||||
}
|
||||
AppEvent::ThreadHistoryEntryResponse { thread_id, event } => {
|
||||
self.enqueue_thread_history_entry_response(thread_id, event)
|
||||
@@ -989,8 +988,7 @@ impl App {
|
||||
/*service_tier*/ None,
|
||||
/*collaboration_mode*/ None,
|
||||
/*personality*/ None,
|
||||
)
|
||||
.into(),
|
||||
),
|
||||
));
|
||||
self.app_event_tx.send(
|
||||
AppEvent::OpenWorldWritableWarningConfirmation {
|
||||
@@ -1015,8 +1013,7 @@ impl App {
|
||||
/*service_tier*/ None,
|
||||
/*collaboration_mode*/ None,
|
||||
/*personality*/ None,
|
||||
)
|
||||
.into(),
|
||||
),
|
||||
));
|
||||
self.app_event_tx
|
||||
.send(AppEvent::UpdateAskForApprovalPolicy(preset.approval));
|
||||
|
||||
@@ -6,6 +6,7 @@ use super::*;
|
||||
use crate::app_backtrack::BacktrackSelection;
|
||||
use crate::app_backtrack::BacktrackState;
|
||||
use crate::app_backtrack::user_count;
|
||||
use crate::app_command::AppCommand;
|
||||
|
||||
use crate::chatwidget::ChatWidgetInit;
|
||||
use crate::chatwidget::create_initial_user_message;
|
||||
@@ -441,12 +442,12 @@ async fn enqueue_primary_thread_session_replays_turns_before_initial_prompt_subm
|
||||
}
|
||||
AppEvent::SubmitThreadOp {
|
||||
thread_id: op_thread_id,
|
||||
op: Op::UserTurn { items, .. },
|
||||
op: AppCommand::UserTurn { items, .. },
|
||||
} => {
|
||||
assert_eq!(op_thread_id, thread_id);
|
||||
submitted_items = Some(items);
|
||||
}
|
||||
AppEvent::CodexOp(Op::UserTurn { items, .. }) => {
|
||||
AppEvent::CodexOp(AppCommand::UserTurn { items, .. }) => {
|
||||
submitted_items = Some(items);
|
||||
}
|
||||
_ => {}
|
||||
|
||||
@@ -706,7 +706,8 @@ impl App {
|
||||
Ok(true)
|
||||
}
|
||||
AppCommandView::OverrideTurnContext { .. } => Ok(true),
|
||||
AppCommandView::Other(Op::ApproveGuardianDeniedAction { event }) => {
|
||||
AppCommandView::ApproveGuardianDeniedAction { event }
|
||||
| AppCommandView::Other(Op::ApproveGuardianDeniedAction { event }) => {
|
||||
app_server
|
||||
.thread_approve_guardian_denied_action(thread_id, event)
|
||||
.await?;
|
||||
|
||||
Reference in new issue
Block a user