addAgentMessage records a chat message in the session and emits the resulting MessageAdded event. Used by the loop for assistant messages and max-iteration stop messages. The dispatcher emits its own variant directly via the [toolexec.Emitter] interface.
(sess *session.Session, a *agent.Agent, msg *chat.Message, events EventSink)
| 151 | // and max-iteration stop messages. The dispatcher emits its own variant |
| 152 | // directly via the [toolexec.Emitter] interface. |
| 153 | func addAgentMessage(sess *session.Session, a *agent.Agent, msg *chat.Message, events EventSink) { |
| 154 | agentMsg := session.NewAgentMessage(a.Name(), msg) |
| 155 | sess.AddMessage(agentMsg) |
| 156 | events.Emit(MessageAdded(sess.ID, agentMsg, a.Name())) |
| 157 | } |
no test coverage detected