diff --git a/pkg/agent/loop_run.go b/pkg/agent/loop_run.go index e2d87c6dd..03f6069a0 100644 --- a/pkg/agent/loop_run.go +++ b/pkg/agent/loop_run.go @@ -1132,17 +1132,39 @@ func (al *AgentLoop) executeToolCalls( totalLen += len(sm.Content) } *messages = append(*messages, steeringMsgs...) - al.emitEvent(EventKindSteeringInjected, - EventMeta{AgentID: agent.ID, TurnID: scope.turnID, SessionKey: opts.SessionKey, Iteration: iteration}, - SteeringInjectedPayload{Count: len(steeringMsgs), TotalContentLen: totalLen}) + steeringMeta := EventMeta{ + AgentID: agent.ID, + TurnID: scope.turnID, + SessionKey: opts.SessionKey, + Iteration: iteration, + } + al.emitEvent( + EventKindSteeringInjected, + steeringMeta, + SteeringInjectedPayload{ + Count: len(steeringMsgs), + TotalContentLen: totalLen, + }, + ) } } // Skip remaining tools if steering was injected if steered { - al.emitEvent(EventKindToolExecSkipped, - EventMeta{AgentID: agent.ID, TurnID: scope.turnID, SessionKey: opts.SessionKey, Iteration: iteration}, - ToolExecSkippedPayload{Tool: tc.Name, Reason: "steering"}) + skipMeta := EventMeta{ + AgentID: agent.ID, + TurnID: scope.turnID, + SessionKey: opts.SessionKey, + Iteration: iteration, + } + al.emitEvent( + EventKindToolExecSkipped, + skipMeta, + ToolExecSkippedPayload{ + Tool: tc.Name, + Reason: "steering", + }, + ) // Still need to add a tool result to messages for protocol correctness *messages = append(*messages, providers.Message{ Role: "tool", diff --git a/pkg/channels/interfaces_ext.go b/pkg/channels/interfaces_ext.go index fd6ceec77..647d7cc64 100644 --- a/pkg/channels/interfaces_ext.go +++ b/pkg/channels/interfaces_ext.go @@ -14,4 +14,3 @@ type MessageSenderWithID interface { type DraftSender interface { SendDraft(ctx context.Context, chatID string, draftID int, content string) error } -