Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

only use preambles for realtime (#12831)

Ahmed Ibrahim2bd87d1a7580
diff --git a/codex-rs/core/src/codex.rs b/codex-rs/core/src/codex.rs
index 3d27faf9bb..f55c73c1d4 100644
--- a/codex-rs/core/src/codex.rs
+++ b/codex-rs/core/src/codex.rs
@@ -197,7 +197,6 @@ use crate::protocol::ModelRerouteEvent;
use crate::protocol::ModelRerouteReason;
use crate::protocol::NetworkApprovalContext;
use crate::protocol::Op;
-use crate::protocol::PatchApplyStatus;
use crate::protocol::PlanDeltaEvent;
use crate::protocol::RateLimitSnapshot;
use crate::protocol::ReasoningContentDeltaEvent;
@@ -5818,46 +5817,80 @@ fn realtime_text_for_event(msg: &EventMsg) -> Option<String> {
TurnItem::AgentMessage(item) => Some(agent_message_text(item)),
_ => None,
},
- EventMsg::ExecCommandBegin(event) => {
- let command = event.command.join(" ");
- Some(format!(
- "Exec command started: {command}\nWorking directory: {}",
- event.cwd.display()
- ))
- }
- EventMsg::PatchApplyBegin(event) => {
- let mut files: Vec<String> = event
- .changes
- .keys()
- .map(|path| path.display().to_string())
- .collect();
- files.sort();
- let file_list = if files.is_empty() {
- "none".to_string()
- } else {
- files.join(", ")
- };
- Some(format!(
- "apply_patch started ({count} file change(s))\nFiles: {file_list}",
- count = files.len()
- ))
- }
- EventMsg::PatchApplyEnd(event) => {
- let status = match event.status {
- PatchApplyStatus::Completed => "completed",
- PatchApplyStatus::Failed => "failed",
- PatchApplyStatus::Declined => "declined",
- };
- let mut text = format!("apply_patch {status}");
- if !event.stdout.is_empty() {
- text.push_str(&format!("\nstdout:\n{}", event.stdout));
- }
- if !event.stderr.is_empty() {
- text.push_str(&format!("\nstderr:\n{}", event.stderr));
- }
- Some(text)
- }
- _ => None,
+ EventMsg::Error(_)
+ | EventMsg::Warning(_)
+ | EventMsg::RealtimeConversationStarted(_)
+ | EventMsg::RealtimeConversationRealtime(_)
+ | EventMsg::RealtimeConversationClosed(_)
+ | EventMsg::ModelReroute(_)
+ | EventMsg::ContextCompacted(_)
+ | EventMsg::ThreadRolledBack(_)
+ | EventMsg::TurnStarted(_)
+ | EventMsg::TurnComplete(_)
+ | EventMsg::TokenCount(_)
+ | EventMsg::UserMessage(_)
+ | EventMsg::AgentMessageDelta(_)
+ | EventMsg::AgentReasoning(_)
+ | EventMsg::AgentReasoningDelta(_)
+ | EventMsg::AgentReasoningRawContent(_)
+ | EventMsg::AgentReasoningRawContentDelta(_)
+ | EventMsg::AgentReasoningSectionBreak(_)
+ | EventMsg::SessionConfigured(_)
+ | EventMsg::ThreadNameUpdated(_)
+ | EventMsg::McpStartupUpdate(_)
+ | EventMsg::McpStartupComplete(_)
+ | EventMsg::McpToolCallBegin(_)
+ | EventMsg::McpToolCallEnd(_)
+ | EventMsg::WebSearchBegin(_)
+ | EventMsg::WebSearchEnd(_)
+ | EventMsg::ExecCommandBegin(_)
+ | EventMsg::ExecCommandOutputDelta(_)
+ | EventMsg::TerminalInteraction(_)
+ | EventMsg::ExecCommandEnd(_)
+ | EventMsg::PatchApplyBegin(_)
+ | EventMsg::PatchApplyEnd(_)
+ | EventMsg::ViewImageToolCall(_)
+ | EventMsg::ExecApprovalRequest(_)
+ | EventMsg::RequestUserInput(_)
+ | EventMsg::DynamicToolCallRequest(_)
+ | EventMsg::DynamicToolCallResponse(_)
+ | EventMsg::SkillRequestApproval(_)
+ | EventMsg::ElicitationRequest(_)
+ | EventMsg::ApplyPatchApprovalRequest(_)
+ | EventMsg::DeprecationNotice(_)
+ | EventMsg::BackgroundEvent(_)
+ | EventMsg::UndoStarted(_)
+ | EventMsg::UndoCompleted(_)
+ | EventMsg::StreamError(_)
+ | EventMsg::TurnDiff(_)
+ | EventMsg::GetHistoryEntryResponse(_)
+ | EventMsg::McpListToolsResponse(_)
+ | EventMsg::ListCustomPromptsResponse(_)
+ | EventMsg::ListSkillsResponse(_)
+ | EventMsg::ListRemoteSkillsResponse(_)
+ | EventMsg::RemoteSkillDownloaded(_)
+ | EventMsg::SkillsUpdateAvailable
+ | EventMsg::PlanUpdate(_)
+ | EventMsg::TurnAborted(_)
+ | EventMsg::ShutdownComplete
+ | EventMsg::EnteredReviewMode(_)
+ | EventMsg::ExitedReviewMode(_)
+ | EventMsg::RawResponseItem(_)
+ | EventMsg::ItemStarted(_)
+ | EventMsg::AgentMessageContentDelta(_)
+ | EventMsg::PlanDelta(_)
+ | EventMsg::ReasoningContentDelta(_)
+ | EventMsg::ReasoningRawContentDelta(_)
+ | EventMsg::CollabAgentSpawnBegin(_)
+ | EventMsg::CollabAgentSpawnEnd(_)
+ | EventMsg::CollabAgentInteractionBegin(_)
+ | EventMsg::CollabAgentInteractionEnd(_)
+ | EventMsg::CollabWaitingBegin(_)
+ | EventMsg::CollabWaitingEnd(_)
+ | EventMsg::CollabCloseBegin(_)
+ | EventMsg::CollabCloseEnd(_)
+ | EventMsg::CollabResumeBegin(_)
+ | EventMsg::CollabResumeEnd(_) => None,
}
}