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

Method ListProtectionEventsByMessage

internal/identity/screening.go:88–102  ·  view source on GitHub ↗

ListProtectionEventsByMessage returns every screening event recorded against a message, newest first — the breakdown a reviewer sees for a held item.

(ctx context.Context, messageID string)

Source from the content-addressed store, hash-verified

86// ListProtectionEventsByMessage returns every screening event recorded against a
87// message, newest first — the breakdown a reviewer sees for a held item.
88func (s *Store) ListProtectionEventsByMessage(ctx context.Context, messageID string) ([]ProtectionEvent, error) {
89 rows, err := s.pool.Query(ctx,
90 `SELECT id, message_id, agent_id, direction, source, reason, action,
91 subject_addr, detector, score, categories, spans, raw, created_at
92 FROM protection_events
93 WHERE message_id = $1
94 ORDER BY created_at DESC, id`,
95 messageID,
96 )
97 if err != nil {
98 return nil, fmt.Errorf("list screening events by message: %w", err)
99 }
100 defer rows.Close()
101 return scanProtectionEvents(rows)
102}
103
104// ListProtectionEventsByAgent returns an agent's most recent screening events
105// (newest first, capped by limit) for the security/analytics view.

Implementers 1

Storeinternal/identity/store.go

Calls 3

scanProtectionEventsFunction · 0.85
QueryMethod · 0.80
CloseMethod · 0.45