mirror of
https://github.com/openai/codex.git
synced 2026-11-08 20:40:33 +00:00
Display session id in status
This commit is contained in:
@@ -35,6 +35,7 @@ use ratatui::widgets::Widget;
|
||||
use ratatui::widgets::WidgetRef;
|
||||
use tokio::sync::mpsc::UnboundedSender;
|
||||
use tracing::debug;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::app_event::AppEvent;
|
||||
use crate::app_event_sender::AppEventSender;
|
||||
@@ -81,6 +82,7 @@ pub(crate) struct ChatWidget<'a> {
|
||||
interrupts: InterruptManager,
|
||||
// Whether a redraw is needed after handling the current event
|
||||
needs_redraw: bool,
|
||||
session_id: Option<Uuid>,
|
||||
}
|
||||
|
||||
struct UserMessage {
|
||||
@@ -114,6 +116,7 @@ impl ChatWidget<'_> {
|
||||
}
|
||||
// --- Small event handlers ---
|
||||
fn on_session_configured(&mut self, event: codex_core::protocol::SessionConfiguredEvent) {
|
||||
self.session_id = Some(event.session_id);
|
||||
self.bottom_pane
|
||||
.set_history_metadata(event.history_log_id, event.history_entry_count);
|
||||
self.add_to_history(HistoryCell::new_session_info(&self.config, event, true));
|
||||
@@ -497,6 +500,7 @@ impl ChatWidget<'_> {
|
||||
task_complete_pending: false,
|
||||
interrupts: InterruptManager::new(),
|
||||
needs_redraw: false,
|
||||
session_id: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -651,6 +655,7 @@ impl ChatWidget<'_> {
|
||||
self.add_to_history(HistoryCell::new_status_output(
|
||||
&self.config,
|
||||
&self.total_token_usage,
|
||||
&self.session_id,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ fn make_chatwidget_manual() -> (
|
||||
task_complete_pending: false,
|
||||
interrupts: InterruptManager::new(),
|
||||
needs_redraw: false,
|
||||
session_id: None,
|
||||
};
|
||||
(widget, rx, op_rx)
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ use std::io::Cursor;
|
||||
use std::path::PathBuf;
|
||||
use std::time::Duration;
|
||||
use tracing::error;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct CommandOutput {
|
||||
@@ -560,7 +561,11 @@ impl HistoryCell {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new_status_output(config: &Config, usage: &TokenUsage) -> Self {
|
||||
pub(crate) fn new_status_output(
|
||||
config: &Config,
|
||||
usage: &TokenUsage,
|
||||
session_id: &Option<Uuid>,
|
||||
) -> Self {
|
||||
let mut lines: Vec<Line<'static>> = Vec::new();
|
||||
lines.push(Line::from("/status".magenta()));
|
||||
|
||||
@@ -597,6 +602,12 @@ impl HistoryCell {
|
||||
" • Sandbox: ".into(),
|
||||
sandbox_name.into(),
|
||||
]));
|
||||
if let Some(session_id) = session_id {
|
||||
lines.push(Line::from(vec![
|
||||
" • Session ID: ".into(),
|
||||
session_id.to_string().into(),
|
||||
]));
|
||||
}
|
||||
|
||||
lines.push(Line::from(""));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user