+ {/* Section Header */}
+
+
+
+
+ Notification Preferences & Alert Rules
+
+
+ Configure webhook endpoints, email digests, and threshold alerts for agent budget exhaustion or policy breaches.
+
+
+
+
+ {/* Alert Categories Section */}
+
+
+
+
+ Alert Categories
+
+
+ {alertRules.filter((r) => r.enabled).length} Active
+
+
+
+
+ {ALERT_CATEGORIES.map((alertDef) => {
+ const rule = alertRules.find((r) => r.category === alertDef.category);
+ const isEnabled = rule?.enabled ?? false;
+ const threshold = rule?.threshold;
+
+ return (
+
+
+
{alertDef.icon}
+
+
+ {alertDef.label}
+
+ {alertDef.severity}
+
+
+
{alertDef.description}
+
+
+
+
+ {/* Threshold input for budget-related alerts */}
+ {(alertDef.category === 'budget_warning' || alertDef.category === 'budget_exhaustion') && (
+
+
+ {
+ if (rule) {
+ updateAlertRule(rule.id, {
+ threshold: Math.min(100, Math.max(0, parseInt(e.target.value) || 0)),
+ });
+ }
+ }}
+ className="w-16 rounded-button border border-border bg-surface px-2 py-1 text-xs text-foreground text-center focus:border-gold focus:outline-none"
+ disabled={!isEnabled}
+ />
+ %
+
+ )}
+
+ {/* Toggle switch */}
+
+
+
+ );
+ })}
+
+
+
+ {/* Webhook Endpoints Section */}
+
+
+
+
+ Webhook Endpoints
+
+
+
+
+
+ {webhookEndpoints.length === 0 ? (
+
+
+
No webhook endpoints configured
+
Add a webhook to receive real-time notifications
+
+ ) : (
+
+ {webhookEndpoints.map((webhook) => (
+
+
+
+ {webhook.name}
+
+ {webhook.isActive ? 'Active' : 'Inactive'}
+
+ {webhook.lastTestStatus && (
+
+ {webhook.lastTestStatus === 'success' && }
+ {webhook.lastTestStatus === 'failed' && }
+ {webhook.lastTestStatus === 'pending' && }
+ {webhook.lastTestStatus}
+
+ )}
+
+
{webhook.url}
+
+
+
+
+
+
+
+
+
+
+ ))}
+
+ )}
+
+
+
+ {/* Email Digest Configuration */}
+
+
+
+
+ Email Digest Configuration
+
+
+
+
+
+ {/* Enable/disable email digest */}
+
+
+
Enable Email Digest
+
Receive summarized notifications via email
+
+
+
+
+ {/* Frequency selection */}
+ {emailDigest.enabled && (
+
+
+
+
+ )}
+
+ {/* Email recipients list */}
+ {emailDigest.enabled && emailDigest.recipients.length > 0 && (
+
+
+
+ {emailDigest.recipients.map((email) => (
+
+ {email}
+
+
+ ))}
+
+
+ )}
+
+ {/* Include summary toggle */}
+ {emailDigest.enabled && (
+
+
+
Include Summary
+
Include a digest summary in each email
+
+
+
+ )}
+
+
+
+ {/* In-App Notification Settings */}
+
+
+
+
+ In-App Notification Settings
+
+
+
+
+ {/* Enable in-app notifications */}
+
+
+
Enable In-App Notifications
+
Show notifications within the application
+
+
+
+
+ {/* Sound notifications */}
+ {inAppNotifications.enabled && (
+
+
+
Notification Sound
+
Play a sound when notifications arrive
+
+
+
+ )}
+
+ {/* Desktop notifications */}
+ {inAppNotifications.enabled && (
+
+
+
Desktop Notifications
+
Show browser desktop notifications
+
+
+
+ )}
+
+
+
+ {/* Add Webhook Modal */}
+ {isAddWebhookOpen && (
+
+ )}
+
+ {/* Add Email Recipient Modal */}
+ {isAddEmailOpen && (
+
+ )}
+
+ );
+}