Skip to content

Commit

Permalink
fix: add logs for goose run (#1085)
Browse files Browse the repository at this point in the history
  • Loading branch information
salman1993 authored Feb 5, 2025
1 parent a04b528 commit 64bb9e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/goose-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ async fn main() -> Result<()> {
}) => {
let mut session = build_session(name, resume, extension, builtin).await;
setup_logging(session.session_file().file_stem().and_then(|s| s.to_str()))?;

let _ = session.start().await;
return Ok(());
}
Expand Down Expand Up @@ -211,6 +210,7 @@ async fn main() -> Result<()> {
stdin
};
let mut session = build_session(name, resume, extension, builtin).await;
setup_logging(session.session_file().file_stem().and_then(|s| s.to_str()))?;
let _ = session.headless_start(contents.clone()).await;
return Ok(());
}
Expand Down
5 changes: 3 additions & 2 deletions crates/goose-cli/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ We've removed the conversation up to the most recent user message
}

async fn close_session(&mut self) {
let usage = self.agent.usage().await;
log_usage(self.session_file.to_string_lossy().to_string(), usage);

self.prompt.render(raw_message(
format!(
"Closing session. Recorded to {}\n",
Expand All @@ -317,8 +320,6 @@ We've removed the conversation up to the most recent user message
.as_str(),
));
self.prompt.close();
let usage = self.agent.usage().await;
log_usage(self.session_file.to_string_lossy().to_string(), usage);
}

pub fn session_file(&self) -> PathBuf {
Expand Down

0 comments on commit 64bb9e9

Please sign in to comment.