1
1
use chrono:: Utc ;
2
2
use codex_common:: elapsed:: format_elapsed;
3
+ use codex_core:: config:: Config ;
3
4
use codex_core:: protocol:: AgentMessageEvent ;
4
5
use codex_core:: protocol:: BackgroundEventEvent ;
5
6
use codex_core:: protocol:: ErrorEvent ;
@@ -13,7 +14,6 @@ use codex_core::protocol::McpToolCallEndEvent;
13
14
use codex_core:: protocol:: PatchApplyBeginEvent ;
14
15
use codex_core:: protocol:: PatchApplyEndEvent ;
15
16
use codex_core:: protocol:: SessionConfiguredEvent ;
16
- use codex_core:: protocol:: TaskCompleteEvent ;
17
17
use owo_colors:: OwoColorize ;
18
18
use owo_colors:: Style ;
19
19
use shlex:: try_join;
@@ -103,9 +103,36 @@ macro_rules! ts_println {
103
103
} } ;
104
104
}
105
105
106
+ /// Print a concise summary of the effective configuration that will be used
107
+ /// for the session. This mirrors the information shown in the TUI welcome
108
+ /// screen.
109
+ pub ( crate ) fn print_config_summary ( config : & Config , with_ansi : bool ) {
110
+ let bold = if with_ansi {
111
+ Style :: new ( ) . bold ( )
112
+ } else {
113
+ Style :: new ( )
114
+ } ;
115
+
116
+ ts_println ! ( "OpenAI Codex (research preview)\n --------" ) ;
117
+
118
+ let entries = vec ! [
119
+ ( "workdir" , config. cwd. display( ) . to_string( ) ) ,
120
+ ( "model" , config. model. clone( ) ) ,
121
+ ( "provider" , config. model_provider_id. clone( ) ) ,
122
+ ( "approval" , format!( "{:?}" , config. approval_policy) ) ,
123
+ ( "sandbox" , format!( "{:?}" , config. sandbox_policy) ) ,
124
+ ] ;
125
+
126
+ for ( key, value) in entries {
127
+ println ! ( "{} {}" , format!( "{key}: " ) . style( bold) , value) ;
128
+ }
129
+
130
+ println ! ( "--------\n " ) ;
131
+ }
132
+
106
133
impl EventProcessor {
107
134
pub ( crate ) fn process_event ( & mut self , event : Event ) {
108
- let Event { id, msg } = event;
135
+ let Event { id : _ , msg } = event;
109
136
match msg {
110
137
EventMsg :: Error ( ErrorEvent { message } ) => {
111
138
let prefix = "ERROR:" . style ( self . red ) ;
@@ -114,15 +141,8 @@ impl EventProcessor {
114
141
EventMsg :: BackgroundEvent ( BackgroundEventEvent { message } ) => {
115
142
ts_println ! ( "{}" , message. style( self . dimmed) ) ;
116
143
}
117
- EventMsg :: TaskStarted => {
118
- let msg = format ! ( "Task started: {id}" ) ;
119
- ts_println ! ( "{}" , msg. style( self . dimmed) ) ;
120
- }
121
- EventMsg :: TaskComplete ( TaskCompleteEvent {
122
- last_agent_message : _,
123
- } ) => {
124
- let msg = format ! ( "Task complete: {id}" ) ;
125
- ts_println ! ( "{}" , msg. style( self . bold) ) ;
144
+ EventMsg :: TaskStarted | EventMsg :: TaskComplete ( _) => {
145
+ // Ignore.
126
146
}
127
147
EventMsg :: AgentMessage ( AgentMessageEvent { message } ) => {
128
148
let prefix = "Agent message:" . style ( self . bold ) ;
@@ -385,7 +405,15 @@ impl EventProcessor {
385
405
history_log_id : _,
386
406
history_entry_count : _,
387
407
} = session_configured_event;
388
- println ! ( "session {session_id} with model {model}" ) ;
408
+
409
+ ts_println ! (
410
+ "{} {}" ,
411
+ "codex session" . style( self . magenta) . style( self . bold) ,
412
+ session_id. to_string( ) . style( self . dimmed)
413
+ ) ;
414
+
415
+ ts_println ! ( "model: {}" , model) ;
416
+ println ! ( ) ;
389
417
}
390
418
EventMsg :: GetHistoryEntryResponse ( _) => {
391
419
// Currently ignored in exec output.
0 commit comments