@aglyn/aglyn 1.0.0-beta.277 → 1.0.0-beta.282

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/package.json +11 -11
  2. package/src/lib/app-utils/account-preferences.d.ts +146 -11
  3. package/src/lib/app-utils/account-preferences.js +266 -18
  4. package/src/lib/app-utils/account-preferences.js.map +1 -1
  5. package/src/lib/app-utils/activity-presenter.js +2 -26
  6. package/src/lib/app-utils/activity-presenter.js.map +1 -1
  7. package/src/lib/app-utils/activity-type-labels.d.ts +18 -0
  8. package/src/lib/app-utils/activity-type-labels.js +46 -0
  9. package/src/lib/app-utils/activity-type-labels.js.map +1 -0
  10. package/src/lib/app-utils/artifact-provenance.d.ts +3 -1
  11. package/src/lib/app-utils/artifact-provenance.js.map +1 -1
  12. package/src/lib/app-utils/bundle-intent.d.ts +37 -0
  13. package/src/lib/app-utils/bundle-intent.js +47 -3
  14. package/src/lib/app-utils/bundle-intent.js.map +1 -1
  15. package/src/lib/app-utils/compose-reusable-components.d.ts +17 -1
  16. package/src/lib/app-utils/compose-reusable-components.js +80 -5
  17. package/src/lib/app-utils/compose-reusable-components.js.map +1 -1
  18. package/src/lib/app-utils/docs-help-sections.generated.js +13 -1
  19. package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
  20. package/src/lib/app-utils/docs-help.generated.d.ts +23 -11
  21. package/src/lib/app-utils/docs-help.generated.js +64 -7
  22. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  23. package/src/lib/app-utils/docs-index.generated.js +357 -49
  24. package/src/lib/app-utils/docs-index.generated.js.map +1 -1
  25. package/src/lib/app-utils/health-report.d.ts +3 -2
  26. package/src/lib/app-utils/health-report.js +22 -2
  27. package/src/lib/app-utils/health-report.js.map +1 -1
  28. package/src/lib/app-utils/native-nav.d.ts +39 -4
  29. package/src/lib/app-utils/native-nav.js +69 -3
  30. package/src/lib/app-utils/native-nav.js.map +1 -1
  31. package/src/lib/app-utils/native-themes.d.ts +28 -17
  32. package/src/lib/app-utils/native-themes.js +123 -45
  33. package/src/lib/app-utils/native-themes.js.map +1 -1
  34. package/src/lib/app-utils/operator-alerts.js +4 -2
  35. package/src/lib/app-utils/operator-alerts.js.map +1 -1
  36. package/src/lib/app-utils/org-permission-editor.d.ts +75 -0
  37. package/src/lib/app-utils/org-permission-editor.js +124 -0
  38. package/src/lib/app-utils/org-permission-editor.js.map +1 -0
  39. package/src/lib/app-utils/org-permissions.d.ts +36 -0
  40. package/src/lib/app-utils/org-permissions.js +78 -26
  41. package/src/lib/app-utils/org-permissions.js.map +1 -1
  42. package/src/lib/app-utils/org-role-grants.d.ts +59 -9
  43. package/src/lib/app-utils/org-role-grants.js +97 -10
  44. package/src/lib/app-utils/org-role-grants.js.map +1 -1
  45. package/src/lib/app-utils/plan-entitlements.d.ts +13 -0
  46. package/src/lib/app-utils/plan-entitlements.js +22 -0
  47. package/src/lib/app-utils/plan-entitlements.js.map +1 -1
  48. package/src/lib/app-utils/release-flags.d.ts +52 -1
  49. package/src/lib/app-utils/release-flags.js +68 -2
  50. package/src/lib/app-utils/release-flags.js.map +1 -1
  51. package/src/lib/app-utils/reusable-component-keys.d.ts +13 -0
  52. package/src/lib/app-utils/reusable-component-keys.js +12 -0
  53. package/src/lib/app-utils/reusable-component-keys.js.map +1 -1
  54. package/src/lib/app-utils/screen-analytics-aggregate.d.ts +34 -0
  55. package/src/lib/app-utils/screen-analytics-aggregate.js +37 -0
  56. package/src/lib/app-utils/screen-analytics-aggregate.js.map +1 -1
  57. package/src/lib/app-utils/site-care.d.ts +35 -0
  58. package/src/lib/app-utils/site-care.js +48 -0
  59. package/src/lib/app-utils/site-care.js.map +1 -1
  60. package/src/lib/app-utils/site-font-pairings.d.ts +59 -0
  61. package/src/lib/app-utils/site-font-pairings.js +514 -0
  62. package/src/lib/app-utils/site-font-pairings.js.map +1 -0
  63. package/src/lib/app-utils/site-starter.d.ts +136 -0
  64. package/src/lib/app-utils/site-starter.js +116 -0
  65. package/src/lib/app-utils/site-starter.js.map +1 -0
  66. package/src/lib/plugin-manager/feature-plugins.d.ts +32 -0
  67. package/src/lib/plugin-manager/feature-plugins.js +12 -0
  68. package/src/lib/plugin-manager/feature-plugins.js.map +1 -1
  69. package/src/lib/plugin-manager/first-party-plugins.generated.js +27 -1
  70. package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
  71. package/src/lib/plugin-manager/plugin-entitlements.d.ts +37 -0
  72. package/src/lib/plugin-manager/plugin-entitlements.js +84 -2
  73. package/src/lib/plugin-manager/plugin-entitlements.js.map +1 -1
  74. package/src/lib/plugin-manager/plugin-permissions.d.ts +7 -0
  75. package/src/lib/plugin-manager/plugin-permissions.js.map +1 -1
  76. package/src/lib/plugin-manager/plugin-product-catalog.d.ts +12 -0
  77. package/src/lib/plugin-manager/plugin-product-catalog.js.map +1 -1
  78. package/src/lib/plugin-manager/plugin-site-starters.d.ts +73 -0
  79. package/src/lib/plugin-manager/plugin-site-starters.js +30 -0
  80. package/src/lib/plugin-manager/plugin-site-starters.js.map +1 -0
  81. package/src/lib/plugin-manager/plugin-sitemap-sections.d.ts +8 -1
  82. package/src/lib/plugin-manager/plugin-sitemap-sections.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/operator-alerts.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { AglynNotificationType, NotificationLevel } from './notifications'\n\n/**\n * OPERATOR ALERTS (AGL-3377): the events whoever runs an install must hear\n * about, as one typed catalog.\n *\n * Every alert is an entry here (or a plugin's entry in the same shape,\n * registered through `@aglyn/aglyn/plugin-manager/operator-alerts`) and is\n * raised through ONE server entry point, `raiseOperatorAlert` in\n * `@aglyn/tenant-data-admin/server/operator-alerts`. That entry point writes\n * the staff console notification, dedupes a flapping condition, honours the\n * per-type switches staff set on Staff → Operator alerts, and delivers by\n * email (the `operator-alert` system email) and the optional out-of-band\n * webhook. No call site composes or sends its own mail.\n *\n * The catalog holds nothing install-specific: no address, no domain, no\n * host. Recipients come from `resolveStaffAlertRecipients()` and the webhook\n * from `OPERATOR_ALERT_WEBHOOK_URL`, so an entry reads the same on aglyn.com,\n * on a self-hosted install and in an OSS consumer's deployment.\n *\n * Copy is written against merge tokens (`{{orgId}}`), filled from the\n * `context` the call site passes. A token the call site did not supply is\n * blanked, so every sentence must still read when its optional tokens are\n * empty. Never put a data subject's address or other personal data into a\n * context: the alert travels to an inbox and a webhook, not only the console.\n */\n\n/**\n * How much an alert matters.\n *\n * - `must` — money moving with nobody looking, a legal duty unmet, data not\n * protected or not erased. On and immediate unless staff change it.\n * - `should` — a fault an operator wants to know about today.\n * - `low` — routine review work; on, and batched into the daily digest.\n */\nexport type OperatorAlertTier = 'must' | 'should' | 'low'\n\nexport type OperatorAlertCategory =\n | 'billing'\n | 'payments'\n | 'legal'\n | 'data'\n | 'ops'\n | 'deliverability'\n | 'security'\n | 'support'\n\n/** `digest` batches the alert into the once-a-day operator digest. */\nexport type OperatorAlertDelivery = 'immediate' | 'digest'\n\nexport interface OperatorAlertDefinition {\n /**\n * Stable id, also the key of its settings row. Never rename: staff\n * switches are stored under it. A plugin's types start with its plugin id\n * and a dot (`commerce.taxNotReversed`).\n */\n type: string\n /** The settings row's name. */\n label: string\n /** What it means and the first thing to do, for the settings page. */\n description: string\n tier: OperatorAlertTier\n category: OperatorAlertCategory\n /** The notification title and email subject, with `{{tokens}}`. */\n title: string\n /** What happened and what to do, with `{{tokens}}`. */\n body: string\n /** Console path the alert opens, with `{{tokens}}`; the call may override. */\n link?: string\n /** The coded default; staff may change it. */\n delivery: OperatorAlertDelivery\n /**\n * How long one `dedupeKey` stays quiet after it fired, in minutes. A\n * condition that flaps inside the window is told once. `0` never dedupes.\n * A call without a `dedupeKey` is never deduped.\n */\n dedupeWindowMinutes: number\n /**\n * Fire only once the same `dedupeKey` has been raised this many times\n * inside the window — for an endpoint any stranger can hit, where one\n * refused request is noise and several are a broken secret. Default 1.\n */\n minOccurrences?: number\n /** The coded default; staff may change it. */\n defaultEnabled: boolean\n /**\n * The console notification's type. Absent is the generic\n * `system.operatorAlert`; a type that already had its own notification\n * keeps it, so its icon, label and everyone's mutes are unchanged.\n */\n notificationType?: AglynNotificationType\n /**\n * How loud its console notification is drawn (AGL-3437). Absent, the\n * tier answers — see {@link operatorAlertLevel}. Set where the tone and\n * the importance part ways: a recovery is worth hearing about and is good\n * news, and a degraded check is a must-know that is not yet an outage.\n */\n level?: NotificationLevel\n /** The plugin that contributed it; absent for core's own. */\n pluginId?: string\n}\n\n/** Values a call site passes for an alert's `{{tokens}}`. */\nexport type OperatorAlertContext = Readonly<\n Record<string, string | number | boolean | null | undefined>\n>\n\n/** The notification type an alert without its own writes under. */\nexport const OPERATOR_ALERT_DEFAULT_NOTIFICATION_TYPE: AglynNotificationType =\n 'system.operatorAlert'\n\nexport const OPERATOR_ALERT_TIER_LABELS: Record<OperatorAlertTier, string> = {\n must: 'Must know',\n should: 'Should know',\n low: 'Routine',\n}\n\n/**\n * The level an alert's notification is drawn at when its entry names none:\n * a must-know is red, a should-know amber, routine review work informational.\n */\nexport const OPERATOR_ALERT_TIER_LEVELS: Record<\n OperatorAlertTier,\n NotificationLevel\n> = {\n must: 'critical',\n should: 'warning',\n low: 'info',\n}\n\n/** The level an alert's console notification carries (AGL-3437). */\nexport function operatorAlertLevel(\n definition: Pick<OperatorAlertDefinition, 'tier' | 'level'>,\n): NotificationLevel {\n return definition.level ?? OPERATOR_ALERT_TIER_LEVELS[definition.tier]\n}\n\nexport const OPERATOR_ALERT_CATEGORY_LABELS: Record<\n OperatorAlertCategory,\n string\n> = {\n billing: 'Billing',\n payments: 'Payments & payouts',\n legal: 'Legal',\n data: 'Data protection',\n ops: 'Operations',\n deliverability: 'Email deliverability',\n security: 'Security',\n support: 'Support',\n}\n\nconst DAY = 24 * 60\n\n/**\n * Core's alerts. Plugins contribute theirs through the plugin-manager\n * registry; nothing plugin-specific belongs in this list.\n */\nexport const CORE_OPERATOR_ALERTS: readonly OperatorAlertDefinition[] = [\n // ── Fraud, risk and legal duties already alerting before AGL-3377 ──────\n {\n type: 'system.abuseReportUrgent',\n label: 'Urgent abuse, fraud or risk alert',\n description:\n 'Phishing, malware or CSAM reported on a site, card testing, a flagged or disputed payment, a held phishing email, a seller under review. Review it on Staff → Abuse reports.',\n tier: 'must',\n category: 'security',\n title: '{{title}}',\n body: '{{body}}',\n link: '/admin/abuse-reports',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'system.abuseReportUrgent',\n },\n {\n // The one lock no person placed (AGL-3450): staff confirm it before the\n // customer's appeal arrives, and re-place it as `abuse` or lift it.\n type: 'security.pageSecurityHold',\n label: 'Automatic security hold on a new workspace',\n description:\n 'The page screen held a phishing page from a workspace in its first two weeks and locked the workspace, the site and the publishing account as security. Confirm it on Staff → Abuse reports, then re-place it as abuse on Staff → Lockdown, or lift it there if it is a false positive.',\n tier: 'must',\n category: 'security',\n title: 'Security hold placed on {{orgName}}',\n body:\n '{{page}} on {{siteName}} ({{hostId}}) was held for review: {{signal}} Locked as security, pending your review: {{locks}}. The abuse row is {{reference}}. Lift the hold, or re-place it as abuse, on Staff → Lockdown (/admin/lockdown).',\n link: '/admin/abuse-reports?report={{reviewId}}',\n delivery: 'immediate',\n // One hold per workspace; a repeat inside the day is the same event.\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n notificationType: 'system.abuseReportUrgent',\n },\n {\n type: 'security.paymentFraudHold',\n label: 'Automatic security hold for payment fraud',\n description:\n 'Stripe flagged a workspace\\'s own subscription payment as fraud — a Radar block at highest risk, a Stripe fraud report, three or more cards failing within 30 minutes, an early fraud warning or a Radar review. A new workspace that never paid is locked as security (takedown) with its subscriptions canceled; an older or paying one is not locked and needs a decision. Confirm it on Staff → Abuse reports, then re-place it as abuse on Staff → Lockdown, or lift it there.',\n tier: 'must',\n category: 'security',\n title: '{{action}}: {{orgName}}',\n body:\n '{{trigger}} on {{orgName}} ({{orgId}}). Charges: {{charges}}; cards: {{cards}}, issued in {{cardCountries}}. Locked: {{locks}}. The abuse row is {{reference}}. Lift it, or re-place it as abuse, on Staff → Lockdown (/admin/lockdown).',\n link: '/admin/abuse-reports?report={{reviewId}}',\n delivery: 'immediate',\n // One per workspace per window: every further card in the burst is the\n // same event, and the abuse row carries all of them.\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n notificationType: 'system.abuseReportUrgent',\n },\n {\n type: 'system.disputeUnattributed',\n label: 'Card dispute with no owner',\n description:\n 'A chargeback arrived that no subscription, order or marketplace purchase claimed, so nothing is answering it. Find the charge in Stripe and respond before the evidence deadline.',\n tier: 'must',\n category: 'billing',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'system.disputeUnattributed',\n },\n {\n type: 'system.dmcaCounterNotice',\n label: 'DMCA counter-notice',\n description:\n 'A customer contested a takedown. The statutory clock is already running; forward it to the complainant and restore on time unless they file suit.',\n tier: 'must',\n category: 'legal',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'system.dmcaCounterNotice',\n },\n {\n type: 'system.billingWebhookHalfApplied',\n label: 'Billing webhook half applied',\n description:\n 'A Stripe event threw after its handlers began, so its effects may be partly applied and Stripe will not retry it. Reconcile the event by hand.',\n tier: 'must',\n category: 'billing',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'system.billingWebhookHalfApplied',\n },\n\n // ── MUST: billing ───────────────────────────────────────────────────────\n {\n type: 'billing.platformDisputeLost',\n label: 'Subscription dispute lost',\n description:\n 'A card dispute on a workspace subscription closed as lost: the money has been taken back. Decide whether the workspace keeps its plan.',\n tier: 'must',\n category: 'billing',\n title: 'Subscription dispute lost on workspace {{orgId}}',\n body:\n 'The card dispute {{disputeId}} on invoice {{invoiceId}} for workspace {{orgName}} ({{orgId}}) closed as lost ({{reason}}), and {{amount}} was taken back. The workspace keeps its plan until somebody decides otherwise.',\n link: '/admin/orgs/{{orgId}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n },\n {\n type: 'billing.orphanedSubscription',\n label: 'Stripe is billing a workspace that does not exist',\n description:\n 'A subscription names a workspace that was deleted or erased, so the customer keeps being charged for nothing. Cancel or refund it in Stripe.',\n tier: 'must',\n category: 'billing',\n title: 'Subscription bills a missing workspace',\n body:\n 'Stripe subscription {{subscriptionId}} (customer {{customerId}}, plan {{plan}}) names workspace {{orgId}}, which {{reason}}. The {{eventType}} event changed nothing. Cancel or refund it in Stripe.',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'billing.usageNotReported',\n label: 'Metered usage not reported to Stripe',\n description:\n 'A closed month measured billable usage and it reached no invoice. Report it to Stripe by hand or the revenue is lost.',\n tier: 'must',\n category: 'billing',\n title: 'Usage for {{month}} not billed on {{orgId}}',\n body:\n 'The closed month {{month}} measured {{amount}} of billable usage on workspace {{orgName}} ({{orgId}}), and it was not reported to Stripe ({{reason}}). Nothing will invoice it until somebody does.',\n link: '/admin/orgs/{{orgId}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 7 * DAY,\n defaultEnabled: true,\n },\n {\n // The scheduled reconciliation of Site Care extra time (AGL-3959): a\n // request's billed hours and the Stripe invoice item that carries them\n // disagree, or one exists without the other. Should know, not must:\n // nothing is lost yet, the next invoice has not gone, and the fix is on\n // the request. The same check compares a flat-quoted project's\n // invoices (AGL-3970), whose findings arrive with `month` \"projects\".\n type: 'billing.siteCareReconciliation',\n label: 'Site Care billing does not match Stripe',\n description:\n 'A Site Care request’s billed hours, amount or line description disagree with its Stripe invoice item, a Stripe item has no request row behind it, a month’s total disagrees with its statement, or a project invoice’s status or amount disagrees with Stripe (or exists in Stripe with no project row). Open the workspace’s staff page and correct it from the request or the project — never by hand in Stripe.',\n tier: 'should',\n category: 'billing',\n title: 'Site Care billing mismatch on {{orgName}} ({{month}})',\n body:\n '{{count}} Site Care finding(s) on workspace {{orgName}} ({{orgId}}) for {{month}}: {{findings}} Fix it from the request on the staff organization page.',\n link: '/admin/orgs/{{orgId}}#site-care',\n delivery: 'immediate',\n // One alert a day per workspace and month: the same finding re-checked\n // tomorrow is the same news.\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'billing.webhookSignatureRejected',\n label: 'Billing webhook failing its signature check',\n description:\n 'Repeated deliveries to the billing webhook were refused because their signature did not match. Usually a rolled signing secret: until it is fixed, Stripe cannot tell the install about money.',\n tier: 'must',\n category: 'billing',\n title: 'Billing webhook is refusing deliveries',\n body:\n 'The billing webhook refused several signed deliveries within six hours because their Stripe signature matched none of the configured secrets. If Stripe is the sender, its signing secret no longer matches this install’s, and no billing event is being applied.',\n link: '/admin/health',\n delivery: 'immediate',\n dedupeWindowMinutes: 6 * 60,\n minOccurrences: 3,\n defaultEnabled: true,\n },\n {\n type: 'billing.webhookInert',\n label: 'Billing webhook delivery moved nothing',\n description:\n 'Stripe delivered an event this install subscribed to, and no handler did anything with it. Usually a handler that stopped being registered.',\n tier: 'must',\n category: 'billing',\n title: 'A {{eventType}} delivery changed nothing',\n body:\n 'Stripe event {{eventId}} ({{eventType}}) was accepted and no handler acted on it. Check which handler stopped being registered, then replay the event.',\n link: '/admin/health',\n delivery: 'immediate',\n dedupeWindowMinutes: 6 * 60,\n defaultEnabled: true,\n },\n\n // ── MUST: data protection and records ───────────────────────────────────\n {\n type: 'data.personErasureFailed',\n label: 'Personal data erasure failed',\n description:\n 'A data subject’s erasure request failed. It will be retried, but the legal deadline keeps running: read the error and fix the cause.',\n tier: 'must',\n category: 'data',\n title: 'Erasure request {{requestId}} failed',\n body:\n 'The erasure request {{requestId}} on workspace {{orgName}} ({{orgId}}) failed (attempt {{attempt}}): {{error}}. The statutory deadline keeps running while it retries.',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'data.orgErasureFailed',\n label: 'Workspace erasure failed',\n description:\n 'A workspace scheduled for erasure could not be erased. Its data is still held after the date it was promised gone.',\n tier: 'must',\n category: 'data',\n title: 'Workspace {{orgId}} could not be erased',\n body:\n 'The scheduled erasure of workspace {{orgName}} ({{orgId}}) did not complete: {{reason}}. It will be retried on the next run; its data is held until it succeeds.',\n link: '/admin/orgs/{{orgId}}',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'data.backupExportFailed',\n label: 'Database export failed',\n description:\n 'The scheduled database export did not start. A stale export means the worst day has nothing to restore from.',\n tier: 'must',\n category: 'data',\n title: 'Database export failed',\n body:\n 'The scheduled database export did not start ({{reason}}). The last good export is getting older; check the service account’s export permission and the bucket.',\n link: '/admin/health',\n delivery: 'immediate',\n dedupeWindowMinutes: 12 * 60,\n defaultEnabled: true,\n },\n\n // ── MUST: legal ─────────────────────────────────────────────────────────\n {\n type: 'legal.abuseReportHigh',\n label: 'Takedown, impersonation or illegal-content report',\n description:\n 'A DMCA takedown, impersonation or illegal-content report. Each carries a response duty; review it on Staff → Abuse reports.',\n tier: 'must',\n category: 'legal',\n title: '{{category}} report on {{site}}',\n body:\n '{{site}} was reported for {{category}}. Reference {{reference}}. Review it and respond within the policy’s window.',\n link: '/admin/abuse-reports',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n },\n\n // ── MUST/SHOULD: health ─────────────────────────────────────────────────\n {\n type: 'system.healthDegraded',\n label: 'Health check degraded',\n description:\n 'A health check went from healthy to degraded: scheduled jobs silent, backups stale, billing deliveries failing, sign-ups refused, server errors, a site not rendering. Told once per incident.',\n tier: 'must',\n category: 'ops',\n title: '{{check}} is degraded',\n body: '{{check}} went from healthy to degraded. {{detail}}',\n link: '/admin/health',\n delivery: 'immediate',\n // Must-know, and still amber rather than red: degraded is not down.\n level: 'warning',\n // A check flapping across the line is told once an hour, not on\n // every swing.\n dedupeWindowMinutes: 60,\n defaultEnabled: true,\n },\n {\n // The reminder the edge alert never sends (AGL-3860): raised by the\n // operator alerts tick at 1 h and every 2 h after while a check stays\n // degraded. The tick raises it as Must know from 2 h, so its level\n // follows the tier it was raised at rather than one coded here.\n type: 'system.healthStillDegraded',\n label: 'Health check still degraded',\n description:\n 'A health check has stayed degraded for an hour or more. Told at 1 h and again every 2 h until it recovers; Should know for the first reminder, Must know from 2 h on. Open the failing endpoint, read the failing check’s code and fix the cause, or the check when the check is what is wrong.',\n tier: 'should',\n category: 'ops',\n title: '{{check}} is still degraded after {{duration}}',\n body: '{{check}} is still degraded after {{duration}}. {{detail}}',\n link: '/admin/health',\n delivery: 'immediate',\n // The tick dedupes each reminder per check per step on the check's own\n // state; the window only stops a retried tick from telling one twice.\n dedupeWindowMinutes: 60,\n defaultEnabled: true,\n },\n {\n // The post-deploy production canary (AGL-3567), raised from GitHub\n // Actions through `/api/admin/operator-alerts/canary`. Red because a\n // deploy that stops rendering pages is every published site down.\n type: 'ops.productionCanaryRed',\n label: 'Production canary failed after a deploy',\n description:\n 'Right after a tenant or console production deploy, uncached pages stopped rendering. The canary rolls the deploy back by itself when the failure holds across sites; after any rollback the next release must be promoted by hand.',\n tier: 'must',\n category: 'ops',\n title: '{{project}} production canary: {{outcome}}',\n body: '{{detail}}',\n link: '/admin/health',\n delivery: 'immediate',\n level: 'critical',\n // The caller dedupes per deployment and verdict; this only stops a\n // re-run of the same red run from telling it twice.\n dedupeWindowMinutes: 30,\n defaultEnabled: true,\n },\n {\n type: 'system.healthRecovered',\n label: 'Health check recovered',\n description: 'A degraded health check is healthy again.',\n tier: 'should',\n category: 'ops',\n title: '{{check}} recovered',\n body: '{{check}} is healthy again after {{duration}}.',\n link: '/admin/health',\n delivery: 'immediate',\n level: 'success',\n // A check flapping across the line is told once an hour, not on\n // every swing.\n dedupeWindowMinutes: 60,\n defaultEnabled: true,\n },\n {\n // The render monitor (AGL-3568): a published site fetched over HTTP, on\n // pages no cache can answer, failed several runs in a row. Red, not the\n // amber of a degraded check: every visitor without a cached copy is\n // getting an error page or a timeout right now.\n type: 'system.siteRenderFailing',\n label: 'Published site not rendering pages',\n description:\n 'The render monitor asked a published site for pages no cache can answer, several runs in a row, and got no complete page back. Visitors to cached pages may still see them, so the site can look up while every other page fails. Check the latest site runtime deployment first and roll it back if it just shipped.',\n tier: 'must',\n category: 'ops',\n title: 'Pages are not rendering on {{site}}',\n body:\n '{{site}} failed {{failures}} render checks in a row, over {{since}}. {{detail}} Cached pages may still load, so the site can look up while new renders fail.',\n link: '/admin/health',\n delivery: 'immediate',\n // Told once per outage: the monitor raises it on the edge, and the\n // window only covers a site flapping across the line.\n dedupeWindowMinutes: 30,\n defaultEnabled: true,\n },\n {\n type: 'system.siteRenderRecovered',\n label: 'Published site rendering again',\n description:\n 'A published site the render monitor had reported as not rendering serves fresh pages again.',\n tier: 'should',\n category: 'ops',\n title: '{{site}} is rendering pages again',\n body: 'Fresh page renders on {{site}} pass again after {{duration}}.',\n link: '/admin/health',\n delivery: 'immediate',\n level: 'success',\n dedupeWindowMinutes: 30,\n defaultEnabled: true,\n },\n {\n // The render monitor could not see the site (AGL-3580): bot protection\n // answered every probe it made, so it knows nothing about whether pages\n // render. Not an outage, and never worded as one — on 2026-10-05 a\n // missing probe token read as \"pages are not rendering\" for three hours\n // while the site served pages. Amber: detection is off until it is fixed.\n type: 'system.renderMonitorBlind',\n label: 'Render monitor cannot see a site',\n description:\n 'Bot protection answered the render monitor instead of a published site, several runs in a row, so nothing is checking whether that site renders pages. The site itself may be fine. Check AGLYN_PROBE_TOKEN on the console and the \"CI and uptime probe bypass\" firewall rule on the site runtime.',\n tier: 'must',\n category: 'ops',\n title: 'The render monitor cannot see {{site}}',\n body:\n 'Bot protection answered instead of {{site}} for {{runs}} runs in a row, so nothing is checking its pages. {{detail}} This is not a verdict on the site.',\n link: '/admin/health',\n delivery: 'immediate',\n level: 'warning',\n dedupeWindowMinutes: 360,\n defaultEnabled: true,\n },\n\n // ── SHOULD: billing ─────────────────────────────────────────────────────\n {\n type: 'billing.autoLocked',\n label: 'Workspace billing locked automatically',\n description:\n 'A workspace crossed its spend guard and the platform locked its billable activity. Check it is not a false positive before the customer notices.',\n tier: 'should',\n category: 'billing',\n title: 'Billing locked on {{orgName}}',\n body:\n 'Workspace {{orgName}} ({{orgId}}) was locked automatically: {{reason}}.',\n link: '/admin/orgs/{{orgId}}',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'billing.platformInvoiceUncollectible',\n label: 'Subscription invoice voided or uncollectible',\n description:\n 'A workspace invoice was voided or marked uncollectible: revenue the books expected is not coming.',\n tier: 'should',\n category: 'billing',\n title: 'Invoice {{status}} on {{orgId}}',\n body:\n 'Invoice {{invoiceId}} for {{amount}} on workspace {{orgName}} ({{orgId}}) was marked {{status}}, so Stripe has stopped collecting it.',\n link: '/admin/orgs/{{orgId}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n },\n {\n type: 'billing.connectPayoutFailed',\n label: 'Connected account payout or transfer failed',\n description:\n 'Money due to a merchant or seller did not arrive. Stripe retries on its own schedule; a human decides what happens next.',\n tier: 'should',\n category: 'billing',\n title: 'A {{kind}} to {{account}} failed',\n body:\n 'A {{amount}} Stripe {{kind}} ({{stripeId}}) to connected account {{account}} ({{merchant}}) failed: {{reason}}. The merchant’s funds are not where the ledger says.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n },\n {\n type: 'staff.paymentFailed',\n label: 'Workspace payment failed',\n description:\n 'A paying workspace’s renewal failed. Stripe is retrying; the customer has been told.',\n tier: 'should',\n category: 'billing',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'staff.paymentFailed',\n },\n\n // ── SHOULD: security ────────────────────────────────────────────────────\n {\n type: 'security.staffGranted',\n label: 'Staff access granted or raised',\n description:\n 'Somebody was made staff, or a staff role was raised. If nobody on the team did it, revoke it and rotate credentials.',\n tier: 'should',\n category: 'security',\n title: '{{target}} is now {{role}} staff',\n body: '{{actor}} granted {{target}} the {{role}} staff role (was {{previous}}).',\n link: '/admin/users',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n },\n\n // ── SHOULD: support ─────────────────────────────────────────────────────\n {\n type: 'support.slaBreached',\n label: 'Support ticket past its response time',\n description:\n 'A support ticket passed its promised response time without a staff reply.',\n tier: 'should',\n category: 'support',\n title: 'Ticket past its response time: {{subject}}',\n body:\n 'The {{tier}} ticket “{{subject}}” from workspace {{orgName}} ({{orgId}}) was due a first response {{overdue}} ago and has none.',\n // The ticket itself: the support page opens `?ticketId=` on load.\n link: '/admin/support?ticketId={{ticketId}}',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'support.ticketOpened',\n label: 'New support ticket',\n description: 'A subscriber opened a support ticket.',\n tier: 'should',\n category: 'support',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'digest',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'support.ticketOpened',\n // A customer asking for help, not a fault.\n level: 'info',\n },\n {\n type: 'support.ticketReply',\n label: 'Support ticket reply',\n description: 'A subscriber replied on a support ticket.',\n tier: 'should',\n category: 'support',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'digest',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'support.ticketReply',\n level: 'info',\n },\n\n // ── SHOULD: deliverability ──────────────────────────────────────────────\n {\n type: 'deliverability.sendRateSaturated',\n label: 'Email send-rate governor saturated',\n description:\n 'The platform’s email send-rate budget is exhausted, so sends are being deferred. Raise the budget or find the sender filling it.',\n tier: 'should',\n category: 'deliverability',\n title: 'Email sending is being throttled',\n body:\n 'The {{scope}} send-rate budget is full ({{detail}}), so sends are being deferred.',\n link: '/admin/emails',\n delivery: 'immediate',\n dedupeWindowMinutes: 6 * 60,\n defaultEnabled: true,\n },\n {\n type: 'deliverability.sendRateUnavailable',\n label: 'Email send-rate governor unavailable',\n description:\n 'The send-rate governor could not read its counters, so mail is going out unmetered: nothing is holding the shared domains under their hourly ceiling.',\n tier: 'should',\n category: 'deliverability',\n title: 'Email send-rate governor unavailable',\n body:\n 'The send-rate governor could not read its counters ({{error}}), so sends are being allowed unmetered until it can.',\n link: '/admin/emails',\n delivery: 'immediate',\n dedupeWindowMinutes: 6 * 60,\n defaultEnabled: true,\n },\n {\n type: 'deliverability.gatewayBlocking',\n label: 'A recipient gateway is blocking the shared domain',\n description:\n 'A mail gateway is refusing mail from the shared sending domain, so everyone behind that gateway stops receiving it.',\n tier: 'should',\n category: 'deliverability',\n title: '{{gateway}} is blocking {{domain}}',\n body:\n 'Mail from {{domain}} is being refused by {{gateway}} ({{detail}}). Recipients behind that gateway are not receiving it.',\n link: '/admin/emails',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'deliverability.providerCredentialsRejected',\n label: 'Email provider rejected the credentials',\n description:\n 'The email provider refused the API key, or a sending pool is unhealthy: invites, password resets and receipts are not leaving. The webhook channel is the one that still reaches you.',\n tier: 'should',\n category: 'deliverability',\n title: 'Email delivery is failing: {{problem}}',\n body: '{{detail}}',\n link: '/admin/emails',\n delivery: 'immediate',\n dedupeWindowMinutes: 6 * 60,\n defaultEnabled: true,\n },\n {\n // A purchasing ceiling, not a job failure: the provisioning sweep ran\n // and every site keeps sending, so the copy must not read as an outage.\n type: 'deliverability.sendingDomainCapacityFull',\n label: 'Sending-domain allowance full',\n description:\n 'Every dedicated sending domain the provider allowance covers is in use, so new sites that ask for one stay on the shared pool. No mail is lost; raise the allowance or move merchants onto domains they own.',\n tier: 'should',\n category: 'deliverability',\n title: 'Sending-domain allowance full ({{held}}/{{capacity}})',\n body:\n 'The sending-domain allowance is full ({{held}} of {{capacity}} in use), so sites that asked for a dedicated domain keep sending on the shared pool. No mail is lost: what they go without is the isolation a domain of their own buys, and their campaigns are held to the pool’s stricter reputation limits. Raise AGLYN_SENDING_DOMAIN_CAPACITY once the provider allowance covers it, or move merchants onto domains they own.',\n link: '/admin/emails',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n\n // ── SHOULD: operations ──────────────────────────────────────────────────\n {\n type: 'ops.reaperStuck',\n label: 'A reaper is stuck or failing',\n description:\n 'A cleanup job (sending domains, unverified workspaces) could not finish, so what it removes keeps accumulating.',\n tier: 'should',\n category: 'ops',\n title: '{{job}} is stuck',\n body: '{{job}} could not finish: {{detail}}',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'ops.pluginJobFailed',\n label: 'A plugin job failed',\n description:\n 'A plugin’s scheduled job threw: consent-group changes, the publish outbox, sending-domain provisioning, a plugin cron.',\n tier: 'should',\n category: 'ops',\n // `job` is a noun phrase that reads as a subject on its own (\"The\n // publish outbox drain\", \"The scheduled job acme-mail-send\"), so the\n // title and the body open with the same words.\n title: '{{job}} failed',\n body: '{{job}} failed: {{error}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 6 * 60,\n defaultEnabled: true,\n },\n {\n // Nightly, so once a day per provider is every run it could report.\n type: 'ops.adAudienceSyncFailed',\n label: 'Ad audience sync failed',\n description:\n 'The nightly account-holder audience sync (AGL-3780) could not update a Meta, Google or LinkedIn audience, or held a run whose audience would have shrunk by more than half. The audience keeps what it last had; check the provider credentials, or run the sync with force once the drop is confirmed.',\n tier: 'should',\n category: 'ops',\n title: 'Ad audience sync: {{provider}} not updated',\n body: 'The {{provider}} account-holder audience was not updated: {{detail}}. It keeps what it was last sent, and the next nightly run tries again.',\n link: '/admin/flags',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'system.pluginVerifierRegression',\n label: 'Plugin verifier regression',\n description:\n 'A live plugin version stopped passing the static verifier.',\n tier: 'should',\n category: 'security',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'system.pluginVerifierRegression',\n },\n {\n type: 'system.bandwidthCeilingTripped',\n label: 'Bandwidth ceiling reached',\n description:\n 'A site crossed the per-month bandwidth abuse ceiling.',\n tier: 'should',\n category: 'ops',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'system.bandwidthCeilingTripped',\n },\n\n // ── LOW ─────────────────────────────────────────────────────────────────\n {\n type: 'marketplace.review',\n label: 'Plugin listing waiting for review',\n description: 'A plugin listing or version was submitted for review.',\n tier: 'low',\n category: 'security',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'digest',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'marketplace.review',\n },\n {\n type: 'system.scopeDrift',\n label: 'Resources missing a sharing scope',\n description:\n 'The weekly sweep found documents invisible to every site-scoped read: a creation path forgot the field.',\n tier: 'low',\n category: 'data',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'digest',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'system.scopeDrift',\n },\n]\n\n/** An amount in minor units, as an alert prints it: `$12.40`. */\nexport function formatOperatorAlertAmount(\n cents: number,\n currency = 'usd',\n): string {\n const value = Number(cents) / 100\n if (!Number.isFinite(value)) return ''\n try {\n return new Intl.NumberFormat('en-US', {\n style: 'currency',\n currency: String(currency || 'usd').toUpperCase(),\n }).format(value)\n } catch {\n return `${value.toFixed(2)} ${String(currency).toUpperCase()}`\n }\n}\n\n/** Replaces each `{{token}}` with its context value, or nothing. */\nexport function renderOperatorAlertTemplate(\n template: string,\n context: OperatorAlertContext | undefined,\n): string {\n return String(template ?? '')\n .replace(/\\{\\{\\s*([\\w.]+)\\s*\\}\\}/g, (_match, name: string) => {\n const value = context?.[name]\n return value === null || value === undefined ? '' : String(value)\n })\n .replace(/\\(\\s*\\)/g, '')\n .replace(/[ \\t]{2,}/g, ' ')\n .replace(/ ([.,;:])/g, '$1')\n .trim()\n}\n\n/** A staff member's answer for one type; an absent key keeps the default. */\nexport interface OperatorAlertTypeSetting {\n enabled?: boolean\n delivery?: OperatorAlertDelivery\n}\n\n/** `platformSettings/operatorAlerts`, keyed by alert type. */\nexport interface OperatorAlertSettings {\n types?: Record<string, OperatorAlertTypeSetting>\n}\n\n/** Whether a type is on, and how it is delivered, after staff's answers. */\nexport function effectiveOperatorAlertSetting(\n definition: Pick<OperatorAlertDefinition, 'type' | 'delivery' | 'defaultEnabled'>,\n settings: OperatorAlertSettings | null | undefined,\n): { enabled: boolean; delivery: OperatorAlertDelivery } {\n const answer = settings?.types?.[definition.type]\n return {\n enabled:\n typeof answer?.enabled === 'boolean'\n ? answer.enabled\n : definition.defaultEnabled,\n delivery:\n answer?.delivery === 'immediate' || answer?.delivery === 'digest'\n ? answer.delivery\n : definition.delivery,\n }\n}\n\n/**\n * Staff notification types whose alert emails the operator on a coded\n * default of immediate (AGL-3375), derived from the catalog so there is one\n * list.\n */\nexport const OPERATOR_ALERT_NOTIFICATION_TYPES: ReadonlySet<string> = new Set(\n CORE_OPERATOR_ALERTS.flatMap((definition) =>\n definition.notificationType ? [definition.notificationType] : [],\n ),\n)\n"],"names":["OPERATOR_ALERT_DEFAULT_NOTIFICATION_TYPE","OPERATOR_ALERT_TIER_LABELS","must","should","low","OPERATOR_ALERT_TIER_LEVELS","operatorAlertLevel","definition","level","tier","OPERATOR_ALERT_CATEGORY_LABELS","billing","payments","legal","data","ops","deliverability","security","support","DAY","CORE_OPERATOR_ALERTS","type","label","description","category","title","body","link","delivery","dedupeWindowMinutes","defaultEnabled","notificationType","minOccurrences","formatOperatorAlertAmount","cents","currency","value","Number","isFinite","Intl","NumberFormat","style","String","toUpperCase","format","toFixed","renderOperatorAlertTemplate","template","context","replace","_match","name","undefined","trim","effectiveOperatorAlertSetting","settings","answer","types","enabled","OPERATOR_ALERT_NOTIFICATION_TYPES","Set","flatMap"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GA6GD,iEAAiE,GACjE,OAAO,MAAMA,2CACX,uBAAsB;AAExB,OAAO,MAAMC,6BAAgE;IAC3EC,MAAM;IACNC,QAAQ;IACRC,KAAK;AACP,EAAC;AAED;;;CAGC,GACD,OAAO,MAAMC,6BAGT;IACFH,MAAM;IACNC,QAAQ;IACRC,KAAK;AACP,EAAC;AAED,kEAAkE,GAClE,OAAO,SAASE,mBACdC,UAA2D;QAEpDA;IAAP,QAAOA,oBAAAA,WAAWC,KAAK,YAAhBD,oBAAoBF,0BAA0B,CAACE,WAAWE,IAAI,CAAC;AACxE;AAEA,OAAO,MAAMC,iCAGT;IACFC,SAAS;IACTC,UAAU;IACVC,OAAO;IACPC,MAAM;IACNC,KAAK;IACLC,gBAAgB;IAChBC,UAAU;IACVC,SAAS;AACX,EAAC;AAED,MAAMC,MAAM,KAAK;AAEjB;;;CAGC,GACD,OAAO,MAAMC,uBAA2D;IACtE,0EAA0E;IAC1E;QACEC,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IACA;QACE,wEAAwE;QACxE,oEAAoE;QACpEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACV,qEAAqE;QACrEC,qBAAqBV;QACrBW,gBAAgB;QAChBC,kBAAkB;IACpB;IACA;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACV,uEAAuE;QACvE,qDAAqD;QACrDC,qBAAqBV;QACrBW,gBAAgB;QAChBC,kBAAkB;IACpB;IACA;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IACA;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IACA;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IAEA,2EAA2E;IAC3E;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,KAAKV;QAC1BW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFE,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,IAAIV;QACzBW,gBAAgB;IAClB;IACA;QACE,qEAAqE;QACrE,uEAAuE;QACvE,oEAAoE;QACpE,wEAAwE;QACxE,+DAA+D;QAC/D,sEAAsE;QACtET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACV,uEAAuE;QACvE,6BAA6B;QAC7BC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,IAAI;QACzBG,gBAAgB;QAChBF,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,IAAI;QACzBC,gBAAgB;IAClB;IAEA,2EAA2E;IAC3E;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFE,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,KAAK;QAC1BC,gBAAgB;IAClB;IAEA,2EAA2E;IAC3E;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;IAClB;IAEA,2EAA2E;IAC3E;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACV,oEAAoE;QACpEpB,OAAO;QACP,gEAAgE;QAChE,eAAe;QACfqB,qBAAqB;QACrBC,gBAAgB;IAClB;IACA;QACE,oEAAoE;QACpE,sEAAsE;QACtE,mEAAmE;QACnE,gEAAgE;QAChET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACV,uEAAuE;QACvE,sEAAsE;QACtEC,qBAAqB;QACrBC,gBAAgB;IAClB;IACA;QACE,mEAAmE;QACnE,qEAAqE;QACrE,kEAAkE;QAClET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACVpB,OAAO;QACP,mEAAmE;QACnE,oDAAoD;QACpDqB,qBAAqB;QACrBC,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aAAa;QACbd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACVpB,OAAO;QACP,gEAAgE;QAChE,eAAe;QACfqB,qBAAqB;QACrBC,gBAAgB;IAClB;IACA;QACE,wEAAwE;QACxE,wEAAwE;QACxE,oEAAoE;QACpE,gDAAgD;QAChDT,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACV,mEAAmE;QACnE,sDAAsD;QACtDC,qBAAqB;QACrBC,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACVpB,OAAO;QACPqB,qBAAqB;QACrBC,gBAAgB;IAClB;IACA;QACE,uEAAuE;QACvE,wEAAwE;QACxE,mEAAmE;QACnE,wEAAwE;QACxE,0EAA0E;QAC1ET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVpB,OAAO;QACPqB,qBAAqB;QACrBC,gBAAgB;IAClB;IAEA,2EAA2E;IAC3E;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,KAAKV;QAC1BW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFE,UAAU;QACVC,qBAAqB,KAAKV;QAC1BW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IAEA,2EAA2E;IAC3E;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;IAClB;IAEA,2EAA2E;IAC3E;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACF,kEAAkE;QAClEC,MAAM;QACNC,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aAAa;QACbd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;QAClB,2CAA2C;QAC3CvB,OAAO;IACT;IACA;QACEa,MAAM;QACNC,OAAO;QACPC,aAAa;QACbd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;QAClBvB,OAAO;IACT;IAEA,2EAA2E;IAC3E;QACEa,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,IAAI;QACzBC,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,IAAI;QACzBC,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACVC,qBAAqB,IAAI;QACzBC,gBAAgB;IAClB;IACA;QACE,sEAAsE;QACtE,wEAAwE;QACxET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IAEA,2EAA2E;IAC3E;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACV,kEAAkE;QAClE,qEAAqE;QACrE,+CAA+C;QAC/CC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB,IAAI;QACzBC,gBAAgB;IAClB;IACA;QACE,oEAAoE;QACpET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IACA;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IAEA,2EAA2E;IAC3E;QACEV,MAAM;QACNC,OAAO;QACPC,aAAa;QACbd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IACA;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;CACD,CAAA;AAED,+DAA+D,GAC/D,OAAO,SAASE,0BACdC,KAAa,EACbC,WAAW,KAAK;IAEhB,MAAMC,QAAQC,OAAOH,SAAS;IAC9B,IAAI,CAACG,OAAOC,QAAQ,CAACF,QAAQ,OAAO;IACpC,IAAI;QACF,OAAO,IAAIG,KAAKC,YAAY,CAAC,SAAS;YACpCC,OAAO;YACPN,UAAUO,OAAOP,YAAY,OAAOQ,WAAW;QACjD,GAAGC,MAAM,CAACR;IACZ,EAAE,eAAM;QACN,OAAO,GAAGA,MAAMS,OAAO,CAAC,GAAG,CAAC,EAAEH,OAAOP,UAAUQ,WAAW,IAAI;IAChE;AACF;AAEA,kEAAkE,GAClE,OAAO,SAASG,4BACdC,QAAgB,EAChBC,OAAyC;IAEzC,OAAON,OAAOK,mBAAAA,WAAY,IACvBE,OAAO,CAAC,2BAA2B,CAACC,QAAQC;QAC3C,MAAMf,QAAQY,2BAAAA,OAAS,CAACG,KAAK;QAC7B,OAAOf,UAAU,QAAQA,UAAUgB,YAAY,KAAKV,OAAON;IAC7D,GACCa,OAAO,CAAC,YAAY,IACpBA,OAAO,CAAC,cAAc,KACtBA,OAAO,CAAC,cAAc,MACtBI,IAAI;AACT;AAaA,0EAA0E,GAC1E,OAAO,SAASC,8BACd/C,UAAiF,EACjFgD,QAAkD;QAEnCA;IAAf,MAAMC,SAASD,6BAAAA,kBAAAA,SAAUE,KAAK,qBAAfF,eAAiB,CAAChD,WAAWc,IAAI,CAAC;IACjD,OAAO;QACLqC,SACE,QAAOF,0BAAAA,OAAQE,OAAO,MAAK,YACvBF,OAAOE,OAAO,GACdnD,WAAWuB,cAAc;QAC/BF,UACE4B,CAAAA,0BAAAA,OAAQ5B,QAAQ,MAAK,eAAe4B,CAAAA,0BAAAA,OAAQ5B,QAAQ,MAAK,WACrD4B,OAAO5B,QAAQ,GACfrB,WAAWqB,QAAQ;IAC3B;AACF;AAEA;;;;CAIC,GACD,OAAO,MAAM+B,oCAAyD,IAAIC,IACxExC,qBAAqByC,OAAO,CAAC,CAACtD,aAC5BA,WAAWwB,gBAAgB,GAAG;QAACxB,WAAWwB,gBAAgB;KAAC,GAAG,EAAE,GAEnE"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/operator-alerts.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { AglynNotificationType, NotificationLevel } from './notifications'\n\n/**\n * OPERATOR ALERTS (AGL-3377): the events whoever runs an install must hear\n * about, as one typed catalog.\n *\n * Every alert is an entry here (or a plugin's entry in the same shape,\n * registered through `@aglyn/aglyn/plugin-manager/operator-alerts`) and is\n * raised through ONE server entry point, `raiseOperatorAlert` in\n * `@aglyn/tenant-data-admin/server/operator-alerts`. That entry point writes\n * the staff console notification, dedupes a flapping condition, honours the\n * per-type switches staff set on Staff → Operator alerts, and delivers by\n * email (the `operator-alert` system email) and the optional out-of-band\n * webhook. No call site composes or sends its own mail.\n *\n * The catalog holds nothing install-specific: no address, no domain, no\n * host. Recipients come from `resolveStaffAlertRecipients()` and the webhook\n * from `OPERATOR_ALERT_WEBHOOK_URL`, so an entry reads the same on aglyn.com,\n * on a self-hosted install and in an OSS consumer's deployment.\n *\n * Copy is written against merge tokens (`{{orgId}}`), filled from the\n * `context` the call site passes. A token the call site did not supply is\n * blanked, so every sentence must still read when its optional tokens are\n * empty. Never put a data subject's address or other personal data into a\n * context: the alert travels to an inbox and a webhook, not only the console.\n */\n\n/**\n * How much an alert matters.\n *\n * - `must` — money moving with nobody looking, a legal duty unmet, data not\n * protected or not erased. On and immediate unless staff change it.\n * - `should` — a fault an operator wants to know about today.\n * - `low` — routine review work; on, and batched into the daily digest.\n */\nexport type OperatorAlertTier = 'must' | 'should' | 'low'\n\nexport type OperatorAlertCategory =\n | 'billing'\n | 'payments'\n | 'legal'\n | 'data'\n | 'ops'\n | 'deliverability'\n | 'security'\n | 'support'\n\n/** `digest` batches the alert into the once-a-day operator digest. */\nexport type OperatorAlertDelivery = 'immediate' | 'digest'\n\nexport interface OperatorAlertDefinition {\n /**\n * Stable id, also the key of its settings row. Never rename: staff\n * switches are stored under it. A plugin's types start with its plugin id\n * and a dot (`commerce.taxNotReversed`).\n */\n type: string\n /** The settings row's name. */\n label: string\n /** What it means and the first thing to do, for the settings page. */\n description: string\n tier: OperatorAlertTier\n category: OperatorAlertCategory\n /** The notification title and email subject, with `{{tokens}}`. */\n title: string\n /** What happened and what to do, with `{{tokens}}`. */\n body: string\n /** Console path the alert opens, with `{{tokens}}`; the call may override. */\n link?: string\n /** The coded default; staff may change it. */\n delivery: OperatorAlertDelivery\n /**\n * How long one `dedupeKey` stays quiet after it fired, in minutes. A\n * condition that flaps inside the window is told once. `0` never dedupes.\n * A call without a `dedupeKey` is never deduped.\n */\n dedupeWindowMinutes: number\n /**\n * Fire only once the same `dedupeKey` has been raised this many times\n * inside the window — for an endpoint any stranger can hit, where one\n * refused request is noise and several are a broken secret. Default 1.\n */\n minOccurrences?: number\n /** The coded default; staff may change it. */\n defaultEnabled: boolean\n /**\n * The console notification's type. Absent is the generic\n * `system.operatorAlert`; a type that already had its own notification\n * keeps it, so its icon, label and everyone's mutes are unchanged.\n */\n notificationType?: AglynNotificationType\n /**\n * How loud its console notification is drawn (AGL-3437). Absent, the\n * tier answers — see {@link operatorAlertLevel}. Set where the tone and\n * the importance part ways: a recovery is worth hearing about and is good\n * news, and a degraded check is a must-know that is not yet an outage.\n */\n level?: NotificationLevel\n /** The plugin that contributed it; absent for core's own. */\n pluginId?: string\n}\n\n/** Values a call site passes for an alert's `{{tokens}}`. */\nexport type OperatorAlertContext = Readonly<\n Record<string, string | number | boolean | null | undefined>\n>\n\n/** The notification type an alert without its own writes under. */\nexport const OPERATOR_ALERT_DEFAULT_NOTIFICATION_TYPE: AglynNotificationType =\n 'system.operatorAlert'\n\nexport const OPERATOR_ALERT_TIER_LABELS: Record<OperatorAlertTier, string> = {\n must: 'Must know',\n should: 'Should know',\n low: 'Routine',\n}\n\n/**\n * The level an alert's notification is drawn at when its entry names none:\n * a must-know is red, a should-know amber, routine review work informational.\n */\nexport const OPERATOR_ALERT_TIER_LEVELS: Record<\n OperatorAlertTier,\n NotificationLevel\n> = {\n must: 'critical',\n should: 'warning',\n low: 'info',\n}\n\n/** The level an alert's console notification carries (AGL-3437). */\nexport function operatorAlertLevel(\n definition: Pick<OperatorAlertDefinition, 'tier' | 'level'>,\n): NotificationLevel {\n return definition.level ?? OPERATOR_ALERT_TIER_LEVELS[definition.tier]\n}\n\nexport const OPERATOR_ALERT_CATEGORY_LABELS: Record<\n OperatorAlertCategory,\n string\n> = {\n billing: 'Billing',\n payments: 'Payments & payouts',\n legal: 'Legal',\n data: 'Data protection',\n ops: 'Operations',\n deliverability: 'Email deliverability',\n security: 'Security',\n support: 'Support',\n}\n\nconst DAY = 24 * 60\n\n/**\n * Core's alerts. Plugins contribute theirs through the plugin-manager\n * registry; nothing plugin-specific belongs in this list.\n */\nexport const CORE_OPERATOR_ALERTS: readonly OperatorAlertDefinition[] = [\n // ── Fraud, risk and legal duties already alerting before AGL-3377 ──────\n {\n type: 'system.abuseReportUrgent',\n label: 'Urgent abuse, fraud or risk alert',\n description:\n 'Phishing, malware or CSAM reported on a site, card testing, a flagged or disputed payment, a held phishing email, a seller under review. Review it on Staff → Abuse reports.',\n tier: 'must',\n category: 'security',\n title: '{{title}}',\n body: '{{body}}',\n link: '/admin/abuse-reports',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'system.abuseReportUrgent',\n },\n {\n // The one lock no person placed (AGL-3450): staff confirm it before the\n // customer's appeal arrives, and re-place it as `abuse` or lift it.\n type: 'security.pageSecurityHold',\n label: 'Automatic security hold on a new workspace',\n description:\n 'The page screen held a phishing page from a workspace in its first two weeks and locked the workspace, the site and the publishing account as security. Confirm it on Staff → Abuse reports, then re-place it as abuse on Staff → Lockdown, or lift it there if it is a false positive.',\n tier: 'must',\n category: 'security',\n title: 'Security hold placed on {{orgName}}',\n body:\n '{{page}} on {{siteName}} ({{hostId}}) was held for review: {{signal}} Locked as security, pending your review: {{locks}}. The abuse row is {{reference}}. Lift the hold, or re-place it as abuse, on Staff → Lockdown (/admin/lockdown).',\n link: '/admin/abuse-reports?report={{reviewId}}',\n delivery: 'immediate',\n // One hold per workspace; a repeat inside the day is the same event.\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n notificationType: 'system.abuseReportUrgent',\n },\n {\n type: 'security.paymentFraudHold',\n label: 'Automatic security hold for payment fraud',\n description:\n 'Stripe flagged a workspace\\'s own subscription payment as fraud — a Radar block at highest risk, a Stripe fraud report, three or more cards failing within 30 minutes, an early fraud warning or a Radar review. A new workspace that never paid is locked as security (takedown) with its subscriptions canceled; an older or paying one is not locked and needs a decision. Confirm it on Staff → Abuse reports, then re-place it as abuse on Staff → Lockdown, or lift it there.',\n tier: 'must',\n category: 'security',\n title: '{{action}}: {{orgName}}',\n body:\n '{{trigger}} on {{orgName}} ({{orgId}}). Charges: {{charges}}; cards: {{cards}}, issued in {{cardCountries}}. Locked: {{locks}}. The abuse row is {{reference}}. Lift it, or re-place it as abuse, on Staff → Lockdown (/admin/lockdown).',\n link: '/admin/abuse-reports?report={{reviewId}}',\n delivery: 'immediate',\n // One per workspace per window: every further card in the burst is the\n // same event, and the abuse row carries all of them.\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n notificationType: 'system.abuseReportUrgent',\n },\n {\n type: 'system.disputeUnattributed',\n label: 'Card dispute with no owner',\n description:\n 'A chargeback arrived that no subscription, order or marketplace purchase claimed, so nothing is answering it. Find the charge in Stripe and respond before the evidence deadline.',\n tier: 'must',\n category: 'billing',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'system.disputeUnattributed',\n },\n {\n type: 'system.dmcaCounterNotice',\n label: 'DMCA counter-notice',\n description:\n 'A customer contested a takedown. The statutory clock is already running; forward it to the complainant and restore on time unless they file suit.',\n tier: 'must',\n category: 'legal',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'system.dmcaCounterNotice',\n },\n {\n type: 'system.billingWebhookHalfApplied',\n label: 'Billing webhook half applied',\n description:\n 'A Stripe event threw after its handlers began, so its effects may be partly applied and Stripe will not retry it. Reconcile the event by hand.',\n tier: 'must',\n category: 'billing',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'system.billingWebhookHalfApplied',\n },\n\n // ── MUST: billing ───────────────────────────────────────────────────────\n {\n type: 'billing.platformDisputeLost',\n label: 'Subscription dispute lost',\n description:\n 'A card dispute on a workspace subscription closed as lost: the money has been taken back. Decide whether the workspace keeps its plan.',\n tier: 'must',\n category: 'billing',\n title: 'Subscription dispute lost on workspace {{orgId}}',\n body:\n 'The card dispute {{disputeId}} on invoice {{invoiceId}} for workspace {{orgName}} ({{orgId}}) closed as lost ({{reason}}), and {{amount}} was taken back. The workspace keeps its plan until somebody decides otherwise.',\n link: '/admin/orgs/{{orgId}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n },\n {\n type: 'billing.orphanedSubscription',\n label: 'Stripe is billing a workspace that does not exist',\n description:\n 'A subscription names a workspace that was deleted or erased, so the customer keeps being charged for nothing. Cancel or refund it in Stripe.',\n tier: 'must',\n category: 'billing',\n title: 'Subscription bills a missing workspace',\n body:\n 'Stripe subscription {{subscriptionId}} (customer {{customerId}}, plan {{plan}}) names workspace {{orgId}}, which {{reason}}. The {{eventType}} event changed nothing. Cancel or refund it in Stripe.',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'billing.usageNotReported',\n label: 'Metered usage not reported to Stripe',\n description:\n 'A closed month measured billable usage and it reached no invoice. Report it to Stripe by hand or the revenue is lost.',\n tier: 'must',\n category: 'billing',\n title: 'Usage for {{month}} not billed on {{orgId}}',\n body:\n 'The closed month {{month}} measured {{amount}} of billable usage on workspace {{orgName}} ({{orgId}}), and it was not reported to Stripe ({{reason}}). Nothing will invoice it until somebody does.',\n link: '/admin/orgs/{{orgId}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 7 * DAY,\n defaultEnabled: true,\n },\n {\n // The scheduled reconciliation of Site Care extra time (AGL-3959): a\n // request's billed hours and the Stripe invoice item that carries them\n // disagree, or one exists without the other. Should know, not must:\n // nothing is lost yet, the next invoice has not gone, and the fix is on\n // the request. It also checks each request against its own minutes and\n // approval, so a charge both sides agree on but the ledger does not is\n // caught too (AGL-4031). The same check compares a flat-quoted project's\n // invoices (AGL-3970), whose findings arrive with `month` \"projects\".\n type: 'billing.siteCareReconciliation',\n label: 'Site Care billing does not match Stripe',\n description:\n 'A Site Care request’s billed hours, amount or line description disagree with its Stripe invoice item, a Stripe item has no request row behind it, a request’s billed hours or charge disagree with its own logged minutes and the owner’s approval (whole started hours past the included hour, never below the approved hours), a month’s total disagrees with its statement or with those minutes, or a project invoice’s status or amount disagrees with Stripe (or exists in Stripe with no project row). Open the workspace’s staff page and correct it from the request or the project — never by hand in Stripe.',\n tier: 'should',\n category: 'billing',\n title: 'Site Care billing mismatch on {{orgName}} ({{month}})',\n body:\n '{{count}} Site Care finding(s) on workspace {{orgName}} ({{orgId}}) for {{month}}: {{findings}} Fix it from the request on the staff organization page.',\n link: '/admin/orgs/{{orgId}}#site-care',\n delivery: 'immediate',\n // One alert a day per workspace and month: the same finding re-checked\n // tomorrow is the same news.\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'billing.webhookSignatureRejected',\n label: 'Billing webhook failing its signature check',\n description:\n 'Repeated deliveries to the billing webhook were refused because their signature did not match. Usually a rolled signing secret: until it is fixed, Stripe cannot tell the install about money.',\n tier: 'must',\n category: 'billing',\n title: 'Billing webhook is refusing deliveries',\n body:\n 'The billing webhook refused several signed deliveries within six hours because their Stripe signature matched none of the configured secrets. If Stripe is the sender, its signing secret no longer matches this install’s, and no billing event is being applied.',\n link: '/admin/health',\n delivery: 'immediate',\n dedupeWindowMinutes: 6 * 60,\n minOccurrences: 3,\n defaultEnabled: true,\n },\n {\n type: 'billing.webhookInert',\n label: 'Billing webhook delivery moved nothing',\n description:\n 'Stripe delivered an event this install subscribed to, and no handler did anything with it. Usually a handler that stopped being registered.',\n tier: 'must',\n category: 'billing',\n title: 'A {{eventType}} delivery changed nothing',\n body:\n 'Stripe event {{eventId}} ({{eventType}}) was accepted and no handler acted on it. Check which handler stopped being registered, then replay the event.',\n link: '/admin/health',\n delivery: 'immediate',\n dedupeWindowMinutes: 6 * 60,\n defaultEnabled: true,\n },\n\n // ── MUST: data protection and records ───────────────────────────────────\n {\n type: 'data.personErasureFailed',\n label: 'Personal data erasure failed',\n description:\n 'A data subject’s erasure request failed. It will be retried, but the legal deadline keeps running: read the error and fix the cause.',\n tier: 'must',\n category: 'data',\n title: 'Erasure request {{requestId}} failed',\n body:\n 'The erasure request {{requestId}} on workspace {{orgName}} ({{orgId}}) failed (attempt {{attempt}}): {{error}}. The statutory deadline keeps running while it retries.',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'data.orgErasureFailed',\n label: 'Workspace erasure failed',\n description:\n 'A workspace scheduled for erasure could not be erased. Its data is still held after the date it was promised gone.',\n tier: 'must',\n category: 'data',\n title: 'Workspace {{orgId}} could not be erased',\n body:\n 'The scheduled erasure of workspace {{orgName}} ({{orgId}}) did not complete: {{reason}}. It will be retried on the next run; its data is held until it succeeds.',\n link: '/admin/orgs/{{orgId}}',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'data.backupExportFailed',\n label: 'Database export failed',\n description:\n 'The scheduled database export did not start. A stale export means the worst day has nothing to restore from.',\n tier: 'must',\n category: 'data',\n title: 'Database export failed',\n body:\n 'The scheduled database export did not start ({{reason}}). The last good export is getting older; check the service account’s export permission and the bucket.',\n link: '/admin/health',\n delivery: 'immediate',\n dedupeWindowMinutes: 12 * 60,\n defaultEnabled: true,\n },\n\n // ── MUST: legal ─────────────────────────────────────────────────────────\n {\n type: 'legal.abuseReportHigh',\n label: 'Takedown, impersonation or illegal-content report',\n description:\n 'A DMCA takedown, impersonation or illegal-content report. Each carries a response duty; review it on Staff → Abuse reports.',\n tier: 'must',\n category: 'legal',\n title: '{{category}} report on {{site}}',\n body:\n '{{site}} was reported for {{category}}. Reference {{reference}}. Review it and respond within the policy’s window.',\n link: '/admin/abuse-reports',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n },\n\n // ── MUST/SHOULD: health ─────────────────────────────────────────────────\n {\n type: 'system.healthDegraded',\n label: 'Health check degraded',\n description:\n 'A health check went from healthy to degraded: scheduled jobs silent, backups stale, billing deliveries failing, sign-ups refused, server errors, a site not rendering. Told once per incident.',\n tier: 'must',\n category: 'ops',\n title: '{{check}} is degraded',\n body: '{{check}} went from healthy to degraded. {{detail}}',\n link: '/admin/health',\n delivery: 'immediate',\n // Must-know, and still amber rather than red: degraded is not down.\n level: 'warning',\n // A check flapping across the line is told once an hour, not on\n // every swing.\n dedupeWindowMinutes: 60,\n defaultEnabled: true,\n },\n {\n // The reminder the edge alert never sends (AGL-3860): raised by the\n // operator alerts tick at 1 h and every 2 h after while a check stays\n // degraded. The tick raises it as Must know from 2 h, so its level\n // follows the tier it was raised at rather than one coded here.\n type: 'system.healthStillDegraded',\n label: 'Health check still degraded',\n description:\n 'A health check has stayed degraded for an hour or more. Told at 1 h and again every 2 h until it recovers; Should know for the first reminder, Must know from 2 h on. Open the failing endpoint, read the failing check’s code and fix the cause, or the check when the check is what is wrong.',\n tier: 'should',\n category: 'ops',\n title: '{{check}} is still degraded after {{duration}}',\n body: '{{check}} is still degraded after {{duration}}. {{detail}}',\n link: '/admin/health',\n delivery: 'immediate',\n // The tick dedupes each reminder per check per step on the check's own\n // state; the window only stops a retried tick from telling one twice.\n dedupeWindowMinutes: 60,\n defaultEnabled: true,\n },\n {\n // The post-deploy production canary (AGL-3567), raised from GitHub\n // Actions through `/api/admin/operator-alerts/canary`. Red because a\n // deploy that stops rendering pages is every published site down.\n type: 'ops.productionCanaryRed',\n label: 'Production canary failed after a deploy',\n description:\n 'Right after a tenant or console production deploy, uncached pages stopped rendering. The canary rolls the deploy back by itself when the failure holds across sites; after any rollback the next release must be promoted by hand.',\n tier: 'must',\n category: 'ops',\n title: '{{project}} production canary: {{outcome}}',\n body: '{{detail}}',\n link: '/admin/health',\n delivery: 'immediate',\n level: 'critical',\n // The caller dedupes per deployment and verdict; this only stops a\n // re-run of the same red run from telling it twice.\n dedupeWindowMinutes: 30,\n defaultEnabled: true,\n },\n {\n type: 'system.healthRecovered',\n label: 'Health check recovered',\n description: 'A degraded health check is healthy again.',\n tier: 'should',\n category: 'ops',\n title: '{{check}} recovered',\n body: '{{check}} is healthy again after {{duration}}.',\n link: '/admin/health',\n delivery: 'immediate',\n level: 'success',\n // A check flapping across the line is told once an hour, not on\n // every swing.\n dedupeWindowMinutes: 60,\n defaultEnabled: true,\n },\n {\n // The render monitor (AGL-3568): a published site fetched over HTTP, on\n // pages no cache can answer, failed several runs in a row. Red, not the\n // amber of a degraded check: every visitor without a cached copy is\n // getting an error page or a timeout right now.\n type: 'system.siteRenderFailing',\n label: 'Published site not rendering pages',\n description:\n 'The render monitor asked a published site for pages no cache can answer, several runs in a row, and got no complete page back. Visitors to cached pages may still see them, so the site can look up while every other page fails. Check the latest site runtime deployment first and roll it back if it just shipped.',\n tier: 'must',\n category: 'ops',\n title: 'Pages are not rendering on {{site}}',\n body:\n '{{site}} failed {{failures}} render checks in a row, over {{since}}. {{detail}} Cached pages may still load, so the site can look up while new renders fail.',\n link: '/admin/health',\n delivery: 'immediate',\n // Told once per outage: the monitor raises it on the edge, and the\n // window only covers a site flapping across the line.\n dedupeWindowMinutes: 30,\n defaultEnabled: true,\n },\n {\n type: 'system.siteRenderRecovered',\n label: 'Published site rendering again',\n description:\n 'A published site the render monitor had reported as not rendering serves fresh pages again.',\n tier: 'should',\n category: 'ops',\n title: '{{site}} is rendering pages again',\n body: 'Fresh page renders on {{site}} pass again after {{duration}}.',\n link: '/admin/health',\n delivery: 'immediate',\n level: 'success',\n dedupeWindowMinutes: 30,\n defaultEnabled: true,\n },\n {\n // The render monitor could not see the site (AGL-3580): bot protection\n // answered every probe it made, so it knows nothing about whether pages\n // render. Not an outage, and never worded as one — on 2026-10-05 a\n // missing probe token read as \"pages are not rendering\" for three hours\n // while the site served pages. Amber: detection is off until it is fixed.\n type: 'system.renderMonitorBlind',\n label: 'Render monitor cannot see a site',\n description:\n 'Bot protection answered the render monitor instead of a published site, several runs in a row, so nothing is checking whether that site renders pages. The site itself may be fine. Check AGLYN_PROBE_TOKEN on the console and the \"CI and uptime probe bypass\" firewall rule on the site runtime.',\n tier: 'must',\n category: 'ops',\n title: 'The render monitor cannot see {{site}}',\n body:\n 'Bot protection answered instead of {{site}} for {{runs}} runs in a row, so nothing is checking its pages. {{detail}} This is not a verdict on the site.',\n link: '/admin/health',\n delivery: 'immediate',\n level: 'warning',\n dedupeWindowMinutes: 360,\n defaultEnabled: true,\n },\n\n // ── SHOULD: billing ─────────────────────────────────────────────────────\n {\n type: 'billing.autoLocked',\n label: 'Workspace billing locked automatically',\n description:\n 'A workspace crossed its spend guard and the platform locked its billable activity. Check it is not a false positive before the customer notices.',\n tier: 'should',\n category: 'billing',\n title: 'Billing locked on {{orgName}}',\n body:\n 'Workspace {{orgName}} ({{orgId}}) was locked automatically: {{reason}}.',\n link: '/admin/orgs/{{orgId}}',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'billing.platformInvoiceUncollectible',\n label: 'Subscription invoice voided or uncollectible',\n description:\n 'A workspace invoice was voided or marked uncollectible: revenue the books expected is not coming.',\n tier: 'should',\n category: 'billing',\n title: 'Invoice {{status}} on {{orgId}}',\n body:\n 'Invoice {{invoiceId}} for {{amount}} on workspace {{orgName}} ({{orgId}}) was marked {{status}}, so Stripe has stopped collecting it.',\n link: '/admin/orgs/{{orgId}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n },\n {\n type: 'billing.connectPayoutFailed',\n label: 'Connected account payout or transfer failed',\n description:\n 'Money due to a merchant or seller did not arrive. Stripe retries on its own schedule; a human decides what happens next.',\n tier: 'should',\n category: 'billing',\n title: 'A {{kind}} to {{account}} failed',\n body:\n 'A {{amount}} Stripe {{kind}} ({{stripeId}}) to connected account {{account}} ({{merchant}}) failed: {{reason}}. The merchant’s funds are not where the ledger says.',\n delivery: 'immediate',\n dedupeWindowMinutes: 30 * DAY,\n defaultEnabled: true,\n },\n {\n type: 'staff.paymentFailed',\n label: 'Workspace payment failed',\n description:\n 'A paying workspace’s renewal failed. Stripe is retrying; the customer has been told.',\n tier: 'should',\n category: 'billing',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'staff.paymentFailed',\n },\n\n // ── SHOULD: security ────────────────────────────────────────────────────\n {\n type: 'security.staffGranted',\n label: 'Staff access granted or raised',\n description:\n 'Somebody was made staff, or a staff role was raised. If nobody on the team did it, revoke it and rotate credentials.',\n tier: 'should',\n category: 'security',\n title: '{{target}} is now {{role}} staff',\n body: '{{actor}} granted {{target}} the {{role}} staff role (was {{previous}}).',\n link: '/admin/users',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n },\n\n // ── SHOULD: support ─────────────────────────────────────────────────────\n {\n type: 'support.slaBreached',\n label: 'Support ticket past its response time',\n description:\n 'A support ticket passed its promised response time without a staff reply.',\n tier: 'should',\n category: 'support',\n title: 'Ticket past its response time: {{subject}}',\n body:\n 'The {{tier}} ticket “{{subject}}” from workspace {{orgName}} ({{orgId}}) was due a first response {{overdue}} ago and has none.',\n // The ticket itself: the support page opens `?ticketId=` on load.\n link: '/admin/support?ticketId={{ticketId}}',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'support.ticketOpened',\n label: 'New support ticket',\n description: 'A subscriber opened a support ticket.',\n tier: 'should',\n category: 'support',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'digest',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'support.ticketOpened',\n // A customer asking for help, not a fault.\n level: 'info',\n },\n {\n type: 'support.ticketReply',\n label: 'Support ticket reply',\n description: 'A subscriber replied on a support ticket.',\n tier: 'should',\n category: 'support',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'digest',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'support.ticketReply',\n level: 'info',\n },\n\n // ── SHOULD: deliverability ──────────────────────────────────────────────\n {\n type: 'deliverability.sendRateSaturated',\n label: 'Email send-rate governor saturated',\n description:\n 'The platform’s email send-rate budget is exhausted, so sends are being deferred. Raise the budget or find the sender filling it.',\n tier: 'should',\n category: 'deliverability',\n title: 'Email sending is being throttled',\n body:\n 'The {{scope}} send-rate budget is full ({{detail}}), so sends are being deferred.',\n link: '/admin/emails',\n delivery: 'immediate',\n dedupeWindowMinutes: 6 * 60,\n defaultEnabled: true,\n },\n {\n type: 'deliverability.sendRateUnavailable',\n label: 'Email send-rate governor unavailable',\n description:\n 'The send-rate governor could not read its counters, so mail is going out unmetered: nothing is holding the shared domains under their hourly ceiling.',\n tier: 'should',\n category: 'deliverability',\n title: 'Email send-rate governor unavailable',\n body:\n 'The send-rate governor could not read its counters ({{error}}), so sends are being allowed unmetered until it can.',\n link: '/admin/emails',\n delivery: 'immediate',\n dedupeWindowMinutes: 6 * 60,\n defaultEnabled: true,\n },\n {\n type: 'deliverability.gatewayBlocking',\n label: 'A recipient gateway is blocking the shared domain',\n description:\n 'A mail gateway is refusing mail from the shared sending domain, so everyone behind that gateway stops receiving it.',\n tier: 'should',\n category: 'deliverability',\n title: '{{gateway}} is blocking {{domain}}',\n body:\n 'Mail from {{domain}} is being refused by {{gateway}} ({{detail}}). Recipients behind that gateway are not receiving it.',\n link: '/admin/emails',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'deliverability.providerCredentialsRejected',\n label: 'Email provider rejected the credentials',\n description:\n 'The email provider refused the API key, or a sending pool is unhealthy: invites, password resets and receipts are not leaving. The webhook channel is the one that still reaches you.',\n tier: 'should',\n category: 'deliverability',\n title: 'Email delivery is failing: {{problem}}',\n body: '{{detail}}',\n link: '/admin/emails',\n delivery: 'immediate',\n dedupeWindowMinutes: 6 * 60,\n defaultEnabled: true,\n },\n {\n // A purchasing ceiling, not a job failure: the provisioning sweep ran\n // and every site keeps sending, so the copy must not read as an outage.\n type: 'deliverability.sendingDomainCapacityFull',\n label: 'Sending-domain allowance full',\n description:\n 'Every dedicated sending domain the provider allowance covers is in use, so new sites that ask for one stay on the shared pool. No mail is lost; raise the allowance or move merchants onto domains they own.',\n tier: 'should',\n category: 'deliverability',\n title: 'Sending-domain allowance full ({{held}}/{{capacity}})',\n body:\n 'The sending-domain allowance is full ({{held}} of {{capacity}} in use), so sites that asked for a dedicated domain keep sending on the shared pool. No mail is lost: what they go without is the isolation a domain of their own buys, and their campaigns are held to the pool’s stricter reputation limits. Raise AGLYN_SENDING_DOMAIN_CAPACITY once the provider allowance covers it, or move merchants onto domains they own.',\n link: '/admin/emails',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n\n // ── SHOULD: operations ──────────────────────────────────────────────────\n {\n type: 'ops.reaperStuck',\n label: 'A reaper is stuck or failing',\n description:\n 'A cleanup job (sending domains, unverified workspaces) could not finish, so what it removes keeps accumulating.',\n tier: 'should',\n category: 'ops',\n title: '{{job}} is stuck',\n body: '{{job}} could not finish: {{detail}}',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'ops.pluginJobFailed',\n label: 'A plugin job failed',\n description:\n 'A plugin’s scheduled job threw: consent-group changes, the publish outbox, sending-domain provisioning, a plugin cron.',\n tier: 'should',\n category: 'ops',\n // `job` is a noun phrase that reads as a subject on its own (\"The\n // publish outbox drain\", \"The scheduled job acme-mail-send\"), so the\n // title and the body open with the same words.\n title: '{{job}} failed',\n body: '{{job}} failed: {{error}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 6 * 60,\n defaultEnabled: true,\n },\n {\n // Nightly, so once a day per provider is every run it could report.\n type: 'ops.adAudienceSyncFailed',\n label: 'Ad audience sync failed',\n description:\n 'The nightly account-holder audience sync (AGL-3780) could not update a Meta, Google or LinkedIn audience, or held a run whose audience would have shrunk by more than half. The audience keeps what it last had; check the provider credentials, or run the sync with force once the drop is confirmed.',\n tier: 'should',\n category: 'ops',\n title: 'Ad audience sync: {{provider}} not updated',\n body: 'The {{provider}} account-holder audience was not updated: {{detail}}. It keeps what it was last sent, and the next nightly run tries again.',\n link: '/admin/flags',\n delivery: 'immediate',\n dedupeWindowMinutes: DAY,\n defaultEnabled: true,\n },\n {\n type: 'system.pluginVerifierRegression',\n label: 'Plugin verifier regression',\n description:\n 'A live plugin version stopped passing the static verifier.',\n tier: 'should',\n category: 'security',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'system.pluginVerifierRegression',\n },\n {\n type: 'system.bandwidthCeilingTripped',\n label: 'Bandwidth ceiling reached',\n description:\n 'A site crossed the per-month bandwidth abuse ceiling.',\n tier: 'should',\n category: 'ops',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'immediate',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'system.bandwidthCeilingTripped',\n },\n\n // ── LOW ─────────────────────────────────────────────────────────────────\n {\n type: 'marketplace.review',\n label: 'Plugin listing waiting for review',\n description: 'A plugin listing or version was submitted for review.',\n tier: 'low',\n category: 'security',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'digest',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'marketplace.review',\n },\n {\n type: 'system.scopeDrift',\n label: 'Resources missing a sharing scope',\n description:\n 'The weekly sweep found documents invisible to every site-scoped read: a creation path forgot the field.',\n tier: 'low',\n category: 'data',\n title: '{{title}}',\n body: '{{body}}',\n delivery: 'digest',\n dedupeWindowMinutes: 0,\n defaultEnabled: true,\n notificationType: 'system.scopeDrift',\n },\n]\n\n/** An amount in minor units, as an alert prints it: `$12.40`. */\nexport function formatOperatorAlertAmount(\n cents: number,\n currency = 'usd',\n): string {\n const value = Number(cents) / 100\n if (!Number.isFinite(value)) return ''\n try {\n return new Intl.NumberFormat('en-US', {\n style: 'currency',\n currency: String(currency || 'usd').toUpperCase(),\n }).format(value)\n } catch {\n return `${value.toFixed(2)} ${String(currency).toUpperCase()}`\n }\n}\n\n/** Replaces each `{{token}}` with its context value, or nothing. */\nexport function renderOperatorAlertTemplate(\n template: string,\n context: OperatorAlertContext | undefined,\n): string {\n return String(template ?? '')\n .replace(/\\{\\{\\s*([\\w.]+)\\s*\\}\\}/g, (_match, name: string) => {\n const value = context?.[name]\n return value === null || value === undefined ? '' : String(value)\n })\n .replace(/\\(\\s*\\)/g, '')\n .replace(/[ \\t]{2,}/g, ' ')\n .replace(/ ([.,;:])/g, '$1')\n .trim()\n}\n\n/** A staff member's answer for one type; an absent key keeps the default. */\nexport interface OperatorAlertTypeSetting {\n enabled?: boolean\n delivery?: OperatorAlertDelivery\n}\n\n/** `platformSettings/operatorAlerts`, keyed by alert type. */\nexport interface OperatorAlertSettings {\n types?: Record<string, OperatorAlertTypeSetting>\n}\n\n/** Whether a type is on, and how it is delivered, after staff's answers. */\nexport function effectiveOperatorAlertSetting(\n definition: Pick<OperatorAlertDefinition, 'type' | 'delivery' | 'defaultEnabled'>,\n settings: OperatorAlertSettings | null | undefined,\n): { enabled: boolean; delivery: OperatorAlertDelivery } {\n const answer = settings?.types?.[definition.type]\n return {\n enabled:\n typeof answer?.enabled === 'boolean'\n ? answer.enabled\n : definition.defaultEnabled,\n delivery:\n answer?.delivery === 'immediate' || answer?.delivery === 'digest'\n ? answer.delivery\n : definition.delivery,\n }\n}\n\n/**\n * Staff notification types whose alert emails the operator on a coded\n * default of immediate (AGL-3375), derived from the catalog so there is one\n * list.\n */\nexport const OPERATOR_ALERT_NOTIFICATION_TYPES: ReadonlySet<string> = new Set(\n CORE_OPERATOR_ALERTS.flatMap((definition) =>\n definition.notificationType ? [definition.notificationType] : [],\n ),\n)\n"],"names":["OPERATOR_ALERT_DEFAULT_NOTIFICATION_TYPE","OPERATOR_ALERT_TIER_LABELS","must","should","low","OPERATOR_ALERT_TIER_LEVELS","operatorAlertLevel","definition","level","tier","OPERATOR_ALERT_CATEGORY_LABELS","billing","payments","legal","data","ops","deliverability","security","support","DAY","CORE_OPERATOR_ALERTS","type","label","description","category","title","body","link","delivery","dedupeWindowMinutes","defaultEnabled","notificationType","minOccurrences","formatOperatorAlertAmount","cents","currency","value","Number","isFinite","Intl","NumberFormat","style","String","toUpperCase","format","toFixed","renderOperatorAlertTemplate","template","context","replace","_match","name","undefined","trim","effectiveOperatorAlertSetting","settings","answer","types","enabled","OPERATOR_ALERT_NOTIFICATION_TYPES","Set","flatMap"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GA6GD,iEAAiE,GACjE,OAAO,MAAMA,2CACX,uBAAsB;AAExB,OAAO,MAAMC,6BAAgE;IAC3EC,MAAM;IACNC,QAAQ;IACRC,KAAK;AACP,EAAC;AAED;;;CAGC,GACD,OAAO,MAAMC,6BAGT;IACFH,MAAM;IACNC,QAAQ;IACRC,KAAK;AACP,EAAC;AAED,kEAAkE,GAClE,OAAO,SAASE,mBACdC,UAA2D;QAEpDA;IAAP,QAAOA,oBAAAA,WAAWC,KAAK,YAAhBD,oBAAoBF,0BAA0B,CAACE,WAAWE,IAAI,CAAC;AACxE;AAEA,OAAO,MAAMC,iCAGT;IACFC,SAAS;IACTC,UAAU;IACVC,OAAO;IACPC,MAAM;IACNC,KAAK;IACLC,gBAAgB;IAChBC,UAAU;IACVC,SAAS;AACX,EAAC;AAED,MAAMC,MAAM,KAAK;AAEjB;;;CAGC,GACD,OAAO,MAAMC,uBAA2D;IACtE,0EAA0E;IAC1E;QACEC,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IACA;QACE,wEAAwE;QACxE,oEAAoE;QACpEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACV,qEAAqE;QACrEC,qBAAqBV;QACrBW,gBAAgB;QAChBC,kBAAkB;IACpB;IACA;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACV,uEAAuE;QACvE,qDAAqD;QACrDC,qBAAqBV;QACrBW,gBAAgB;QAChBC,kBAAkB;IACpB;IACA;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IACA;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IACA;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IAEA,2EAA2E;IAC3E;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,KAAKV;QAC1BW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFE,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,IAAIV;QACzBW,gBAAgB;IAClB;IACA;QACE,qEAAqE;QACrE,uEAAuE;QACvE,oEAAoE;QACpE,wEAAwE;QACxE,uEAAuE;QACvE,uEAAuE;QACvE,yEAAyE;QACzE,sEAAsE;QACtET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACV,uEAAuE;QACvE,6BAA6B;QAC7BC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,IAAI;QACzBG,gBAAgB;QAChBF,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,IAAI;QACzBC,gBAAgB;IAClB;IAEA,2EAA2E;IAC3E;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFE,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,KAAK;QAC1BC,gBAAgB;IAClB;IAEA,2EAA2E;IAC3E;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;IAClB;IAEA,2EAA2E;IAC3E;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACV,oEAAoE;QACpEpB,OAAO;QACP,gEAAgE;QAChE,eAAe;QACfqB,qBAAqB;QACrBC,gBAAgB;IAClB;IACA;QACE,oEAAoE;QACpE,sEAAsE;QACtE,mEAAmE;QACnE,gEAAgE;QAChET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACV,uEAAuE;QACvE,sEAAsE;QACtEC,qBAAqB;QACrBC,gBAAgB;IAClB;IACA;QACE,mEAAmE;QACnE,qEAAqE;QACrE,kEAAkE;QAClET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACVpB,OAAO;QACP,mEAAmE;QACnE,oDAAoD;QACpDqB,qBAAqB;QACrBC,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aAAa;QACbd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACVpB,OAAO;QACP,gEAAgE;QAChE,eAAe;QACfqB,qBAAqB;QACrBC,gBAAgB;IAClB;IACA;QACE,wEAAwE;QACxE,wEAAwE;QACxE,oEAAoE;QACpE,gDAAgD;QAChDT,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACV,mEAAmE;QACnE,sDAAsD;QACtDC,qBAAqB;QACrBC,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACVpB,OAAO;QACPqB,qBAAqB;QACrBC,gBAAgB;IAClB;IACA;QACE,uEAAuE;QACvE,wEAAwE;QACxE,mEAAmE;QACnE,wEAAwE;QACxE,0EAA0E;QAC1ET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVpB,OAAO;QACPqB,qBAAqB;QACrBC,gBAAgB;IAClB;IAEA,2EAA2E;IAC3E;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,KAAKV;QAC1BW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFE,UAAU;QACVC,qBAAqB,KAAKV;QAC1BW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IAEA,2EAA2E;IAC3E;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;IAClB;IAEA,2EAA2E;IAC3E;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACF,kEAAkE;QAClEC,MAAM;QACNC,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aAAa;QACbd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;QAClB,2CAA2C;QAC3CvB,OAAO;IACT;IACA;QACEa,MAAM;QACNC,OAAO;QACPC,aAAa;QACbd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;QAClBvB,OAAO;IACT;IAEA,2EAA2E;IAC3E;QACEa,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,IAAI;QACzBC,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqB,IAAI;QACzBC,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACVC,qBAAqB,IAAI;QACzBC,gBAAgB;IAClB;IACA;QACE,sEAAsE;QACtE,wEAAwE;QACxET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MACE;QACFC,MAAM;QACNC,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IAEA,2EAA2E;IAC3E;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACV,kEAAkE;QAClE,qEAAqE;QACrE,+CAA+C;QAC/CC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB,IAAI;QACzBC,gBAAgB;IAClB;IACA;QACE,oEAAoE;QACpET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNC,MAAM;QACNC,UAAU;QACVC,qBAAqBV;QACrBW,gBAAgB;IAClB;IACA;QACET,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IACA;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IAEA,2EAA2E;IAC3E;QACEV,MAAM;QACNC,OAAO;QACPC,aAAa;QACbd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;IACA;QACEV,MAAM;QACNC,OAAO;QACPC,aACE;QACFd,MAAM;QACNe,UAAU;QACVC,OAAO;QACPC,MAAM;QACNE,UAAU;QACVC,qBAAqB;QACrBC,gBAAgB;QAChBC,kBAAkB;IACpB;CACD,CAAA;AAED,+DAA+D,GAC/D,OAAO,SAASE,0BACdC,KAAa,EACbC,WAAW,KAAK;IAEhB,MAAMC,QAAQC,OAAOH,SAAS;IAC9B,IAAI,CAACG,OAAOC,QAAQ,CAACF,QAAQ,OAAO;IACpC,IAAI;QACF,OAAO,IAAIG,KAAKC,YAAY,CAAC,SAAS;YACpCC,OAAO;YACPN,UAAUO,OAAOP,YAAY,OAAOQ,WAAW;QACjD,GAAGC,MAAM,CAACR;IACZ,EAAE,eAAM;QACN,OAAO,GAAGA,MAAMS,OAAO,CAAC,GAAG,CAAC,EAAEH,OAAOP,UAAUQ,WAAW,IAAI;IAChE;AACF;AAEA,kEAAkE,GAClE,OAAO,SAASG,4BACdC,QAAgB,EAChBC,OAAyC;IAEzC,OAAON,OAAOK,mBAAAA,WAAY,IACvBE,OAAO,CAAC,2BAA2B,CAACC,QAAQC;QAC3C,MAAMf,QAAQY,2BAAAA,OAAS,CAACG,KAAK;QAC7B,OAAOf,UAAU,QAAQA,UAAUgB,YAAY,KAAKV,OAAON;IAC7D,GACCa,OAAO,CAAC,YAAY,IACpBA,OAAO,CAAC,cAAc,KACtBA,OAAO,CAAC,cAAc,MACtBI,IAAI;AACT;AAaA,0EAA0E,GAC1E,OAAO,SAASC,8BACd/C,UAAiF,EACjFgD,QAAkD;QAEnCA;IAAf,MAAMC,SAASD,6BAAAA,kBAAAA,SAAUE,KAAK,qBAAfF,eAAiB,CAAChD,WAAWc,IAAI,CAAC;IACjD,OAAO;QACLqC,SACE,QAAOF,0BAAAA,OAAQE,OAAO,MAAK,YACvBF,OAAOE,OAAO,GACdnD,WAAWuB,cAAc;QAC/BF,UACE4B,CAAAA,0BAAAA,OAAQ5B,QAAQ,MAAK,eAAe4B,CAAAA,0BAAAA,OAAQ5B,QAAQ,MAAK,WACrD4B,OAAO5B,QAAQ,GACfrB,WAAWqB,QAAQ;IAC3B;AACF;AAEA;;;;CAIC,GACD,OAAO,MAAM+B,oCAAyD,IAAIC,IACxExC,qBAAqByC,OAAO,CAAC,CAACtD,aAC5BA,WAAWwB,gBAAgB,GAAG;QAACxB,WAAWwB,gBAAgB;KAAC,GAAG,EAAE,GAEnE"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type OrgPermissionDefinition, type OrgPermissionGroup } from './org-permissions';
18
+ /**
19
+ * What a permission editor offers, as logic (AGL-4047): which catalog keys a
20
+ * workspace is shown, filed under which group, narrowed by a search, and the
21
+ * three states a custom role or a per-member override stores for each.
22
+ * Every editor (the custom role dialog, a member's Permissions section, the
23
+ * roster's quick view) reads these, so they cannot offer different keys.
24
+ */
25
+ /** Whose keys are offered: the workspace's plugins, after their release flags. */
26
+ export interface OfferedPermissionsSubject {
27
+ /** The workspace document; its `enabledPlugins` decides which plugins' keys show. */
28
+ org?: {
29
+ enabledPlugins?: string[];
30
+ } | null;
31
+ /** A release flag's verdict for the workspace; absent: no plugin is held back by a flag. */
32
+ isFlagOn?: (flagKey: string) => boolean;
33
+ /** Staff preview: every enabled plugin's keys, flags or not. */
34
+ staffBypass?: boolean;
35
+ }
36
+ /**
37
+ * The catalog keys a workspace is offered: every core key, and a plugin's
38
+ * keys while the plugin is on for the workspace and released to it. A key a
39
+ * stored role or override already carries for a plugin that is now off is
40
+ * not offered and not dropped: the editors write back the stored map.
41
+ */
42
+ export declare function offeredOrgPermissions(subject?: OfferedPermissionsSubject, definitions?: readonly OrgPermissionDefinition[]): OrgPermissionDefinition[];
43
+ /** One group of an editor's list: its heading and its keys, in catalog order. */
44
+ export interface OrgPermissionSection {
45
+ group: OrgPermissionGroup;
46
+ permissions: OrgPermissionDefinition[];
47
+ }
48
+ /**
49
+ * The keys filed under their groups, in the groups' display order; a group
50
+ * with no key among `definitions` is left out, and a key whose group the
51
+ * list does not name is filed under a group of its own id.
52
+ */
53
+ export declare function groupOrgPermissions(definitions: readonly OrgPermissionDefinition[], groups?: readonly OrgPermissionGroup[]): OrgPermissionSection[];
54
+ /**
55
+ * The keys a search keeps: every word of the query found, ignoring case, in
56
+ * the key's label, description, key or group heading. An empty query keeps
57
+ * everything.
58
+ */
59
+ export declare function searchOrgPermissions(definitions: readonly OrgPermissionDefinition[], query: string, groups?: readonly OrgPermissionGroup[]): OrgPermissionDefinition[];
60
+ /**
61
+ * What a custom role or a per-member override stores for one key: nothing
62
+ * (`inherit`, the layer below decides), `grant` (true) or `deny` (false).
63
+ */
64
+ export type PermissionChoice = 'inherit' | 'grant' | 'deny';
65
+ export declare const PERMISSION_CHOICES: readonly PermissionChoice[];
66
+ /** The stored choice for a key; anything but a boolean reads as inherit. */
67
+ export declare function permissionChoice(stored: Readonly<Partial<Record<string, unknown>>> | null | undefined, key: string): PermissionChoice;
68
+ /**
69
+ * The stored map with one or more keys set to a choice: `inherit` deletes
70
+ * the key, so the document stores only real decisions. Keys not named are
71
+ * kept as they were, whether or not the editor offers them.
72
+ */
73
+ export declare function withPermissionChoice(stored: Readonly<Partial<Record<string, boolean>>> | null | undefined, keys: string | readonly string[], choice: PermissionChoice): Record<string, boolean>;
74
+ /** How many keys of a list a stored map grants and denies. */
75
+ export declare function permissionChoiceCounts(stored: Readonly<Partial<Record<string, unknown>>> | null | undefined, keys: readonly string[]): Record<PermissionChoice, number>;
@@ -0,0 +1,124 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { filterPluginsByReleaseFlags, resolveEnabledPlugins } from "../plugin-manager/enabled-plugins.js";
17
+ import { ORG_PERMISSION_GROUPS, ORG_PERMISSIONS } from "./org-permissions.js";
18
+ /**
19
+ * The catalog keys a workspace is offered: every core key, and a plugin's
20
+ * keys while the plugin is on for the workspace and released to it. A key a
21
+ * stored role or override already carries for a plugin that is now off is
22
+ * not offered and not dropped: the editors write back the stored map.
23
+ */ export function offeredOrgPermissions(subject = {}, definitions = ORG_PERMISSIONS) {
24
+ var _subject_org;
25
+ const enabled = resolveEnabledPlugins((_subject_org = subject.org) != null ? _subject_org : null);
26
+ const on = new Set(subject.isFlagOn ? filterPluginsByReleaseFlags(enabled, subject.isFlagOn, {
27
+ staffBypass: subject.staffBypass
28
+ }) : enabled);
29
+ return definitions.filter((definition)=>!definition.pluginId || on.has(definition.pluginId));
30
+ }
31
+ /**
32
+ * The keys filed under their groups, in the groups' display order; a group
33
+ * with no key among `definitions` is left out, and a key whose group the
34
+ * list does not name is filed under a group of its own id.
35
+ */ export function groupOrgPermissions(definitions, groups = ORG_PERMISSION_GROUPS) {
36
+ const known = new Map(groups.map((group)=>[
37
+ group.id,
38
+ group
39
+ ]));
40
+ const sections = new Map();
41
+ for (const group of groups)sections.set(group.id, {
42
+ group,
43
+ permissions: []
44
+ });
45
+ for (const definition of definitions){
46
+ let section = sections.get(definition.group);
47
+ if (!section) {
48
+ var _known_get;
49
+ section = {
50
+ group: (_known_get = known.get(definition.group)) != null ? _known_get : {
51
+ id: definition.group,
52
+ label: definition.group
53
+ },
54
+ permissions: []
55
+ };
56
+ sections.set(definition.group, section);
57
+ }
58
+ section.permissions.push(definition);
59
+ }
60
+ return [
61
+ ...sections.values()
62
+ ].filter((section)=>section.permissions.length > 0);
63
+ }
64
+ /**
65
+ * The keys a search keeps: every word of the query found, ignoring case, in
66
+ * the key's label, description, key or group heading. An empty query keeps
67
+ * everything.
68
+ */ export function searchOrgPermissions(definitions, query, groups = ORG_PERMISSION_GROUPS) {
69
+ const words = query.toLowerCase().split(/\s+/).filter(Boolean);
70
+ if (!words.length) return [
71
+ ...definitions
72
+ ];
73
+ const headings = new Map(groups.map((group)=>[
74
+ group.id,
75
+ group.label
76
+ ]));
77
+ return definitions.filter((definition)=>{
78
+ var _headings_get;
79
+ const haystack = [
80
+ definition.label,
81
+ definition.description,
82
+ definition.key,
83
+ (_headings_get = headings.get(definition.group)) != null ? _headings_get : definition.group
84
+ ].join(' ').toLowerCase();
85
+ return words.every((word)=>haystack.includes(word));
86
+ });
87
+ }
88
+ export const PERMISSION_CHOICES = [
89
+ 'inherit',
90
+ 'grant',
91
+ 'deny'
92
+ ];
93
+ /** The stored choice for a key; anything but a boolean reads as inherit. */ export function permissionChoice(stored, key) {
94
+ const value = stored == null ? void 0 : stored[key];
95
+ return value === true ? 'grant' : value === false ? 'deny' : 'inherit';
96
+ }
97
+ /**
98
+ * The stored map with one or more keys set to a choice: `inherit` deletes
99
+ * the key, so the document stores only real decisions. Keys not named are
100
+ * kept as they were, whether or not the editor offers them.
101
+ */ export function withPermissionChoice(stored, keys, choice) {
102
+ const next = {};
103
+ for (const [key, value] of Object.entries(stored != null ? stored : {})){
104
+ if (typeof value === 'boolean') next[key] = value;
105
+ }
106
+ for (const key of typeof keys === 'string' ? [
107
+ keys
108
+ ] : keys){
109
+ if (choice === 'inherit') delete next[key];
110
+ else next[key] = choice === 'grant';
111
+ }
112
+ return next;
113
+ }
114
+ /** How many keys of a list a stored map grants and denies. */ export function permissionChoiceCounts(stored, keys) {
115
+ const counts = {
116
+ inherit: 0,
117
+ grant: 0,
118
+ deny: 0
119
+ };
120
+ for (const key of keys)counts[permissionChoice(stored, key)] += 1;
121
+ return counts;
122
+ }
123
+
124
+ //# sourceMappingURL=org-permission-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/org-permission-editor.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { filterPluginsByReleaseFlags, resolveEnabledPlugins } from '../plugin-manager/enabled-plugins'\nimport {\n ORG_PERMISSION_GROUPS,\n ORG_PERMISSIONS,\n type OrgPermissionDefinition,\n type OrgPermissionGroup,\n} from './org-permissions'\n\n/**\n * What a permission editor offers, as logic (AGL-4047): which catalog keys a\n * workspace is shown, filed under which group, narrowed by a search, and the\n * three states a custom role or a per-member override stores for each.\n * Every editor (the custom role dialog, a member's Permissions section, the\n * roster's quick view) reads these, so they cannot offer different keys.\n */\n\n/** Whose keys are offered: the workspace's plugins, after their release flags. */\nexport interface OfferedPermissionsSubject {\n /** The workspace document; its `enabledPlugins` decides which plugins' keys show. */\n org?: { enabledPlugins?: string[] } | null\n /** A release flag's verdict for the workspace; absent: no plugin is held back by a flag. */\n isFlagOn?: (flagKey: string) => boolean\n /** Staff preview: every enabled plugin's keys, flags or not. */\n staffBypass?: boolean\n}\n\n/**\n * The catalog keys a workspace is offered: every core key, and a plugin's\n * keys while the plugin is on for the workspace and released to it. A key a\n * stored role or override already carries for a plugin that is now off is\n * not offered and not dropped: the editors write back the stored map.\n */\nexport function offeredOrgPermissions(\n subject: OfferedPermissionsSubject = {},\n definitions: readonly OrgPermissionDefinition[] = ORG_PERMISSIONS,\n): OrgPermissionDefinition[] {\n const enabled = resolveEnabledPlugins(subject.org ?? null)\n const on = new Set(\n subject.isFlagOn\n ? filterPluginsByReleaseFlags(enabled, subject.isFlagOn, { staffBypass: subject.staffBypass })\n : enabled,\n )\n return definitions.filter((definition) => !definition.pluginId || on.has(definition.pluginId))\n}\n\n/** One group of an editor's list: its heading and its keys, in catalog order. */\nexport interface OrgPermissionSection {\n group: OrgPermissionGroup\n permissions: OrgPermissionDefinition[]\n}\n\n/**\n * The keys filed under their groups, in the groups' display order; a group\n * with no key among `definitions` is left out, and a key whose group the\n * list does not name is filed under a group of its own id.\n */\nexport function groupOrgPermissions(\n definitions: readonly OrgPermissionDefinition[],\n groups: readonly OrgPermissionGroup[] = ORG_PERMISSION_GROUPS,\n): OrgPermissionSection[] {\n const known = new Map(groups.map((group) => [group.id, group]))\n const sections = new Map<string, OrgPermissionSection>()\n for (const group of groups) sections.set(group.id, { group, permissions: [] })\n for (const definition of definitions) {\n let section = sections.get(definition.group)\n if (!section) {\n section = {\n group: known.get(definition.group) ?? { id: definition.group, label: definition.group },\n permissions: [],\n }\n sections.set(definition.group, section)\n }\n section.permissions.push(definition)\n }\n return [...sections.values()].filter((section) => section.permissions.length > 0)\n}\n\n/**\n * The keys a search keeps: every word of the query found, ignoring case, in\n * the key's label, description, key or group heading. An empty query keeps\n * everything.\n */\nexport function searchOrgPermissions(\n definitions: readonly OrgPermissionDefinition[],\n query: string,\n groups: readonly OrgPermissionGroup[] = ORG_PERMISSION_GROUPS,\n): OrgPermissionDefinition[] {\n const words = query.toLowerCase().split(/\\s+/).filter(Boolean)\n if (!words.length) return [...definitions]\n const headings = new Map(groups.map((group) => [group.id, group.label]))\n return definitions.filter((definition) => {\n const haystack = [\n definition.label,\n definition.description,\n definition.key,\n headings.get(definition.group) ?? definition.group,\n ]\n .join(' ')\n .toLowerCase()\n return words.every((word) => haystack.includes(word))\n })\n}\n\n/**\n * What a custom role or a per-member override stores for one key: nothing\n * (`inherit`, the layer below decides), `grant` (true) or `deny` (false).\n */\nexport type PermissionChoice = 'inherit' | 'grant' | 'deny'\n\nexport const PERMISSION_CHOICES: readonly PermissionChoice[] = ['inherit', 'grant', 'deny']\n\n/** The stored choice for a key; anything but a boolean reads as inherit. */\nexport function permissionChoice(\n stored: Readonly<Partial<Record<string, unknown>>> | null | undefined,\n key: string,\n): PermissionChoice {\n const value = stored?.[key]\n return value === true ? 'grant' : value === false ? 'deny' : 'inherit'\n}\n\n/**\n * The stored map with one or more keys set to a choice: `inherit` deletes\n * the key, so the document stores only real decisions. Keys not named are\n * kept as they were, whether or not the editor offers them.\n */\nexport function withPermissionChoice(\n stored: Readonly<Partial<Record<string, boolean>>> | null | undefined,\n keys: string | readonly string[],\n choice: PermissionChoice,\n): Record<string, boolean> {\n const next: Record<string, boolean> = {}\n for (const [key, value] of Object.entries(stored ?? {})) {\n if (typeof value === 'boolean') next[key] = value\n }\n for (const key of typeof keys === 'string' ? [keys] : keys) {\n if (choice === 'inherit') delete next[key]\n else next[key] = choice === 'grant'\n }\n return next\n}\n\n/** How many keys of a list a stored map grants and denies. */\nexport function permissionChoiceCounts(\n stored: Readonly<Partial<Record<string, unknown>>> | null | undefined,\n keys: readonly string[],\n): Record<PermissionChoice, number> {\n const counts: Record<PermissionChoice, number> = { inherit: 0, grant: 0, deny: 0 }\n for (const key of keys) counts[permissionChoice(stored, key)] += 1\n return counts\n}\n"],"names":["filterPluginsByReleaseFlags","resolveEnabledPlugins","ORG_PERMISSION_GROUPS","ORG_PERMISSIONS","offeredOrgPermissions","subject","definitions","enabled","org","on","Set","isFlagOn","staffBypass","filter","definition","pluginId","has","groupOrgPermissions","groups","known","Map","map","group","id","sections","set","permissions","section","get","label","push","values","length","searchOrgPermissions","query","words","toLowerCase","split","Boolean","headings","haystack","description","key","join","every","word","includes","PERMISSION_CHOICES","permissionChoice","stored","value","withPermissionChoice","keys","choice","next","Object","entries","permissionChoiceCounts","counts","inherit","grant","deny"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,2BAA2B,EAAEC,qBAAqB,QAAQ,uCAAmC;AACtG,SACEC,qBAAqB,EACrBC,eAAe,QAGV,uBAAmB;AAoB1B;;;;;CAKC,GACD,OAAO,SAASC,sBACdC,UAAqC,CAAC,CAAC,EACvCC,cAAkDH,eAAe;QAE3BE;IAAtC,MAAME,UAAUN,uBAAsBI,eAAAA,QAAQG,GAAG,YAAXH,eAAe;IACrD,MAAMI,KAAK,IAAIC,IACbL,QAAQM,QAAQ,GACZX,4BAA4BO,SAASF,QAAQM,QAAQ,EAAE;QAAEC,aAAaP,QAAQO,WAAW;IAAC,KAC1FL;IAEN,OAAOD,YAAYO,MAAM,CAAC,CAACC,aAAe,CAACA,WAAWC,QAAQ,IAAIN,GAAGO,GAAG,CAACF,WAAWC,QAAQ;AAC9F;AAQA;;;;CAIC,GACD,OAAO,SAASE,oBACdX,WAA+C,EAC/CY,SAAwChB,qBAAqB;IAE7D,MAAMiB,QAAQ,IAAIC,IAAIF,OAAOG,GAAG,CAAC,CAACC,QAAU;YAACA,MAAMC,EAAE;YAAED;SAAM;IAC7D,MAAME,WAAW,IAAIJ;IACrB,KAAK,MAAME,SAASJ,OAAQM,SAASC,GAAG,CAACH,MAAMC,EAAE,EAAE;QAAED;QAAOI,aAAa,EAAE;IAAC;IAC5E,KAAK,MAAMZ,cAAcR,YAAa;QACpC,IAAIqB,UAAUH,SAASI,GAAG,CAACd,WAAWQ,KAAK;QAC3C,IAAI,CAACK,SAAS;gBAEHR;YADTQ,UAAU;gBACRL,KAAK,GAAEH,aAAAA,MAAMS,GAAG,CAACd,WAAWQ,KAAK,aAA1BH,aAA+B;oBAAEI,IAAIT,WAAWQ,KAAK;oBAAEO,OAAOf,WAAWQ,KAAK;gBAAC;gBACtFI,aAAa,EAAE;YACjB;YACAF,SAASC,GAAG,CAACX,WAAWQ,KAAK,EAAEK;QACjC;QACAA,QAAQD,WAAW,CAACI,IAAI,CAAChB;IAC3B;IACA,OAAO;WAAIU,SAASO,MAAM;KAAG,CAAClB,MAAM,CAAC,CAACc,UAAYA,QAAQD,WAAW,CAACM,MAAM,GAAG;AACjF;AAEA;;;;CAIC,GACD,OAAO,SAASC,qBACd3B,WAA+C,EAC/C4B,KAAa,EACbhB,SAAwChB,qBAAqB;IAE7D,MAAMiC,QAAQD,MAAME,WAAW,GAAGC,KAAK,CAAC,OAAOxB,MAAM,CAACyB;IACtD,IAAI,CAACH,MAAMH,MAAM,EAAE,OAAO;WAAI1B;KAAY;IAC1C,MAAMiC,WAAW,IAAInB,IAAIF,OAAOG,GAAG,CAAC,CAACC,QAAU;YAACA,MAAMC,EAAE;YAAED,MAAMO,KAAK;SAAC;IACtE,OAAOvB,YAAYO,MAAM,CAAC,CAACC;YAKvByB;QAJF,MAAMC,WAAW;YACf1B,WAAWe,KAAK;YAChBf,WAAW2B,WAAW;YACtB3B,WAAW4B,GAAG;aACdH,gBAAAA,SAASX,GAAG,CAACd,WAAWQ,KAAK,aAA7BiB,gBAAkCzB,WAAWQ,KAAK;SACnD,CACEqB,IAAI,CAAC,KACLP,WAAW;QACd,OAAOD,MAAMS,KAAK,CAAC,CAACC,OAASL,SAASM,QAAQ,CAACD;IACjD;AACF;AAQA,OAAO,MAAME,qBAAkD;IAAC;IAAW;IAAS;CAAO,CAAA;AAE3F,0EAA0E,GAC1E,OAAO,SAASC,iBACdC,MAAqE,EACrEP,GAAW;IAEX,MAAMQ,QAAQD,0BAAAA,MAAQ,CAACP,IAAI;IAC3B,OAAOQ,UAAU,OAAO,UAAUA,UAAU,QAAQ,SAAS;AAC/D;AAEA;;;;CAIC,GACD,OAAO,SAASC,qBACdF,MAAqE,EACrEG,IAAgC,EAChCC,MAAwB;IAExB,MAAMC,OAAgC,CAAC;IACvC,KAAK,MAAM,CAACZ,KAAKQ,MAAM,IAAIK,OAAOC,OAAO,CAACP,iBAAAA,SAAU,CAAC,GAAI;QACvD,IAAI,OAAOC,UAAU,WAAWI,IAAI,CAACZ,IAAI,GAAGQ;IAC9C;IACA,KAAK,MAAMR,OAAO,OAAOU,SAAS,WAAW;QAACA;KAAK,GAAGA,KAAM;QAC1D,IAAIC,WAAW,WAAW,OAAOC,IAAI,CAACZ,IAAI;aACrCY,IAAI,CAACZ,IAAI,GAAGW,WAAW;IAC9B;IACA,OAAOC;AACT;AAEA,4DAA4D,GAC5D,OAAO,SAASG,uBACdR,MAAqE,EACrEG,IAAuB;IAEvB,MAAMM,SAA2C;QAAEC,SAAS;QAAGC,OAAO;QAAGC,MAAM;IAAE;IACjF,KAAK,MAAMnB,OAAOU,KAAMM,MAAM,CAACV,iBAAiBC,QAAQP,KAAK,IAAI;IACjE,OAAOgB;AACT"}
@@ -15,6 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import type { AglynOrgMember, OrgRole } from '../foundation';
18
+ import { type OrgPermissionGroup, type OrgPermissionScope } from './org-role-grants';
19
+ export type { OrgPermissionGroup, OrgPermissionScope };
18
20
  /**
19
21
  * Granular org permissions (AGL-243) layered on the 4 org roles: each
20
22
  * role maps to a default permission set; custom roles
@@ -52,6 +54,14 @@ export interface OrgPermissionDefinition {
52
54
  description: string;
53
55
  /** The plugin that declared the key; absent for a core key. */
54
56
  pluginId?: string;
57
+ /** The `ORG_PERMISSION_GROUPS` id the role editor files it under (AGL-4047). */
58
+ group: string;
59
+ /** Where it is decided: `org`, or `site` for a key a site collaborator holds per site. */
60
+ scope: OrgPermissionScope;
61
+ /** Each org role's verdict when nothing refines it (`DEFAULT_ROLE_PERMISSIONS`). */
62
+ roleDefaults: Readonly<Record<OrgRole, boolean>>;
63
+ /** Each host role's verdict, for a `site` key. */
64
+ hostRoleDefaults?: Readonly<Record<string, boolean>>;
55
65
  }
56
66
  /**
57
67
  * Every permission, in display order for role editors: the core keys, then
@@ -68,6 +78,19 @@ export interface OrgPermissionDefinition {
68
78
  */
69
79
  export declare const ORG_PERMISSIONS: readonly OrgPermissionDefinition[];
70
80
  export declare const ORG_PERMISSION_KEYS: readonly OrgPermission[];
81
+ /**
82
+ * The groups the catalog's keys are filed under, in display order (AGL-4047):
83
+ * the core groups, then one per plugin group a declaration names. Live, like
84
+ * `ORG_PERMISSIONS`; a group with no key is left out.
85
+ */
86
+ export declare const ORG_PERMISSION_GROUPS: readonly OrgPermissionGroup[];
87
+ /**
88
+ * The catalog keys that came through `registerPluginPermissions` (AGL-4047):
89
+ * the keys the per-tier resolver (`resolveRolePermissions`) also answers,
90
+ * which a caller holding a catalog-resolved map lays over that resolver's
91
+ * answer so a custom role reaches them. Live.
92
+ */
93
+ export declare const TIER_PERMISSION_KEYS: readonly OrgPermission[];
71
94
  /**
72
95
  * Role → default permission set. Owner/admin hold everything (owner-only
73
96
  * actions like org deletion stay role-checked, not permission-checked);
@@ -76,6 +99,19 @@ export declare const ORG_PERMISSION_KEYS: readonly OrgPermission[];
76
99
  * names.
77
100
  */
78
101
  export declare const DEFAULT_ROLE_PERMISSIONS: Record<OrgRole, Record<OrgPermission, boolean>>;
102
+ /**
103
+ * The `registerPluginPermissions` keys of a catalog-resolved map (AGL-4047).
104
+ *
105
+ * Those keys are answered twice: by the per-tier resolver
106
+ * (`resolveRolePermissions`, the role's tier default and the member's
107
+ * override) and, now that they are catalog keys, by `resolveOrgPermissions`
108
+ * with every layer — the custom role's included. A caller that builds its
109
+ * map from the first spreads this over it, so the custom role a member
110
+ * carries reaches `managePos` the way it reaches `hosts.create`.
111
+ */
112
+ export declare function tierPermissionsOf(granted: Readonly<Record<string, boolean>> | null | undefined): Record<string, boolean>;
113
+ /** One catalog key by name, or undefined. */
114
+ export declare function orgPermissionDefinition(permission: OrgPermission): OrgPermissionDefinition | undefined;
79
115
  /** `orgs/{orgId}/roles/{roleId}` — a named custom permission set. */
80
116
  export interface AglynOrgCustomRole {
81
117
  $id?: string;