@aglyn/aglyn 1.24.0 → 1.26.0

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 (54) hide show
  1. package/package.json +11 -11
  2. package/src/lib/app-utils/activity-labels.js +4 -1
  3. package/src/lib/app-utils/activity-labels.js.map +1 -1
  4. package/src/lib/app-utils/bandwidth-cap.d.ts +99 -1
  5. package/src/lib/app-utils/bandwidth-cap.js +148 -4
  6. package/src/lib/app-utils/bandwidth-cap.js.map +1 -1
  7. package/src/lib/app-utils/business-details.d.ts +5 -0
  8. package/src/lib/app-utils/business-details.js +4 -0
  9. package/src/lib/app-utils/business-details.js.map +1 -1
  10. package/src/lib/app-utils/crm.d.ts +17 -30
  11. package/src/lib/app-utils/crm.js +139 -3
  12. package/src/lib/app-utils/crm.js.map +1 -1
  13. package/src/lib/app-utils/docs-help-sections.generated.js +4 -1
  14. package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
  15. package/src/lib/app-utils/docs-help.generated.d.ts +1 -1
  16. package/src/lib/app-utils/docs-help.generated.js +7 -0
  17. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  18. package/src/lib/app-utils/docs-index.generated.js +95 -11
  19. package/src/lib/app-utils/docs-index.generated.js.map +1 -1
  20. package/src/lib/app-utils/host-tokens.d.ts +17 -0
  21. package/src/lib/app-utils/host-tokens.js +18 -0
  22. package/src/lib/app-utils/host-tokens.js.map +1 -1
  23. package/src/lib/app-utils/native-app-association.d.ts +5 -3
  24. package/src/lib/app-utils/native-app-association.js +5 -3
  25. package/src/lib/app-utils/native-app-association.js.map +1 -1
  26. package/src/lib/app-utils/native-nav.js +1 -1
  27. package/src/lib/app-utils/native-nav.js.map +1 -1
  28. package/src/lib/app-utils/notifications.js +5 -0
  29. package/src/lib/app-utils/notifications.js.map +1 -1
  30. package/src/lib/app-utils/plan-entitlements.d.ts +227 -36
  31. package/src/lib/app-utils/plan-entitlements.js +339 -45
  32. package/src/lib/app-utils/plan-entitlements.js.map +1 -1
  33. package/src/lib/app-utils/reusable-component-keys.d.ts +9 -0
  34. package/src/lib/app-utils/reusable-component-keys.js +9 -0
  35. package/src/lib/app-utils/reusable-component-keys.js.map +1 -1
  36. package/src/lib/app-utils/server.d.ts +1 -0
  37. package/src/lib/app-utils/server.js +1 -0
  38. package/src/lib/app-utils/server.js.map +1 -1
  39. package/src/lib/app-utils/sign-in-hint-cookie.d.ts +58 -0
  40. package/src/lib/app-utils/sign-in-hint-cookie.js +71 -0
  41. package/src/lib/app-utils/sign-in-hint-cookie.js.map +1 -0
  42. package/src/lib/app-utils/sign-in-visibility.d.ts +75 -0
  43. package/src/lib/app-utils/sign-in-visibility.js +79 -0
  44. package/src/lib/app-utils/sign-in-visibility.js.map +1 -0
  45. package/src/lib/app-utils/site-live-url.d.ts +4 -1
  46. package/src/lib/app-utils/site-live-url.js +17 -3
  47. package/src/lib/app-utils/site-live-url.js.map +1 -1
  48. package/src/lib/app-utils/usage-level.d.ts +50 -0
  49. package/src/lib/app-utils/usage-level.js +94 -0
  50. package/src/lib/app-utils/usage-level.js.map +1 -0
  51. package/src/lib/foundation/definitions/org-billing.types.d.ts +45 -2
  52. package/src/lib/foundation/definitions/org-billing.types.js.map +1 -1
  53. package/src/lib/foundation/definitions/platform.types.d.ts +9 -0
  54. package/src/lib/foundation/definitions/platform.types.js.map +1 -1
@@ -159,7 +159,8 @@ export declare const ENTERPRISE_EMAIL_SENDS_PER_MONTH = 260000;
159
159
  * (AGL-67, 2026-07-07): storage-per-host is media storage; the published
160
160
  * total-site-size cap it used to exceed by design was retired in AGL-2133.
161
161
  * Metered costs are passed through
162
- * from Firebase/Vercel at cost × 1.30 separately (AGL-41).
162
+ * from Firebase/Vercel separately (AGL-41), priced at cost ×
163
+ * `METERED_PRICE_MULTIPLE` (1.3388) so cost + 30% is kept after Stripe.
163
164
  */
164
165
  /** Legacy host-keyed dataset overrides resolved into org keys (AGL-240). */
165
166
  type LegacyEntitlementKeys = 'datasetsPerHost' | 'maxDatasetsPerHost';
@@ -407,9 +408,13 @@ export interface PlanPricing {
407
408
  * $16 per included host on annual prices and $12 to $22 on monthly: ten
408
409
  * Business sites plus fifteen extras came to $219 against Advanced's $299,
409
410
  * and plus ninety extras to $819 against Agency's $1,049, so on host count
410
- * alone no plan was ever worth upgrading to. $20 clears the steepest step on
411
- * both intervals: extra hosts are how a plan takes a few more sites, and
412
- * the next plan is how it takes many more (2026-09-20).
411
+ * alone no plan was ever worth upgrading to. $20 cleared the steepest step
412
+ * on both intervals when it was set (2026-09-20); pricing v4's $69 Pro made
413
+ * the Starter → Pro step $22 a site on monthly prices, so three Starter
414
+ * sites came to $65 against Pro's $69. Starter's is $25 since AGL-4227
415
+ * (three sites $75 monthly, $66 annual); every other plan stays at $20.
416
+ * Extra hosts are how a plan takes a few more sites, and the next plan is
417
+ * how it takes many more.
413
418
  */
414
419
  extraHostMonthlyUsd: number | null;
415
420
  /**
@@ -451,9 +456,10 @@ export interface PlanPricing {
451
456
  extraDataGbMonthlyUsd: number | null;
452
457
  /**
453
458
  * Metered overage per 1,000 customer REST API requests beyond
454
- * `apiRequestsPerMonth` (AGL-634). API access starts at Pro since pricing
455
- * v4 (Business before it) and every tier above it carries it, so Free and
456
- * Starter are null (no API to meter).
459
+ * `apiRequestsPerMonth` (AGL-634). API access starts at Starter since
460
+ * AGL-4226 (Pro from pricing v4, Business before it) and every tier above it
461
+ * carries it, so Free alone is null (no API to meter) beside Custom's
462
+ * contractual null. Starter's overage stops at `maxApiRequestsPerMonth`.
457
463
  */
458
464
  extraApiRequestsUsdPer1k: number | null;
459
465
  /**
@@ -553,20 +559,23 @@ export interface PlanPricing {
553
559
  *
554
560
  * Null wherever the plan has no email band to be over, and null on
555
561
  * enterprise, where every rate is the "not for sale" sentinel and the terms
556
- * are contractual. Free and Starter are the two banded at 0: campaign email
557
- * begins at Pro, and `emailSendsOverage` yields 0 against a non-positive
558
- * band, so a rate on either would advertise a fee that can never be
559
- * computed — the same defect as a rate beside an UNLIMITED band.
562
+ * are contractual. Free is banded at 0 and has no subscription to bill:
563
+ * `emailSendsOverage` yields 0 against a non-positive band, so a rate there
564
+ * would advertise a fee that can never be computed — the same defect as a
565
+ * rate beside an UNLIMITED band. (Starter's campaign band is 0 too, but it
566
+ * is billed against its own band — below.)
560
567
  *
561
568
  * Every tier whose band is POSITIVE carries one, Pro upward. A finite band
562
569
  * with no rate is silently free past the band, and since transactional mail
563
570
  * cannot be refused at any tier that would be unbounded absorbed spend
564
571
  * rather than "no overage".
565
572
  *
566
- * The Starter null therefore leaves that tier's transactional mail — the
567
- * only mail it can send — unbilled at any volume. Bounded in practice by
568
- * `hostLimit: 1` and a 1,000-contact CRM, and the alternative prices a
569
- * password reset, but it is the one place this axis absorbs cost by design.
573
+ * Starter is the exception since AGL-4227: its campaign band is 0, so its
574
+ * rate is measured against `INCLUDED_EMAIL_SENDS_BY_PLAN` — 1,000 emails a
575
+ * month of everything it sends — and bills past it. (This comment used to
576
+ * call Starter's unbilled mail "bounded in practice by `hostLimit: 1` and a
577
+ * 1,000-contact CRM"; neither bounded it — Starter buys extra sites and
578
+ * meters CRM records — and the real bound was the daily abuse ceiling.)
570
579
  */
571
580
  extraEmailSendsUsdPer1k: number | null;
572
581
  /**
@@ -1055,7 +1064,8 @@ export declare function publishedMeteredPrice(costPerQuotedUnitUsd: number, deci
1055
1064
  * and functions bill, in USD per view (AGL-1879, AGL-3444): the CDN requests
1056
1065
  * a cold load makes, and the one of them that reaches a function — the
1057
1066
  * analytics beacon. A page view billed past a plan's band is priced at
1058
- * `(perPageView + this) × METERED_MARKUP` — $0.80 per 1,000 — and every
1067
+ * `(perPageView + this) × METERED_PRICE_MULTIPLE`, rounded up — $0.83 per
1068
+ * 1,000 since AGL-3476 (this said $0.80 at × 1.3 until AGL-4227) — and every
1059
1069
  * `bandwidthGb` band is sized with it counted.
1060
1070
  *
1061
1071
  * ## Why a page view needs a second cost term
@@ -1126,8 +1136,9 @@ export declare const PAGE_VIEW_CDN_REQUEST_COST_USD = 0.00021635711;
1126
1136
  /**
1127
1137
  * Monthly unit costs for the meters the rollup already records (AGL-1134).
1128
1138
  *
1129
- * These are OUR costs, not prices — the org is billed at cost × 1.30
1130
- * (`METERED_MARKUP`, AGL-41). Storage/page-view/form rates match
1139
+ * These are OUR costs, not prices — the org is billed at cost ×
1140
+ * `METERED_PRICE_MULTIPLE` (1.3388, AGL-3476), which keeps cost + 30%
1141
+ * (`METERED_MARKUP`, AGL-41) after Stripe's 2.9%. Storage/page-view/form rates match
1131
1142
  * `METERED_UNIT_RATES_USD` in the metering module on purpose: two files
1132
1143
  * disagreeing about what a page view costs is exactly the drift this function
1133
1144
  * exists to remove.
@@ -1213,18 +1224,24 @@ export declare const ORG_COGS_UNIT_RATES_USD: {
1213
1224
  */
1214
1225
  dataStoragePerGbMonth: number;
1215
1226
  /**
1216
- * One `/v1` request — $117 per million (AGL-3444).
1227
+ * One `/v1` request — $120 per million (AGL-3444, re-derived for AGL-4226).
1217
1228
  *
1218
1229
  * Every request is a function invocation behind a CDN request, and it reads
1219
1230
  * before it answers (`apps/console/utils/api-v1.ts`). The ledger for a
1220
1231
  * default list page — 25 records, read as 26 — at Vercel's dearest region
1221
- * and nam5's list prices:
1232
+ * and nam5's list prices, as the pipeline stands after AGL-4226:
1222
1233
  *
1223
- * - reads: the key, the rate-limit window, the org, the month's quota
1224
- * counter, the site the resource sits under, and the page — 31, at
1225
- * $0.06 per 100,000 = $0.0000186
1226
- * - writes: the rate-limit window and the usage counter — 2, at $0.18 per
1227
- * 100,000 = $0.0000036
1234
+ * - reads: the key, the key's rate-limit window, the org, the WORKSPACE's
1235
+ * rate-limit window (AGL-4226), the site the resource sits under, and
1236
+ * the page — 31, at $0.06 per 100,000 = $0.0000186. A plan whose month
1237
+ * is MEASURED (Starter, for its ceiling; a comp; Custom's fallback
1238
+ * band) reads the month's counter as well, 32 in all ($0.0000192). Before the
1239
+ * workspace limit it was 30 on a plan that never measured, and the
1240
+ * comment said 31 — the counter read is paid only where a month can
1241
+ * refuse.
1242
+ * - writes: the two rate-limit windows and the usage counter — 3, at
1243
+ * $0.18 per 100,000 = $0.0000054 (the key's last-used stamp is written
1244
+ * at most once a minute, and is left out)
1228
1245
  * - the function, 0.4 s billed as active CPU at $0.221/hr, 2 GB at
1229
1246
  * $0.0183/GB-hr, $0.60 per million invocations = $0.0000292
1230
1247
  * - the CDN request: $3.20 per million = $0.0000032
@@ -1234,9 +1251,30 @@ export declare const ORG_COGS_UNIT_RATES_USD: {
1234
1251
  * of request and envelope, through Fast Data Transfer ($0.35 a GB) and
1235
1252
  * Fast Origin Transfer ($0.43 a GB), decimal GB = $0.0000615
1236
1253
  *
1237
- * $0.0001161, carried up to $0.000117. A page of 100 — the most a client
1238
- * may ask for — costs about three times that, so the figure is the default
1239
- * request rather than the ceiling; see the 2026-10-01 decision entry.
1254
+ * $0.0001179, or $0.0001185 where the month is measured, carried up to
1255
+ * $0.00012. It was $0.000117 before the workspace window's read and write.
1256
+ *
1257
+ * The figure is the DEFAULT request, not the ceiling — which is why a
1258
+ * request has been BILLED by size since AGL-4227: one unit per started
1259
+ * 256 KB of the larger of its request and response
1260
+ * (`API_BILLING_UNIT_BYTES`). At Pro's $0.50 per 1,000, $0.0005 a unit and
1261
+ * 97.1% of it kept after Stripe:
1262
+ *
1263
+ * - a full 256 KiB unit costs about $0.000262 (the $0.000057 fixed part
1264
+ * above plus 262,144 bytes at $0.78 a decimal GB): kept 1.86×, the
1265
+ * thinnest case, still above cost + 30%;
1266
+ * - a page of 100 — the most a client may ask for — is $0.000343 and
1267
+ * about 302 KiB, so 2 units ($0.001): kept 2.83×;
1268
+ * - a 1 MB body is 4 units ($0.002) against about $0.000837: kept 2.32×;
1269
+ * - a body at Vercel's 4.5 MB function limit (a base64 image upload, or a
1270
+ * page of large dataset records) is 18 units ($0.009) against about
1271
+ * $0.00357: kept 2.45×. Billed as one unit it lost about 7×.
1272
+ *
1273
+ * Before the unit, a request paid for itself only up to about 550 KB on the
1274
+ * wire; with it, every size clears cost + 30% at $0.50, and by more at
1275
+ * Starter's $3.00.
1276
+ *
1277
+ * See the 2026-10-01 and 2026-11-16 decision entries.
1240
1278
  */
1241
1279
  perApiRequest: number;
1242
1280
  /**
@@ -1290,8 +1328,10 @@ export declare const ORG_COGS_UNIT_RATES_USD: {
1290
1328
  * document returned — and a step that writes a dataset record or calls a
1291
1329
  * webhook adds to it, so this is the typical figure, not the ceiling.
1292
1330
  *
1293
- * It is a COST, not a price: no plan bills runs, and none refuses past the
1294
- * band on a metered plan. It exists so a tier's run bands reach
1331
+ * It is a COST, not a price. Since pricing v4 Pro bills runs past its bands
1332
+ * at `RUN_OVERAGE_USD_PER_1K` ($0.02, cost × the pass-through multiple) and
1333
+ * Starter refuses at its band (comment corrected in AGL-4227). It exists so
1334
+ * a tier's run bands reach
1295
1335
  * `orgMonthlyCogsUsd` and `tier-margin-floor.spec.ts` — Agency's 3,000,000
1296
1336
  * runs are $36 a month that read as nothing while this was absent.
1297
1337
  */
@@ -2454,14 +2494,48 @@ export interface ApiRequestQuotaResult {
2454
2494
  overageMonthlyUsd: number;
2455
2495
  /** Per-1,000 overage rate; null when the plan has no API. */
2456
2496
  overageRateUsd: number | null;
2497
+ /**
2498
+ * The most requests the month allows, overage included (AGL-4226):
2499
+ * `maxApiRequestsPerMonth`, never below `included`. `UNLIMITED` from Pro up.
2500
+ */
2501
+ ceiling: number;
2502
+ /**
2503
+ * Which limit refused, when `allowed` is false (AGL-4226): `'ceiling'` — a
2504
+ * metered plan at its monthly ceiling; `'band'` — a plan with no rate (or
2505
+ * whose overage cannot be collected) at its included band.
2506
+ */
2507
+ refusedBy: 'ceiling' | 'band' | null;
2457
2508
  }
2509
+ /**
2510
+ * The per-1,000 rate API requests past the band are SOLD at for this org, or
2511
+ * `null` when nothing past the band is sold (AGL-4226).
2512
+ *
2513
+ * The plan's rate (`resolvePlanPricing`, so a comp sells nothing), withheld
2514
+ * on EVERY plan when the overage could never be collected: no live billing
2515
+ * subscription (`isBillingSubscription` — a paid plan stored without one), or
2516
+ * a 100% whole-bill discount. A withheld rate turns the band into the wall
2517
+ * `checkApiRequestQuota` already enforces for a plan with no rate, so those
2518
+ * workspaces stop at the requests they were given rather than metering onto
2519
+ * an invoice nobody pays.
2520
+ *
2521
+ * Starter-only when it was written (AGL-4226); every plan since a read-only
2522
+ * production count on 2026-11-16 found no workspace it would cut off (none
2523
+ * of 275 on a paid plan without a live subscription, none on a 100%
2524
+ * whole-bill coupon; the only unbilled ones are staff comps, none of them
2525
+ * calling the API). An explicit uncapped staff comp is untouched: its band is
2526
+ * `UNLIMITED`, so a null rate refuses nothing. Custom carries no rate, so its
2527
+ * contracted band was already the wall.
2528
+ */
2529
+ export declare function apiOverageRateUsd(org: Partial<AglynOrgBilling> | null | undefined): number | null;
2458
2530
  /**
2459
2531
  * Customer REST API request meter (AGL-634): the monthly request count for an
2460
- * org. Pro (since pricing v4) and every tier above it carry `apiAccess` and an
2461
- * `extraApiRequestsUsdPer1k` rate, so requests past the included quota meter
2462
- * onto the monthly invoice
2463
- * (cost-plus, like storage overage — never a hard wall mid-integration); plans
2464
- * without API access have `included: 0` and always block.
2532
+ * org. Every plan with `apiAccess` but Custom carries an
2533
+ * `extraApiRequestsUsdPer1k` rate (Starter since AGL-4226, Pro since pricing
2534
+ * v4), so requests past the included band meter onto the monthly invoice up
2535
+ * to the plan's monthly CEILING (`maxApiRequestsPerMonth`: 20,000 on
2536
+ * Starter, none from Pro up). Plans without a rate — Free, a comp, Custom
2537
+ * on its fallback band, or a Starter workspace whose overage cannot be
2538
+ * collected (`apiOverageRateUsd`) — stop at the band.
2465
2539
  */
2466
2540
  export declare function checkApiRequestQuota(org: Partial<AglynOrgBilling> | null | undefined, usedRequests: number): ApiRequestQuotaResult;
2467
2541
  /** The two monthly run bands the workflows plugin's gates are held to. */
@@ -2512,6 +2586,19 @@ export interface CrmRecordsQuotaResult {
2512
2586
  overageMonthlyUsd: number;
2513
2587
  /** Per-1,000 overage rate; null when the plan hard-bands (free). */
2514
2588
  overageRateUsd: number | null;
2589
+ /**
2590
+ * The most records the plan allows, overage included (AGL-4227):
2591
+ * `maxCrmRecords`, never below `included`. Starter's is Pro's included
2592
+ * amount; `UNLIMITED` from Pro up.
2593
+ */
2594
+ ceiling: number;
2595
+ /**
2596
+ * Which limit refused, when `allowed` is false (AGL-4227): `'ceiling'` — a
2597
+ * metered plan at its records ceiling (Starter at Pro's band, where the
2598
+ * upgrade is the way on); `'band'` — a plan that sells nothing past its
2599
+ * included records (Free, a comp).
2600
+ */
2601
+ refusedBy: 'ceiling' | 'band' | null;
2515
2602
  }
2516
2603
  /**
2517
2604
  * The name this result carried while the band counted contacts alone.
@@ -2521,7 +2608,9 @@ export type ContactQuotaResult = CrmRecordsQuotaResult;
2521
2608
  /**
2522
2609
  * CRM records band meter (AGL-890, widened in AGL-2611): contacts, companies
2523
2610
  * and deals, counted together across the org and measured against the ONE
2524
- * band `contactsPerHost` names. Paid plans carry an `extraContactsUsdPer1k`
2611
+ * band `contactsPerHost` names, up to `maxCrmRecords` (AGL-4227: Starter
2612
+ * stops adding at Pro's included amount; records it already holds stay and
2613
+ * bill). Paid plans carry an `extraContactsUsdPer1k`
2525
2614
  * rate, so records past the included band meter onto the monthly invoice
2526
2615
  * (cost-plus, like storage and API overage — a growing audience is never
2527
2616
  * dropped); free has no rate and hard-bands at the included count, refusing
@@ -2609,6 +2698,56 @@ export interface CrmEmailQuotaResult {
2609
2698
  * told their limit by being refused.
2610
2699
  */
2611
2700
  export declare function checkCrmEmailQuota(org: Partial<AglynOrgBilling> | null | undefined, usedToday: number, now?: Date): CrmEmailQuotaResult;
2701
+ /**
2702
+ * The EMAIL BILLING band where it is not the campaign band (AGL-4227): the
2703
+ * emails a month a plan includes across ALL mail on the cost meter — receipts,
2704
+ * notices, workflow and one-to-one CRM mail as well as campaigns — before
2705
+ * `extraEmailSendsUsdPer1k` bills.
2706
+ *
2707
+ * Starter's campaign band is 0 (campaigns start at Pro), so measuring its
2708
+ * overage against that band priced nothing at any volume. It now includes
2709
+ * 1,000 emails a month of everything, one-to-one CRM mail inside the same
2710
+ * 1,000, and bills past it. Every other plan bills against its campaign band
2711
+ * as before; a plan absent here has no separate billing band.
2712
+ */
2713
+ export declare const INCLUDED_EMAIL_SENDS_BY_PLAN: Readonly<Partial<Record<OrgPlan, number>>>;
2714
+ /**
2715
+ * A HARD monthly cap on a plan's email (AGL-4227), across everything on the
2716
+ * cost meter but account and security mail: past it, the next email is not
2717
+ * sent until the month turns (UTC). For the plan that cannot be billed for
2718
+ * usage — Free — so its mail has a bound that is not an invoice.
2719
+ *
2720
+ * 300 on Free. What a Free workspace legitimately sends is small: 20 form
2721
+ * submissions a month (a notice and a confirmation each, at most 40), no
2722
+ * store, no bookings, no campaigns, no one-to-one CRM mail and no workflows;
2723
+ * invitations, sign-in links and password resets are exempt and never
2724
+ * counted. 300 is several times that, and costs at most $0.27 a month at
2725
+ * `perEmailSend`. Counted on its own field from the month it ships, so it
2726
+ * never refuses mail because of what was sent before it existed.
2727
+ *
2728
+ * A plan absent here has no monthly cap (its daily abuse ceiling still
2729
+ * applies). An org can be given its own figure on
2730
+ * `entitlements.emailSendsMonthlyCap`.
2731
+ */
2732
+ export declare const EMAIL_SENDS_MONTHLY_CAP_BY_PLAN: Readonly<Partial<Record<OrgPlan, number>>>;
2733
+ /** The per-org override key for the monthly email cap. */
2734
+ export declare const EMAIL_SENDS_MONTHLY_CAP_KEY = "emailSendsMonthlyCap";
2735
+ /**
2736
+ * The org's hard monthly email cap (AGL-4227): its own figure when staff
2737
+ * wrote one, else its plan's, else `UNLIMITED`. The ONE reader the send seam,
2738
+ * the usage page and the usage alerts ask. Read off the plan the org RESOLVES
2739
+ * as, so a lapsed paid plan reads as Free.
2740
+ */
2741
+ export declare function resolveMonthlyEmailCap(org: Partial<AglynOrgBilling> | null | undefined): number;
2742
+ /**
2743
+ * The band an org's month of email is billed against (AGL-4227):
2744
+ * `INCLUDED_EMAIL_SENDS_BY_PLAN` for its plan where one is set, else its
2745
+ * resolved `emailSendsPerMonth`. The ONE reader the rollup and the billing
2746
+ * page ask, so the invoice and the readout cannot measure different bands.
2747
+ * A comp prices nothing past any band (`compPricing`), so the band it reads
2748
+ * here never bills.
2749
+ */
2750
+ export declare function emailSendsBillingBand(org: Partial<AglynOrgBilling> | null | undefined): number;
2612
2751
  /**
2613
2752
  * Volume above the plan's included band, in emails.
2614
2753
  *
@@ -3135,3 +3274,55 @@ export declare function dataStorageEnforcementShape(org: Partial<AglynOrgBilling
3135
3274
  * anything has been measured. @see QuotaEnforcementShape
3136
3275
  */
3137
3276
  export declare function apiRequestEnforcementShape(org: Partial<AglynOrgBilling> | null | undefined): QuotaEnforcementShape;
3277
+ /**
3278
+ * Requests per minute the WHOLE workspace may make on the customer API, every
3279
+ * key and connection together (AGL-4226): the resolved
3280
+ * `apiRequestsPerMinutePerOrg`, or `UNLIMITED` when the plan sets none
3281
+ * (Custom without an agreed figure, an uncapped comp). Sits beside the
3282
+ * per-key 120 a minute, never instead of it.
3283
+ *
3284
+ * The ladder: Starter 120 (one key's worth), Pro 600, and each retired tier
3285
+ * above it at least Pro's — Business 600, Scale 1,200, Advanced 2,400,
3286
+ * Agency 6,000 — with Custom unlimited unless its agreement sets a number.
3287
+ */
3288
+ export declare function apiWorkspaceRateLimitPerMinute(org: Partial<AglynOrgBilling> | null | undefined): number;
3289
+ /**
3290
+ * The cheapest self-serve plan with no monthly API ceiling, by price — the
3291
+ * plan a refusal at the ceiling names as the way past it (AGL-4226). `null`
3292
+ * when every self-serve plan has one.
3293
+ */
3294
+ export declare function cheapestPlanWithoutApiCeiling(): OrgPlan | null;
3295
+ /**
3296
+ * What a monthly refusal says (AGL-4226), naming the limit that refused: the
3297
+ * plan's ceiling and the plan without one, or the band a plan that sells no
3298
+ * overage stopped at.
3299
+ */
3300
+ export declare function apiMonthlyRefusalMessage(org: Partial<AglynOrgBilling> | null | undefined, quota: Pick<ApiRequestQuotaResult, 'ceiling' | 'included' | 'refusedBy'>): string;
3301
+ /**
3302
+ * What a refused CRM record says (AGL-4227): at Starter's ceiling, the
3303
+ * ceiling and the plan that includes it; at a band a plan sells nothing past,
3304
+ * the band. Records already held are never touched, and the message says so.
3305
+ */
3306
+ export declare function crmRecordsRefusalMessage(org: Partial<AglynOrgBilling> | null | undefined, quota: Pick<CrmRecordsQuotaResult, 'ceiling' | 'included' | 'refusedBy'>): string;
3307
+ /**
3308
+ * The size of ONE billed API unit (AGL-4227): a request is billed one unit
3309
+ * per started 256 KB of the larger of its request and response body.
3310
+ *
3311
+ * Every request was one unit at any size, and a request costs its bytes: a
3312
+ * default page is about 77 KB on the wire, a page of 100 records about
3313
+ * 302 KB, and a body at Vercel's 4.5 MB function limit about $0.0035 in
3314
+ * transfer alone — roughly 7× what one unit brings in at $0.50 per 1,000. A
3315
+ * 256 KB unit costs at most about $0.00026 (transfer at $0.78 per decimal GB
3316
+ * plus the request's fixed cost), which $0.50 per 1,000 covers 1.9 times
3317
+ * after Stripe's fee. The unit counts on the monthly counter, so it reaches
3318
+ * the invoice, the ceiling and the usage meter alike; the per-minute limits
3319
+ * keep counting CALLS.
3320
+ */
3321
+ export declare const API_BILLING_UNIT_BYTES: number;
3322
+ /**
3323
+ * How many billed units a request is (AGL-4227): one per started
3324
+ * `API_BILLING_UNIT_BYTES` of the larger of its request and response body,
3325
+ * and never fewer than one. A size that is not a finite, non-negative number
3326
+ * reads as 0, so it can only ever charge the one unit every call is.
3327
+ */
3328
+ export declare function apiRequestBillingUnits(requestBytes: number, responseBytes: number): number;