feat: TUI undo op (#5629)

This commit is contained in:
jif-oai
2025-10-27 10:55:29 +00:00
committed by GitHub
parent e92c4f6561
commit afc4eaab8b
20 changed files with 604 additions and 138 deletions

View File

@@ -9,6 +9,7 @@ use serde::ser::Serializer;
use ts_rs::TS;
use crate::user_input::UserInput;
use codex_git_tooling::GhostCommit;
use schemars::JsonSchema;
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, JsonSchema, TS)]
@@ -118,9 +119,7 @@ pub enum ResponseItem {
},
// Generated by the harness but considered exactly as a model response.
GhostSnapshot {
commit_id: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
parent: Option<String>,
ghost_commit: GhostCommit,
},
#[serde(other)]
Other,

View File

@@ -178,6 +178,9 @@ pub enum Op {
/// to generate a summary which will be returned as an AgentMessage event.
Compact,
/// Request Codex to undo a turn (turn are stacked so it is the same effect as CMD + Z).
Undo,
/// Request a code review from the agent.
Review { review_request: ReviewRequest },
@@ -486,6 +489,10 @@ pub enum EventMsg {
BackgroundEvent(BackgroundEventEvent),
UndoStarted(UndoStartedEvent),
UndoCompleted(UndoCompletedEvent),
/// Notification that a model stream experienced an error or disconnect
/// and the system is handling it (e.g., retrying with backoff).
StreamError(StreamErrorEvent),
@@ -1135,6 +1142,19 @@ pub struct BackgroundEventEvent {
pub message: String,
}
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
pub struct UndoStartedEvent {
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
}
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
pub struct UndoCompletedEvent {
pub success: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
}
#[derive(Debug, Clone, Deserialize, Serialize, JsonSchema, TS)]
pub struct StreamErrorEvent {
pub message: String,