Skip to content

Commit ce80026

Browse files
committed
More compact
Signed-off-by: David Gageot <david.gageot@docker.com>
1 parent 0736dd0 commit ce80026

1 file changed

Lines changed: 8 additions & 23 deletions

File tree

pkg/runtime/event.go

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,15 @@ type UserMessageEvent struct {
2222
Message string `json:"message"`
2323
}
2424

25+
func (e *UserMessageEvent) GetAgentName() string { return "" }
26+
2527
func UserMessage(message string) Event {
2628
return &UserMessageEvent{
2729
Type: "user_message",
2830
Message: message,
2931
}
3032
}
3133

32-
func (e *UserMessageEvent) GetAgentName() string {
33-
return ""
34-
}
35-
3634
// PartialToolCallEvent is sent when a tool call is first received (partial/complete)
3735
type PartialToolCallEvent struct {
3836
Type string `json:"type"`
@@ -112,17 +110,13 @@ func StreamStarted(sessionID, agentName string) Event {
112110
}
113111
}
114112

115-
func (e *StreamStartedEvent) GetAgentName() string {
116-
return e.AgentName
117-
}
118-
119113
type AgentChoiceEvent struct {
120114
Type string `json:"type"`
121115
Content string `json:"content"`
122116
AgentContext
123117
}
124118

125-
func AgentChoice(agentName, content string) Event { //nolint:gocritic
119+
func AgentChoice(agentName, content string) Event {
126120
return &AgentChoiceEvent{
127121
Type: "agent_choice",
128122
Content: content,
@@ -136,7 +130,7 @@ type AgentChoiceReasoningEvent struct {
136130
AgentContext
137131
}
138132

139-
func AgentChoiceReasoning(agentName, content string) Event { //nolint:gocritic
133+
func AgentChoiceReasoning(agentName, content string) Event {
140134
return &AgentChoiceReasoningEvent{
141135
Type: "agent_choice_reasoning",
142136
Content: content,
@@ -162,13 +156,14 @@ type ShellOutputEvent struct {
162156
Output string `json:"error"`
163157
}
164158

159+
func (e *ShellOutputEvent) GetAgentName() string { return "" }
160+
165161
func ShellOutput(output string) Event {
166162
return &ShellOutputEvent{
167163
Type: "shell",
168164
Output: output,
169165
}
170166
}
171-
func (e *ShellOutputEvent) GetAgentName() string { return "" }
172167

173168
type TokenUsageEvent struct {
174169
Type string `json:"type"`
@@ -265,10 +260,6 @@ func StreamStopped(sessionID, agentName string) Event {
265260
}
266261
}
267262

268-
func (e *StreamStoppedEvent) GetAgentName() string {
269-
return e.AgentName
270-
}
271-
272263
type AuthorizationRequiredEvent struct {
273264
Type string `json:"type"`
274265
ServerURL string `json:"server_url"`
@@ -277,6 +268,8 @@ type AuthorizationRequiredEvent struct {
277268
AgentContext
278269
}
279270

271+
func (e *AuthorizationRequiredEvent) GetAgentName() string { return "" }
272+
280273
func AuthorizationRequired(serverURL, serverType, confirmation, agentName string) Event {
281274
return &AuthorizationRequiredEvent{
282275
Type: "authorization_required",
@@ -287,10 +280,6 @@ func AuthorizationRequired(serverURL, serverType, confirmation, agentName string
287280
}
288281
}
289282

290-
func (e *AuthorizationRequiredEvent) GetAgentName() string {
291-
return ""
292-
}
293-
294283
type MaxIterationsReachedEvent struct {
295284
Type string `json:"type"`
296285
MaxIterations int `json:"max_iterations"`
@@ -303,7 +292,3 @@ func MaxIterationsReached(maxIterations int) Event {
303292
MaxIterations: maxIterations,
304293
}
305294
}
306-
307-
func (e *MaxIterationsReachedEvent) GetAgentName() string {
308-
return e.AgentName
309-
}

0 commit comments

Comments
 (0)