feat: enhance command classification and error handling; improve process checks and credential security

This commit is contained in:
asepharyana
2026-07-12 11:55:02 +07:00
parent 87d0aac596
commit ac99835eb4
10 changed files with 148 additions and 70 deletions
+11 -2
View File
@@ -139,7 +139,11 @@ impl LlmClient {
Ok((msg, usage)) => return Ok((msg, usage)),
Err(e) => {
let err_str = e.to_string();
let is_auth_error = err_str.contains("API error 401") || err_str.contains("API error 403");
let err_lower = err_str.to_lowercase();
let is_auth_error = err_str.contains("401") || err_str.contains("403")
|| err_lower.contains("unauthorized")
|| err_lower.contains("forbidden")
|| err_lower.contains("authentication failed");
if attempt >= max_retries || is_auth_error {
return Err(e);
}
@@ -191,7 +195,11 @@ impl LlmClient {
Ok(result) => return Ok(result),
Err(e) => {
let err_str = e.to_string();
let is_auth_error = err_str.contains("API error 401") || err_str.contains("API error 403");
let err_lower = err_str.to_lowercase();
let is_auth_error = err_str.contains("401") || err_str.contains("403")
|| err_lower.contains("unauthorized")
|| err_lower.contains("forbidden")
|| err_lower.contains("authentication failed");
if started || attempt >= max_retries || is_auth_error {
return Err(e);
}
@@ -281,6 +289,7 @@ impl LlmClient {
}
StreamEvent::Done => {
turn.apply_event(&event);
turn.done_received = true;
return Ok((turn.build_assistant_message(), usage));
}
_ => turn.apply_event(&event),