@aglyn/plugins-ai 1.0.0-beta.143
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.
- package/LICENSE +201 -0
- package/README.md +25 -0
- package/package.json +60 -0
- package/src/index.d.ts +21 -0
- package/src/index.js +22 -0
- package/src/index.js.map +1 -0
- package/src/lib/activity/ai-activity-actions.d.ts +106 -0
- package/src/lib/activity/ai-activity-actions.js +209 -0
- package/src/lib/activity/ai-activity-actions.js.map +1 -0
- package/src/lib/activity/ai-activity.d.ts +219 -0
- package/src/lib/activity/ai-activity.js +251 -0
- package/src/lib/activity/ai-activity.js.map +1 -0
- package/src/lib/billing/ai-overage-charge.d.ts +102 -0
- package/src/lib/billing/ai-overage-charge.js +258 -0
- package/src/lib/billing/ai-overage-charge.js.map +1 -0
- package/src/lib/billing/ai-overage-close.d.ts +62 -0
- package/src/lib/billing/ai-overage-close.js +129 -0
- package/src/lib/billing/ai-overage-close.js.map +1 -0
- package/src/lib/billing/ai-overage-cutover.d.ts +63 -0
- package/src/lib/billing/ai-overage-cutover.js +114 -0
- package/src/lib/billing/ai-overage-cutover.js.map +1 -0
- package/src/lib/billing/ai-overage-events.d.ts +77 -0
- package/src/lib/billing/ai-overage-events.js +174 -0
- package/src/lib/billing/ai-overage-events.js.map +1 -0
- package/src/lib/billing/ai-overage-gate.d.ts +147 -0
- package/src/lib/billing/ai-overage-gate.js +177 -0
- package/src/lib/billing/ai-overage-gate.js.map +1 -0
- package/src/lib/billing/ai-overage-ledger.d.ts +135 -0
- package/src/lib/billing/ai-overage-ledger.js +278 -0
- package/src/lib/billing/ai-overage-ledger.js.map +1 -0
- package/src/lib/billing/ai-overage-standing-writes.d.ts +110 -0
- package/src/lib/billing/ai-overage-standing-writes.js +205 -0
- package/src/lib/billing/ai-overage-standing-writes.js.map +1 -0
- package/src/lib/billing/ai-overage-standing.d.ts +168 -0
- package/src/lib/billing/ai-overage-standing.js +215 -0
- package/src/lib/billing/ai-overage-standing.js.map +1 -0
- package/src/lib/billing/ai-overage-trigger.d.ts +30 -0
- package/src/lib/billing/ai-overage-trigger.js +76 -0
- package/src/lib/billing/ai-overage-trigger.js.map +1 -0
- package/src/lib/components/ai-allotment-editor.component.d.ts +40 -0
- package/src/lib/components/ai-allotment-editor.component.js +213 -0
- package/src/lib/components/ai-allotment-editor.component.js.map +1 -0
- package/src/lib/components/ai-assist-actions-context.d.ts +13 -0
- package/src/lib/components/ai-assist-actions-context.js +21 -0
- package/src/lib/components/ai-assist-actions-context.js.map +1 -0
- package/src/lib/components/ai-assist-provider.component.d.ts +51 -0
- package/src/lib/components/ai-assist-provider.component.js +519 -0
- package/src/lib/components/ai-assist-provider.component.js.map +1 -0
- package/src/lib/components/ai-brief-dialog.component.d.ts +56 -0
- package/src/lib/components/ai-brief-dialog.component.js +319 -0
- package/src/lib/components/ai-brief-dialog.component.js.map +1 -0
- package/src/lib/components/ai-collaborator-permissions-column.component.d.ts +32 -0
- package/src/lib/components/ai-collaborator-permissions-column.component.js +132 -0
- package/src/lib/components/ai-collaborator-permissions-column.component.js.map +1 -0
- package/src/lib/components/ai-credits-card.component.d.ts +34 -0
- package/src/lib/components/ai-credits-card.component.js +131 -0
- package/src/lib/components/ai-credits-card.component.js.map +1 -0
- package/src/lib/components/ai-credits-columns.component.d.ts +56 -0
- package/src/lib/components/ai-credits-columns.component.js +118 -0
- package/src/lib/components/ai-credits-columns.component.js.map +1 -0
- package/src/lib/components/ai-crm-email-draft.component.d.ts +17 -0
- package/src/lib/components/ai-crm-email-draft.component.js +159 -0
- package/src/lib/components/ai-crm-email-draft.component.js.map +1 -0
- package/src/lib/components/ai-crm-import-mapping.component.d.ts +20 -0
- package/src/lib/components/ai-crm-import-mapping.component.js +167 -0
- package/src/lib/components/ai-crm-import-mapping.component.js.map +1 -0
- package/src/lib/components/ai-crm-record-card.component.d.ts +27 -0
- package/src/lib/components/ai-crm-record-card.component.js +263 -0
- package/src/lib/components/ai-crm-record-card.component.js.map +1 -0
- package/src/lib/components/ai-describe-automation.component.d.ts +31 -0
- package/src/lib/components/ai-describe-automation.component.js +226 -0
- package/src/lib/components/ai-describe-automation.component.js.map +1 -0
- package/src/lib/components/ai-describe-button.component.d.ts +39 -0
- package/src/lib/components/ai-describe-button.component.js +87 -0
- package/src/lib/components/ai-describe-button.component.js.map +1 -0
- package/src/lib/components/ai-describe-page.component.d.ts +26 -0
- package/src/lib/components/ai-describe-page.component.js +18 -0
- package/src/lib/components/ai-describe-page.component.js.map +1 -0
- package/src/lib/components/ai-experiment-cards.component.d.ts +75 -0
- package/src/lib/components/ai-experiment-cards.component.js +573 -0
- package/src/lib/components/ai-experiment-cards.component.js.map +1 -0
- package/src/lib/components/ai-explain-automation.component.d.ts +31 -0
- package/src/lib/components/ai-explain-automation.component.js +265 -0
- package/src/lib/components/ai-explain-automation.component.js.map +1 -0
- package/src/lib/components/ai-insight-dialog.component.d.ts +37 -0
- package/src/lib/components/ai-insight-dialog.component.js +441 -0
- package/src/lib/components/ai-insight-dialog.component.js.map +1 -0
- package/src/lib/components/ai-job-plan.component.d.ts +46 -0
- package/src/lib/components/ai-job-plan.component.js +192 -0
- package/src/lib/components/ai-job-plan.component.js.map +1 -0
- package/src/lib/components/ai-model-selector.component.d.ts +21 -0
- package/src/lib/components/ai-model-selector.component.js +109 -0
- package/src/lib/components/ai-model-selector.component.js.map +1 -0
- package/src/lib/components/ai-page-brief-dialog.component.d.ts +29 -0
- package/src/lib/components/ai-page-brief-dialog.component.js +27 -0
- package/src/lib/components/ai-page-brief-dialog.component.js.map +1 -0
- package/src/lib/components/ai-permissions-on-host.component.d.ts +55 -0
- package/src/lib/components/ai-permissions-on-host.component.js +91 -0
- package/src/lib/components/ai-permissions-on-host.component.js.map +1 -0
- package/src/lib/components/ai-product-copy-card.component.d.ts +25 -0
- package/src/lib/components/ai-product-copy-card.component.js +328 -0
- package/src/lib/components/ai-product-copy-card.component.js.map +1 -0
- package/src/lib/components/ai-product-import-option.component.d.ts +14 -0
- package/src/lib/components/ai-product-import-option.component.js +58 -0
- package/src/lib/components/ai-product-import-option.component.js.map +1 -0
- package/src/lib/components/ai-products-hub-card.component.d.ts +15 -0
- package/src/lib/components/ai-products-hub-card.component.js +418 -0
- package/src/lib/components/ai-products-hub-card.component.js.map +1 -0
- package/src/lib/components/ai-products-proposals.component.d.ts +19 -0
- package/src/lib/components/ai-products-proposals.component.js +547 -0
- package/src/lib/components/ai-products-proposals.component.js.map +1 -0
- package/src/lib/components/ai-save-as-component.component.d.ts +38 -0
- package/src/lib/components/ai-save-as-component.component.js +231 -0
- package/src/lib/components/ai-save-as-component.component.js.map +1 -0
- package/src/lib/components/ai-seo-audit-card.component.d.ts +9 -0
- package/src/lib/components/ai-seo-audit-card.component.js +620 -0
- package/src/lib/components/ai-seo-audit-card.component.js.map +1 -0
- package/src/lib/components/ai-seo-fields-card.component.d.ts +10 -0
- package/src/lib/components/ai-seo-fields-card.component.js +453 -0
- package/src/lib/components/ai-seo-fields-card.component.js.map +1 -0
- package/src/lib/components/ai-site-batch-card.component.d.ts +32 -0
- package/src/lib/components/ai-site-batch-card.component.js +531 -0
- package/src/lib/components/ai-site-batch-card.component.js.map +1 -0
- package/src/lib/components/ai-site-seo-start-card.component.d.ts +26 -0
- package/src/lib/components/ai-site-seo-start-card.component.js +178 -0
- package/src/lib/components/ai-site-seo-start-card.component.js.map +1 -0
- package/src/lib/components/ai-site-start-card.component.d.ts +19 -0
- package/src/lib/components/ai-site-start-card.component.js +348 -0
- package/src/lib/components/ai-site-start-card.component.js.map +1 -0
- package/src/lib/components/ai-template-collection-field.component.d.ts +32 -0
- package/src/lib/components/ai-template-collection-field.component.js +63 -0
- package/src/lib/components/ai-template-collection-field.component.js.map +1 -0
- package/src/lib/components/ai-theme-proposal-card.component.d.ts +6 -0
- package/src/lib/components/ai-theme-proposal-card.component.js +619 -0
- package/src/lib/components/ai-theme-proposal-card.component.js.map +1 -0
- package/src/lib/components/ai-usage-strip.component.d.ts +27 -0
- package/src/lib/components/ai-usage-strip.component.js +145 -0
- package/src/lib/components/ai-usage-strip.component.js.map +1 -0
- package/src/lib/components/assist-edit-canvas.d.ts +169 -0
- package/src/lib/components/assist-edit-canvas.js +636 -0
- package/src/lib/components/assist-edit-canvas.js.map +1 -0
- package/src/lib/components/assist-edit-card.component.d.ts +16 -0
- package/src/lib/components/assist-edit-card.component.js +181 -0
- package/src/lib/components/assist-edit-card.component.js.map +1 -0
- package/src/lib/components/assist-jobs-drawer.component.d.ts +72 -0
- package/src/lib/components/assist-jobs-drawer.component.js +626 -0
- package/src/lib/components/assist-jobs-drawer.component.js.map +1 -0
- package/src/lib/components/assist-panel.component.d.ts +136 -0
- package/src/lib/components/assist-panel.component.js +1099 -0
- package/src/lib/components/assist-panel.component.js.map +1 -0
- package/src/lib/components/assist-signals-page.component.d.ts +3 -0
- package/src/lib/components/assist-signals-page.component.js +1017 -0
- package/src/lib/components/assist-signals-page.component.js.map +1 -0
- package/src/lib/components/besigner-ai-controls.component.d.ts +29 -0
- package/src/lib/components/besigner-ai-controls.component.js +81 -0
- package/src/lib/components/besigner-ai-controls.component.js.map +1 -0
- package/src/lib/components/billing-ai-allotments.component.d.ts +36 -0
- package/src/lib/components/billing-ai-allotments.component.js +486 -0
- package/src/lib/components/billing-ai-allotments.component.js.map +1 -0
- package/src/lib/components/billing-ai-top-users.component.d.ts +44 -0
- package/src/lib/components/billing-ai-top-users.component.js +304 -0
- package/src/lib/components/billing-ai-top-users.component.js.map +1 -0
- package/src/lib/components/billing-assist-overage-card.component.d.ts +69 -0
- package/src/lib/components/billing-assist-overage-card.component.js +437 -0
- package/src/lib/components/billing-assist-overage-card.component.js.map +1 -0
- package/src/lib/components/host-ai-allotments.component.d.ts +40 -0
- package/src/lib/components/host-ai-allotments.component.js +239 -0
- package/src/lib/components/host-ai-allotments.component.js.map +1 -0
- package/src/lib/components/member-ai-allotment-card.component.d.ts +28 -0
- package/src/lib/components/member-ai-allotment-card.component.js +172 -0
- package/src/lib/components/member-ai-allotment-card.component.js.map +1 -0
- package/src/lib/components/member-ai-usage-card.component.d.ts +28 -0
- package/src/lib/components/member-ai-usage-card.component.js +240 -0
- package/src/lib/components/member-ai-usage-card.component.js.map +1 -0
- package/src/lib/components/staff-org-ai-card.component.d.ts +17 -0
- package/src/lib/components/staff-org-ai-card.component.js +739 -0
- package/src/lib/components/staff-org-ai-card.component.js.map +1 -0
- package/src/lib/components/staff-org-usage-ai-columns.component.d.ts +41 -0
- package/src/lib/components/staff-org-usage-ai-columns.component.js +65 -0
- package/src/lib/components/staff-org-usage-ai-columns.component.js.map +1 -0
- package/src/lib/components/staff-orgs-ai-spend-column.component.d.ts +28 -0
- package/src/lib/components/staff-orgs-ai-spend-column.component.js +89 -0
- package/src/lib/components/staff-orgs-ai-spend-column.component.js.map +1 -0
- package/src/lib/components/staff-user-ai-usage-card.component.d.ts +27 -0
- package/src/lib/components/staff-user-ai-usage-card.component.js +183 -0
- package/src/lib/components/staff-user-ai-usage-card.component.js.map +1 -0
- package/src/lib/components/use-ai-allotments.d.ts +49 -0
- package/src/lib/components/use-ai-allotments.js +171 -0
- package/src/lib/components/use-ai-allotments.js.map +1 -0
- package/src/lib/components/use-ai-crm-answer.d.ts +50 -0
- package/src/lib/components/use-ai-crm-answer.js +220 -0
- package/src/lib/components/use-ai-crm-answer.js.map +1 -0
- package/src/lib/components/use-ai-job-run.d.ts +51 -0
- package/src/lib/components/use-ai-job-run.js +176 -0
- package/src/lib/components/use-ai-job-run.js.map +1 -0
- package/src/lib/components/use-ai-model-choice.d.ts +47 -0
- package/src/lib/components/use-ai-model-choice.js +150 -0
- package/src/lib/components/use-ai-model-choice.js.map +1 -0
- package/src/lib/components/use-ai-products-jobs.d.ts +36 -0
- package/src/lib/components/use-ai-products-jobs.js +190 -0
- package/src/lib/components/use-ai-products-jobs.js.map +1 -0
- package/src/lib/components/use-ai-usage-meter.d.ts +11 -0
- package/src/lib/components/use-ai-usage-meter.js +96 -0
- package/src/lib/components/use-ai-usage-meter.js.map +1 -0
- package/src/lib/components/use-org-ai-usage.d.ts +42 -0
- package/src/lib/components/use-org-ai-usage.js +181 -0
- package/src/lib/components/use-org-ai-usage.js.map +1 -0
- package/src/lib/components/use-staff-orgs-ai-spend.d.ts +18 -0
- package/src/lib/components/use-staff-orgs-ai-spend.js +127 -0
- package/src/lib/components/use-staff-orgs-ai-spend.js.map +1 -0
- package/src/lib/constants.d.ts +24 -0
- package/src/lib/constants.js +23 -0
- package/src/lib/constants.js.map +1 -0
- package/src/lib/declarations.d.ts +48 -0
- package/src/lib/declarations.js +129 -0
- package/src/lib/declarations.js.map +1 -0
- package/src/lib/declarations.server.d.ts +35 -0
- package/src/lib/declarations.server.js +138 -0
- package/src/lib/declarations.server.js.map +1 -0
- package/src/lib/insights/ai-figure-readers.d.ts +90 -0
- package/src/lib/insights/ai-figure-readers.js +863 -0
- package/src/lib/insights/ai-figure-readers.js.map +1 -0
- package/src/lib/insights/ai-insight-digest.d.ts +165 -0
- package/src/lib/insights/ai-insight-digest.js +363 -0
- package/src/lib/insights/ai-insight-digest.js.map +1 -0
- package/src/lib/insights/ai-insight-readers.d.ts +71 -0
- package/src/lib/insights/ai-insight-readers.js +141 -0
- package/src/lib/insights/ai-insight-readers.js.map +1 -0
- package/src/lib/jobs/ai-crm-access.d.ts +61 -0
- package/src/lib/jobs/ai-crm-access.js +94 -0
- package/src/lib/jobs/ai-crm-access.js.map +1 -0
- package/src/lib/jobs/ai-email-bindings.d.ts +97 -0
- package/src/lib/jobs/ai-email-bindings.js +147 -0
- package/src/lib/jobs/ai-email-bindings.js.map +1 -0
- package/src/lib/jobs/ai-job-admission.d.ts +82 -0
- package/src/lib/jobs/ai-job-admission.js +45 -0
- package/src/lib/jobs/ai-job-admission.js.map +1 -0
- package/src/lib/jobs/ai-job-budget.d.ts +167 -0
- package/src/lib/jobs/ai-job-budget.js +161 -0
- package/src/lib/jobs/ai-job-budget.js.map +1 -0
- package/src/lib/jobs/ai-job-campaign-step.d.ts +108 -0
- package/src/lib/jobs/ai-job-campaign-step.js +340 -0
- package/src/lib/jobs/ai-job-campaign-step.js.map +1 -0
- package/src/lib/jobs/ai-job-component-checks.d.ts +74 -0
- package/src/lib/jobs/ai-job-component-checks.js +442 -0
- package/src/lib/jobs/ai-job-component-checks.js.map +1 -0
- package/src/lib/jobs/ai-job-component-step.d.ts +75 -0
- package/src/lib/jobs/ai-job-component-step.js +262 -0
- package/src/lib/jobs/ai-job-component-step.js.map +1 -0
- package/src/lib/jobs/ai-job-crm-step.d.ts +192 -0
- package/src/lib/jobs/ai-job-crm-step.js +734 -0
- package/src/lib/jobs/ai-job-crm-step.js.map +1 -0
- package/src/lib/jobs/ai-job-draft-ids.d.ts +62 -0
- package/src/lib/jobs/ai-job-draft-ids.js +132 -0
- package/src/lib/jobs/ai-job-draft-ids.js.map +1 -0
- package/src/lib/jobs/ai-job-drafts.d.ts +304 -0
- package/src/lib/jobs/ai-job-drafts.js +557 -0
- package/src/lib/jobs/ai-job-drafts.js.map +1 -0
- package/src/lib/jobs/ai-job-email-step.d.ts +195 -0
- package/src/lib/jobs/ai-job-email-step.js +547 -0
- package/src/lib/jobs/ai-job-email-step.js.map +1 -0
- package/src/lib/jobs/ai-job-experiment-step.d.ts +105 -0
- package/src/lib/jobs/ai-job-experiment-step.js +445 -0
- package/src/lib/jobs/ai-job-experiment-step.js.map +1 -0
- package/src/lib/jobs/ai-job-form-step.d.ts +250 -0
- package/src/lib/jobs/ai-job-form-step.js +634 -0
- package/src/lib/jobs/ai-job-form-step.js.map +1 -0
- package/src/lib/jobs/ai-job-generation.d.ts +114 -0
- package/src/lib/jobs/ai-job-generation.js +384 -0
- package/src/lib/jobs/ai-job-generation.js.map +1 -0
- package/src/lib/jobs/ai-job-insight-budget.d.ts +41 -0
- package/src/lib/jobs/ai-job-insight-budget.js +46 -0
- package/src/lib/jobs/ai-job-insight-budget.js.map +1 -0
- package/src/lib/jobs/ai-job-insight-step.d.ts +58 -0
- package/src/lib/jobs/ai-job-insight-step.js +350 -0
- package/src/lib/jobs/ai-job-insight-step.js.map +1 -0
- package/src/lib/jobs/ai-job-layout-step.d.ts +103 -0
- package/src/lib/jobs/ai-job-layout-step.js +340 -0
- package/src/lib/jobs/ai-job-layout-step.js.map +1 -0
- package/src/lib/jobs/ai-job-page-budget.d.ts +57 -0
- package/src/lib/jobs/ai-job-page-budget.js +60 -0
- package/src/lib/jobs/ai-job-page-budget.js.map +1 -0
- package/src/lib/jobs/ai-job-page-sections.d.ts +150 -0
- package/src/lib/jobs/ai-job-page-sections.js +450 -0
- package/src/lib/jobs/ai-job-page-sections.js.map +1 -0
- package/src/lib/jobs/ai-job-page-step.d.ts +198 -0
- package/src/lib/jobs/ai-job-page-step.js +667 -0
- package/src/lib/jobs/ai-job-page-step.js.map +1 -0
- package/src/lib/jobs/ai-job-plan-conformance.d.ts +107 -0
- package/src/lib/jobs/ai-job-plan-conformance.js +164 -0
- package/src/lib/jobs/ai-job-plan-conformance.js.map +1 -0
- package/src/lib/jobs/ai-job-plan-step.d.ts +196 -0
- package/src/lib/jobs/ai-job-plan-step.js +458 -0
- package/src/lib/jobs/ai-job-plan-step.js.map +1 -0
- package/src/lib/jobs/ai-job-plugin-drafts.d.ts +76 -0
- package/src/lib/jobs/ai-job-plugin-drafts.js +91 -0
- package/src/lib/jobs/ai-job-plugin-drafts.js.map +1 -0
- package/src/lib/jobs/ai-job-products-step.d.ts +106 -0
- package/src/lib/jobs/ai-job-products-step.js +436 -0
- package/src/lib/jobs/ai-job-products-step.js.map +1 -0
- package/src/lib/jobs/ai-job-seo-budget.d.ts +52 -0
- package/src/lib/jobs/ai-job-seo-budget.js +63 -0
- package/src/lib/jobs/ai-job-seo-budget.js.map +1 -0
- package/src/lib/jobs/ai-job-seo-step.d.ts +145 -0
- package/src/lib/jobs/ai-job-seo-step.js +809 -0
- package/src/lib/jobs/ai-job-seo-step.js.map +1 -0
- package/src/lib/jobs/ai-job-site-step.d.ts +252 -0
- package/src/lib/jobs/ai-job-site-step.js +538 -0
- package/src/lib/jobs/ai-job-site-step.js.map +1 -0
- package/src/lib/jobs/ai-job-template-step.d.ts +105 -0
- package/src/lib/jobs/ai-job-template-step.js +391 -0
- package/src/lib/jobs/ai-job-template-step.js.map +1 -0
- package/src/lib/jobs/ai-job-text-step.d.ts +125 -0
- package/src/lib/jobs/ai-job-text-step.js +128 -0
- package/src/lib/jobs/ai-job-text-step.js.map +1 -0
- package/src/lib/jobs/ai-job-theme-budget.d.ts +38 -0
- package/src/lib/jobs/ai-job-theme-budget.js +43 -0
- package/src/lib/jobs/ai-job-theme-budget.js.map +1 -0
- package/src/lib/jobs/ai-job-theme-step.d.ts +115 -0
- package/src/lib/jobs/ai-job-theme-step.js +337 -0
- package/src/lib/jobs/ai-job-theme-step.js.map +1 -0
- package/src/lib/jobs/ai-job-workflow-step.d.ts +139 -0
- package/src/lib/jobs/ai-job-workflow-step.js +530 -0
- package/src/lib/jobs/ai-job-workflow-step.js.map +1 -0
- package/src/lib/jobs/ai-jobs-beat.d.ts +78 -0
- package/src/lib/jobs/ai-jobs-beat.js +93 -0
- package/src/lib/jobs/ai-jobs-beat.js.map +1 -0
- package/src/lib/jobs/ai-jobs-pause.d.ts +38 -0
- package/src/lib/jobs/ai-jobs-pause.js +45 -0
- package/src/lib/jobs/ai-jobs-pause.js.map +1 -0
- package/src/lib/jobs/ai-jobs.d.ts +558 -0
- package/src/lib/jobs/ai-jobs.js +1410 -0
- package/src/lib/jobs/ai-jobs.js.map +1 -0
- package/src/lib/jobs/ai-media-asset-server.d.ts +34 -0
- package/src/lib/jobs/ai-media-asset-server.js +34 -0
- package/src/lib/jobs/ai-media-asset-server.js.map +1 -0
- package/src/lib/jobs/ai-media-asset.d.ts +59 -0
- package/src/lib/jobs/ai-media-asset.js +86 -0
- package/src/lib/jobs/ai-media-asset.js.map +1 -0
- package/src/lib/jobs/ai-product-image.d.ts +78 -0
- package/src/lib/jobs/ai-product-image.js +113 -0
- package/src/lib/jobs/ai-product-image.js.map +1 -0
- package/src/lib/jobs/ai-theme-brand-inputs.d.ts +125 -0
- package/src/lib/jobs/ai-theme-brand-inputs.js +378 -0
- package/src/lib/jobs/ai-theme-brand-inputs.js.map +1 -0
- package/src/lib/jobs/ai-theme-brand-server.d.ts +33 -0
- package/src/lib/jobs/ai-theme-brand-server.js +33 -0
- package/src/lib/jobs/ai-theme-brand-server.js.map +1 -0
- package/src/lib/jobs/ai-workflow-records.d.ts +84 -0
- package/src/lib/jobs/ai-workflow-records.js +158 -0
- package/src/lib/jobs/ai-workflow-records.js.map +1 -0
- package/src/lib/jobs/fixtures/ai-free-page-built-recording.d.ts +31 -0
- package/src/lib/jobs/fixtures/ai-free-page-built-recording.js +367 -0
- package/src/lib/jobs/fixtures/ai-free-page-built-recording.js.map +1 -0
- package/src/lib/jobs/fixtures/ai-free-page-recording.d.ts +69 -0
- package/src/lib/jobs/fixtures/ai-free-page-recording.js +442 -0
- package/src/lib/jobs/fixtures/ai-free-page-recording.js.map +1 -0
- package/src/lib/jobs/fixtures/ai-page-briefs.d.ts +146 -0
- package/src/lib/jobs/fixtures/ai-page-briefs.js +1850 -0
- package/src/lib/jobs/fixtures/ai-page-briefs.js.map +1 -0
- package/src/lib/model/ai-allotments.d.ts +208 -0
- package/src/lib/model/ai-allotments.js +269 -0
- package/src/lib/model/ai-allotments.js.map +1 -0
- package/src/lib/model/ai-automation-draft.d.ts +74 -0
- package/src/lib/model/ai-automation-draft.js +310 -0
- package/src/lib/model/ai-automation-draft.js.map +1 -0
- package/src/lib/model/ai-automation-outline.d.ts +50 -0
- package/src/lib/model/ai-automation-outline.js +262 -0
- package/src/lib/model/ai-automation-outline.js.map +1 -0
- package/src/lib/model/ai-build-plan.d.ts +197 -0
- package/src/lib/model/ai-build-plan.js +438 -0
- package/src/lib/model/ai-build-plan.js.map +1 -0
- package/src/lib/model/ai-crm.d.ts +237 -0
- package/src/lib/model/ai-crm.js +225 -0
- package/src/lib/model/ai-crm.js.map +1 -0
- package/src/lib/model/ai-experiment-proposal.d.ts +68 -0
- package/src/lib/model/ai-experiment-proposal.js +146 -0
- package/src/lib/model/ai-experiment-proposal.js.map +1 -0
- package/src/lib/model/ai-experiment.d.ts +309 -0
- package/src/lib/model/ai-experiment.js +395 -0
- package/src/lib/model/ai-experiment.js.map +1 -0
- package/src/lib/model/ai-insight.d.ts +178 -0
- package/src/lib/model/ai-insight.js +201 -0
- package/src/lib/model/ai-insight.js.map +1 -0
- package/src/lib/model/ai-jobs.types.d.ts +412 -0
- package/src/lib/model/ai-jobs.types.js +42 -0
- package/src/lib/model/ai-jobs.types.js.map +1 -0
- package/src/lib/model/ai-page-job.d.ts +92 -0
- package/src/lib/model/ai-page-job.js +159 -0
- package/src/lib/model/ai-page-job.js.map +1 -0
- package/src/lib/model/ai-permissions.d.ts +49 -0
- package/src/lib/model/ai-permissions.js +97 -0
- package/src/lib/model/ai-permissions.js.map +1 -0
- package/src/lib/model/ai-plan-capabilities.d.ts +139 -0
- package/src/lib/model/ai-plan-capabilities.js +149 -0
- package/src/lib/model/ai-plan-capabilities.js.map +1 -0
- package/src/lib/model/ai-products.d.ts +251 -0
- package/src/lib/model/ai-products.js +253 -0
- package/src/lib/model/ai-products.js.map +1 -0
- package/src/lib/model/ai-seo.d.ts +208 -0
- package/src/lib/model/ai-seo.js +150 -0
- package/src/lib/model/ai-seo.js.map +1 -0
- package/src/lib/model/ai-site-inventory.d.ts +164 -0
- package/src/lib/model/ai-site-inventory.js +145 -0
- package/src/lib/model/ai-site-inventory.js.map +1 -0
- package/src/lib/model/ai-site-job.d.ts +247 -0
- package/src/lib/model/ai-site-job.js +314 -0
- package/src/lib/model/ai-site-job.js.map +1 -0
- package/src/lib/model/ai-site-start-seo.d.ts +103 -0
- package/src/lib/model/ai-site-start-seo.js +154 -0
- package/src/lib/model/ai-site-start-seo.js.map +1 -0
- package/src/lib/model/ai-site-start.d.ts +122 -0
- package/src/lib/model/ai-site-start.js +159 -0
- package/src/lib/model/ai-site-start.js.map +1 -0
- package/src/lib/model/ai-site-switch.d.ts +56 -0
- package/src/lib/model/ai-site-switch.js +73 -0
- package/src/lib/model/ai-site-switch.js.map +1 -0
- package/src/lib/model/ai-storefront-claims.d.ts +70 -0
- package/src/lib/model/ai-storefront-claims.js +130 -0
- package/src/lib/model/ai-storefront-claims.js.map +1 -0
- package/src/lib/model/ai-template-subjects.d.ts +82 -0
- package/src/lib/model/ai-template-subjects.js +136 -0
- package/src/lib/model/ai-template-subjects.js.map +1 -0
- package/src/lib/model/ai-theme-proposal.d.ts +210 -0
- package/src/lib/model/ai-theme-proposal.js +506 -0
- package/src/lib/model/ai-theme-proposal.js.map +1 -0
- package/src/lib/model/ai-tokens.d.ts +96 -0
- package/src/lib/model/ai-tokens.js +117 -0
- package/src/lib/model/ai-tokens.js.map +1 -0
- package/src/lib/model/ai-usage-by-user.d.ts +120 -0
- package/src/lib/model/ai-usage-by-user.js +139 -0
- package/src/lib/model/ai-usage-by-user.js.map +1 -0
- package/src/lib/model/ai-workflow-job.d.ts +111 -0
- package/src/lib/model/ai-workflow-job.js +183 -0
- package/src/lib/model/ai-workflow-job.js.map +1 -0
- package/src/lib/model/assist-edit.d.ts +261 -0
- package/src/lib/model/assist-edit.js +175 -0
- package/src/lib/model/assist-edit.js.map +1 -0
- package/src/lib/plugin-config.d.ts +33 -0
- package/src/lib/plugin-config.js +118 -0
- package/src/lib/plugin-config.js.map +1 -0
- package/src/lib/plugin.d.ts +30 -0
- package/src/lib/plugin.js +525 -0
- package/src/lib/plugin.js.map +1 -0
- package/src/lib/providers/anthropic.d.ts +84 -0
- package/src/lib/providers/anthropic.js +432 -0
- package/src/lib/providers/anthropic.js.map +1 -0
- package/src/lib/providers/catalog.d.ts +197 -0
- package/src/lib/providers/catalog.js +312 -0
- package/src/lib/providers/catalog.js.map +1 -0
- package/src/lib/providers/contract.d.ts +464 -0
- package/src/lib/providers/contract.js +274 -0
- package/src/lib/providers/contract.js.map +1 -0
- package/src/lib/providers/model-choice.d.ts +119 -0
- package/src/lib/providers/model-choice.js +416 -0
- package/src/lib/providers/model-choice.js.map +1 -0
- package/src/lib/providers/openai-compatible.d.ts +58 -0
- package/src/lib/providers/openai-compatible.js +361 -0
- package/src/lib/providers/openai-compatible.js.map +1 -0
- package/src/lib/providers/registry.d.ts +49 -0
- package/src/lib/providers/registry.js +71 -0
- package/src/lib/providers/registry.js.map +1 -0
- package/src/lib/providers/routing.d.ts +98 -0
- package/src/lib/providers/routing.js +450 -0
- package/src/lib/providers/routing.js.map +1 -0
- package/src/lib/runtime/ai-abuse-guards.d.ts +113 -0
- package/src/lib/runtime/ai-abuse-guards.js +148 -0
- package/src/lib/runtime/ai-abuse-guards.js.map +1 -0
- package/src/lib/runtime/ai-component-bindings.d.ts +67 -0
- package/src/lib/runtime/ai-component-bindings.js +106 -0
- package/src/lib/runtime/ai-component-bindings.js.map +1 -0
- package/src/lib/runtime/ai-device-audit.d.ts +109 -0
- package/src/lib/runtime/ai-device-audit.js +97 -0
- package/src/lib/runtime/ai-device-audit.js.map +1 -0
- package/src/lib/runtime/ai-doctrine-validators.d.ts +720 -0
- package/src/lib/runtime/ai-doctrine-validators.js +3133 -0
- package/src/lib/runtime/ai-doctrine-validators.js.map +1 -0
- package/src/lib/runtime/ai-doctrine.d.ts +372 -0
- package/src/lib/runtime/ai-doctrine.js +944 -0
- package/src/lib/runtime/ai-doctrine.js.map +1 -0
- package/src/lib/runtime/ai-eval-live.d.ts +321 -0
- package/src/lib/runtime/ai-eval-live.js +1257 -0
- package/src/lib/runtime/ai-eval-live.js.map +1 -0
- package/src/lib/runtime/ai-eval-memory-firestore.d.ts +51 -0
- package/src/lib/runtime/ai-eval-memory-firestore.js +183 -0
- package/src/lib/runtime/ai-eval-memory-firestore.js.map +1 -0
- package/src/lib/runtime/ai-eval.d.ts +441 -0
- package/src/lib/runtime/ai-eval.js +1151 -0
- package/src/lib/runtime/ai-eval.js.map +1 -0
- package/src/lib/runtime/ai-gate.d.ts +130 -0
- package/src/lib/runtime/ai-gate.js +272 -0
- package/src/lib/runtime/ai-gate.js.map +1 -0
- package/src/lib/runtime/ai-generation-bounds.d.ts +24 -0
- package/src/lib/runtime/ai-generation-bounds.js +23 -0
- package/src/lib/runtime/ai-generation-bounds.js.map +1 -0
- package/src/lib/runtime/ai-insight-check.d.ts +76 -0
- package/src/lib/runtime/ai-insight-check.js +281 -0
- package/src/lib/runtime/ai-insight-check.js.map +1 -0
- package/src/lib/runtime/ai-node-tree.d.ts +181 -0
- package/src/lib/runtime/ai-node-tree.js +931 -0
- package/src/lib/runtime/ai-node-tree.js.map +1 -0
- package/src/lib/runtime/ai-page-links.d.ts +79 -0
- package/src/lib/runtime/ai-page-links.js +135 -0
- package/src/lib/runtime/ai-page-links.js.map +1 -0
- package/src/lib/runtime/ai-palette.d.ts +252 -0
- package/src/lib/runtime/ai-palette.generated.d.ts +34 -0
- package/src/lib/runtime/ai-palette.generated.js +5263 -0
- package/src/lib/runtime/ai-palette.generated.js.map +1 -0
- package/src/lib/runtime/ai-palette.js +187 -0
- package/src/lib/runtime/ai-palette.js.map +1 -0
- package/src/lib/runtime/ai-products-generation.d.ts +107 -0
- package/src/lib/runtime/ai-products-generation.js +250 -0
- package/src/lib/runtime/ai-products-generation.js.map +1 -0
- package/src/lib/runtime/ai-repeated-items.d.ts +95 -0
- package/src/lib/runtime/ai-repeated-items.js +397 -0
- package/src/lib/runtime/ai-repeated-items.js.map +1 -0
- package/src/lib/runtime/ai-runtime.d.ts +148 -0
- package/src/lib/runtime/ai-runtime.js +237 -0
- package/src/lib/runtime/ai-runtime.js.map +1 -0
- package/src/lib/runtime/ai-template-examples.d.ts +71 -0
- package/src/lib/runtime/ai-template-examples.js +135 -0
- package/src/lib/runtime/ai-template-examples.js.map +1 -0
- package/src/lib/runtime/assist-answer-cache.d.ts +80 -0
- package/src/lib/runtime/assist-answer-cache.js +184 -0
- package/src/lib/runtime/assist-answer-cache.js.map +1 -0
- package/src/lib/runtime/seo-audit.d.ts +93 -0
- package/src/lib/runtime/seo-audit.js +260 -0
- package/src/lib/runtime/seo-audit.js.map +1 -0
- package/src/lib/runtime/seo-content-fixes.d.ts +41 -0
- package/src/lib/runtime/seo-content-fixes.js +168 -0
- package/src/lib/runtime/seo-content-fixes.js.map +1 -0
- package/src/lib/runtime/seo-fields.d.ts +152 -0
- package/src/lib/runtime/seo-fields.js +215 -0
- package/src/lib/runtime/seo-fields.js.map +1 -0
- package/src/lib/runtime/seo-page-facts.d.ts +61 -0
- package/src/lib/runtime/seo-page-facts.js +150 -0
- package/src/lib/runtime/seo-page-facts.js.map +1 -0
- package/src/lib/runtime/site-inventory.d.ts +63 -0
- package/src/lib/runtime/site-inventory.js +230 -0
- package/src/lib/runtime/site-inventory.js.map +1 -0
- package/src/lib/server/ai-admin-org.d.ts +33 -0
- package/src/lib/server/ai-admin-org.js +381 -0
- package/src/lib/server/ai-admin-org.js.map +1 -0
- package/src/lib/server/ai-admin-orgs-spend.d.ts +40 -0
- package/src/lib/server/ai-admin-orgs-spend.js +129 -0
- package/src/lib/server/ai-admin-orgs-spend.js.map +1 -0
- package/src/lib/server/ai-admin-overage.d.ts +19 -0
- package/src/lib/server/ai-admin-overage.js +246 -0
- package/src/lib/server/ai-admin-overage.js.map +1 -0
- package/src/lib/server/ai-admin-signals.d.ts +34 -0
- package/src/lib/server/ai-admin-signals.js +330 -0
- package/src/lib/server/ai-admin-signals.js.map +1 -0
- package/src/lib/server/ai-admin-user.d.ts +27 -0
- package/src/lib/server/ai-admin-user.js +128 -0
- package/src/lib/server/ai-admin-user.js.map +1 -0
- package/src/lib/server/ai-allotments.d.ts +27 -0
- package/src/lib/server/ai-allotments.js +544 -0
- package/src/lib/server/ai-allotments.js.map +1 -0
- package/src/lib/server/ai-assist-prompts.d.ts +102 -0
- package/src/lib/server/ai-assist-prompts.js +207 -0
- package/src/lib/server/ai-assist-prompts.js.map +1 -0
- package/src/lib/server/ai-assist.d.ts +119 -0
- package/src/lib/server/ai-assist.js +517 -0
- package/src/lib/server/ai-assist.js.map +1 -0
- package/src/lib/server/ai-crm-answer.d.ts +30 -0
- package/src/lib/server/ai-crm-answer.js +98 -0
- package/src/lib/server/ai-crm-answer.js.map +1 -0
- package/src/lib/server/ai-generate-component.d.ts +111 -0
- package/src/lib/server/ai-generate-component.js +643 -0
- package/src/lib/server/ai-generate-component.js.map +1 -0
- package/src/lib/server/ai-host-permissions.d.ts +46 -0
- package/src/lib/server/ai-host-permissions.js +204 -0
- package/src/lib/server/ai-host-permissions.js.map +1 -0
- package/src/lib/server/ai-insight-answer.d.ts +30 -0
- package/src/lib/server/ai-insight-answer.js +83 -0
- package/src/lib/server/ai-insight-answer.js.map +1 -0
- package/src/lib/server/ai-insight-digest-route.d.ts +30 -0
- package/src/lib/server/ai-insight-digest-route.js +156 -0
- package/src/lib/server/ai-insight-digest-route.js.map +1 -0
- package/src/lib/server/ai-jobs-batch.d.ts +48 -0
- package/src/lib/server/ai-jobs-batch.js +306 -0
- package/src/lib/server/ai-jobs-batch.js.map +1 -0
- package/src/lib/server/ai-jobs-beat-route.d.ts +36 -0
- package/src/lib/server/ai-jobs-beat-route.js +86 -0
- package/src/lib/server/ai-jobs-beat-route.js.map +1 -0
- package/src/lib/server/ai-jobs-cancel.d.ts +30 -0
- package/src/lib/server/ai-jobs-cancel.js +74 -0
- package/src/lib/server/ai-jobs-cancel.js.map +1 -0
- package/src/lib/server/ai-jobs-events-route.d.ts +31 -0
- package/src/lib/server/ai-jobs-events-route.js +51 -0
- package/src/lib/server/ai-jobs-events-route.js.map +1 -0
- package/src/lib/server/ai-jobs-events.d.ts +55 -0
- package/src/lib/server/ai-jobs-events.js +144 -0
- package/src/lib/server/ai-jobs-events.js.map +1 -0
- package/src/lib/server/ai-jobs-gate.d.ts +47 -0
- package/src/lib/server/ai-jobs-gate.js +106 -0
- package/src/lib/server/ai-jobs-gate.js.map +1 -0
- package/src/lib/server/ai-jobs-resume.d.ts +23 -0
- package/src/lib/server/ai-jobs-resume.js +209 -0
- package/src/lib/server/ai-jobs-resume.js.map +1 -0
- package/src/lib/server/ai-jobs-route.d.ts +32 -0
- package/src/lib/server/ai-jobs-route.js +307 -0
- package/src/lib/server/ai-jobs-route.js.map +1 -0
- package/src/lib/server/ai-models.d.ts +18 -0
- package/src/lib/server/ai-models.js +134 -0
- package/src/lib/server/ai-models.js.map +1 -0
- package/src/lib/server/ai-seo-apply.d.ts +53 -0
- package/src/lib/server/ai-seo-apply.js +294 -0
- package/src/lib/server/ai-seo-apply.js.map +1 -0
- package/src/lib/server/ai-usage.d.ts +18 -0
- package/src/lib/server/ai-usage.js +220 -0
- package/src/lib/server/ai-usage.js.map +1 -0
- package/src/lib/server/assist-chat.d.ts +234 -0
- package/src/lib/server/assist-chat.js +1446 -0
- package/src/lib/server/assist-chat.js.map +1 -0
- package/src/lib/server/assist-edit-applied.d.ts +22 -0
- package/src/lib/server/assist-edit-applied.js +239 -0
- package/src/lib/server/assist-edit-applied.js.map +1 -0
- package/src/lib/server/assist-edit.d.ts +124 -0
- package/src/lib/server/assist-edit.js +1000 -0
- package/src/lib/server/assist-edit.js.map +1 -0
- package/src/lib/server/assist-feedback.d.ts +31 -0
- package/src/lib/server/assist-feedback.js +115 -0
- package/src/lib/server/assist-feedback.js.map +1 -0
- package/src/lib/server/assist-view-context.d.ts +343 -0
- package/src/lib/server/assist-view-context.js +690 -0
- package/src/lib/server/assist-view-context.js.map +1 -0
- package/src/lib/server/billing-credits.d.ts +59 -0
- package/src/lib/server/billing-credits.js +146 -0
- package/src/lib/server/billing-credits.js.map +1 -0
- package/src/lib/server/billing-overage.d.ts +19 -0
- package/src/lib/server/billing-overage.js +337 -0
- package/src/lib/server/billing-overage.js.map +1 -0
- package/src/lib/server.d.ts +32 -0
- package/src/lib/server.js +265 -0
- package/src/lib/server.js.map +1 -0
- package/src/lib/subprocessors.d.ts +18 -0
- package/src/lib/subprocessors.js +52 -0
- package/src/lib/subprocessors.js.map +1 -0
- package/src/lib/tools/ai-component-tool.d.ts +99 -0
- package/src/lib/tools/ai-component-tool.js +369 -0
- package/src/lib/tools/ai-component-tool.js.map +1 -0
- package/src/lib/tools/ai-crm-tool.d.ts +106 -0
- package/src/lib/tools/ai-crm-tool.js +488 -0
- package/src/lib/tools/ai-crm-tool.js.map +1 -0
- package/src/lib/tools/ai-duplicate-resource-tool.d.ts +71 -0
- package/src/lib/tools/ai-duplicate-resource-tool.js +164 -0
- package/src/lib/tools/ai-duplicate-resource-tool.js.map +1 -0
- package/src/lib/tools/ai-experiment-tool.d.ts +40 -0
- package/src/lib/tools/ai-experiment-tool.js +155 -0
- package/src/lib/tools/ai-experiment-tool.js.map +1 -0
- package/src/lib/tools/ai-insight-tool.d.ts +46 -0
- package/src/lib/tools/ai-insight-tool.js +200 -0
- package/src/lib/tools/ai-insight-tool.js.map +1 -0
- package/src/lib/tools/ai-inventory-lookup-tool.d.ts +86 -0
- package/src/lib/tools/ai-inventory-lookup-tool.js +164 -0
- package/src/lib/tools/ai-inventory-lookup-tool.js.map +1 -0
- package/src/lib/tools/ai-products-tool.d.ts +65 -0
- package/src/lib/tools/ai-products-tool.js +644 -0
- package/src/lib/tools/ai-products-tool.js.map +1 -0
- package/src/lib/tools/ai-seo-tool.d.ts +162 -0
- package/src/lib/tools/ai-seo-tool.js +546 -0
- package/src/lib/tools/ai-seo-tool.js.map +1 -0
- package/src/lib/tools/ai-theme-tool.d.ts +101 -0
- package/src/lib/tools/ai-theme-tool.js +562 -0
- package/src/lib/tools/ai-theme-tool.js.map +1 -0
- package/src/lib/tools/ai-workflow-tool.d.ts +166 -0
- package/src/lib/tools/ai-workflow-tool.js +860 -0
- package/src/lib/tools/ai-workflow-tool.js.map +1 -0
- package/src/lib/usage/ai-allotment-alerts.d.ts +72 -0
- package/src/lib/usage/ai-allotment-alerts.js +157 -0
- package/src/lib/usage/ai-allotment-alerts.js.map +1 -0
- package/src/lib/usage/ai-allotments.d.ts +125 -0
- package/src/lib/usage/ai-allotments.js +239 -0
- package/src/lib/usage/ai-allotments.js.map +1 -0
- package/src/lib/usage/ai-model-sample.d.ts +36 -0
- package/src/lib/usage/ai-model-sample.js +68 -0
- package/src/lib/usage/ai-model-sample.js.map +1 -0
- package/src/lib/usage/ai-usage-alerts.d.ts +55 -0
- package/src/lib/usage/ai-usage-alerts.js +114 -0
- package/src/lib/usage/ai-usage-alerts.js.map +1 -0
- package/src/lib/usage/ai-usage-by-user.d.ts +161 -0
- package/src/lib/usage/ai-usage-by-user.js +211 -0
- package/src/lib/usage/ai-usage-by-user.js.map +1 -0
- package/src/lib/usage/ai-usage-eraser.d.ts +29 -0
- package/src/lib/usage/ai-usage-eraser.js +40 -0
- package/src/lib/usage/ai-usage-eraser.js.map +1 -0
- package/src/lib/usage/ai-usage-meter.d.ts +39 -0
- package/src/lib/usage/ai-usage-meter.js +85 -0
- package/src/lib/usage/ai-usage-meter.js.map +1 -0
- package/src/lib/usage/ai-usage-wire.d.ts +184 -0
- package/src/lib/usage/ai-usage-wire.js +98 -0
- package/src/lib/usage/ai-usage-wire.js.map +1 -0
- package/src/lib/usage/assist-ceiling.d.ts +87 -0
- package/src/lib/usage/assist-ceiling.js +110 -0
- package/src/lib/usage/assist-ceiling.js.map +1 -0
- package/src/lib/usage/assist-free-taste.d.ts +225 -0
- package/src/lib/usage/assist-free-taste.js +308 -0
- package/src/lib/usage/assist-free-taste.js.map +1 -0
- package/src/lib/usage/assist-refusals.d.ts +69 -0
- package/src/lib/usage/assist-refusals.js +79 -0
- package/src/lib/usage/assist-refusals.js.map +1 -0
- package/src/lib/usage/assist-signal-mining.d.ts +375 -0
- package/src/lib/usage/assist-signal-mining.js +344 -0
- package/src/lib/usage/assist-signal-mining.js.map +1 -0
- package/src/lib/usage/assist-usage.d.ts +571 -0
- package/src/lib/usage/assist-usage.js +978 -0
- package/src/lib/usage/assist-usage.js.map +1 -0
- package/src/lib/usage/staff-org-ai.d.ts +242 -0
- package/src/lib/usage/staff-org-ai.js +173 -0
- package/src/lib/usage/staff-org-ai.js.map +1 -0
- package/src/lib/usage/staff-org-usage-ai.d.ts +83 -0
- package/src/lib/usage/staff-org-usage-ai.js +59 -0
- package/src/lib/usage/staff-org-usage-ai.js.map +1 -0
- package/src/lib/usage/staff-orgs-ai-spend.d.ts +83 -0
- package/src/lib/usage/staff-orgs-ai-spend.js +114 -0
- package/src/lib/usage/staff-orgs-ai-spend.js.map +1 -0
|
@@ -0,0 +1,184 @@
|
|
|
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 AiUsageByUserMonth } from '../model/ai-usage-by-user';
|
|
18
|
+
import { type AiAllotmentMode, type AiCreditAllotmentScope } from '../model/ai-allotments';
|
|
19
|
+
/**
|
|
20
|
+
* What `/api/ai/usage` answers (AGL-2928), shared by the route and the
|
|
21
|
+
* console surfaces that read it — the Usage table, the roster column, the
|
|
22
|
+
* site collaborators card and the member card. Dependency-free on purpose:
|
|
23
|
+
* the route imports the Admin SDK and a client component may not.
|
|
24
|
+
*/
|
|
25
|
+
/** Header naming the row count the export undertook to send. */
|
|
26
|
+
export declare const AI_USAGE_EXPORT_ROWS_HEADER = "X-Aglyn-Export-Rows";
|
|
27
|
+
/** A row as a customer sees it — credits and a share, never `estCostUsd`. */
|
|
28
|
+
export interface OrgAiUsageRowWire {
|
|
29
|
+
uid: string;
|
|
30
|
+
/** The roster's name — display name, else email, else the uid. */
|
|
31
|
+
name: string;
|
|
32
|
+
email: string | null;
|
|
33
|
+
role: string | null;
|
|
34
|
+
credits: number;
|
|
35
|
+
/** Of the workspace's measured spend for the month, in `[0, 1]`. */
|
|
36
|
+
share: number;
|
|
37
|
+
requests: number;
|
|
38
|
+
refusals: number;
|
|
39
|
+
byKind: Record<string, number>;
|
|
40
|
+
byHost: Record<string, number>;
|
|
41
|
+
/** Credits on the site the request named, when it named one. */
|
|
42
|
+
hostCredits?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface OrgAiUsageTableWire {
|
|
45
|
+
month: string;
|
|
46
|
+
/** The months a reader may ask for, newest first. */
|
|
47
|
+
months: string[];
|
|
48
|
+
/** The workspace's own credits for the month — the pool the shares are of. */
|
|
49
|
+
orgCredits: number;
|
|
50
|
+
rows: OrgAiUsageRowWire[];
|
|
51
|
+
}
|
|
52
|
+
/** One person's month, as the member card reads it. */
|
|
53
|
+
export interface UserAiUsageMonthWire {
|
|
54
|
+
month: string;
|
|
55
|
+
credits: number;
|
|
56
|
+
share: number;
|
|
57
|
+
requests: number;
|
|
58
|
+
refusals: number;
|
|
59
|
+
byKind: Record<string, number>;
|
|
60
|
+
byHost: Record<string, number>;
|
|
61
|
+
}
|
|
62
|
+
export interface UserAiUsageWire {
|
|
63
|
+
uid: string;
|
|
64
|
+
/** Newest first. */
|
|
65
|
+
months: UserAiUsageMonthWire[];
|
|
66
|
+
}
|
|
67
|
+
/** The roster's month, joined and shared, projected onto the wire. */
|
|
68
|
+
export declare function toAiUsageWireRow(row: AiUsageByUserMonth & {
|
|
69
|
+
name: string;
|
|
70
|
+
email: string | null;
|
|
71
|
+
role: string | null;
|
|
72
|
+
share: number;
|
|
73
|
+
}, hostId: string): OrgAiUsageRowWire;
|
|
74
|
+
/** The CSV's columns, in order. */
|
|
75
|
+
export declare const AI_USAGE_CSV_HEADER: readonly ["Member", "Email", "Role", "Credits", "Share", "Requests", "Refusals", "Top kinds", "Sites"];
|
|
76
|
+
/** A share as the table and the file print it: one decimal of a percent. */
|
|
77
|
+
export declare function formatAiUsageShare(share: number): string;
|
|
78
|
+
export declare function aiUsageCsvLine(row: OrgAiUsageRowWire): string;
|
|
79
|
+
/**
|
|
80
|
+
* THE USAGE STRIP'S ENVELOPE (AGL-2942): what every AI door adds to the
|
|
81
|
+
* answer it already sends — the chat door's `done` event, the copy
|
|
82
|
+
* assistant's JSON, a job's create response, and each door's quota refusal —
|
|
83
|
+
* so the strip in the panel and the generation dialogs updates with no read
|
|
84
|
+
* of its own.
|
|
85
|
+
*
|
|
86
|
+
* Credits only. `pool` is the workspace's month against its band; `mine` is
|
|
87
|
+
* the caller's own month, measured against the allotment that binds them
|
|
88
|
+
* when one does — for a site allotment, the site's month, because that is
|
|
89
|
+
* the line the next request meets.
|
|
90
|
+
*/
|
|
91
|
+
export type AiUsageMeterState = 'ok' | 'warn' | 'capped';
|
|
92
|
+
export interface AiUsageMeterWire {
|
|
93
|
+
month: string;
|
|
94
|
+
pool: {
|
|
95
|
+
used: number;
|
|
96
|
+
limit: number | null;
|
|
97
|
+
};
|
|
98
|
+
mine: {
|
|
99
|
+
used: number;
|
|
100
|
+
limit: number | null;
|
|
101
|
+
mode: AiAllotmentMode | null;
|
|
102
|
+
scope: AiCreditAllotmentScope | null;
|
|
103
|
+
};
|
|
104
|
+
/** Credits the exchange this envelope answers cost; `null` when no model ran. */
|
|
105
|
+
last: number | null;
|
|
106
|
+
/** True when the envelope rides a refusal. */
|
|
107
|
+
refused: boolean;
|
|
108
|
+
state: AiUsageMeterState;
|
|
109
|
+
/** The model that answered, as the catalog names it. */
|
|
110
|
+
model: {
|
|
111
|
+
id: string;
|
|
112
|
+
label: string;
|
|
113
|
+
auto: boolean;
|
|
114
|
+
} | null;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* `capped` when a hard allotment is spent or the request was refused, `warn`
|
|
118
|
+
* from 80% of the allotment that binds or of the pool, `ok` otherwise.
|
|
119
|
+
*/
|
|
120
|
+
export declare function aiUsageMeterState(meter: Pick<AiUsageMeterWire, 'pool' | 'mine' | 'refused'>): AiUsageMeterState;
|
|
121
|
+
/**
|
|
122
|
+
* What `/api/ai/allotments` answers (AGL-2942): the allotments a reader may
|
|
123
|
+
* see, each with what its subject drew this month, and the roster, sites
|
|
124
|
+
* and models the editors pick from. Credits only.
|
|
125
|
+
*/
|
|
126
|
+
export interface AiAllotmentRowWire {
|
|
127
|
+
subject: string;
|
|
128
|
+
scope: 'member' | 'collab' | 'host' | 'org';
|
|
129
|
+
uid: string | null;
|
|
130
|
+
hostId: string | null;
|
|
131
|
+
credits: number | null;
|
|
132
|
+
mode: AiAllotmentMode;
|
|
133
|
+
models: string[] | null;
|
|
134
|
+
/** Credits the subject drew this month — the figure the gate measures. */
|
|
135
|
+
used: number;
|
|
136
|
+
}
|
|
137
|
+
export interface AiAllotmentsMemberWire {
|
|
138
|
+
uid: string;
|
|
139
|
+
name: string;
|
|
140
|
+
email: string | null;
|
|
141
|
+
role: string | null;
|
|
142
|
+
/** False for a site collaborator, whose allotments are per site. */
|
|
143
|
+
orgWide: boolean;
|
|
144
|
+
/** Credits this month, every site. */
|
|
145
|
+
credits: number;
|
|
146
|
+
/** Credits this month by site. */
|
|
147
|
+
byHost: Record<string, number>;
|
|
148
|
+
}
|
|
149
|
+
export interface AiAllotmentsHostWire {
|
|
150
|
+
hostId: string;
|
|
151
|
+
name: string;
|
|
152
|
+
/** The site's credits this month, everyone on it. */
|
|
153
|
+
credits: number;
|
|
154
|
+
}
|
|
155
|
+
export interface AiAllotmentsWire {
|
|
156
|
+
/** The org the answer is about — resolved from the site when only one was named. */
|
|
157
|
+
orgId: string;
|
|
158
|
+
month: string;
|
|
159
|
+
pool: {
|
|
160
|
+
used: number;
|
|
161
|
+
limit: number | null;
|
|
162
|
+
};
|
|
163
|
+
allotments: AiAllotmentRowWire[];
|
|
164
|
+
members: AiAllotmentsMemberWire[];
|
|
165
|
+
hosts: AiAllotmentsHostWire[];
|
|
166
|
+
/** The catalog models this deployment serves, for an allowlist. */
|
|
167
|
+
models: Array<{
|
|
168
|
+
id: string;
|
|
169
|
+
label: string;
|
|
170
|
+
tier: string;
|
|
171
|
+
}>;
|
|
172
|
+
/** Whether the plan lets the workspace restrict models org-wide. */
|
|
173
|
+
restrictionAvailable: boolean;
|
|
174
|
+
canEdit: {
|
|
175
|
+
/** Members, sites and the restriction: `billing.manage`. */
|
|
176
|
+
billing: boolean;
|
|
177
|
+
/** Collaborators on the site asked about: `billing.manage`, or its admin. */
|
|
178
|
+
collaborators: boolean;
|
|
179
|
+
};
|
|
180
|
+
/** Who is reading, so an editor can refuse to offer a self-raise. */
|
|
181
|
+
callerUid: string;
|
|
182
|
+
}
|
|
183
|
+
/** `2026-09` as a reader says it, on the UTC calendar the key is cut from. */
|
|
184
|
+
export declare function aiUsageMonthLabel(month: string): string;
|
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
*/ // By their own entry points rather than the barrel: the route that serves
|
|
17
|
+
// this shape imports it on the server, where the whole library is dead weight.
|
|
18
|
+
import { topAiUsageKinds } from "../model/ai-usage-by-user.js";
|
|
19
|
+
import { AI_ALLOTMENT_WARN_SHARE } from "../model/ai-allotments.js";
|
|
20
|
+
import { csvCell } from "@aglyn/aglyn/app-utils/csv-import";
|
|
21
|
+
/**
|
|
22
|
+
* What `/api/ai/usage` answers (AGL-2928), shared by the route and the
|
|
23
|
+
* console surfaces that read it — the Usage table, the roster column, the
|
|
24
|
+
* site collaborators card and the member card. Dependency-free on purpose:
|
|
25
|
+
* the route imports the Admin SDK and a client component may not.
|
|
26
|
+
*/ /** Header naming the row count the export undertook to send. */ export const AI_USAGE_EXPORT_ROWS_HEADER = 'X-Aglyn-Export-Rows';
|
|
27
|
+
/** The roster's month, joined and shared, projected onto the wire. */ export function toAiUsageWireRow(row, hostId) {
|
|
28
|
+
var _row_byHost_hostId;
|
|
29
|
+
const wire = {
|
|
30
|
+
uid: row.uid,
|
|
31
|
+
name: row.name,
|
|
32
|
+
email: row.email,
|
|
33
|
+
role: row.role,
|
|
34
|
+
credits: row.credits,
|
|
35
|
+
share: row.share,
|
|
36
|
+
requests: row.requests,
|
|
37
|
+
refusals: row.refusals,
|
|
38
|
+
byKind: row.byKind,
|
|
39
|
+
byHost: row.byHost
|
|
40
|
+
};
|
|
41
|
+
if (hostId) wire.hostCredits = (_row_byHost_hostId = row.byHost[hostId]) != null ? _row_byHost_hostId : 0;
|
|
42
|
+
return wire;
|
|
43
|
+
}
|
|
44
|
+
/** The CSV's columns, in order. */ export const AI_USAGE_CSV_HEADER = [
|
|
45
|
+
'Member',
|
|
46
|
+
'Email',
|
|
47
|
+
'Role',
|
|
48
|
+
'Credits',
|
|
49
|
+
'Share',
|
|
50
|
+
'Requests',
|
|
51
|
+
'Refusals',
|
|
52
|
+
'Top kinds',
|
|
53
|
+
'Sites'
|
|
54
|
+
];
|
|
55
|
+
/** A share as the table and the file print it: one decimal of a percent. */ export function formatAiUsageShare(share) {
|
|
56
|
+
return `${Math.round(share * 1000) / 10}%`;
|
|
57
|
+
}
|
|
58
|
+
export function aiUsageCsvLine(row) {
|
|
59
|
+
var _row_email, _row_role;
|
|
60
|
+
const kinds = topAiUsageKinds(row.byKind, 3).map((entry)=>`${entry.kind} ${entry.credits}`).join('; ');
|
|
61
|
+
const sites = Object.entries(row.byHost).sort((a, b)=>b[1] - a[1]).map(([hostId, credits])=>`${hostId} ${credits}`).join('; ');
|
|
62
|
+
return [
|
|
63
|
+
row.name,
|
|
64
|
+
(_row_email = row.email) != null ? _row_email : '',
|
|
65
|
+
(_row_role = row.role) != null ? _row_role : '',
|
|
66
|
+
row.credits,
|
|
67
|
+
formatAiUsageShare(row.share),
|
|
68
|
+
row.requests,
|
|
69
|
+
row.refusals,
|
|
70
|
+
kinds,
|
|
71
|
+
sites
|
|
72
|
+
].map(csvCell).join(',');
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* `capped` when a hard allotment is spent or the request was refused, `warn`
|
|
76
|
+
* from 80% of the allotment that binds or of the pool, `ok` otherwise.
|
|
77
|
+
*/ export function aiUsageMeterState(meter) {
|
|
78
|
+
const { mine, pool } = meter;
|
|
79
|
+
if (meter.refused) return 'capped';
|
|
80
|
+
if (mine.limit !== null && mine.mode === 'hard' && mine.used >= mine.limit) return 'capped';
|
|
81
|
+
const past = (used, limit)=>limit !== null && limit > 0 && used >= limit * AI_ALLOTMENT_WARN_SHARE;
|
|
82
|
+
return past(mine.used, mine.limit) || past(pool.used, pool.limit) ? 'warn' : 'ok';
|
|
83
|
+
}
|
|
84
|
+
/** `2026-09` as a reader says it, on the UTC calendar the key is cut from. */ export function aiUsageMonthLabel(month) {
|
|
85
|
+
const [year, monthOfYear] = month.split('-').map(Number);
|
|
86
|
+
if (!year || !monthOfYear) return month;
|
|
87
|
+
try {
|
|
88
|
+
return new Date(Date.UTC(year, monthOfYear - 1, 1)).toLocaleDateString(undefined, {
|
|
89
|
+
month: 'long',
|
|
90
|
+
year: 'numeric',
|
|
91
|
+
timeZone: 'UTC'
|
|
92
|
+
});
|
|
93
|
+
} catch (unused) {
|
|
94
|
+
return month;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
//# sourceMappingURL=ai-usage-wire.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/usage/ai-usage-wire.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\n// By their own entry points rather than the barrel: the route that serves\n// this shape imports it on the server, where the whole library is dead weight.\nimport {\n topAiUsageKinds,\n type AiUsageByUserMonth,\n} from '../model/ai-usage-by-user'\nimport {\n AI_ALLOTMENT_WARN_SHARE,\n type AiAllotmentMode,\n type AiCreditAllotmentScope,\n} from '../model/ai-allotments'\nimport { csvCell } from '@aglyn/aglyn/app-utils/csv-import'\n\n/**\n * What `/api/ai/usage` answers (AGL-2928), shared by the route and the\n * console surfaces that read it — the Usage table, the roster column, the\n * site collaborators card and the member card. Dependency-free on purpose:\n * the route imports the Admin SDK and a client component may not.\n */\n\n/** Header naming the row count the export undertook to send. */\nexport const AI_USAGE_EXPORT_ROWS_HEADER = 'X-Aglyn-Export-Rows'\n\n/** A row as a customer sees it — credits and a share, never `estCostUsd`. */\nexport interface OrgAiUsageRowWire {\n uid: string\n /** The roster's name — display name, else email, else the uid. */\n name: string\n email: string | null\n role: string | null\n credits: number\n /** Of the workspace's measured spend for the month, in `[0, 1]`. */\n share: number\n requests: number\n refusals: number\n byKind: Record<string, number>\n byHost: Record<string, number>\n /** Credits on the site the request named, when it named one. */\n hostCredits?: number\n}\n\nexport interface OrgAiUsageTableWire {\n month: string\n /** The months a reader may ask for, newest first. */\n months: string[]\n /** The workspace's own credits for the month — the pool the shares are of. */\n orgCredits: number\n rows: OrgAiUsageRowWire[]\n}\n\n/** One person's month, as the member card reads it. */\nexport interface UserAiUsageMonthWire {\n month: string\n credits: number\n share: number\n requests: number\n refusals: number\n byKind: Record<string, number>\n byHost: Record<string, number>\n}\n\nexport interface UserAiUsageWire {\n uid: string\n /** Newest first. */\n months: UserAiUsageMonthWire[]\n}\n\n/** The roster's month, joined and shared, projected onto the wire. */\nexport function toAiUsageWireRow(\n row: AiUsageByUserMonth & {\n name: string\n email: string | null\n role: string | null\n share: number\n },\n hostId: string,\n): OrgAiUsageRowWire {\n const wire: OrgAiUsageRowWire = {\n uid: row.uid,\n name: row.name,\n email: row.email,\n role: row.role,\n credits: row.credits,\n share: row.share,\n requests: row.requests,\n refusals: row.refusals,\n byKind: row.byKind,\n byHost: row.byHost,\n }\n if (hostId) wire.hostCredits = row.byHost[hostId] ?? 0\n return wire\n}\n\n/** The CSV's columns, in order. */\nexport const AI_USAGE_CSV_HEADER = [\n 'Member',\n 'Email',\n 'Role',\n 'Credits',\n 'Share',\n 'Requests',\n 'Refusals',\n 'Top kinds',\n 'Sites',\n] as const\n\n/** A share as the table and the file print it: one decimal of a percent. */\nexport function formatAiUsageShare(share: number): string {\n return `${Math.round(share * 1000) / 10}%`\n}\n\nexport function aiUsageCsvLine(row: OrgAiUsageRowWire): string {\n const kinds = topAiUsageKinds(row.byKind, 3)\n .map((entry) => `${entry.kind} ${entry.credits}`)\n .join('; ')\n const sites = Object.entries(row.byHost)\n .sort((a, b) => b[1] - a[1])\n .map(([hostId, credits]) => `${hostId} ${credits}`)\n .join('; ')\n return [\n row.name,\n row.email ?? '',\n row.role ?? '',\n row.credits,\n formatAiUsageShare(row.share),\n row.requests,\n row.refusals,\n kinds,\n sites,\n ]\n .map(csvCell)\n .join(',')\n}\n\n/**\n * THE USAGE STRIP'S ENVELOPE (AGL-2942): what every AI door adds to the\n * answer it already sends — the chat door's `done` event, the copy\n * assistant's JSON, a job's create response, and each door's quota refusal —\n * so the strip in the panel and the generation dialogs updates with no read\n * of its own.\n *\n * Credits only. `pool` is the workspace's month against its band; `mine` is\n * the caller's own month, measured against the allotment that binds them\n * when one does — for a site allotment, the site's month, because that is\n * the line the next request meets.\n */\nexport type AiUsageMeterState = 'ok' | 'warn' | 'capped'\n\nexport interface AiUsageMeterWire {\n month: string\n pool: { used: number; limit: number | null }\n mine: {\n used: number\n limit: number | null\n mode: AiAllotmentMode | null\n scope: AiCreditAllotmentScope | null\n }\n /** Credits the exchange this envelope answers cost; `null` when no model ran. */\n last: number | null\n /** True when the envelope rides a refusal. */\n refused: boolean\n state: AiUsageMeterState\n /** The model that answered, as the catalog names it. */\n model: { id: string; label: string; auto: boolean } | null\n}\n\n/**\n * `capped` when a hard allotment is spent or the request was refused, `warn`\n * from 80% of the allotment that binds or of the pool, `ok` otherwise.\n */\nexport function aiUsageMeterState(\n meter: Pick<AiUsageMeterWire, 'pool' | 'mine' | 'refused'>,\n): AiUsageMeterState {\n const { mine, pool } = meter\n if (meter.refused) return 'capped'\n if (mine.limit !== null && mine.mode === 'hard' && mine.used >= mine.limit) return 'capped'\n const past = (used: number, limit: number | null) =>\n limit !== null && limit > 0 && used >= limit * AI_ALLOTMENT_WARN_SHARE\n return past(mine.used, mine.limit) || past(pool.used, pool.limit) ? 'warn' : 'ok'\n}\n\n/**\n * What `/api/ai/allotments` answers (AGL-2942): the allotments a reader may\n * see, each with what its subject drew this month, and the roster, sites\n * and models the editors pick from. Credits only.\n */\nexport interface AiAllotmentRowWire {\n subject: string\n scope: 'member' | 'collab' | 'host' | 'org'\n uid: string | null\n hostId: string | null\n credits: number | null\n mode: AiAllotmentMode\n models: string[] | null\n /** Credits the subject drew this month — the figure the gate measures. */\n used: number\n}\n\nexport interface AiAllotmentsMemberWire {\n uid: string\n name: string\n email: string | null\n role: string | null\n /** False for a site collaborator, whose allotments are per site. */\n orgWide: boolean\n /** Credits this month, every site. */\n credits: number\n /** Credits this month by site. */\n byHost: Record<string, number>\n}\n\nexport interface AiAllotmentsHostWire {\n hostId: string\n name: string\n /** The site's credits this month, everyone on it. */\n credits: number\n}\n\nexport interface AiAllotmentsWire {\n /** The org the answer is about — resolved from the site when only one was named. */\n orgId: string\n month: string\n pool: { used: number; limit: number | null }\n allotments: AiAllotmentRowWire[]\n members: AiAllotmentsMemberWire[]\n hosts: AiAllotmentsHostWire[]\n /** The catalog models this deployment serves, for an allowlist. */\n models: Array<{ id: string; label: string; tier: string }>\n /** Whether the plan lets the workspace restrict models org-wide. */\n restrictionAvailable: boolean\n canEdit: {\n /** Members, sites and the restriction: `billing.manage`. */\n billing: boolean\n /** Collaborators on the site asked about: `billing.manage`, or its admin. */\n collaborators: boolean\n }\n /** Who is reading, so an editor can refuse to offer a self-raise. */\n callerUid: string\n}\n\n/** `2026-09` as a reader says it, on the UTC calendar the key is cut from. */\nexport function aiUsageMonthLabel(month: string): string {\n const [year, monthOfYear] = month.split('-').map(Number)\n if (!year || !monthOfYear) return month\n try {\n return new Date(Date.UTC(year, monthOfYear - 1, 1)).toLocaleDateString(undefined, {\n month: 'long',\n year: 'numeric',\n timeZone: 'UTC',\n })\n } catch {\n return month\n }\n}\n"],"names":["topAiUsageKinds","AI_ALLOTMENT_WARN_SHARE","csvCell","AI_USAGE_EXPORT_ROWS_HEADER","toAiUsageWireRow","row","hostId","wire","uid","name","email","role","credits","share","requests","refusals","byKind","byHost","hostCredits","AI_USAGE_CSV_HEADER","formatAiUsageShare","Math","round","aiUsageCsvLine","kinds","map","entry","kind","join","sites","Object","entries","sort","a","b","aiUsageMeterState","meter","mine","pool","refused","limit","mode","used","past","aiUsageMonthLabel","month","year","monthOfYear","split","Number","Date","UTC","toLocaleDateString","undefined","timeZone"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,0EAA0E;AAC1E,+EAA+E;AAC/E,SACEA,eAAe,QAEV,+BAA2B;AAClC,SACEC,uBAAuB,QAGlB,4BAAwB;AAC/B,SAASC,OAAO,QAAQ,oCAAmC;AAE3D;;;;;CAKC,GAED,8DAA8D,GAC9D,OAAO,MAAMC,8BAA8B,sBAAqB;AA8ChE,oEAAoE,GACpE,OAAO,SAASC,iBACdC,GAKC,EACDC,MAAc;QAciBD;IAZ/B,MAAME,OAA0B;QAC9BC,KAAKH,IAAIG,GAAG;QACZC,MAAMJ,IAAII,IAAI;QACdC,OAAOL,IAAIK,KAAK;QAChBC,MAAMN,IAAIM,IAAI;QACdC,SAASP,IAAIO,OAAO;QACpBC,OAAOR,IAAIQ,KAAK;QAChBC,UAAUT,IAAIS,QAAQ;QACtBC,UAAUV,IAAIU,QAAQ;QACtBC,QAAQX,IAAIW,MAAM;QAClBC,QAAQZ,IAAIY,MAAM;IACpB;IACA,IAAIX,QAAQC,KAAKW,WAAW,IAAGb,qBAAAA,IAAIY,MAAM,CAACX,OAAO,YAAlBD,qBAAsB;IACrD,OAAOE;AACT;AAEA,iCAAiC,GACjC,OAAO,MAAMY,sBAAsB;IACjC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAS;AAEV,0EAA0E,GAC1E,OAAO,SAASC,mBAAmBP,KAAa;IAC9C,OAAO,GAAGQ,KAAKC,KAAK,CAACT,QAAQ,QAAQ,GAAG,CAAC,CAAC;AAC5C;AAEA,OAAO,SAASU,eAAelB,GAAsB;QAUjDA,YACAA;IAVF,MAAMmB,QAAQxB,gBAAgBK,IAAIW,MAAM,EAAE,GACvCS,GAAG,CAAC,CAACC,QAAU,GAAGA,MAAMC,IAAI,CAAC,CAAC,EAAED,MAAMd,OAAO,EAAE,EAC/CgB,IAAI,CAAC;IACR,MAAMC,QAAQC,OAAOC,OAAO,CAAC1B,IAAIY,MAAM,EACpCe,IAAI,CAAC,CAACC,GAAGC,IAAMA,CAAC,CAAC,EAAE,GAAGD,CAAC,CAAC,EAAE,EAC1BR,GAAG,CAAC,CAAC,CAACnB,QAAQM,QAAQ,GAAK,GAAGN,OAAO,CAAC,EAAEM,SAAS,EACjDgB,IAAI,CAAC;IACR,OAAO;QACLvB,IAAII,IAAI;SACRJ,aAAAA,IAAIK,KAAK,YAATL,aAAa;SACbA,YAAAA,IAAIM,IAAI,YAARN,YAAY;QACZA,IAAIO,OAAO;QACXQ,mBAAmBf,IAAIQ,KAAK;QAC5BR,IAAIS,QAAQ;QACZT,IAAIU,QAAQ;QACZS;QACAK;KACD,CACEJ,GAAG,CAACvB,SACJ0B,IAAI,CAAC;AACV;AAkCA;;;CAGC,GACD,OAAO,SAASO,kBACdC,KAA0D;IAE1D,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAE,GAAGF;IACvB,IAAIA,MAAMG,OAAO,EAAE,OAAO;IAC1B,IAAIF,KAAKG,KAAK,KAAK,QAAQH,KAAKI,IAAI,KAAK,UAAUJ,KAAKK,IAAI,IAAIL,KAAKG,KAAK,EAAE,OAAO;IACnF,MAAMG,OAAO,CAACD,MAAcF,QAC1BA,UAAU,QAAQA,QAAQ,KAAKE,QAAQF,QAAQvC;IACjD,OAAO0C,KAAKN,KAAKK,IAAI,EAAEL,KAAKG,KAAK,KAAKG,KAAKL,KAAKI,IAAI,EAAEJ,KAAKE,KAAK,IAAI,SAAS;AAC/E;AA6DA,4EAA4E,GAC5E,OAAO,SAASI,kBAAkBC,KAAa;IAC7C,MAAM,CAACC,MAAMC,YAAY,GAAGF,MAAMG,KAAK,CAAC,KAAKvB,GAAG,CAACwB;IACjD,IAAI,CAACH,QAAQ,CAACC,aAAa,OAAOF;IAClC,IAAI;QACF,OAAO,IAAIK,KAAKA,KAAKC,GAAG,CAACL,MAAMC,cAAc,GAAG,IAAIK,kBAAkB,CAACC,WAAW;YAChFR,OAAO;YACPC,MAAM;YACNQ,UAAU;QACZ;IACF,EAAE,eAAM;QACN,OAAOT;IACT;AACF"}
|
|
@@ -0,0 +1,87 @@
|
|
|
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 { AglynOrgBilling } from '@aglyn/aglyn/foundation/definitions/org-billing.types';
|
|
18
|
+
/**
|
|
19
|
+
* The ceiling one reservation is actually measured against, given the org's
|
|
20
|
+
* plan band.
|
|
21
|
+
*
|
|
22
|
+
* ## Why the repo default must not bind an org that has a band
|
|
23
|
+
*
|
|
24
|
+
* `ASSIST_ORG_MONTHLY_COGS_LIMIT_DEFAULT_USD` (in `usage-budget.ts`, beside
|
|
25
|
+
* the alert that announces the ceiling) is $40, which was sized as a
|
|
26
|
+
* runaway guard back when every org's assist spend was bounded by a message
|
|
27
|
+
* cap. It is BELOW what Agency and Enterprise include, so applying it to a
|
|
28
|
+
* plan band would refuse those workspaces partway through capacity they are
|
|
29
|
+
* paying for. The rule is not about which tiers happen to clear $40 today: a
|
|
30
|
+
* band that is sold is a product limit, and a default nobody typed is not
|
|
31
|
+
* allowed to undercut one at any size.
|
|
32
|
+
*
|
|
33
|
+
* ## Why an operator's explicit figure still does
|
|
34
|
+
*
|
|
35
|
+
* A self-hoster paying their own provider bill, or an operator responding to
|
|
36
|
+
* an incident, sets `ASSIST_ORG_MONTHLY_COGS_LIMIT_USD` on purpose. The lower
|
|
37
|
+
* of the two wins there, because that is what setting it means.
|
|
38
|
+
*
|
|
39
|
+
* `off` removes the operator's ceiling and does NOT remove a plan band: the
|
|
40
|
+
* word turns off a backstop, and the band is not one.
|
|
41
|
+
*
|
|
42
|
+
* An org with no band (`budgetUsd === null`) is unchanged in every case: it
|
|
43
|
+
* gets exactly the ceiling it got before, default and all. Since AGL-3203
|
|
44
|
+
* every plan row carries a band, so this is an org whose band was overridden
|
|
45
|
+
* to zero rather than a tier that sells none.
|
|
46
|
+
*
|
|
47
|
+
* ## When the band is a line rather than a wall (AGL-2653)
|
|
48
|
+
*
|
|
49
|
+
* `bandRefuses` is `assistBandRefuses(org)`: false on a plan that sells
|
|
50
|
+
* credits past its band unless the org's `assistOverage.hardCap` is on. A
|
|
51
|
+
* band that does not refuse is not a ceiling, so it drops out of the
|
|
52
|
+
* composition and the operator's explicit figure is the only thing left that
|
|
53
|
+
* can bind — the repo default stays off, for the reason above, and `off`
|
|
54
|
+
* leaves nothing. The message cap is still there either way, so a workspace
|
|
55
|
+
* buying overage is bounded by messages a month rather than by nothing; the
|
|
56
|
+
* overage it buys is priced by `report-usage` at the plan's rate.
|
|
57
|
+
*
|
|
58
|
+
* ## An uncapped staff comp (AGL-3049)
|
|
59
|
+
*
|
|
60
|
+
* `uncapped` is `isUncappedPlanComp(org)`. Its band resolves `null` — there
|
|
61
|
+
* is no band — but it is not a workspace that was never sold one, so the
|
|
62
|
+
* repo default must not stand in for a band here any more than it may
|
|
63
|
+
* undercut a sold one: a $40 wall on the workspace staff uncapped is exactly
|
|
64
|
+
* the cap uncapping removes. It composes like a band that does not refuse:
|
|
65
|
+
* the operator's explicit figure binds, because that is an incident
|
|
66
|
+
* decision about every workspace, and nothing else does. The message cap
|
|
67
|
+
* still applies, as it does to every entitled workspace.
|
|
68
|
+
*/
|
|
69
|
+
export declare function assistMonthlyCeilingUsd(budgetUsd: number | null, bandRefuses?: boolean, uncapped?: boolean): number | null;
|
|
70
|
+
/**
|
|
71
|
+
* The dollar ceiling this org's reservations refuse at that is NOT its own
|
|
72
|
+
* band, or `null` where none applies — the operator backstop as it binds
|
|
73
|
+
* this workspace.
|
|
74
|
+
*
|
|
75
|
+
* A reservation measured against a band that refuses is the workspace's own
|
|
76
|
+
* product limit, refused as `band` and told to the customer by the credits
|
|
77
|
+
* alert. Every other finite ceiling the reservation compares against is a
|
|
78
|
+
* backstop, refused as `budget`, and that is the stop staff are told about.
|
|
79
|
+
* Which one applies is `assistMonthlyCeilingUsd`'s decision, so:
|
|
80
|
+
*
|
|
81
|
+
* - a workspace with no band gets the repo default or the operator's figure;
|
|
82
|
+
* - a band sold past, or an uncapped staff comp (AGL-3049), gets only an
|
|
83
|
+
* operator's explicit figure, and nothing when none is set;
|
|
84
|
+
* - a band that is a wall gets the operator's figure only where it sits
|
|
85
|
+
* below the band, because only then is the operator's figure what refuses.
|
|
86
|
+
*/
|
|
87
|
+
export declare function assistBackstopCeilingUsd(org: Partial<AglynOrgBilling> | null | undefined): number | null;
|
|
@@ -0,0 +1,110 @@
|
|
|
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 { assistBandRefuses, resolveAssistBudgetUsd } from "@aglyn/aglyn/app-utils/assist-credits";
|
|
17
|
+
import { isUncappedPlanComp } from "@aglyn/aglyn/app-utils/plan-entitlements";
|
|
18
|
+
import { assistOperatorCeilingUsd, assistOrgMonthlyCostLimitUsd } from "@aglyn/aglyn/app-utils/usage-budget";
|
|
19
|
+
/*
|
|
20
|
+
* THE MONTHLY DOLLAR CEILING an assist reservation is measured against, apart
|
|
21
|
+
* from the reservation itself: pure arithmetic over the org document and the
|
|
22
|
+
* operator's setting, with nothing that writes. The reservation resolves it
|
|
23
|
+
* before its transaction opens, and the staff alert that announces a refusal
|
|
24
|
+
* reads the same composition, so the figure announced is the figure enforced.
|
|
25
|
+
*/ /**
|
|
26
|
+
* The ceiling one reservation is actually measured against, given the org's
|
|
27
|
+
* plan band.
|
|
28
|
+
*
|
|
29
|
+
* ## Why the repo default must not bind an org that has a band
|
|
30
|
+
*
|
|
31
|
+
* `ASSIST_ORG_MONTHLY_COGS_LIMIT_DEFAULT_USD` (in `usage-budget.ts`, beside
|
|
32
|
+
* the alert that announces the ceiling) is $40, which was sized as a
|
|
33
|
+
* runaway guard back when every org's assist spend was bounded by a message
|
|
34
|
+
* cap. It is BELOW what Agency and Enterprise include, so applying it to a
|
|
35
|
+
* plan band would refuse those workspaces partway through capacity they are
|
|
36
|
+
* paying for. The rule is not about which tiers happen to clear $40 today: a
|
|
37
|
+
* band that is sold is a product limit, and a default nobody typed is not
|
|
38
|
+
* allowed to undercut one at any size.
|
|
39
|
+
*
|
|
40
|
+
* ## Why an operator's explicit figure still does
|
|
41
|
+
*
|
|
42
|
+
* A self-hoster paying their own provider bill, or an operator responding to
|
|
43
|
+
* an incident, sets `ASSIST_ORG_MONTHLY_COGS_LIMIT_USD` on purpose. The lower
|
|
44
|
+
* of the two wins there, because that is what setting it means.
|
|
45
|
+
*
|
|
46
|
+
* `off` removes the operator's ceiling and does NOT remove a plan band: the
|
|
47
|
+
* word turns off a backstop, and the band is not one.
|
|
48
|
+
*
|
|
49
|
+
* An org with no band (`budgetUsd === null`) is unchanged in every case: it
|
|
50
|
+
* gets exactly the ceiling it got before, default and all. Since AGL-3203
|
|
51
|
+
* every plan row carries a band, so this is an org whose band was overridden
|
|
52
|
+
* to zero rather than a tier that sells none.
|
|
53
|
+
*
|
|
54
|
+
* ## When the band is a line rather than a wall (AGL-2653)
|
|
55
|
+
*
|
|
56
|
+
* `bandRefuses` is `assistBandRefuses(org)`: false on a plan that sells
|
|
57
|
+
* credits past its band unless the org's `assistOverage.hardCap` is on. A
|
|
58
|
+
* band that does not refuse is not a ceiling, so it drops out of the
|
|
59
|
+
* composition and the operator's explicit figure is the only thing left that
|
|
60
|
+
* can bind — the repo default stays off, for the reason above, and `off`
|
|
61
|
+
* leaves nothing. The message cap is still there either way, so a workspace
|
|
62
|
+
* buying overage is bounded by messages a month rather than by nothing; the
|
|
63
|
+
* overage it buys is priced by `report-usage` at the plan's rate.
|
|
64
|
+
*
|
|
65
|
+
* ## An uncapped staff comp (AGL-3049)
|
|
66
|
+
*
|
|
67
|
+
* `uncapped` is `isUncappedPlanComp(org)`. Its band resolves `null` — there
|
|
68
|
+
* is no band — but it is not a workspace that was never sold one, so the
|
|
69
|
+
* repo default must not stand in for a band here any more than it may
|
|
70
|
+
* undercut a sold one: a $40 wall on the workspace staff uncapped is exactly
|
|
71
|
+
* the cap uncapping removes. It composes like a band that does not refuse:
|
|
72
|
+
* the operator's explicit figure binds, because that is an incident
|
|
73
|
+
* decision about every workspace, and nothing else does. The message cap
|
|
74
|
+
* still applies, as it does to every entitled workspace.
|
|
75
|
+
*/ export function assistMonthlyCeilingUsd(budgetUsd, bandRefuses = true, uncapped = false) {
|
|
76
|
+
const configured = process.env.ASSIST_ORG_MONTHLY_COGS_LIMIT_USD;
|
|
77
|
+
if (uncapped) {
|
|
78
|
+
const operator = assistOperatorCeilingUsd(configured);
|
|
79
|
+
return typeof operator === 'number' ? operator : null;
|
|
80
|
+
}
|
|
81
|
+
if (budgetUsd === null) return assistOrgMonthlyCostLimitUsd(configured);
|
|
82
|
+
const operator = assistOperatorCeilingUsd(configured);
|
|
83
|
+
if (!bandRefuses) return typeof operator === 'number' ? operator : null;
|
|
84
|
+
return typeof operator === 'number' ? Math.min(budgetUsd, operator) : budgetUsd;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The dollar ceiling this org's reservations refuse at that is NOT its own
|
|
88
|
+
* band, or `null` where none applies — the operator backstop as it binds
|
|
89
|
+
* this workspace.
|
|
90
|
+
*
|
|
91
|
+
* A reservation measured against a band that refuses is the workspace's own
|
|
92
|
+
* product limit, refused as `band` and told to the customer by the credits
|
|
93
|
+
* alert. Every other finite ceiling the reservation compares against is a
|
|
94
|
+
* backstop, refused as `budget`, and that is the stop staff are told about.
|
|
95
|
+
* Which one applies is `assistMonthlyCeilingUsd`'s decision, so:
|
|
96
|
+
*
|
|
97
|
+
* - a workspace with no band gets the repo default or the operator's figure;
|
|
98
|
+
* - a band sold past, or an uncapped staff comp (AGL-3049), gets only an
|
|
99
|
+
* operator's explicit figure, and nothing when none is set;
|
|
100
|
+
* - a band that is a wall gets the operator's figure only where it sits
|
|
101
|
+
* below the band, because only then is the operator's figure what refuses.
|
|
102
|
+
*/ export function assistBackstopCeilingUsd(org) {
|
|
103
|
+
const budgetUsd = resolveAssistBudgetUsd(org);
|
|
104
|
+
const bandRefuses = assistBandRefuses(org);
|
|
105
|
+
const ceilingUsd = assistMonthlyCeilingUsd(budgetUsd, bandRefuses, isUncappedPlanComp(org));
|
|
106
|
+
const ceilingIsBand = bandRefuses && budgetUsd !== null && ceilingUsd === budgetUsd;
|
|
107
|
+
return ceilingIsBand ? null : ceilingUsd;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
//# sourceMappingURL=assist-ceiling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/usage/assist-ceiling.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 {\n assistBandRefuses,\n resolveAssistBudgetUsd,\n} from '@aglyn/aglyn/app-utils/assist-credits'\nimport { isUncappedPlanComp } from '@aglyn/aglyn/app-utils/plan-entitlements'\nimport {\n assistOperatorCeilingUsd,\n assistOrgMonthlyCostLimitUsd,\n} from '@aglyn/aglyn/app-utils/usage-budget'\nimport type { AglynOrgBilling } from '@aglyn/aglyn/foundation/definitions/org-billing.types'\n\n/*\n * THE MONTHLY DOLLAR CEILING an assist reservation is measured against, apart\n * from the reservation itself: pure arithmetic over the org document and the\n * operator's setting, with nothing that writes. The reservation resolves it\n * before its transaction opens, and the staff alert that announces a refusal\n * reads the same composition, so the figure announced is the figure enforced.\n */\n\n/**\n * The ceiling one reservation is actually measured against, given the org's\n * plan band.\n *\n * ## Why the repo default must not bind an org that has a band\n *\n * `ASSIST_ORG_MONTHLY_COGS_LIMIT_DEFAULT_USD` (in `usage-budget.ts`, beside\n * the alert that announces the ceiling) is $40, which was sized as a\n * runaway guard back when every org's assist spend was bounded by a message\n * cap. It is BELOW what Agency and Enterprise include, so applying it to a\n * plan band would refuse those workspaces partway through capacity they are\n * paying for. The rule is not about which tiers happen to clear $40 today: a\n * band that is sold is a product limit, and a default nobody typed is not\n * allowed to undercut one at any size.\n *\n * ## Why an operator's explicit figure still does\n *\n * A self-hoster paying their own provider bill, or an operator responding to\n * an incident, sets `ASSIST_ORG_MONTHLY_COGS_LIMIT_USD` on purpose. The lower\n * of the two wins there, because that is what setting it means.\n *\n * `off` removes the operator's ceiling and does NOT remove a plan band: the\n * word turns off a backstop, and the band is not one.\n *\n * An org with no band (`budgetUsd === null`) is unchanged in every case: it\n * gets exactly the ceiling it got before, default and all. Since AGL-3203\n * every plan row carries a band, so this is an org whose band was overridden\n * to zero rather than a tier that sells none.\n *\n * ## When the band is a line rather than a wall (AGL-2653)\n *\n * `bandRefuses` is `assistBandRefuses(org)`: false on a plan that sells\n * credits past its band unless the org's `assistOverage.hardCap` is on. A\n * band that does not refuse is not a ceiling, so it drops out of the\n * composition and the operator's explicit figure is the only thing left that\n * can bind — the repo default stays off, for the reason above, and `off`\n * leaves nothing. The message cap is still there either way, so a workspace\n * buying overage is bounded by messages a month rather than by nothing; the\n * overage it buys is priced by `report-usage` at the plan's rate.\n *\n * ## An uncapped staff comp (AGL-3049)\n *\n * `uncapped` is `isUncappedPlanComp(org)`. Its band resolves `null` — there\n * is no band — but it is not a workspace that was never sold one, so the\n * repo default must not stand in for a band here any more than it may\n * undercut a sold one: a $40 wall on the workspace staff uncapped is exactly\n * the cap uncapping removes. It composes like a band that does not refuse:\n * the operator's explicit figure binds, because that is an incident\n * decision about every workspace, and nothing else does. The message cap\n * still applies, as it does to every entitled workspace.\n */\nexport function assistMonthlyCeilingUsd(\n budgetUsd: number | null,\n bandRefuses = true,\n uncapped = false,\n): number | null {\n const configured = process.env.ASSIST_ORG_MONTHLY_COGS_LIMIT_USD\n if (uncapped) {\n const operator = assistOperatorCeilingUsd(configured)\n return typeof operator === 'number' ? operator : null\n }\n if (budgetUsd === null) return assistOrgMonthlyCostLimitUsd(configured)\n const operator = assistOperatorCeilingUsd(configured)\n if (!bandRefuses) return typeof operator === 'number' ? operator : null\n return typeof operator === 'number'\n ? Math.min(budgetUsd, operator)\n : budgetUsd\n}\n\n/**\n * The dollar ceiling this org's reservations refuse at that is NOT its own\n * band, or `null` where none applies — the operator backstop as it binds\n * this workspace.\n *\n * A reservation measured against a band that refuses is the workspace's own\n * product limit, refused as `band` and told to the customer by the credits\n * alert. Every other finite ceiling the reservation compares against is a\n * backstop, refused as `budget`, and that is the stop staff are told about.\n * Which one applies is `assistMonthlyCeilingUsd`'s decision, so:\n *\n * - a workspace with no band gets the repo default or the operator's figure;\n * - a band sold past, or an uncapped staff comp (AGL-3049), gets only an\n * operator's explicit figure, and nothing when none is set;\n * - a band that is a wall gets the operator's figure only where it sits\n * below the band, because only then is the operator's figure what refuses.\n */\nexport function assistBackstopCeilingUsd(\n org: Partial<AglynOrgBilling> | null | undefined,\n): number | null {\n const budgetUsd = resolveAssistBudgetUsd(org)\n const bandRefuses = assistBandRefuses(org)\n const ceilingUsd = assistMonthlyCeilingUsd(\n budgetUsd,\n bandRefuses,\n isUncappedPlanComp(org),\n )\n const ceilingIsBand =\n bandRefuses && budgetUsd !== null && ceilingUsd === budgetUsd\n return ceilingIsBand ? null : ceilingUsd\n}\n"],"names":["assistBandRefuses","resolveAssistBudgetUsd","isUncappedPlanComp","assistOperatorCeilingUsd","assistOrgMonthlyCostLimitUsd","assistMonthlyCeilingUsd","budgetUsd","bandRefuses","uncapped","configured","process","env","ASSIST_ORG_MONTHLY_COGS_LIMIT_USD","operator","Math","min","assistBackstopCeilingUsd","org","ceilingUsd","ceilingIsBand"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,iBAAiB,EACjBC,sBAAsB,QACjB,wCAAuC;AAC9C,SAASC,kBAAkB,QAAQ,2CAA0C;AAC7E,SACEC,wBAAwB,EACxBC,4BAA4B,QACvB,sCAAqC;AAG5C;;;;;;CAMC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDC,GACD,OAAO,SAASC,wBACdC,SAAwB,EACxBC,cAAc,IAAI,EAClBC,WAAW,KAAK;IAEhB,MAAMC,aAAaC,QAAQC,GAAG,CAACC,iCAAiC;IAChE,IAAIJ,UAAU;QACZ,MAAMK,WAAWV,yBAAyBM;QAC1C,OAAO,OAAOI,aAAa,WAAWA,WAAW;IACnD;IACA,IAAIP,cAAc,MAAM,OAAOF,6BAA6BK;IAC5D,MAAMI,WAAWV,yBAAyBM;IAC1C,IAAI,CAACF,aAAa,OAAO,OAAOM,aAAa,WAAWA,WAAW;IACnE,OAAO,OAAOA,aAAa,WACvBC,KAAKC,GAAG,CAACT,WAAWO,YACpBP;AACN;AAEA;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,SAASU,yBACdC,GAAgD;IAEhD,MAAMX,YAAYL,uBAAuBgB;IACzC,MAAMV,cAAcP,kBAAkBiB;IACtC,MAAMC,aAAab,wBACjBC,WACAC,aACAL,mBAAmBe;IAErB,MAAME,gBACJZ,eAAeD,cAAc,QAAQY,eAAeZ;IACtD,OAAOa,gBAAgB,OAAOD;AAChC"}
|