@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,337 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2026 Aglyn LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/ import { pluginRequestFromWeb } from "@aglyn/aglyn/server";
|
|
18
|
+
import { ASSIST_HARD_CAP_CONTROL_LABEL, ASSIST_OVERAGE_CAP_CONTROL_LABEL, ASSIST_OVERAGE_CAP_MAX_USD, ASSIST_OVERAGE_CAP_MIN_USD, resolveAssistCreditBudget, resolveAssistHardCap, resolveAssistOverageCapUsd, resolveAssistOverageRateUsdPer1k } from "@aglyn/aglyn/app-utils/assist-credits";
|
|
19
|
+
import { emailUnverifiedResponse, firebaseAdmin, isImpersonationSession, memberHasOrgPermission, resolveOrgMembership } from "@aglyn/tenant-data-admin";
|
|
20
|
+
import { logAiOverageControl } from "../activity/ai-activity.js";
|
|
21
|
+
import { assistMonthOverage } from "@aglyn/aglyn/app-utils/assist-credits";
|
|
22
|
+
import { assistUsageMonth } from "../usage/assist-usage.js";
|
|
23
|
+
import { aiOverageBillsByInvoice } from "../billing/ai-overage-cutover.js";
|
|
24
|
+
import { aiOverageNextChargeUsd } from "../billing/ai-overage-gate.js";
|
|
25
|
+
import { AI_BILLING_STANDING_DOC, AI_BILLING_SUBCOLLECTION, readAiOverageMonthLedger } from "../billing/ai-overage-ledger.js";
|
|
26
|
+
import { AI_OVERAGE_THRESHOLD_USD, aiOverageCardOnFile, aiOverageStandingCeilingUsd, aiOverageStep, readAiOverageStanding } from "../billing/ai-overage-standing.js";
|
|
27
|
+
import { FieldValue } from "firebase-admin/firestore";
|
|
28
|
+
import { invalidIdTokenResponse } from "@aglyn/tenant-data-admin/server/id-token-refusal";
|
|
29
|
+
// lockdown-423: exempt — self-serve billing surface, same posture as
|
|
30
|
+
// billing/storage-overage beside it. AGL-1501 keeps billing-locked sessions
|
|
31
|
+
// alive precisely so members can reach Billing, and this is the control that
|
|
32
|
+
// stops an org accruing assist charges, so a 423 would trap it accruing them.
|
|
33
|
+
/**
|
|
34
|
+
* Read or set the org's own assist controls: the hard-cap switch (AGL-2653)
|
|
35
|
+
* and the dollar ceiling on overage (AGL-2898).
|
|
36
|
+
*
|
|
37
|
+
* Credits past the plan's assist band are SOLD by default, at the rate
|
|
38
|
+
* `resolveAssistOverageRateUsdPer1k` answers — the plan's listed
|
|
39
|
+
* `extraAssistCreditsUsdPer1k`, or the add-on's rate on a plan that carries
|
|
40
|
+
* its band only with the add-on. This route holds the two
|
|
41
|
+
* controls a customer has over that, and nothing else — it is not a consent
|
|
42
|
+
* surface, and there is nothing here an org must do before assist works.
|
|
43
|
+
*
|
|
44
|
+
* `get` → whether the switch is on, the ceiling if any, the band,
|
|
45
|
+
* the rate the overage bills at, and whether the plan sells
|
|
46
|
+
* overage at all
|
|
47
|
+
* `setHardCap` → store `hardCap: true | false`
|
|
48
|
+
* `setCap` → store `capUsd: number`, or `null` to clear the ceiling
|
|
49
|
+
*
|
|
50
|
+
* `billing.manage`-gated, because both controls bound spend in both
|
|
51
|
+
* directions: lifting either is what lets the org be invoiced further past
|
|
52
|
+
* its band, and setting either is what stops a workspace's assistant.
|
|
53
|
+
* Admin-SDK-only by construction — `assistOverage` is denied to every client
|
|
54
|
+
* in the rules, so a member cannot lift their own ceiling or lower somebody
|
|
55
|
+
* else's.
|
|
56
|
+
*
|
|
57
|
+
* TURNING THE SWITCH OFF AND CLEARING THE CEILING ARE ALWAYS AVAILABLE, on
|
|
58
|
+
* any plan and at any usage level: an org that wants the sale back on must
|
|
59
|
+
* not have to argue with a precondition. Turning the switch on, or setting a
|
|
60
|
+
* ceiling, is refused, 409, on a plan that sells no overage — there the band
|
|
61
|
+
* is already the wall (`assistBandRefuses`), and storing a control that
|
|
62
|
+
* changes nothing would read as protection the org does not have.
|
|
63
|
+
*/ /**
|
|
64
|
+
* What the overage card needs to say about Aglyn's own limit (AGL-3011).
|
|
65
|
+
*
|
|
66
|
+
* Every figure is `null` before the cutover month. That is not a missing
|
|
67
|
+
* value: it is the honest answer while overage still bills on the monthly
|
|
68
|
+
* invoice, and rendering a ceiling and a "next charge" figure that nothing
|
|
69
|
+
* enforces would be a promise the platform is not yet keeping.
|
|
70
|
+
*/ async function readAiOverageStandingForCard(orgRef, org) {
|
|
71
|
+
var _standingSnapshot_data, _usageSnapshot_data, _usageSnapshot_get, _ref, _aiOverageCardOnFile;
|
|
72
|
+
var _standing_pause;
|
|
73
|
+
const now = new Date();
|
|
74
|
+
const month = assistUsageMonth(now);
|
|
75
|
+
const empty = {
|
|
76
|
+
aglynCeilingUsd: null,
|
|
77
|
+
overageStep: null,
|
|
78
|
+
overageThresholdUsd: null,
|
|
79
|
+
overageChargedUsd: null,
|
|
80
|
+
overageChargeCount: null,
|
|
81
|
+
overageNextChargeUsd: null,
|
|
82
|
+
overagePaused: null,
|
|
83
|
+
overageCardOnFile: null,
|
|
84
|
+
overageBillsByInvoice: false
|
|
85
|
+
};
|
|
86
|
+
if (!aiOverageBillsByInvoice(month)) return empty;
|
|
87
|
+
const [standingSnapshot, usageSnapshot] = await Promise.all([
|
|
88
|
+
orgRef.collection(AI_BILLING_SUBCOLLECTION).doc(AI_BILLING_STANDING_DOC).get(),
|
|
89
|
+
orgRef.collection('assistUsage').doc(month).get()
|
|
90
|
+
]);
|
|
91
|
+
const standing = readAiOverageStanding(standingSnapshot.exists ? (_standingSnapshot_data = standingSnapshot.data()) != null ? _standingSnapshot_data : null : null);
|
|
92
|
+
const ledger = readAiOverageMonthLedger(usageSnapshot.exists ? (_usageSnapshot_data = usageSnapshot.data()) != null ? _usageSnapshot_data : null : null);
|
|
93
|
+
const priced = assistMonthOverage(org, Number((_usageSnapshot_get = usageSnapshot.get('estCostUsd')) != null ? _usageSnapshot_get : 0));
|
|
94
|
+
return {
|
|
95
|
+
aglynCeilingUsd: aiOverageStandingCeilingUsd(standing, now),
|
|
96
|
+
overageStep: aiOverageStep(standing),
|
|
97
|
+
overageThresholdUsd: AI_OVERAGE_THRESHOLD_USD,
|
|
98
|
+
overageChargedUsd: ledger.paidUsd,
|
|
99
|
+
overageChargeCount: ledger.charges,
|
|
100
|
+
overageNextChargeUsd: aiOverageNextChargeUsd(priced.overageMonthlyUsd, ledger.invoicedUsd),
|
|
101
|
+
overagePaused: (_ref = (_standing_pause = standing.pause) == null ? void 0 : _standing_pause.reason) != null ? _ref : null,
|
|
102
|
+
overageCardOnFile: (_aiOverageCardOnFile = aiOverageCardOnFile(standing)) != null ? _aiOverageCardOnFile : null,
|
|
103
|
+
overageBillsByInvoice: true
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
async function handler(request) {
|
|
107
|
+
var _headers_authorization, _ref, _ref1;
|
|
108
|
+
const { method, body, headers: rawHeaders } = await pluginRequestFromWeb(request);
|
|
109
|
+
const headers = rawHeaders;
|
|
110
|
+
if (method !== 'POST') {
|
|
111
|
+
return Response.json({
|
|
112
|
+
error: 'Method not allowed'
|
|
113
|
+
}, {
|
|
114
|
+
status: 405
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
const authorization = (_headers_authorization = headers.authorization) != null ? _headers_authorization : '';
|
|
118
|
+
const idToken = authorization.startsWith('Bearer ') ? authorization.slice('Bearer '.length) : undefined;
|
|
119
|
+
if (!idToken) return Response.json({
|
|
120
|
+
error: 'Unauthenticated'
|
|
121
|
+
}, {
|
|
122
|
+
status: 401
|
|
123
|
+
});
|
|
124
|
+
const orgId = String((_ref = body == null ? void 0 : body.orgId) != null ? _ref : '');
|
|
125
|
+
const action = String((_ref1 = body == null ? void 0 : body.action) != null ? _ref1 : '');
|
|
126
|
+
if (!orgId || ![
|
|
127
|
+
'get',
|
|
128
|
+
'setHardCap',
|
|
129
|
+
'setCap'
|
|
130
|
+
].includes(action)) {
|
|
131
|
+
return Response.json({
|
|
132
|
+
error: 'Bad request'
|
|
133
|
+
}, {
|
|
134
|
+
status: 400
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
var _orgSnapshot_data, _decoded_email, _decoded_email1;
|
|
139
|
+
const decoded = await firebaseAdmin.app().auth().verifyIdToken(idToken);
|
|
140
|
+
if (!decoded.email_verified && !isImpersonationSession(decoded)) {
|
|
141
|
+
return emailUnverifiedResponse();
|
|
142
|
+
}
|
|
143
|
+
const isStaff = decoded['staff'] === true;
|
|
144
|
+
const actor = await resolveOrgMembership(decoded.uid, orgId);
|
|
145
|
+
if (!isStaff && !await memberHasOrgPermission(orgId, actor == null ? void 0 : actor.member, 'billing.manage')) {
|
|
146
|
+
return Response.json({
|
|
147
|
+
error: 'billing.manage required'
|
|
148
|
+
}, {
|
|
149
|
+
status: 403
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
const orgRef = firebaseAdmin.app().firestore().collection('orgs').doc(orgId);
|
|
153
|
+
const orgSnapshot = await orgRef.get();
|
|
154
|
+
if (!orgSnapshot.exists) {
|
|
155
|
+
return Response.json({
|
|
156
|
+
error: 'Unknown organization'
|
|
157
|
+
}, {
|
|
158
|
+
status: 404
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
const org = (_orgSnapshot_data = orgSnapshot.data()) != null ? _orgSnapshot_data : {};
|
|
162
|
+
const hardCap = resolveAssistHardCap(org);
|
|
163
|
+
const capUsd = resolveAssistOverageCapUsd(org);
|
|
164
|
+
const bandCredits = resolveAssistCreditBudget(org);
|
|
165
|
+
// The rate the card quotes must be the rate the rollup bills, so it is
|
|
166
|
+
// read through the one resolver every reader of the rate goes through.
|
|
167
|
+
// That mattered acutely under AGL-3014, when Starter's rate lived off
|
|
168
|
+
// `PLAN_PRICING` and reading the table directly quoted $0.00 on an org
|
|
169
|
+
// that was really being invoiced. AGL-3203 put the rate on Starter's own
|
|
170
|
+
// row and deleted the exception, so the table and the resolver now agree
|
|
171
|
+
// — and this still reads the resolver, because a comp is priced at
|
|
172
|
+
// nothing and only `resolvePlanPricing` knows that.
|
|
173
|
+
const overageRateUsdPer1k = resolveAssistOverageRateUsdPer1k(org);
|
|
174
|
+
const sellsOverage = bandCredits !== null && overageRateUsdPer1k !== null;
|
|
175
|
+
if (action === 'get') {
|
|
176
|
+
// AGLYN'S OWN LIMIT BESIDE THE WORKSPACE'S (AGL-3011). The card shows
|
|
177
|
+
// both because the LOWER of the two binds, and a card that showed only
|
|
178
|
+
// the figure the workspace set would explain neither the refusal it
|
|
179
|
+
// gets at Aglyn's nor the charge it sees before its own is reached.
|
|
180
|
+
//
|
|
181
|
+
// `null` for every figure while the platform still bills overage on
|
|
182
|
+
// the monthly invoice, so the card keeps saying what is true today
|
|
183
|
+
// rather than describing a mechanism that is not running.
|
|
184
|
+
const overage = await readAiOverageStandingForCard(orgRef, org);
|
|
185
|
+
return Response.json(_extends({
|
|
186
|
+
hardCap,
|
|
187
|
+
capUsd,
|
|
188
|
+
bandCredits,
|
|
189
|
+
overageRateUsdPer1k,
|
|
190
|
+
sellsOverage
|
|
191
|
+
}, overage, {
|
|
192
|
+
label: ASSIST_HARD_CAP_CONTROL_LABEL,
|
|
193
|
+
capLabel: ASSIST_OVERAGE_CAP_CONTROL_LABEL,
|
|
194
|
+
minCapUsd: ASSIST_OVERAGE_CAP_MIN_USD,
|
|
195
|
+
maxCapUsd: ASSIST_OVERAGE_CAP_MAX_USD
|
|
196
|
+
}), {
|
|
197
|
+
status: 200
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
if (action === 'setCap') {
|
|
201
|
+
var _decoded_email2, _decoded_email3;
|
|
202
|
+
const raw = body == null ? void 0 : body.capUsd;
|
|
203
|
+
// `null` clears; anything else must be a real number in a real range.
|
|
204
|
+
// A string "25" is refused rather than coerced, the way the switch
|
|
205
|
+
// refuses a string "false": the resolver reads the field strictly, so
|
|
206
|
+
// a value that reached the document as a string would be no ceiling
|
|
207
|
+
// at all while the card said one was set.
|
|
208
|
+
const clearing = raw === null;
|
|
209
|
+
if (!clearing && (typeof raw !== 'number' || !Number.isFinite(raw) || raw < ASSIST_OVERAGE_CAP_MIN_USD || raw > ASSIST_OVERAGE_CAP_MAX_USD)) {
|
|
210
|
+
return Response.json({
|
|
211
|
+
error: `Set a monthly AI overage ceiling between ` + `$${ASSIST_OVERAGE_CAP_MIN_USD} and ` + `$${ASSIST_OVERAGE_CAP_MAX_USD.toLocaleString('en-US')}, ` + `or clear it.`,
|
|
212
|
+
code: 'invalid_cap'
|
|
213
|
+
}, {
|
|
214
|
+
status: 400
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
if (!clearing && !sellsOverage) {
|
|
218
|
+
return Response.json({
|
|
219
|
+
error: bandCredits === null ? 'Your plan includes no AI assist credits, so there is no ' + 'overage to cap. Upgrade in Billing to add AI assist.' : 'Your plan already stops AI assist at its included band — ' + 'it sells no credits past it, so there is no overage to cap.',
|
|
220
|
+
code: 'not_sold'
|
|
221
|
+
}, {
|
|
222
|
+
status: 409
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
const requestedCap = clearing ? null : raw;
|
|
226
|
+
await orgRef.set({
|
|
227
|
+
assistOverage: {
|
|
228
|
+
capUsd: requestedCap,
|
|
229
|
+
capSetAt: FieldValue.serverTimestamp(),
|
|
230
|
+
capSetBy: decoded.uid
|
|
231
|
+
}
|
|
232
|
+
}, {
|
|
233
|
+
merge: true
|
|
234
|
+
});
|
|
235
|
+
await firebaseAdmin.app().firestore().collection('adminAudit').add({
|
|
236
|
+
actorUid: decoded.uid,
|
|
237
|
+
actorEmail: (_decoded_email2 = decoded.email) != null ? _decoded_email2 : null,
|
|
238
|
+
action: 'billing.assistOverage.setCap',
|
|
239
|
+
target: `orgs/${orgId}`,
|
|
240
|
+
before: {
|
|
241
|
+
capUsd
|
|
242
|
+
},
|
|
243
|
+
after: {
|
|
244
|
+
capUsd: requestedCap
|
|
245
|
+
},
|
|
246
|
+
at: FieldValue.serverTimestamp()
|
|
247
|
+
}).catch(()=>undefined);
|
|
248
|
+
// The customer's own feed (AGL-2929): `adminAudit` is staff-only, and
|
|
249
|
+
// the workspace should see who set its ceiling. Nothing when the value
|
|
250
|
+
// did not move.
|
|
251
|
+
await logAiOverageControl(orgId, {
|
|
252
|
+
uid: decoded.uid,
|
|
253
|
+
email: (_decoded_email3 = decoded.email) != null ? _decoded_email3 : null
|
|
254
|
+
}, {
|
|
255
|
+
control: 'cap',
|
|
256
|
+
before: capUsd,
|
|
257
|
+
after: requestedCap
|
|
258
|
+
});
|
|
259
|
+
return Response.json({
|
|
260
|
+
ok: true,
|
|
261
|
+
capUsd: requestedCap
|
|
262
|
+
}, {
|
|
263
|
+
status: 200
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
// Strictly a boolean, the same way the resolver reads it strictly: a
|
|
267
|
+
// string "false" arriving here would otherwise be stored as `true`.
|
|
268
|
+
if (typeof (body == null ? void 0 : body.hardCap) !== 'boolean') {
|
|
269
|
+
return Response.json({
|
|
270
|
+
error: 'hardCap must be true or false',
|
|
271
|
+
code: 'invalid_value'
|
|
272
|
+
}, {
|
|
273
|
+
status: 400
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
const requested = body.hardCap;
|
|
277
|
+
if (requested && !sellsOverage) {
|
|
278
|
+
return Response.json({
|
|
279
|
+
error: bandCredits === null ? 'Your plan includes no AI assist credits, so there is no band ' + 'to stop at. Upgrade in Billing to add AI assist.' : 'Your plan already stops AI assist at its included band — ' + 'it sells no credits past it, so there is nothing to switch off.',
|
|
280
|
+
code: 'not_sold'
|
|
281
|
+
}, {
|
|
282
|
+
status: 409
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
await orgRef.set({
|
|
286
|
+
assistOverage: {
|
|
287
|
+
hardCap: requested,
|
|
288
|
+
hardCapSetAt: FieldValue.serverTimestamp(),
|
|
289
|
+
hardCapSetBy: decoded.uid
|
|
290
|
+
}
|
|
291
|
+
}, {
|
|
292
|
+
merge: true
|
|
293
|
+
});
|
|
294
|
+
await firebaseAdmin.app().firestore().collection('adminAudit').add({
|
|
295
|
+
actorUid: decoded.uid,
|
|
296
|
+
actorEmail: (_decoded_email = decoded.email) != null ? _decoded_email : null,
|
|
297
|
+
action: 'billing.assistOverage.setHardCap',
|
|
298
|
+
target: `orgs/${orgId}`,
|
|
299
|
+
before: {
|
|
300
|
+
hardCap
|
|
301
|
+
},
|
|
302
|
+
after: {
|
|
303
|
+
hardCap: requested
|
|
304
|
+
},
|
|
305
|
+
at: FieldValue.serverTimestamp()
|
|
306
|
+
}).catch(()=>undefined);
|
|
307
|
+
await logAiOverageControl(orgId, {
|
|
308
|
+
uid: decoded.uid,
|
|
309
|
+
email: (_decoded_email1 = decoded.email) != null ? _decoded_email1 : null
|
|
310
|
+
}, {
|
|
311
|
+
control: 'hardCap',
|
|
312
|
+
before: hardCap,
|
|
313
|
+
after: requested
|
|
314
|
+
});
|
|
315
|
+
return Response.json({
|
|
316
|
+
ok: true,
|
|
317
|
+
hardCap: requested
|
|
318
|
+
}, {
|
|
319
|
+
status: 200
|
|
320
|
+
});
|
|
321
|
+
} catch (error) {
|
|
322
|
+
// A refused credential is a 401, not a fault of ours (AGL-1993). Null
|
|
323
|
+
// for anything else, so a real failure keeps the answer below.
|
|
324
|
+
const unauthenticated = invalidIdTokenResponse(error);
|
|
325
|
+
if (unauthenticated) return unauthenticated;
|
|
326
|
+
console.error(error);
|
|
327
|
+
return Response.json({
|
|
328
|
+
error: 'Assist overage update failed'
|
|
329
|
+
}, {
|
|
330
|
+
status: 500
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
export const dynamic = 'force-dynamic';
|
|
335
|
+
export { handler as POST };
|
|
336
|
+
|
|
337
|
+
//# sourceMappingURL=billing-overage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/server/billing-overage.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 { pluginRequestFromWeb } from '@aglyn/aglyn/server'\nimport {\n ASSIST_HARD_CAP_CONTROL_LABEL,\n ASSIST_OVERAGE_CAP_CONTROL_LABEL,\n ASSIST_OVERAGE_CAP_MAX_USD,\n ASSIST_OVERAGE_CAP_MIN_USD,\n resolveAssistCreditBudget,\n resolveAssistHardCap,\n resolveAssistOverageCapUsd,\n resolveAssistOverageRateUsdPer1k,\n} from '@aglyn/aglyn/app-utils/assist-credits'\nimport {\n emailUnverifiedResponse,\n firebaseAdmin,\n isImpersonationSession,\n memberHasOrgPermission,\n resolveOrgMembership,\n} from '@aglyn/tenant-data-admin'\nimport { logAiOverageControl } from '../activity/ai-activity'\nimport { assistMonthOverage } from '@aglyn/aglyn/app-utils/assist-credits'\nimport { assistUsageMonth } from '../usage/assist-usage'\nimport { aiOverageBillsByInvoice } from '../billing/ai-overage-cutover'\nimport { aiOverageNextChargeUsd } from '../billing/ai-overage-gate'\nimport {\n AI_BILLING_STANDING_DOC,\n AI_BILLING_SUBCOLLECTION,\n readAiOverageMonthLedger,\n} from '../billing/ai-overage-ledger'\nimport {\n AI_OVERAGE_THRESHOLD_USD,\n aiOverageCardOnFile,\n aiOverageEffectiveCeilingUsd,\n aiOverageStandingCeilingUsd,\n aiOverageStep,\n readAiOverageStanding,\n} from '../billing/ai-overage-standing'\nimport { FieldValue } from 'firebase-admin/firestore'\nimport { invalidIdTokenResponse } from '@aglyn/tenant-data-admin/server/id-token-refusal'\n\n// lockdown-423: exempt — self-serve billing surface, same posture as\n// billing/storage-overage beside it. AGL-1501 keeps billing-locked sessions\n// alive precisely so members can reach Billing, and this is the control that\n// stops an org accruing assist charges, so a 423 would trap it accruing them.\n\n/**\n * Read or set the org's own assist controls: the hard-cap switch (AGL-2653)\n * and the dollar ceiling on overage (AGL-2898).\n *\n * Credits past the plan's assist band are SOLD by default, at the rate\n * `resolveAssistOverageRateUsdPer1k` answers — the plan's listed\n * `extraAssistCreditsUsdPer1k`, or the add-on's rate on a plan that carries\n * its band only with the add-on. This route holds the two\n * controls a customer has over that, and nothing else — it is not a consent\n * surface, and there is nothing here an org must do before assist works.\n *\n * `get` → whether the switch is on, the ceiling if any, the band,\n * the rate the overage bills at, and whether the plan sells\n * overage at all\n * `setHardCap` → store `hardCap: true | false`\n * `setCap` → store `capUsd: number`, or `null` to clear the ceiling\n *\n * `billing.manage`-gated, because both controls bound spend in both\n * directions: lifting either is what lets the org be invoiced further past\n * its band, and setting either is what stops a workspace's assistant.\n * Admin-SDK-only by construction — `assistOverage` is denied to every client\n * in the rules, so a member cannot lift their own ceiling or lower somebody\n * else's.\n *\n * TURNING THE SWITCH OFF AND CLEARING THE CEILING ARE ALWAYS AVAILABLE, on\n * any plan and at any usage level: an org that wants the sale back on must\n * not have to argue with a precondition. Turning the switch on, or setting a\n * ceiling, is refused, 409, on a plan that sells no overage — there the band\n * is already the wall (`assistBandRefuses`), and storing a control that\n * changes nothing would read as protection the org does not have.\n */\n/**\n * What the overage card needs to say about Aglyn's own limit (AGL-3011).\n *\n * Every figure is `null` before the cutover month. That is not a missing\n * value: it is the honest answer while overage still bills on the monthly\n * invoice, and rendering a ceiling and a \"next charge\" figure that nothing\n * enforces would be a promise the platform is not yet keeping.\n */\nasync function readAiOverageStandingForCard(\n orgRef: FirebaseFirestore.DocumentReference,\n org: Parameters<typeof aiOverageEffectiveCeilingUsd>[0],\n): Promise<{\n aglynCeilingUsd: number | null\n overageStep: number | null\n overageThresholdUsd: number | null\n overageChargedUsd: number | null\n overageChargeCount: number | null\n overageNextChargeUsd: number | null\n overagePaused: string | null\n overageCardOnFile: boolean | null\n overageBillsByInvoice: boolean\n}> {\n const now = new Date()\n const month = assistUsageMonth(now)\n const empty = {\n aglynCeilingUsd: null,\n overageStep: null,\n overageThresholdUsd: null,\n overageChargedUsd: null,\n overageChargeCount: null,\n overageNextChargeUsd: null,\n overagePaused: null,\n overageCardOnFile: null,\n overageBillsByInvoice: false,\n }\n if (!aiOverageBillsByInvoice(month)) return empty\n const [standingSnapshot, usageSnapshot] = await Promise.all([\n orgRef.collection(AI_BILLING_SUBCOLLECTION).doc(AI_BILLING_STANDING_DOC).get(),\n orgRef.collection('assistUsage').doc(month).get(),\n ])\n const standing = readAiOverageStanding(\n standingSnapshot.exists ? (standingSnapshot.data() ?? null) : null,\n )\n const ledger = readAiOverageMonthLedger(\n usageSnapshot.exists ? (usageSnapshot.data() ?? null) : null,\n )\n const priced = assistMonthOverage(org, Number(usageSnapshot.get('estCostUsd') ?? 0))\n return {\n aglynCeilingUsd: aiOverageStandingCeilingUsd(standing, now),\n overageStep: aiOverageStep(standing),\n overageThresholdUsd: AI_OVERAGE_THRESHOLD_USD,\n overageChargedUsd: ledger.paidUsd,\n overageChargeCount: ledger.charges,\n overageNextChargeUsd: aiOverageNextChargeUsd(\n priced.overageMonthlyUsd,\n ledger.invoicedUsd,\n ),\n overagePaused: standing.pause?.reason ?? null,\n overageCardOnFile: aiOverageCardOnFile(standing) ?? null,\n overageBillsByInvoice: true,\n }\n}\n\nasync function handler(request: Request): Promise<Response> {\n const { method, body, headers: rawHeaders } = await pluginRequestFromWeb(request)\n const headers = rawHeaders as Partial<Record<string, string>>\n if (method !== 'POST') {\n return Response.json({ error: 'Method not allowed' }, { status: 405 })\n }\n const authorization = headers.authorization ?? ''\n const idToken = authorization.startsWith('Bearer ')\n ? authorization.slice('Bearer '.length)\n : undefined\n if (!idToken) return Response.json({ error: 'Unauthenticated' }, { status: 401 })\n const orgId = String(body?.orgId ?? '')\n const action = String(body?.action ?? '')\n if (!orgId || !['get', 'setHardCap', 'setCap'].includes(action)) {\n return Response.json({ error: 'Bad request' }, { status: 400 })\n }\n\n try {\n const decoded = await firebaseAdmin.app().auth().verifyIdToken(idToken)\n if (!decoded.email_verified && !isImpersonationSession(decoded)) {\n return emailUnverifiedResponse()\n }\n const isStaff = decoded['staff'] === true\n const actor = await resolveOrgMembership(decoded.uid, orgId)\n if (\n !isStaff &&\n !(await memberHasOrgPermission(orgId, actor?.member, 'billing.manage'))\n ) {\n return Response.json({ error: 'billing.manage required' }, { status: 403 })\n }\n\n const orgRef = firebaseAdmin.app().firestore().collection('orgs').doc(orgId)\n const orgSnapshot = await orgRef.get()\n if (!orgSnapshot.exists) {\n return Response.json({ error: 'Unknown organization' }, { status: 404 })\n }\n const org = (orgSnapshot.data() ?? {}) as Record<string, unknown>\n const hardCap = resolveAssistHardCap(org as never)\n const capUsd = resolveAssistOverageCapUsd(org as never)\n const bandCredits = resolveAssistCreditBudget(org as never)\n // The rate the card quotes must be the rate the rollup bills, so it is\n // read through the one resolver every reader of the rate goes through.\n // That mattered acutely under AGL-3014, when Starter's rate lived off\n // `PLAN_PRICING` and reading the table directly quoted $0.00 on an org\n // that was really being invoiced. AGL-3203 put the rate on Starter's own\n // row and deleted the exception, so the table and the resolver now agree\n // — and this still reads the resolver, because a comp is priced at\n // nothing and only `resolvePlanPricing` knows that.\n const overageRateUsdPer1k = resolveAssistOverageRateUsdPer1k(org as never)\n const sellsOverage = bandCredits !== null && overageRateUsdPer1k !== null\n\n if (action === 'get') {\n // AGLYN'S OWN LIMIT BESIDE THE WORKSPACE'S (AGL-3011). The card shows\n // both because the LOWER of the two binds, and a card that showed only\n // the figure the workspace set would explain neither the refusal it\n // gets at Aglyn's nor the charge it sees before its own is reached.\n //\n // `null` for every figure while the platform still bills overage on\n // the monthly invoice, so the card keeps saying what is true today\n // rather than describing a mechanism that is not running.\n const overage = await readAiOverageStandingForCard(orgRef, org as never)\n return Response.json(\n {\n hardCap,\n capUsd,\n bandCredits,\n overageRateUsdPer1k,\n sellsOverage,\n ...overage,\n label: ASSIST_HARD_CAP_CONTROL_LABEL,\n capLabel: ASSIST_OVERAGE_CAP_CONTROL_LABEL,\n minCapUsd: ASSIST_OVERAGE_CAP_MIN_USD,\n maxCapUsd: ASSIST_OVERAGE_CAP_MAX_USD,\n },\n { status: 200 },\n )\n }\n\n if (action === 'setCap') {\n const raw = body?.capUsd\n // `null` clears; anything else must be a real number in a real range.\n // A string \"25\" is refused rather than coerced, the way the switch\n // refuses a string \"false\": the resolver reads the field strictly, so\n // a value that reached the document as a string would be no ceiling\n // at all while the card said one was set.\n const clearing = raw === null\n if (\n !clearing &&\n (typeof raw !== 'number' ||\n !Number.isFinite(raw) ||\n raw < ASSIST_OVERAGE_CAP_MIN_USD ||\n raw > ASSIST_OVERAGE_CAP_MAX_USD)\n ) {\n return Response.json(\n {\n error:\n `Set a monthly AI overage ceiling between ` +\n `$${ASSIST_OVERAGE_CAP_MIN_USD} and ` +\n `$${ASSIST_OVERAGE_CAP_MAX_USD.toLocaleString('en-US')}, ` +\n `or clear it.`,\n code: 'invalid_cap',\n },\n { status: 400 },\n )\n }\n if (!clearing && !sellsOverage) {\n return Response.json(\n {\n error:\n bandCredits === null\n ? 'Your plan includes no AI assist credits, so there is no ' +\n 'overage to cap. Upgrade in Billing to add AI assist.'\n : 'Your plan already stops AI assist at its included band — ' +\n 'it sells no credits past it, so there is no overage to cap.',\n code: 'not_sold',\n },\n { status: 409 },\n )\n }\n const requestedCap = clearing ? null : (raw as number)\n await orgRef.set(\n {\n assistOverage: {\n capUsd: requestedCap,\n capSetAt: FieldValue.serverTimestamp(),\n capSetBy: decoded.uid,\n },\n },\n { merge: true },\n )\n await firebaseAdmin\n .app()\n .firestore()\n .collection('adminAudit')\n .add({\n actorUid: decoded.uid,\n actorEmail: decoded.email ?? null,\n action: 'billing.assistOverage.setCap',\n target: `orgs/${orgId}`,\n before: { capUsd },\n after: { capUsd: requestedCap },\n at: FieldValue.serverTimestamp(),\n })\n .catch(() => undefined)\n // The customer's own feed (AGL-2929): `adminAudit` is staff-only, and\n // the workspace should see who set its ceiling. Nothing when the value\n // did not move.\n await logAiOverageControl(\n orgId,\n { uid: decoded.uid, email: decoded.email ?? null },\n { control: 'cap', before: capUsd, after: requestedCap },\n )\n return Response.json({ ok: true, capUsd: requestedCap }, { status: 200 })\n }\n\n // Strictly a boolean, the same way the resolver reads it strictly: a\n // string \"false\" arriving here would otherwise be stored as `true`.\n if (typeof body?.hardCap !== 'boolean') {\n return Response.json(\n { error: 'hardCap must be true or false', code: 'invalid_value' },\n { status: 400 },\n )\n }\n const requested = body.hardCap as boolean\n\n if (requested && !sellsOverage) {\n return Response.json(\n {\n error:\n bandCredits === null\n ? 'Your plan includes no AI assist credits, so there is no band ' +\n 'to stop at. Upgrade in Billing to add AI assist.'\n : 'Your plan already stops AI assist at its included band — ' +\n 'it sells no credits past it, so there is nothing to switch off.',\n code: 'not_sold',\n },\n { status: 409 },\n )\n }\n\n await orgRef.set(\n {\n assistOverage: {\n hardCap: requested,\n hardCapSetAt: FieldValue.serverTimestamp(),\n hardCapSetBy: decoded.uid,\n },\n },\n { merge: true },\n )\n await firebaseAdmin\n .app()\n .firestore()\n .collection('adminAudit')\n .add({\n actorUid: decoded.uid,\n actorEmail: decoded.email ?? null,\n action: 'billing.assistOverage.setHardCap',\n target: `orgs/${orgId}`,\n before: { hardCap },\n after: { hardCap: requested },\n at: FieldValue.serverTimestamp(),\n })\n .catch(() => undefined)\n await logAiOverageControl(\n orgId,\n { uid: decoded.uid, email: decoded.email ?? null },\n { control: 'hardCap', before: hardCap, after: requested },\n )\n\n return Response.json({ ok: true, hardCap: requested }, { status: 200 })\n } catch (error) {\n // A refused credential is a 401, not a fault of ours (AGL-1993). Null\n // for anything else, so a real failure keeps the answer below.\n const unauthenticated = invalidIdTokenResponse(error)\n if (unauthenticated) return unauthenticated\n console.error(error)\n return Response.json(\n { error: 'Assist overage update failed' },\n { status: 500 },\n )\n }\n}\n\nexport const dynamic = 'force-dynamic'\nexport { handler as POST }\n"],"names":["pluginRequestFromWeb","ASSIST_HARD_CAP_CONTROL_LABEL","ASSIST_OVERAGE_CAP_CONTROL_LABEL","ASSIST_OVERAGE_CAP_MAX_USD","ASSIST_OVERAGE_CAP_MIN_USD","resolveAssistCreditBudget","resolveAssistHardCap","resolveAssistOverageCapUsd","resolveAssistOverageRateUsdPer1k","emailUnverifiedResponse","firebaseAdmin","isImpersonationSession","memberHasOrgPermission","resolveOrgMembership","logAiOverageControl","assistMonthOverage","assistUsageMonth","aiOverageBillsByInvoice","aiOverageNextChargeUsd","AI_BILLING_STANDING_DOC","AI_BILLING_SUBCOLLECTION","readAiOverageMonthLedger","AI_OVERAGE_THRESHOLD_USD","aiOverageCardOnFile","aiOverageStandingCeilingUsd","aiOverageStep","readAiOverageStanding","FieldValue","invalidIdTokenResponse","readAiOverageStandingForCard","orgRef","org","standingSnapshot","usageSnapshot","standing","now","Date","month","empty","aglynCeilingUsd","overageStep","overageThresholdUsd","overageChargedUsd","overageChargeCount","overageNextChargeUsd","overagePaused","overageCardOnFile","overageBillsByInvoice","Promise","all","collection","doc","get","exists","data","ledger","priced","Number","paidUsd","charges","overageMonthlyUsd","invoicedUsd","pause","reason","handler","request","headers","method","body","rawHeaders","Response","json","error","status","authorization","idToken","startsWith","slice","length","undefined","orgId","String","action","includes","orgSnapshot","decoded","app","auth","verifyIdToken","email_verified","isStaff","actor","uid","member","firestore","hardCap","capUsd","bandCredits","overageRateUsdPer1k","sellsOverage","overage","label","capLabel","minCapUsd","maxCapUsd","raw","clearing","isFinite","toLocaleString","code","requestedCap","set","assistOverage","capSetAt","serverTimestamp","capSetBy","merge","add","actorUid","actorEmail","email","target","before","after","at","catch","control","ok","requested","hardCapSetAt","hardCapSetBy","unauthenticated","console","dynamic","POST"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,oBAAoB,QAAQ,sBAAqB;AAC1D,SACEC,6BAA6B,EAC7BC,gCAAgC,EAChCC,0BAA0B,EAC1BC,0BAA0B,EAC1BC,yBAAyB,EACzBC,oBAAoB,EACpBC,0BAA0B,EAC1BC,gCAAgC,QAC3B,wCAAuC;AAC9C,SACEC,uBAAuB,EACvBC,aAAa,EACbC,sBAAsB,EACtBC,sBAAsB,EACtBC,oBAAoB,QACf,2BAA0B;AACjC,SAASC,mBAAmB,QAAQ,6BAAyB;AAC7D,SAASC,kBAAkB,QAAQ,wCAAuC;AAC1E,SAASC,gBAAgB,QAAQ,2BAAuB;AACxD,SAASC,uBAAuB,QAAQ,mCAA+B;AACvE,SAASC,sBAAsB,QAAQ,gCAA4B;AACnE,SACEC,uBAAuB,EACvBC,wBAAwB,EACxBC,wBAAwB,QACnB,kCAA8B;AACrC,SACEC,wBAAwB,EACxBC,mBAAmB,EAEnBC,2BAA2B,EAC3BC,aAAa,EACbC,qBAAqB,QAChB,oCAAgC;AACvC,SAASC,UAAU,QAAQ,2BAA0B;AACrD,SAASC,sBAAsB,QAAQ,mDAAkD;AAEzF,qEAAqE;AACrE,4EAA4E;AAC5E,6EAA6E;AAC7E,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BC,GACD;;;;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QmC,KAAK,YAAbnC,kBAAiB;QAAK,GACjD;YAAEyC,SAAS;YAAWJ,QAAQ3B;YAAS4B,OAAOK;QAAU;QAG1D,OAAO1D,SAASC,IAAI,CAAC;YAAEwD,IAAI;YAAMhC,SAASiC;QAAU,GAAG;YAAEvD,QAAQ;QAAI;IACvE,EAAE,OAAOD,OAAO;QACd,sEAAsE;QACtE,+DAA+D;QAC/D,MAAM2D,kBAAkBvG,uBAAuB4C;QAC/C,IAAI2D,iBAAiB,OAAOA;QAC5BC,QAAQ5D,KAAK,CAACA;QACd,OAAOF,SAASC,IAAI,CAClB;YAAEC,OAAO;QAA+B,GACxC;YAAEC,QAAQ;QAAI;IAElB;AACF;AAEA,OAAO,MAAM4D,UAAU,gBAAe;AACtC,SAASrE,WAAWsE,IAAI,GAAE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
export * from './providers/contract';
|
|
18
|
+
export * from './providers/catalog';
|
|
19
|
+
export * from './providers/registry';
|
|
20
|
+
export * from './providers/routing';
|
|
21
|
+
export * from './runtime/ai-runtime';
|
|
22
|
+
/**
|
|
23
|
+
* The console-side API (AGL-2939): every AI door, under the `ai` and
|
|
24
|
+
* `assist` prefixes the plugin owns. The URLs the panel and the besigner
|
|
25
|
+
* call are unchanged — `/api/assist/chat`, `/api/ai/assist`,
|
|
26
|
+
* `/api/ai/jobs` — because the dispatcher serves them from the registry
|
|
27
|
+
* exactly where the named routes used to; the two billing doors and the
|
|
28
|
+
* per-member usage read (`ai/usage`) live under the plugin's own prefix.
|
|
29
|
+
* The jobs beat is the one path outside them, for the reason
|
|
30
|
+
* `AI_JOBS_BEAT_PATH` gives.
|
|
31
|
+
*/
|
|
32
|
+
export declare function registerAiConsoleApi(): void;
|