Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions bt-daemon/src/command_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ pub struct SetupCommandOutput {
pub restart_required: bool,
}

#[derive(Debug, Clone, Serialize)]
pub struct UpdateCommandOutput {
pub source: String,
pub display_name: String,
pub restart_required: bool,
}

#[derive(Debug, Clone, Serialize)]
pub struct StopCommandOutput {
pub running: bool,
Expand Down Expand Up @@ -115,6 +122,7 @@ pub enum TraceCommandOutput {
Doctor(Box<DoctorCommandOutput>),
Enable(SetupCommandOutput),
Disable(SetupCommandOutput),
Update(UpdateCommandOutput),
Stop(StopCommandOutput),
Import { summaries: Vec<ImportSummary> },
}
Expand Down Expand Up @@ -162,6 +170,14 @@ impl TraceCommandOutput {
})
}

pub fn update(source: impl Into<String>, display_name: impl Into<String>) -> Self {
Self::Update(UpdateCommandOutput {
source: source.into(),
display_name: display_name.into(),
restart_required: true,
})
}

pub fn render(&self, format: OutputFormat) -> anyhow::Result<String> {
match format {
OutputFormat::Json => Ok(serde_json::to_string(self)?),
Expand Down Expand Up @@ -219,6 +235,10 @@ impl TraceCommandOutput {
disable.display_name,
disable.settings_path.display()
)),
Self::Update(update) => Ok(format!(
"The Braintrust tracing plugin was updated for {}.\nRestart the coding agent to load the update.",
update.display_name,
)),
Self::Stop(stop) if stop.stopped => Ok("Tracing daemon stopped.".into()),
Self::Stop(_) => Ok("No tracing daemon is running.".into()),
Self::Import { summaries } => Ok(summaries
Expand Down
4 changes: 2 additions & 2 deletions bt-daemon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ pub use command_output::{
#[doc(hidden)]
pub use journal::source_journal_path;
pub use server::{AuthLease, AuthProvider, AuthResolveReason, ServeOptions};
pub use setup::{run_disable, run_enable, run_setup};
pub use setup::{run_disable, run_enable, run_setup, run_update};
pub use sink::{BraintrustSinkConfig, BraintrustSinkFactory, DebugSinkFactory, Sink, SinkFactory};
pub use trace_command::{
DisableArgs, DoctorAgent, DoctorArgs, EnableArgs, SetupAgent, SetupArgs, StopArgs, TraceArgs,
TraceCommand,
TraceCommand, UpdateArgs,
};
pub use trace_runtime::{run_trace, RouteRequirements, TraceHostContext, TraceHostServices};
pub use translate::{
Expand Down
Loading
Loading