upgrade copilot cli (#1844)
This commit is contained in:
@@ -167,10 +167,22 @@
|
||||
"allow_all_tools": true
|
||||
}
|
||||
},
|
||||
"GPT_5": {
|
||||
"GPT_5_2": {
|
||||
"COPILOT": {
|
||||
"allow_all_tools": true,
|
||||
"model": "gpt-5"
|
||||
"model": "gpt-5.2"
|
||||
}
|
||||
},
|
||||
"GEMINI_3_PRO_PREVIEW": {
|
||||
"COPILOT": {
|
||||
"allow_all_tools": true,
|
||||
"model": "gemini-3-pro-preview"
|
||||
}
|
||||
},
|
||||
"CLAUDE_OPUS_4_5": {
|
||||
"COPILOT": {
|
||||
"allow_all_tools": true,
|
||||
"model": "claude-opus-4.5"
|
||||
}
|
||||
},
|
||||
"CLAUDE_SONNET_4_5": {
|
||||
@@ -179,6 +191,54 @@
|
||||
"model": "claude-sonnet-4.5"
|
||||
}
|
||||
},
|
||||
"CLAUDE_HAIKU_4_5": {
|
||||
"COPILOT": {
|
||||
"allow_all_tools": true,
|
||||
"model": "claude-haiku-4.5"
|
||||
}
|
||||
},
|
||||
"GPT_5_1_CODEX_MAX": {
|
||||
"COPILOT": {
|
||||
"allow_all_tools": true,
|
||||
"model": "gpt-5.1-codex-max"
|
||||
}
|
||||
},
|
||||
"GPT_5_1_CODEX": {
|
||||
"COPILOT": {
|
||||
"allow_all_tools": true,
|
||||
"model": "gpt-5.1-codex"
|
||||
}
|
||||
},
|
||||
"GPT_5": {
|
||||
"COPILOT": {
|
||||
"allow_all_tools": true,
|
||||
"model": "gpt-5"
|
||||
}
|
||||
},
|
||||
"GPT_5_1": {
|
||||
"COPILOT": {
|
||||
"allow_all_tools": true,
|
||||
"model": "gpt-5.1"
|
||||
}
|
||||
},
|
||||
"GPT_5_1_CODEX_MINI": {
|
||||
"COPILOT": {
|
||||
"allow_all_tools": true,
|
||||
"model": "gpt-5.1-codex-mini"
|
||||
}
|
||||
},
|
||||
"GPT_5_MINI": {
|
||||
"COPILOT": {
|
||||
"allow_all_tools": true,
|
||||
"model": "gpt-5-mini"
|
||||
}
|
||||
},
|
||||
"GPT_4_1": {
|
||||
"COPILOT": {
|
||||
"allow_all_tools": true,
|
||||
"model": "gpt-4.1"
|
||||
}
|
||||
},
|
||||
"CLAUDE_SONNET_4": {
|
||||
"COPILOT": {
|
||||
"allow_all_tools": true,
|
||||
|
||||
@@ -56,7 +56,7 @@ pub struct Copilot {
|
||||
|
||||
impl Copilot {
|
||||
fn build_command_builder(&self, log_dir: &str) -> CommandBuilder {
|
||||
let mut builder = CommandBuilder::new("npx -y @github/copilot@0.0.367").params([
|
||||
let mut builder = CommandBuilder::new("npx -y @github/copilot@0.0.375").params([
|
||||
"--no-color",
|
||||
"--log-level",
|
||||
"debug",
|
||||
@@ -271,21 +271,24 @@ impl Copilot {
|
||||
|
||||
// Scan the log directory for a file named `<UUID>.log` or `session-<UUID>.log` and extract the UUID as session ID.
|
||||
async fn watch_session_id(log_dir_path: PathBuf) -> Result<String, String> {
|
||||
let mut ticker = interval(Duration::from_millis(200));
|
||||
let re =
|
||||
Regex::new(r"^(?:session-)?([0-9a-fA-F-]{36})\.log$").map_err(|e| e.to_string())?;
|
||||
let session_regex =
|
||||
Regex::new(r"events to session ([0-9a-fA-F-]{36})").map_err(|e| e.to_string())?;
|
||||
|
||||
timeout(Duration::from_secs(600), async {
|
||||
let log_dir_clone = log_dir_path.clone();
|
||||
timeout(Duration::from_secs(600), async move {
|
||||
let mut ticker = interval(Duration::from_millis(200));
|
||||
loop {
|
||||
if let Ok(mut rd) = fs::read_dir(&log_dir_path).await {
|
||||
while let Ok(Some(e)) = rd.next_entry().await {
|
||||
if let Some(file_name) = e.file_name().to_str()
|
||||
&& let Some(caps) = re.captures(file_name)
|
||||
if let Ok(mut rd) = fs::read_dir(&log_dir_clone).await {
|
||||
while let Ok(Some(entry)) = rd.next_entry().await {
|
||||
let path = entry.path();
|
||||
if path.extension().map(|e| e == "log").unwrap_or(false)
|
||||
&& let Ok(content) = fs::read_to_string(&path).await
|
||||
&& let Some(caps) = session_regex.captures(&content)
|
||||
&& let Some(matched) = caps.get(1)
|
||||
{
|
||||
let uuid_str = matched.as_str();
|
||||
if Uuid::parse_str(uuid_str).is_ok() {
|
||||
return uuid_str.to_string();
|
||||
return Ok(uuid_str.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -294,7 +297,7 @@ impl Copilot {
|
||||
}
|
||||
})
|
||||
.await
|
||||
.map_err(|_| format!("No [session-]<uuid>.log found in {log_dir_path:?}"))
|
||||
.map_err(|_| format!("No session ID found in log files at {log_dir_path:?}"))?
|
||||
}
|
||||
|
||||
const SESSION_PREFIX: &'static str = "[copilot-session] ";
|
||||
|
||||
Reference in New Issue
Block a user