MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / buildRejectedEvent

Method buildRejectedEvent

internal/agent/webhooks_api.go:137–158  ·  view source on GitHub ↗

buildRejectedEvent fires when a reviewer rejects a pending outbound. userID is the reviewer (a separate identity from the agent's owner when multi-reviewer ACLs land in a future slice — today they're always the same).

(
	userID string,
	rejected *identity.Message,
	reason string,
)

Source from the content-addressed store, hash-verified

135// when multi-reviewer ACLs land in a future slice — today they're
136// always the same).
137func (a *API) buildRejectedEvent(
138 userID string,
139 rejected *identity.Message,
140 reason string,
141) webhookpub.Event {
142 data := map[string]interface{}{
143 "message_id": rejected.ID,
144 "direction": "outbound",
145 "type": rejected.Type,
146 "rejection_reason": reason,
147 "reviewed_by_user_id": userID,
148 }
149 return webhookpub.Event{
150 ID: generateEventIDForAgent(),
151 Type: webhookpub.EventEmailReviewRejected,
152 CreatedAt: time.Now().UTC(),
153 UserID: userID,
154 AgentID: rejected.AgentID,
155 MessageID: rejected.ID,
156 Data: data,
157 }
158}
159
160// buildInboundReleasedEvent fires when a reviewer releases a held inbound
161// message to the agent (status pending_review → review_approved, now inbox-

Callers 2

TestBuildRejectedEventFunction · 0.95
RejectPendingCoreMethod · 0.95

Calls 1

generateEventIDForAgentFunction · 0.85

Tested by 1

TestBuildRejectedEventFunction · 0.76