Documentation
¶
Overview ¶
Package hitlnotify sends the approval notification email that fires whenever a new outbound message enters pending_approval.
The notification is the reviewer's primary touchpoint with HITL — it arrives in the account owner's inbox with a preview of the held message and one-click approve / reject magic links, plus a link back to the dashboard for edit-before-approve.
The notifier is intentionally best-effort: delivery failures are logged but never surfaced as HTTP errors, so a broken relay cannot block the send-hold contract the API promises to its SDK/CLI users.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Notifier ¶
type Notifier struct {
// contains filtered or unexported fields
}
Notifier sends approval notification emails. Construct with New, then call NotifyPendingApproval from the HITL gate right after the pending row is written. Errors are logged, never returned upstream.
func New ¶
func New(store *identity.Store, relay *outbound.SMTPRelay, signer *approvaltoken.Signer, fromDomain, publicURL string) *Notifier
New returns a Notifier that sends mail through relay using the given public URL to build magic-link URLs. fromDomain is the platform relay's from-domain — e.g. "send.example.com" — which is combined with the fixed local-part to produce the From address.
func (*Notifier) NotifyPendingApproval ¶
func (n *Notifier) NotifyPendingApproval(ctx context.Context, msg *identity.Message, agent *identity.AgentIdentity) error
NotifyPendingApproval composes and sends the notification email for a newly held message. Designed to be called in a goroutine from the HTTP handler — any returned error is only for tests; production callers should ignore it and rely on the notifier's own logging.
func (*Notifier) NotifyPendingApprovalAsync ¶
func (n *Notifier) NotifyPendingApprovalAsync(msg *identity.Message, agent *identity.AgentIdentity)
NotifyPendingApprovalAsync is a thin fire-and-forget wrapper suitable for goroutine launches from HTTP handlers. It swallows the error after logging so callers don't need to.