ResolveSession returns the agent for sess: when sess pins a specific agent (e.g. background agent tasks), that agent is returned directly instead of reading the shared current-agent field; otherwise Current is returned.
(sess *session.Session)
| 74 | // instead of reading the shared current-agent field; otherwise Current |
| 75 | // is returned. |
| 76 | func (r *agentRouter) ResolveSession(sess *session.Session) *agent.Agent { |
| 77 | if sess.AgentName != "" { |
| 78 | if a, err := r.team.Agent(sess.AgentName); err == nil { |
| 79 | return a |
| 80 | } |
| 81 | } |
| 82 | return r.Current() |
| 83 | } |