mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
fix: Error when calling Goose CLI with session resume from Python subprocess
This commit is contained in:
committed by
github-actions[bot]
parent
2822681b11
commit
b75662275a
@@ -205,7 +205,7 @@ async fn offer_extension_debugging_help(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn check_missing_extensions_or_exit(saved_extensions: &[ExtensionConfig]) {
|
||||
fn check_missing_extensions_or_exit(saved_extensions: &[ExtensionConfig], interactive: bool) {
|
||||
let missing: Vec<_> = saved_extensions
|
||||
.iter()
|
||||
.filter(|ext| get_extension_by_name(&ext.name()).is_none())
|
||||
@@ -219,13 +219,14 @@ fn check_missing_extensions_or_exit(saved_extensions: &[ExtensionConfig]) {
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
|
||||
if !cliclack::confirm(format!(
|
||||
"Extension(s) {} from previous session are no longer available. Restore for this session?",
|
||||
names
|
||||
))
|
||||
.initial_value(true)
|
||||
.interact()
|
||||
.unwrap_or(false)
|
||||
if interactive
|
||||
&& !cliclack::confirm(format!(
|
||||
"Extension(s) {} from previous session are no longer available. Restore for this session?",
|
||||
names
|
||||
))
|
||||
.initial_value(true)
|
||||
.interact()
|
||||
.unwrap_or(false)
|
||||
{
|
||||
println!("{}", style("Resume cancelled.").yellow());
|
||||
process::exit(0);
|
||||
@@ -400,7 +401,7 @@ pub async fn build_session(session_config: SessionBuilderConfig) -> CliSession {
|
||||
|
||||
let current_workdir =
|
||||
std::env::current_dir().expect("Failed to get current working directory");
|
||||
if current_workdir != session.working_dir {
|
||||
if current_workdir != session.working_dir && session_config.interactive {
|
||||
let change_workdir = cliclack::confirm(format!("{} The original working directory of this session was set to {}. Your current directory is {}. Do you want to switch back to the original working directory?", style("WARNING:").yellow(), style(session.working_dir.display()).cyan(), style(current_workdir.display()).cyan()))
|
||||
.initial_value(true)
|
||||
.interact().expect("Failed to get user input");
|
||||
@@ -433,7 +434,10 @@ pub async fn build_session(session_config: SessionBuilderConfig) -> CliSession {
|
||||
if let Some(saved_state) =
|
||||
EnabledExtensionsState::from_extension_data(&session_data.extension_data)
|
||||
{
|
||||
check_missing_extensions_or_exit(&saved_state.extensions);
|
||||
check_missing_extensions_or_exit(
|
||||
&saved_state.extensions,
|
||||
session_config.interactive,
|
||||
);
|
||||
saved_state.extensions
|
||||
} else {
|
||||
get_enabled_extensions()
|
||||
|
||||
Reference in New Issue
Block a user