refactor(subagent): remove unused step parameter from SubagentEvent

This commit is contained in:
asepharyana
2026-07-16 07:58:34 +07:00
parent a00aa9bec8
commit 1afca97c1b
2 changed files with 4 additions and 8 deletions
+3 -3
View File
@@ -556,7 +556,7 @@ pub fn apply_action(state: &mut AppStateRest, action: Action) {
.map(str::len) .map(str::len)
.sum(); .sum();
let token_estimate = total_chars / 3; let token_estimate = total_chars / 3;
rt.messages = crate::app::runtime::shortsend::shape_messages(&rt.messages, token_estimate, max_wire_tokens, true, None); rt.messages = crate::app::runtime::context::shaping::shape_messages(&rt.messages, token_estimate, max_wire_tokens, true, None);
state.push_toast(Toast::new(ToastKind::Success, "Conversation history compacted.".to_string())); state.push_toast(Toast::new(ToastKind::Success, "Conversation history compacted.".to_string()));
state.dirty = true; state.dirty = true;
} }
@@ -1154,10 +1154,10 @@ fn run_agent_turn(
// Skip message compaction if abort was requested — the non-streaming // Skip message compaction if abort was requested — the non-streaming
// LLM call for summarization would block without checking abort_flag. // LLM call for summarization would block without checking abort_flag.
let wire_msgs = if !tc.abort_flag.load(std::sync::atomic::Ordering::SeqCst) let wire_msgs = if !tc.abort_flag.load(std::sync::atomic::Ordering::SeqCst)
&& crate::app::runtime::shortsend::should_shape(token_estimate, max_wire_tokens, prev_shaped) && crate::app::runtime::context::shaping::should_shape(token_estimate, max_wire_tokens, prev_shaped)
{ {
prev_shaped = true; prev_shaped = true;
let compacted = crate::app::runtime::shortsend::shape_messages(&msgs, token_estimate, max_wire_tokens, false, Some(&tc.client)); let compacted = crate::app::runtime::context::shaping::shape_messages(&msgs, token_estimate, max_wire_tokens, false, Some(&tc.client));
// Dispatch the compacted messages to the main thread so the local session history // Dispatch the compacted messages to the main thread so the local session history
// is permanently compacted and doesn't trigger shaping again immediately on next turn. // is permanently compacted and doesn't trigger shaping again immediately on next turn.
+1 -5
View File
@@ -475,7 +475,6 @@ pub fn run_subagent(ctx: &SubagentContext, tx: &mpsc::Sender<SubagentEvent>) ->
// drain thread can show it as progress instead of just the tool name. // drain thread can show it as progress instead of just the tool name.
if !content.is_empty() { if !content.is_empty() {
let _ = tx.blocking_send(SubagentEvent::StepCompleted { let _ = tx.blocking_send(SubagentEvent::StepCompleted {
step,
output: content.clone(), output: content.clone(),
}); });
} }
@@ -612,7 +611,6 @@ pub fn run_subagent(ctx: &SubagentContext, tx: &mpsc::Sender<SubagentEvent>) ->
let _ = tx.blocking_send(SubagentEvent::ToolResult { let _ = tx.blocking_send(SubagentEvent::ToolResult {
tool: tool_name.clone(), tool: tool_name.clone(),
args: args.clone(), args: args.clone(),
output: output_text.clone(),
}); });
let is_readonly = tool_name == "read" let is_readonly = tool_name == "read"
@@ -651,7 +649,6 @@ pub fn run_subagent(ctx: &SubagentContext, tx: &mpsc::Sender<SubagentEvent>) ->
let _ = tx.blocking_send(SubagentEvent::ToolResult { let _ = tx.blocking_send(SubagentEvent::ToolResult {
tool: tool_name.clone(), tool: tool_name.clone(),
args: args.clone(), args: args.clone(),
output: msg,
}); });
} }
} }
@@ -663,7 +660,6 @@ pub fn run_subagent(ctx: &SubagentContext, tx: &mpsc::Sender<SubagentEvent>) ->
output.push('\n'); output.push('\n');
} }
let _ = tx.blocking_send(SubagentEvent::StepCompleted { let _ = tx.blocking_send(SubagentEvent::StepCompleted {
step,
output: content.clone(), output: content.clone(),
}); });
// Break only when we got real content; empty means something went wrong // Break only when we got real content; empty means something went wrong
@@ -673,7 +669,7 @@ pub fn run_subagent(ctx: &SubagentContext, tx: &mpsc::Sender<SubagentEvent>) ->
} }
} }
let _ = tx.blocking_send(SubagentEvent::Completed { output: output.clone() }); let _ = tx.blocking_send(SubagentEvent::Completed);
Ok(output) Ok(output)
} }