loadInbound resolves the owned agent + the inbound message (404 if missing or not on this agent).
(ctx context.Context, address, msgID string)
| 219 | // loadInbound resolves the owned agent + the inbound message (404 if missing |
| 220 | // or not on this agent). |
| 221 | func (s *Server) loadInbound(ctx context.Context, address, msgID string) (*identity.AgentIdentity, *identity.Message, *identity.User, error) { |
| 222 | ag, err := s.resolveOwnedAgent(ctx, address) |
| 223 | if err != nil { |
| 224 | return nil, nil, nil, err |
| 225 | } |
| 226 | user, uerr := s.requireUser(ctx) |
| 227 | if uerr != nil { |
| 228 | return nil, nil, nil, uerr |
| 229 | } |
| 230 | if s.deps.GetInboundMessage == nil { |
| 231 | return nil, nil, nil, NewError(http.StatusInternalServerError, "internal_error", "outbound unavailable") |
| 232 | } |
| 233 | in, err := s.deps.GetInboundMessage(ctx, msgID) |
| 234 | if err != nil || in == nil || in.AgentID != ag.ID { |
| 235 | return nil, nil, nil, NewError(http.StatusNotFound, "not_found", "message not found") |
| 236 | } |
| 237 | return ag, in, user, nil |
| 238 | } |
| 239 | |
| 240 | func (s *Server) handleReply(ctx context.Context, in *replyInput) (*sendOutput, error) { |
| 241 | ag, inbound, user, err := s.loadInbound(ctx, in.Address, in.ID) |
no test coverage detected