feat(agent): implement agent execution engine and turn handling with background processing
This commit is contained in:
@@ -324,7 +324,12 @@ impl LlmClient {
|
||||
name,
|
||||
arguments_delta,
|
||||
} => {
|
||||
while self.tool_calls.len() <= *index {
|
||||
// Cap the index to prevent memory exhaustion from
|
||||
// maliciously large indices.
|
||||
const MAX_TOOL_CALLS: usize = 64;
|
||||
let index = usize::min(*index, MAX_TOOL_CALLS.saturating_sub(1));
|
||||
|
||||
while self.tool_calls.len() <= index {
|
||||
self.tool_calls.push(zesdex_domain::core::ToolCall {
|
||||
id: String::new(),
|
||||
type_: "function".to_string(),
|
||||
@@ -334,8 +339,8 @@ impl LlmClient {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
let tc = &mut self.tool_calls[*index];
|
||||
|
||||
let tc = &mut self.tool_calls[index];
|
||||
|
||||
if let Some(ref id_val) = id {
|
||||
tc.id = id_val.clone();
|
||||
|
||||
Reference in New Issue
Block a user