@aglyn/aglyn 1.8.0 → 1.9.1

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 (51) hide show
  1. package/package.json +11 -11
  2. package/src/lib/app-utils/ai-credit-blocks.d.ts +124 -0
  3. package/src/lib/app-utils/ai-credit-blocks.js +122 -0
  4. package/src/lib/app-utils/ai-credit-blocks.js.map +1 -0
  5. package/src/lib/app-utils/bundle-intent.d.ts +17 -51
  6. package/src/lib/app-utils/bundle-intent.js +30 -74
  7. package/src/lib/app-utils/bundle-intent.js.map +1 -1
  8. package/src/lib/app-utils/contacts.d.ts +4 -1
  9. package/src/lib/app-utils/contacts.js.map +1 -1
  10. package/src/lib/app-utils/docs-help-sections.generated.js +3 -3
  11. package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
  12. package/src/lib/app-utils/docs-help.generated.d.ts +1 -1
  13. package/src/lib/app-utils/docs-help.generated.js +1 -1
  14. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  15. package/src/lib/app-utils/docs-index.generated.js +84 -84
  16. package/src/lib/app-utils/docs-index.generated.js.map +1 -1
  17. package/src/lib/app-utils/margin-utilization.js +6 -5
  18. package/src/lib/app-utils/margin-utilization.js.map +1 -1
  19. package/src/lib/app-utils/onboarding-deep-link.d.ts +10 -11
  20. package/src/lib/app-utils/onboarding-deep-link.js +37 -32
  21. package/src/lib/app-utils/onboarding-deep-link.js.map +1 -1
  22. package/src/lib/app-utils/operator-alerts.js +17 -0
  23. package/src/lib/app-utils/operator-alerts.js.map +1 -1
  24. package/src/lib/app-utils/plan-entitlements.d.ts +142 -150
  25. package/src/lib/app-utils/plan-entitlements.js +202 -201
  26. package/src/lib/app-utils/plan-entitlements.js.map +1 -1
  27. package/src/lib/app-utils/release-flags.d.ts +6 -4
  28. package/src/lib/app-utils/release-flags.js +8 -9
  29. package/src/lib/app-utils/release-flags.js.map +1 -1
  30. package/src/lib/app-utils/server.d.ts +1 -0
  31. package/src/lib/app-utils/server.js +3 -0
  32. package/src/lib/app-utils/server.js.map +1 -1
  33. package/src/lib/app-utils/site-interactions.d.ts +1 -1
  34. package/src/lib/app-utils/site-interactions.js +2 -2
  35. package/src/lib/app-utils/site-interactions.js.map +1 -1
  36. package/src/lib/app-utils/transactional-email-ceiling.d.ts +119 -0
  37. package/src/lib/app-utils/transactional-email-ceiling.js +134 -0
  38. package/src/lib/app-utils/transactional-email-ceiling.js.map +1 -0
  39. package/src/lib/app-utils/upgrade-proposal.d.ts +17 -7
  40. package/src/lib/app-utils/upgrade-proposal.js +20 -13
  41. package/src/lib/app-utils/upgrade-proposal.js.map +1 -1
  42. package/src/lib/foundation/definitions/org-billing.types.d.ts +4 -29
  43. package/src/lib/foundation/definitions/org-billing.types.js.map +1 -1
  44. package/src/lib/foundation/definitions/organization.types.d.ts +1 -3
  45. package/src/lib/foundation/definitions/organization.types.js.map +1 -1
  46. package/src/lib/foundation/index.d.ts +1 -1
  47. package/src/lib/foundation/index.js.map +1 -1
  48. package/src/lib/plugin-manager/first-party-plugins.generated.js +9 -4
  49. package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
  50. package/src/lib/plugin-manager/plugin-usage-axes.d.ts +14 -0
  51. package/src/lib/plugin-manager/plugin-usage-axes.js.map +1 -1
@@ -14,7 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import type { AglynOrgBilling, AiTierId, CoreOrgEntitlements, CoreOrgFeatureFlags, OrgDiscount, OrgFeatureFlags, OrgPlan, OrgSeatAddons } from '../foundation';
17
+ import type { AglynOrgBilling, CoreOrgEntitlements, CoreOrgFeatureFlags, OrgDiscount, OrgFeatureFlags, OrgPlan, OrgSeatAddons } from '../foundation';
18
18
  import type { PluginOrgFeatures, PluginOrgQuotas } from '../plugin-manager/plugin-entitlement-keys';
19
19
  import { type OrgOverrideReasonCode } from './org-override-reason';
20
20
  import type { ResolvedBrandingProfile } from './platform-brand';
@@ -211,8 +211,31 @@ export declare const PLAN_ENTITLEMENTS: Record<OrgPlan, ResolvedOrgEntitlements>
211
211
  * marketing pricing table, the plan-change dialog) MUST iterate this rather
212
212
  * than `Object.keys(PLAN_ENTITLEMENTS)`, so a custom-priced tier can never
213
213
  * show a self-serve Upgrade button or a $0 headline price.
214
+ *
215
+ * Pricing v4 (2026-11-03, AGL-4126): three self-serve plans and Custom above
216
+ * them. Business, Scale, Advanced and Agency are RETIRED_PLANS: never sold
217
+ * again, their rows kept so a stored `plan`, a comp and an old record still
218
+ * resolve and type-check.
214
219
  */
215
220
  export declare const SELF_SERVE_PLANS: OrgPlan[];
221
+ /**
222
+ * The plans pricing v4 retired (2026-11-03, AGL-4126). Nothing offers them:
223
+ * no plan card, no checkout price, no comp picker, no sign-up link. Their
224
+ * `PLAN_ENTITLEMENTS` and `PLAN_PRICING` rows stay, read-only, so an org whose
225
+ * stored `plan` still names one resolves exactly as it always did. When v4
226
+ * shipped no subscription was on any of them.
227
+ */
228
+ export declare const RETIRED_PLANS: readonly OrgPlan[];
229
+ /**
230
+ * Every plan a workspace can be ON, cheapest first: the self-serve ladder,
231
+ * the retired plans in their old place above it, then the custom plan. The
232
+ * ORDER question ("is this move down?", "what is the plan below this one?")
233
+ * reads this, so a workspace left on a retired plan is still placed on the
234
+ * ladder; the SALE question ("what may be bought?") reads `SELF_SERVE_PLANS`.
235
+ */
236
+ export declare const PLAN_LADDER: readonly OrgPlan[];
237
+ /** Whether a plan is one pricing v4 retired (`RETIRED_PLANS`). */
238
+ export declare function isRetiredPlan(plan: OrgPlan | string | undefined | null): boolean;
216
239
  /**
217
240
  * Whether the plan has no list price and is quoted per deal (AGL-1118).
218
241
  * `PLAN_PRICING` still carries a row for it — the record is exhaustive by
@@ -304,105 +327,12 @@ export declare const SITE_CARE_PROJECT_SPLIT_ABOVE_USD = 500;
304
327
  */
305
328
  export declare const POS_REGISTER_ADDON_MONTHLY_USD = 89;
306
329
  /**
307
- * The Aglyn AI tiers (AGL-3965): credits sold on their own, to ANY paid
308
- * plan, on top of what the plan includes.
309
- *
310
- * ## One pool
311
- *
312
- * Every plan's `assistCreditsPerMonth` pays for ALL of Aglyn AI — the
313
- * assistant and generation alike — and `features.aiGenerative` is on for
314
- * every plan. A tier ADDS `credits` to that same band in
315
- * `resolveOrgEntitlements`, so `resolveAssistCreditBudget`, the overage
316
- * price and the hard-cap switch all still see one number. Past the pool the
317
- * plan's `extraAssistCreditsUsdPer1k` bills per 1,000 credits unless the
318
- * owner turned on `assistOverage.hardCap`; a tier changes neither.
319
- *
320
- * ## Sized against the tier's own price
321
- *
322
- * A credit is `ASSIST_CREDIT_COST_USD` of provider spend, so `credits` is a
323
- * cost figure: 1,000 credits are $1.00. Every tier costs at most 50% of its
324
- * price at full consumption — Spark $4 of $9, Boost $9 of $19, Plus $19 of
325
- * $39, Max $34 of $69, Ultra $49 of $99, Studio $149 of $299 — the same
326
- * line-margin floor (`ASSIST_CREDIT_MIN_MARGIN_PCT`) every retail assist
327
- * rate clears. The plan's included band is priced at 100% burn on its own
328
- * tier, so a tier's margin never leans on the plan's; that is what
329
- * `tier-margin-floor.spec.ts` holds, per tier.
330
- *
331
- * These are the six price/credit pairs the add-on was sold at per plan
332
- * before AGL-3965 (Starter's $9 / 4,000 through Agency's $299 / 149,000),
333
- * now chosen independently of the plan. `LEGACY_AI_ADDON_TIER_BY_PLAN` maps
334
- * each old per-plan add-on to the tier with its price and band.
335
- *
336
- * Yearly is ×12 with no discount, as every add-on is. Studio is the top;
337
- * more is an Enterprise contract. Free sells none (`planSellsAiTiers`).
338
- */
339
- export interface AiTier {
340
- /** The tier's name as a person sees it, after the product name. */
341
- label: string;
342
- monthlyUsd: number;
343
- yearlyUsd: number;
344
- /** Credits a month the tier adds to the plan's included band. */
345
- credits: number;
346
- }
347
- /** The tiers, smallest first — the order every picker lists them in. */
348
- export declare const AI_TIER_IDS: readonly AiTierId[];
349
- export declare const AI_TIERS: Readonly<Record<AiTierId, AiTier>>;
350
- /**
351
- * The tier an add-on bought before AGL-3965 is (AGL-3965): the one with the
352
- * same price and the same band the plan sold it at, so a workspace that
353
- * held "the Pro add-on" holds Boost — $19, 9,000 credits — and neither its
354
- * bill nor its credits move. Read when `aiTier` is absent and to classify a
355
- * per-plan `STRIPE_PRICE_{PLAN}_AI_ADDON` item still on a subscription.
356
- */
357
- export declare const LEGACY_AI_ADDON_TIER_BY_PLAN: Readonly<Partial<Record<OrgPlan, AiTierId>>>;
358
- /**
359
- * The tier a purchase that names a plan and no tier means (AGL-3965): a
360
- * `?plan=pro&ai=1` deep link, a checkout posting `aiAddon: true` alone. The
361
- * tier with that plan's old price and band, so a link published before tiers
362
- * existed still sells what it quoted. Null where the plan sells no tier.
363
- */
364
- export declare function defaultAiTierForPlan(plan: OrgPlan | string | null | undefined): AiTierId | null;
365
- /** Whether a value is one of the tier ids. */
366
- export declare function isAiTierId(value: unknown): value is AiTierId;
367
- /**
368
- * The add-on key an Aglyn AI tier travels under outside the billing routes
369
- * (AGL-3965): `ai:<tier>`, e.g. `ai:boost`. The ONE spelling a bundle
370
- * checkout link (AGL-3955) and a hand-off proposal's add-on list (AGL-3956)
371
- * name a tier by, parsed and listed here, beside the tiers, so neither
372
- * restates the ids.
373
- */
374
- export type AiTierAddonKey = `ai:${AiTierId}`;
375
- /** `ai:<tier>` for a tier. */
376
- export declare function aiTierAddonKey(tier: AiTierId): AiTierAddonKey;
377
- /**
378
- * The tier an `ai:<tier>` key names, or null for anything else — another
379
- * add-on's key, a bare `ai`, an unknown tier, a non-string. Exact and
380
- * case-sensitive: a key is read off a link, and guessing is the expensive
381
- * direction to be wrong in (`parseOnboardingPlanIntent` reads `?ai=` the
382
- * same way).
383
- */
384
- export declare function parseAiTierAddonKey(key: unknown): AiTierId | null;
385
- /** One tier as an add-on a bundle or a proposal can carry. */
386
- export interface AiTierAddonOption {
387
- key: AiTierAddonKey;
388
- tier: AiTierId;
389
- label: string;
390
- monthlyUsd: number;
391
- yearlyUsd: number;
392
- credits: number;
393
- }
394
- /**
395
- * Every tier as an `ai:<tier>` add-on, smallest first — what a picker that
396
- * offers "Aglyn AI" beside the other add-ons lists. Empty for a plan that
397
- * sells no tier (Free, Enterprise) when a plan is given.
398
- */
399
- export declare function listAiTierAddons(plan?: OrgPlan | string | null): AiTierAddonOption[];
400
- /**
401
- * Whether a plan may buy an Aglyn AI tier (AGL-3965): every paid self-serve
402
- * plan. Not Free, which has no subscription to carry it, and not Enterprise,
403
- * whose AI is in the agreement.
330
+ * Whether a plan sells Aglyn AI credit blocks (AGL-4144): every paid
331
+ * self-serve plan. Not Free, which has no subscription to carry them, and
332
+ * not Enterprise, whose AI is in the agreement. The block itself — 5,000
333
+ * credits for $10 a month, up to 30 — is `ai-credit-blocks.ts`.
404
334
  */
405
- export declare function planSellsAiTiers(plan: OrgPlan | string | undefined | null): boolean;
335
+ export declare function planSellsAiCredits(plan: OrgPlan | string | undefined | null): boolean;
406
336
  /**
407
337
  * The generative add-on's name as a person sees it (AGL-2896): the brand,
408
338
  * then "AI". Read from the platform brand by default and from the org's
@@ -513,9 +443,9 @@ export interface PlanPricing {
513
443
  extraDataGbMonthlyUsd: number | null;
514
444
  /**
515
445
  * Metered overage per 1,000 customer REST API requests beyond
516
- * `apiRequestsPerMonth` (AGL-634). API access starts at Business and every
517
- * tier above it carries it, so Free, Starter and Pro are null (no API to
518
- * meter).
446
+ * `apiRequestsPerMonth` (AGL-634). API access starts at Pro since pricing
447
+ * v4 (Business before it) and every tier above it carries it, so Free and
448
+ * Starter are null (no API to meter).
519
449
  */
520
450
  extraApiRequestsUsdPer1k: number | null;
521
451
  /**
@@ -586,6 +516,9 @@ export interface PlanPricing {
586
516
  * month above its band whenever receipts, invites, booking reminders and
587
517
  * workflow notifications carry it there. That excess is real provider spend
588
518
  * that no gate could have stopped, and this is the rate it bills at.
519
+ * (The one bound on it is an abuse ceiling per UTC day, far above any real
520
+ * store's volume and named nowhere a customer reads:
521
+ * `transactional-email-ceiling.ts`, AGL-4145.)
589
522
  *
590
523
  * ## Retail, NOT the infrastructure pass-through
591
524
  *
@@ -628,6 +561,31 @@ export interface PlanPricing {
628
561
  * password reset, but it is the one place this axis absorbs cost by design.
629
562
  */
630
563
  extraEmailSendsUsdPer1k: number | null;
564
+ /**
565
+ * Overage per 1,000 workflow and action runs past the plan's run bands
566
+ * (`workflowRunsPerMonth`, `actionRunsPerMonth`), since pricing v4
567
+ * (2026-11-03, AGL-4126). Null where the bands are walls: Free and Starter
568
+ * keep every wall, and Enterprise's terms are contractual.
569
+ *
570
+ * ## Derived from cost, like the pass-through
571
+ *
572
+ * Not a retail ladder like contacts or email: it is
573
+ * `ORG_COGS_UNIT_RATES_USD.perRun` ($13 per million) at cost + 30% kept
574
+ * after Stripe's percentage fee — `publishedMeteredPrice(perRun × 1,000, 2)`,
575
+ * the rule `METERED_PRICE_MULTIPLE` sets for storage, bandwidth and form
576
+ * submissions — which is $0.0174 per 1,000, rounded UP to the cent the page
577
+ * quotes it in: $0.02. Written as {@link RUN_OVERAGE_USD_PER_1K} because a
578
+ * `const` declared further down this file cannot be read while this table
579
+ * is built; `tier-margin-floor.spec.ts` derives it and pins the two equal.
580
+ *
581
+ * ## What it decides at the gate
582
+ *
583
+ * A plan WITH a rate runs past its band and bills the excess
584
+ * (`runOverageSold`); a plan without one stops at the band, as every plan
585
+ * did before v4. Billed by `report-usage` through `priceRunOverage`, on the
586
+ * same invoice line as the other overages.
587
+ */
588
+ extraRunsUsdPer1k: number | null;
631
589
  /**
632
590
  * Whether the plan carries the metered infrastructure pass-through
633
591
  * (AGL-41, turned on in AGL-1280): media storage, bandwidth (page views)
@@ -646,6 +604,15 @@ export interface PlanPricing {
646
604
  */
647
605
  meteredInfraPassThrough: boolean;
648
606
  }
607
+ /**
608
+ * The run overage, per 1,000 workflow or action runs past the bands (pricing
609
+ * v4, 2026-11-03, AGL-4126): `ORG_COGS_UNIT_RATES_USD.perRun` × 1,000 ×
610
+ * `METERED_PRICE_MULTIPLE`, rounded up to the cent — $0.013 × 1.3388 is
611
+ * $0.0174, published as $0.02. A literal because the cost table and the
612
+ * multiple are declared below `PLAN_PRICING`, which reads this at load;
613
+ * `tier-margin-floor.spec.ts` derives it from them and pins it.
614
+ */
615
+ export declare const RUN_OVERAGE_USD_PER_1K = 0.02;
649
616
  /**
650
617
  * Flat subscription pricing per tier (AGL-68). Kept beside the entitlements
651
618
  * so price changes ride the same review path; Stripe price ids map to plans
@@ -850,12 +817,11 @@ export declare function isBillingSubscription(org: Partial<AglynOrgBilling> | nu
850
817
  */
851
818
  export declare function orgListPriceMonthlyUsd(org: Partial<AglynOrgBilling> | null | undefined): number;
852
819
  /**
853
- * How many Aglyn AI add-ons a purchase map counts as: 0 or 1 (AGL-2896).
854
- * The add-on is org-wide like Event Calendar, so a quantity above one — a
855
- * hand edit, a doubled webhook item — is one purchase, and a non-number,
856
- * `NaN` or a negative is none.
820
+ * How many Aglyn AI credit blocks a purchase map counts as (AGL-4144): a
821
+ * whole number from 0 to 30 (`aiCreditBlockCount`). A non-number, `NaN` or a
822
+ * negative is none, and a quantity above the ceiling is the ceiling.
857
823
  */
858
- export declare function aiAddonUnits(addons: OrgSeatAddons | null | undefined): 0 | 1;
824
+ export declare function aiAddonUnits(addons: OrgSeatAddons | null | undefined): number;
859
825
  /**
860
826
  * How many Site Care add-ons a purchase map counts as: 0 or 1 (AGL-3954).
861
827
  * Org-wide like the Aglyn AI add-on, so a quantity above one is one
@@ -1551,61 +1517,52 @@ export declare function checkDiscountMargin(org: Partial<AglynOrgBilling> | null
1551
1517
  */
1552
1518
  export declare function resolveEffectivePlan(org: Partial<AglynOrgBilling> | null | undefined): OrgPlan;
1553
1519
  /**
1554
- * Whether the org's Aglyn AI add-on currently applies (AGL-2896): bought,
1555
- * and on a subscription that is still paying for it. The ONE reading of
1556
- * `seatAddons.aiAddon` — the entitlement fold and the assist overage rate
1557
- * both ask this, so a dead subscription drops the band and the rate
1558
- * together rather than leaving a rate on a band that has gone.
1520
+ * Whether the org holds Aglyn AI credit blocks that currently apply
1521
+ * (AGL-2896, AGL-4144): bought, and on a subscription that is still paying
1522
+ * for them. The ONE reading of `seatAddons.aiAddon` — the entitlement fold
1523
+ * and the assist overage rate both ask this, so a dead subscription drops
1524
+ * the credits and the rate together rather than leaving a rate on a band
1525
+ * that has gone.
1559
1526
  */
1560
1527
  export declare function hasAiAddon(org: Partial<AglynOrgBilling> | null | undefined): boolean;
1561
1528
  /**
1562
- * Which Aglyn AI tier the org's purchase map holds (AGL-3965), whether or
1563
- * not the subscription is still paying for it — `resolveAiTier` is the
1564
- * reading that drops a dead one. `org.aiTier` when it names a tier;
1565
- * otherwise, for an add-on bought before tiers existed, the tier with that
1566
- * plan's old price and band (`LEGACY_AI_ADDON_TIER_BY_PLAN`). Null when no
1567
- * add-on is held or the plan sells no tier (Free, Enterprise).
1568
- */
1569
- export declare function aiTierOfPurchase(org: Partial<AglynOrgBilling> | null | undefined): AiTierId | null;
1570
- /**
1571
- * The Aglyn AI tier that currently applies (AGL-3965): bought, on a
1572
- * subscription still paying for it, on a plan that sells tiers. The ONE
1573
- * reading every surface that shows or counts a tier goes through.
1529
+ * How many Aglyn AI credit blocks currently apply (AGL-4144): bought, on a
1530
+ * subscription still paying for them, on a plan that sells blocks. 0 on a
1531
+ * dead subscription, on Free, and on Enterprise (whose add-on is the
1532
+ * agreement's figure, not blocks). The ONE reading every surface that shows
1533
+ * or counts blocks goes through.
1574
1534
  */
1575
- export declare function resolveAiTier(org: Partial<AglynOrgBilling> | null | undefined): AiTierId | null;
1535
+ export declare function resolveAiCreditBlocks(org: Partial<AglynOrgBilling> | null | undefined): number;
1576
1536
  /**
1577
- * What `seatAddons.aiAddon` adds on an Enterprise org (AGL-2896, kept by
1578
- * AGL-3965): twice Studio's band, the figure the per-plan table carried as
1579
- * twice Agency's (the rule every Enterprise fallback follows since AGL-2654),
1580
- * and still what a contract that names the add-on starts from before its own
1581
- * number is written. Enterprise buys no tier — its AI is in the agreement —
1582
- * so this is the contract figure kept, not a price; finite, never
1583
- * `UNLIMITED`, for the reason `ENTERPRISE_ASSIST_CREDITS_PER_MONTH` gives.
1537
+ * What one unit of `seatAddons.aiAddon` adds on an Enterprise org (AGL-2896,
1538
+ * kept through AGL-3965 and AGL-4144): 298,000 credits, the figure the
1539
+ * per-plan table carried as twice the top plan's band, and still what a
1540
+ * contract that names the add-on starts from before its own number is
1541
+ * written. Enterprise buys no blocks — its AI is in the agreement — so this
1542
+ * is the contract figure kept, not a price; finite, never `UNLIMITED`, for
1543
+ * the reason `ENTERPRISE_ASSIST_CREDITS_PER_MONTH` gives.
1584
1544
  */
1585
- export declare const ENTERPRISE_AI_ADDON_CREDITS_PER_MONTH: number;
1545
+ export declare const ENTERPRISE_AI_ADDON_CREDITS_PER_MONTH = 298000;
1586
1546
  /**
1587
1547
  * The Aglyn AI add-on's per-unit quota as `resolveOrgEntitlements` folds it
1588
- * (AGL-3965): the purchased tier's credits, on a plan that sells tiers;
1589
- * Enterprise's contract figure (`ENTERPRISE_AI_ADDON_CREDITS_PER_MONTH`);
1590
- * else 0 (Free). The AI plugin declares its seat add-on with this as
1591
- * `quota.perUnit`.
1548
+ * (AGL-4144): 5,000 credits a block on a plan that sells blocks; Enterprise's
1549
+ * contract figure (`ENTERPRISE_AI_ADDON_CREDITS_PER_MONTH`); else 0 (Free).
1550
+ * The AI plugin declares its seat add-on with this as `quota.perUnit`.
1592
1551
  */
1593
- export declare function aiTierQuotaPerUnit(org: Partial<AglynOrgBilling> | null | undefined, plan: OrgPlan): number;
1552
+ export declare function aiCreditsQuotaPerUnit(_org: Partial<AglynOrgBilling> | null | undefined, plan: OrgPlan): number;
1594
1553
  /**
1595
1554
  * The credits a month the org's Aglyn AI add-on adds to its plan's included
1596
- * band (AGL-3965) — 0 with none held. The SAME figure `resolveOrgEntitlements`
1597
- * folds into `assistCreditsPerMonth` (`aiTierQuotaPerUnit`), so a surface
1598
- * quoting "your tier adds" and the meter agree.
1555
+ * band (AGL-4144) — 0 with none held. The SAME figure `resolveOrgEntitlements`
1556
+ * folds into `assistCreditsPerMonth` (units × `aiCreditsQuotaPerUnit`), so a
1557
+ * surface quoting "your blocks add" and the meter agree.
1599
1558
  */
1600
- export declare function aiTierCreditsPerMonth(org: Partial<AglynOrgBilling> | null | undefined): number;
1559
+ export declare function aiCreditBlocksCreditsPerMonth(org: Partial<AglynOrgBilling> | null | undefined): number;
1601
1560
  /**
1602
- * Whether this org can buy or change an Aglyn AI tier itself (AGL-3965): a
1603
- * plan that sells tiers, and not one a staff comp grants — a comp has no
1604
- * subscription to put the tier on (`compPricing`).
1561
+ * Whether this org can buy or change Aglyn AI credit blocks itself
1562
+ * (AGL-4144): a plan that sells them, and not one a staff comp grants — a
1563
+ * comp has no subscription to put the blocks on (`compPricing`).
1605
1564
  */
1606
- export declare function orgCanBuyAiTier(org: Partial<AglynOrgBilling> | null | undefined): boolean;
1607
- /** "Aglyn AI Boost": the product name, then the tier's. */
1608
- export declare const aiTierName: (tier: AiTierId, brand?: string) => string;
1565
+ export declare function orgCanBuyAiCredits(org: Partial<AglynOrgBilling> | null | undefined): boolean;
1609
1566
  /**
1610
1567
  * Whether the org's Site Care add-on currently applies (AGL-3954): bought,
1611
1568
  * and on a subscription that is still paying for it, so a dead subscription
@@ -2387,13 +2344,46 @@ export interface ApiRequestQuotaResult {
2387
2344
  }
2388
2345
  /**
2389
2346
  * Customer REST API request meter (AGL-634): the monthly request count for an
2390
- * org. Business and every tier above it carry `apiAccess` and an
2347
+ * org. Pro (since pricing v4) and every tier above it carry `apiAccess` and an
2391
2348
  * `extraApiRequestsUsdPer1k` rate, so requests past the included quota meter
2392
2349
  * onto the monthly invoice
2393
2350
  * (cost-plus, like storage overage — never a hard wall mid-integration); plans
2394
2351
  * without API access have `included: 0` and always block.
2395
2352
  */
2396
2353
  export declare function checkApiRequestQuota(org: Partial<AglynOrgBilling> | null | undefined, usedRequests: number): ApiRequestQuotaResult;
2354
+ /** The two monthly run bands the workflows plugin's gates are held to. */
2355
+ export type RunBandKey = 'workflowRunsPerMonth' | 'actionRunsPerMonth';
2356
+ /** Both run bands, in the order the usage page meters them. */
2357
+ export declare const RUN_BAND_KEYS: readonly RunBandKey[];
2358
+ /**
2359
+ * Whether the org's plan sells runs past its run bands (pricing v4,
2360
+ * 2026-11-03, AGL-4126): a non-null `extraRunsUsdPer1k` on the row the org is
2361
+ * priced at (`resolvePlanPricing`, so a comp sells nothing). The run gates ask
2362
+ * this before refusing at the band: true and the run goes ahead and is billed
2363
+ * past the band; false — Free, Starter, a comp, Enterprise — and the band is
2364
+ * the wall it always was.
2365
+ */
2366
+ export declare function runOverageSold(org: Partial<AglynOrgBilling> | null | undefined): boolean;
2367
+ export interface RunOveragePrice {
2368
+ /** Runs past each band, summed: workflow runs plus action runs. */
2369
+ overageRuns: number;
2370
+ /** Per-1,000 rate; null when the plan sells no runs past its bands. */
2371
+ overageRateUsd: number | null;
2372
+ /** The month's charge at that rate, to the cent; 0 without a rate. */
2373
+ overageMonthlyUsd: number;
2374
+ }
2375
+ /**
2376
+ * The month's run overage (pricing v4, AGL-4126): each band's excess on its
2377
+ * own — a workspace far under its action band does not lend headroom to its
2378
+ * workflow band — summed and priced at the plan's `extraRunsUsdPer1k`. The
2379
+ * counts are the WORKSPACE's (`run-meter.ts`), the figure each band is held
2380
+ * to. A plan with no rate prices nothing, whatever the counts say.
2381
+ *
2382
+ * `used` is keyed by the band each count is held to (`RUN_BAND_KEYS`), so a
2383
+ * caller outside the workflows plugin reads its counts off the declared bands
2384
+ * and never names the plugin's own meters.
2385
+ */
2386
+ export declare function priceRunOverage(org: Partial<AglynOrgBilling> | null | undefined, used: Readonly<Partial<Record<RunBandKey, number | null>>>): RunOveragePrice;
2397
2387
  export interface CrmRecordsQuotaResult {
2398
2388
  /** Metered plans always allow; free hard-bands at the included count. */
2399
2389
  allowed: boolean;
@@ -2509,7 +2499,9 @@ export declare function checkCrmEmailQuota(org: Partial<AglynOrgBilling> | null
2509
2499
  /**
2510
2500
  * Volume above the plan's included band, in emails.
2511
2501
  *
2512
- * Transactional mail is never refused, so an org CAN and will finish a month
2502
+ * Transactional mail is never refused by a quota (only by the daily abuse
2503
+ * ceiling in `transactional-email-ceiling.ts`, which no real store reaches),
2504
+ * so an org CAN and will finish a month
2513
2505
  * over its included allowance. That is not an error and not a failed send —
2514
2506
  * it is the overage the cap chose not to enforce, and recording it is what
2515
2507
  * keeps it from being a surprise at invoicing. `UNLIMITED` (and any