@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,571 @@
|
|
|
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 PublicAssistCredits } from '@aglyn/aglyn/app-utils/assist-credits';
|
|
18
|
+
import { type AiOverageCapReason } from '../billing/ai-overage-gate';
|
|
19
|
+
import type { AiRefusedBy } from '../model/ai-allotments';
|
|
20
|
+
import { type AiAllotmentGate, type AiAllotmentRequestSubject } from './ai-allotments';
|
|
21
|
+
import { type AssistMeteredOrg, type FreeAssistAccount } from './assist-free-taste';
|
|
22
|
+
import { type AiUsageKind } from '../model/ai-usage-by-user';
|
|
23
|
+
export { assistMonthlyCeilingUsd } from './assist-ceiling';
|
|
24
|
+
/**
|
|
25
|
+
* Aglyn Assist metering + the data loop (AGL-1860, phase 1).
|
|
26
|
+
*
|
|
27
|
+
* Collections (org-scoped, ABSENT from firebase-firestore.rules on purpose —
|
|
28
|
+
* default-deny, the forumThreads precedent: every read/write passes the
|
|
29
|
+
* assist API route via the Admin SDK):
|
|
30
|
+
*
|
|
31
|
+
* orgs/{orgId}/assistUsage/{YYYY-MM} per-org monthly cost telemetry:
|
|
32
|
+
* { month, messages, inputTokens, outputTokens, cacheReadTokens,
|
|
33
|
+
* cacheWriteTokens, estCostUsd, byHost: { hostId: credits },
|
|
34
|
+
* kinds: { kind: { requests, estCostUsd, tokens } }, updatedAt }
|
|
35
|
+
* (`byHost` is each site's credits, which a site's AI allotment is
|
|
36
|
+
* measured against — AGL-2942; `kinds` splits the tokens and the
|
|
37
|
+
* measured spend by what each model request was for — AGL-2937)
|
|
38
|
+
* orgs/{orgId}/counters/assistMessagesDaily
|
|
39
|
+
* fields keyed YYYY-MM-DD → integer (the free-tier daily cap counter;
|
|
40
|
+
* same field-per-period shape as the other `counters/*` docs)
|
|
41
|
+
* orgs/{orgId}/assistExchanges/{id} the VERBATIM half of one exchange:
|
|
42
|
+
* { uid, question, answer, hostId, createdAt, expiresAt }
|
|
43
|
+
* orgs/{orgId}/assistSignals/{id} the DERIVED half, same id:
|
|
44
|
+
* { route, hostId, model, tier, kind, inputTokens, outputTokens,
|
|
45
|
+
* cacheReadTokens, cacheWriteTokens, estCostUsd, docsPaths,
|
|
46
|
+
* stopReason, feedback: 'up'|'down'|null, createdAt }
|
|
47
|
+
*
|
|
48
|
+
* The Free taste (AGL-2925) adds two more, one under the workspace OWNER's
|
|
49
|
+
* user document and one platform-wide, both documented and both closed to
|
|
50
|
+
* clients in `assist-free-taste.ts`.
|
|
51
|
+
*
|
|
52
|
+
* Costs are OUR cost estimates at list rates (pricing-tunable telemetry),
|
|
53
|
+
* mirrored after ORG_COGS_UNIT_RATES_USD's posture: cost visibility per org
|
|
54
|
+
* from day one so the paid gate and caps can be tuned with data — the * "must not eat margins" constraint.
|
|
55
|
+
*
|
|
56
|
+
* ── Why the exchange is split in two (AGL-1972) ────────────────────────────
|
|
57
|
+
*
|
|
58
|
+
* One document carrying both halves forces one retention period onto two
|
|
59
|
+
* kinds of data with opposite needs. The prose is what a person typed; the
|
|
60
|
+
* data loop is what it cited and what it cost. Keeping them together means
|
|
61
|
+
* either the prose is retained forever so the loop keeps its corpus, or the
|
|
62
|
+
* loop's corpus is destroyed so the prose can expire. Neither is the answer,
|
|
63
|
+
* and picking one number for both is how that false choice gets made.
|
|
64
|
+
*
|
|
65
|
+
* So: `assistExchanges` holds the question, the answer and the asking `uid`,
|
|
66
|
+
* and carries `expiresAt` — a TTL policy reaps it after
|
|
67
|
+
* ASSIST_EXCHANGE_RETENTION_DAYS. `assistSignals` holds no prose and NO uid,
|
|
68
|
+
* carries no expiry, and is what the docs-gap view, the thumbs loop and the
|
|
69
|
+
* cost meters actually read. The corpus the loop needs outlives the words
|
|
70
|
+
* that produced it, because the corpus was never the words.
|
|
71
|
+
*
|
|
72
|
+
* Both subcollections sit under the org, so `recursiveDelete(orgRef)` still
|
|
73
|
+
* takes them and an erasure still clears everything with no extra sweep. And
|
|
74
|
+
* both are ABSENT from firebase-firestore.rules deliberately: the org block
|
|
75
|
+
* matches its subcollections BY NAME and has no wildcard, so an unmatched
|
|
76
|
+
* name is default-deny for every client (verified against the live ruleset —
|
|
77
|
+
* the `{subcollection}/{document=**}` catch-all is under `hosts/{hostId}`,
|
|
78
|
+
* not here).
|
|
79
|
+
*
|
|
80
|
+
* ⚠️ The TTL policy is MANUAL gcloud configuration, not repo state. It is
|
|
81
|
+
* documented in `docs/FIRESTORE_MANUAL_CONFIG.md` and declared as a
|
|
82
|
+
* `fieldOverrides` entry in `cloud/firebase-firestore.indexes.json` — the
|
|
83
|
+
* declaration is not decoration, it is what stops the next unrelated index
|
|
84
|
+
* deploy from DELETING the policy. `apps/console/specs/retention-ttl-config.spec.ts`
|
|
85
|
+
* fails the build if either half goes missing.
|
|
86
|
+
*/
|
|
87
|
+
/** Current billing month key, `YYYY-MM`, matching the usage rollup. */
|
|
88
|
+
export declare function assistUsageMonth(now?: Date): string;
|
|
89
|
+
/** Current day key, `YYYY-MM-DD` (UTC — same clock as the month key). */
|
|
90
|
+
export declare function assistUsageDay(now?: Date): string;
|
|
91
|
+
/**
|
|
92
|
+
* How long the VERBATIM half of an exchange is kept — the question, the
|
|
93
|
+
* answer and the asking uid (AGL-1972).
|
|
94
|
+
*
|
|
95
|
+
* 180 days, and the number is chosen against what actually reads this data
|
|
96
|
+
* rather than against a round figure:
|
|
97
|
+
*
|
|
98
|
+
* - The docs-gap loop mines `docsPaths` and the thumbs rating. Both live on
|
|
99
|
+
* the signal document, which has no expiry, so shortening this period
|
|
100
|
+
* costs the loop nothing. That separation is what makes 180 affordable;
|
|
101
|
+
* without it the honest answer would have been "forever".
|
|
102
|
+
* - Two full quarters is long enough to read a quarter's questions LATE, and
|
|
103
|
+
* long enough to diff what people asked before and after a docs rewrite —
|
|
104
|
+
* the one analysis that genuinely needs the prose and not the citations.
|
|
105
|
+
* - It is short enough that a workspace open for years is not an indefinite
|
|
106
|
+
* archive of what its people typed into a text box.
|
|
107
|
+
*
|
|
108
|
+
* ⚠️ TTL deletion is best-effort within ~72h of expiry, so nothing may treat
|
|
109
|
+
* an exchange's absence OR its presence as exact at the boundary. Nothing
|
|
110
|
+
* does: the only reader addresses an exchange by id and tolerates a miss.
|
|
111
|
+
*/
|
|
112
|
+
export declare const ASSIST_EXCHANGE_RETENTION_DAYS = 180;
|
|
113
|
+
/**
|
|
114
|
+
* When an exchange written at `now` expires. A `Date` rather than a number:
|
|
115
|
+
* a TTL policy keys on a Firestore **Timestamp** and silently governs
|
|
116
|
+
* nothing when the field is a number (`bookings.expiresAtMs` is the
|
|
117
|
+
* documented non-target for exactly this reason). The Admin SDK converts a
|
|
118
|
+
* JS `Date` to a Timestamp on write, which is how `cspViolationDaily` does
|
|
119
|
+
* it and is why this module needs no firebase-admin type here.
|
|
120
|
+
*/
|
|
121
|
+
export declare function assistExchangeExpiry(now?: Date): Date;
|
|
122
|
+
/**
|
|
123
|
+
* Free-tier daily message cap (level-1 answers only). Env-tunable without a
|
|
124
|
+
* deploy of new code paths.
|
|
125
|
+
*
|
|
126
|
+
* What ten messages actually cost: about **$0.28 a day** at Sonnet list
|
|
127
|
+
* rates, taking the worst case the clamps allow (see
|
|
128
|
+
* `ASSIST_ORG_MONTHLY_COGS_LIMIT_DEFAULT_USD` for the same arithmetic
|
|
129
|
+
* carried to the monthly ceiling). A typical question costs a fraction of
|
|
130
|
+
* that, because the worst case assumes a full 8,000-character history and a
|
|
131
|
+
* 4,000-character question on every one of the ten.
|
|
132
|
+
*
|
|
133
|
+
* This docstring used to claim "well under a cent a day", which was the
|
|
134
|
+
* pre-AGL-2441 figure and wrong by ~28x once the history clamp was measured
|
|
135
|
+
* rather than assumed. It is restated here because it is the stated
|
|
136
|
+
* justification for the size of this cap, and a justification that is off by
|
|
137
|
+
* that much is how a cap ends up set by a number nobody re-derived.
|
|
138
|
+
*/
|
|
139
|
+
export declare function assistFreeDailyLimit(): number;
|
|
140
|
+
/**
|
|
141
|
+
* Entitled (Pro+/aiAssist) monthly message cap — a runaway guard, not a
|
|
142
|
+
* product limit: high enough that no real user hits it, low enough that a
|
|
143
|
+
* scripted client cannot turn one subscription into unbounded token spend.
|
|
144
|
+
*/
|
|
145
|
+
export declare function assistEntitledMonthlyLimit(): number;
|
|
146
|
+
export interface AssistTokenUsage {
|
|
147
|
+
inputTokens: number;
|
|
148
|
+
outputTokens: number;
|
|
149
|
+
cacheReadTokens: number;
|
|
150
|
+
cacheWriteTokens: number;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* What one exchange DRAWS FROM THE CUSTOMER, at the serving model's billed
|
|
154
|
+
* rates, rounded to 6dp — the figure `assistCreditsFromUsd` turns into
|
|
155
|
+
* credits and the one the band, the cap and the invoice are measured in.
|
|
156
|
+
*
|
|
157
|
+
* The rates are the model catalog's (AGL-2939), keyed by model rather than
|
|
158
|
+
* fixed at one model's because `ASSIST_MODEL` is an env override: a
|
|
159
|
+
* one-line incident swap to a dearer model would otherwise keep reporting
|
|
160
|
+
* the cheaper money, and per-org cost would read as roughly right — the
|
|
161
|
+
* failure mode this whole meter exists to prevent. An unknown id is priced
|
|
162
|
+
* at the dearest known tier on purpose, because an estimate that errs low is
|
|
163
|
+
* worse than one that errs high, and a docs-only answer is metered under a
|
|
164
|
+
* zero-priced sentinel (`AI_METER_SENTINELS`) so it lands in the same rollup
|
|
165
|
+
* as a served one.
|
|
166
|
+
*
|
|
167
|
+
* NOT A COST (AGL-3015). A model may be billed above what its provider
|
|
168
|
+
* charges, so this overstates what the exchange cost us by exactly that
|
|
169
|
+
* markup. `estimateAssistProviderCostUsd` is the figure a margin or a spend
|
|
170
|
+
* meter takes.
|
|
171
|
+
*/
|
|
172
|
+
export declare function estimateAssistCostUsd(usage: AssistTokenUsage, model: string): number;
|
|
173
|
+
/**
|
|
174
|
+
* What one exchange COST US, at the serving model's provider rates, rounded
|
|
175
|
+
* to 6dp — real money, recorded beside the billed figure so a margin is
|
|
176
|
+
* taken against a bill we actually pay rather than against a price we
|
|
177
|
+
* charge.
|
|
178
|
+
*
|
|
179
|
+
* At or below `estimateAssistCostUsd` for the same tokens, and equal to it
|
|
180
|
+
* on every model billed at its provider's list.
|
|
181
|
+
*/
|
|
182
|
+
export declare function estimateAssistProviderCostUsd(usage: AssistTokenUsage, model: string): number;
|
|
183
|
+
export interface AssistQuotaVerdict {
|
|
184
|
+
allowed: boolean;
|
|
185
|
+
/** Which limit applied: free orgs meter daily, entitled orgs monthly. */
|
|
186
|
+
period: 'day' | 'month';
|
|
187
|
+
used: number;
|
|
188
|
+
limit: number;
|
|
189
|
+
remaining: number;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* A reservation taken against the cap, carrying BOTH counter keys so it can
|
|
193
|
+
* be handed back against the periods it actually moved rather than against
|
|
194
|
+
* "now". A request that reserves at 23:59:59 and fails at 00:00:01 would
|
|
195
|
+
* otherwise credit the NEXT day — capacity nobody paid for, arriving by the
|
|
196
|
+
* one route a cap must never have.
|
|
197
|
+
*/
|
|
198
|
+
export interface AssistReservation extends AssistQuotaVerdict {
|
|
199
|
+
/** UTC day the daily counter was incremented for (`YYYY-MM-DD`). */
|
|
200
|
+
dayKey: string;
|
|
201
|
+
/** Month the `assistUsage` doc was incremented for (`YYYY-MM`). */
|
|
202
|
+
monthKey: string;
|
|
203
|
+
/**
|
|
204
|
+
* Which ceiling refused, or `null` when the message was reserved. The
|
|
205
|
+
* refusals need different words at the surface: a message cap resets on a
|
|
206
|
+
* clock the user can be told about, a spend ceiling does not, and the
|
|
207
|
+
* plan's own band (`'band'`, AGL-2653) is a line the org could have chosen
|
|
208
|
+
* to buy past — so its refusal has to name the switch that made it a wall.
|
|
209
|
+
* `'band'` is answered only when the figure that refused IS the band; an
|
|
210
|
+
* operator's lower figure refuses as `'budget'` even on a plan with one.
|
|
211
|
+
* `'cap'` (AGL-2898) is the org's own dollar ceiling on the overage it
|
|
212
|
+
* buys past the band — reachable only on a plan that sells past it.
|
|
213
|
+
* `'requests'`, `'refusals'`, `'account'` and `'platform'` (AGL-2925) are
|
|
214
|
+
* the Free taste's own precautions, and only a Free workspace can hear
|
|
215
|
+
* them. `'allotment'` (AGL-2942) is a hard allotment the person or the
|
|
216
|
+
* site has spent — see `allotment` for which.
|
|
217
|
+
*
|
|
218
|
+
* Only on the reservation, not on `AssistQuotaVerdict` — `checkAssistQuota`
|
|
219
|
+
* is a reporting read that never consults the spend ceiling, and widening
|
|
220
|
+
* the shared type would let a caller believe it had.
|
|
221
|
+
*/
|
|
222
|
+
refusedBy: AiRefusedBy;
|
|
223
|
+
/**
|
|
224
|
+
* WHICH dollar ceiling refused, when `refusedBy` is `'cap'` (AGL-3011).
|
|
225
|
+
*
|
|
226
|
+
* `'customer'` is the workspace's own ceiling (AGL-2898) and keeps the
|
|
227
|
+
* sentence and the 402 it has always had. The other four are Aglyn's own
|
|
228
|
+
* guards on the overage it extends between invoices: no card on file,
|
|
229
|
+
* accrual paused, this month's ceiling, and the unpaid balance at its
|
|
230
|
+
* limit. Absent on every other refusal and on an admitted request.
|
|
231
|
+
*
|
|
232
|
+
* The doors need it because the four answer differently: a missing card
|
|
233
|
+
* and a paused workspace are 402s a person can act on, and a ceiling or a
|
|
234
|
+
* settling balance are 429s they can only wait out.
|
|
235
|
+
*/
|
|
236
|
+
capReason?: AiOverageCapReason | null;
|
|
237
|
+
/**
|
|
238
|
+
* The figure the `cap` refusal was measured against — the month's ceiling
|
|
239
|
+
* for `'limit'`, the unpaid limit for `'settling'` — so the sentence the
|
|
240
|
+
* door renders quotes the number that actually refused rather than
|
|
241
|
+
* re-deriving one that could differ.
|
|
242
|
+
*/
|
|
243
|
+
overageLimitUsd?: number | null;
|
|
244
|
+
/** Overage accrued and not yet paid for, at the instant of the refusal. */
|
|
245
|
+
overageUnpaidUsd?: number | null;
|
|
246
|
+
/**
|
|
247
|
+
* The allotments that applied to the person asking, measured (AGL-2942):
|
|
248
|
+
* which one refused, which one binds the usage strip, the caller's own
|
|
249
|
+
* credits this month, and the model allowlists. `null` when the request
|
|
250
|
+
* named nobody, and when a ceiling of the workspace's own refused before
|
|
251
|
+
* any allotment was read.
|
|
252
|
+
*/
|
|
253
|
+
allotment?: AiAllotmentGate | null;
|
|
254
|
+
/**
|
|
255
|
+
* The account the workspace's FREE spend is attributed to, or `null` for
|
|
256
|
+
* a workspace that is not on the Free plan (AGL-2925).
|
|
257
|
+
*
|
|
258
|
+
* Carried on the reservation so the door that meters the turn can hand
|
|
259
|
+
* the same attribution to `recordAssistCost` without resolving it twice:
|
|
260
|
+
* the reservation decided which account's allowance this request drew
|
|
261
|
+
* on, and the record must charge that account and no other.
|
|
262
|
+
*/
|
|
263
|
+
free: FreeAssistAccount | null;
|
|
264
|
+
/**
|
|
265
|
+
* Measured provider spend for `monthKey` in USD as read inside the
|
|
266
|
+
* transaction, or `null` when the transaction did not consult it.
|
|
267
|
+
*
|
|
268
|
+
* Nullable rather than defaulted to 0, and the difference is the whole
|
|
269
|
+
* point: an entitled reservation reads the monthly document anyway (it is
|
|
270
|
+
* the gate), but a free one gates on the daily counter and only opens the
|
|
271
|
+
* monthly document when a ceiling is configured — so there is a path with
|
|
272
|
+
* no figure to report. Reporting `0` there would be a constant wearing a
|
|
273
|
+
* measurement's name, and a caller could not tell "this org has spent
|
|
274
|
+
* nothing" from "nobody looked".
|
|
275
|
+
*/
|
|
276
|
+
costUsd: number | null;
|
|
277
|
+
/**
|
|
278
|
+
* The ceiling this reservation was measured against, or `null` when none
|
|
279
|
+
* applied — the plan's band, the operator's figure, or the lower of the
|
|
280
|
+
* two. See `assistMonthlyCeilingUsd`.
|
|
281
|
+
*/
|
|
282
|
+
costLimitUsd: number | null;
|
|
283
|
+
/**
|
|
284
|
+
* The org's PLAN assist band in USD, or `null` when its plan sells none.
|
|
285
|
+
*
|
|
286
|
+
* Separate from `costLimitUsd` because they answer different questions and
|
|
287
|
+
* a surface needs both. `costLimitUsd` is what refused; this is whether the
|
|
288
|
+
* org has a band at all, and therefore whether it can be shown a credit
|
|
289
|
+
* balance. An org with no band that met the operator's backstop must not be
|
|
290
|
+
* told it used up credits it was never sold, and an org whose band was
|
|
291
|
+
* undercut by an operator's figure must not be told it has credits left
|
|
292
|
+
* while being refused.
|
|
293
|
+
*/
|
|
294
|
+
budgetUsd: number | null;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Reserve one assist message BEFORE the model is called (AGL-2057).
|
|
298
|
+
*
|
|
299
|
+
* This replaces `checkAssistQuota` on the request path, and the difference is
|
|
300
|
+
* the whole point. `checkAssistQuota` READ the counter and let the request
|
|
301
|
+
* through; the counter only moved in `recordAssistExchange`, at stream
|
|
302
|
+
* COMPLETION. Two ways out of the cap followed, both of which spend real
|
|
303
|
+
* provider tokens for an org that has no invoice to put them on:
|
|
304
|
+
*
|
|
305
|
+
* 1. **Concurrency.** N in-flight requests each read `used < limit` before any
|
|
306
|
+
* of them recorded. The per-uid rate limiter (20/min) was the only bound.
|
|
307
|
+
* 2. **Abandoned streams.** Recording ran in the stream's completion handler,
|
|
308
|
+
* so a client that opened a request and dropped it never counted at all.
|
|
309
|
+
* Looped, that is UNBOUNDED spend on a free workspace — the cap simply
|
|
310
|
+
* never advanced. This is the fail-open that costs money silently.
|
|
311
|
+
*
|
|
312
|
+
* So the count moves to the front, inside a transaction: read and increment
|
|
313
|
+
* are one atomic step, and a refused request never reaches the provider. The
|
|
314
|
+
* lesson is AGL's own — fix WHEN the quota is evaluated, not how the counting
|
|
315
|
+
* is done.
|
|
316
|
+
*
|
|
317
|
+
* Both counters move here (the daily one AND monthly `messages`) so message
|
|
318
|
+
* counting has exactly one home. `recordAssistExchange` therefore records the
|
|
319
|
+
* exchange, its tokens and its cost, and counts NO messages; calling it after
|
|
320
|
+
* a reservation must not double-count.
|
|
321
|
+
*
|
|
322
|
+
* A plan-less org resolves as free upstream, so an unknown org gets the
|
|
323
|
+
* SMALLER cap. That direction is deliberate.
|
|
324
|
+
*
|
|
325
|
+
* ## The spend gate is the one that matters now
|
|
326
|
+
*
|
|
327
|
+
* The message caps above are a runaway guard. The gate that decides what a
|
|
328
|
+
* paying workspace gets is the SPEND ceiling, because assist actions differ
|
|
329
|
+
* in cost by up to two orders of magnitude: a question is a few thousand
|
|
330
|
+
* tokens and generating a screen carries a node tree, a component catalog and
|
|
331
|
+
* theme tokens in and structured markup out. Counting both as one message
|
|
332
|
+
* would let ten screen builds outspend a thousand questions while both read
|
|
333
|
+
* as being within allowance.
|
|
334
|
+
*
|
|
335
|
+
* `org` is the billing document the caller already resolved `entitled` from.
|
|
336
|
+
* It is optional and defaults to no org, which resolves as free — a band of
|
|
337
|
+
* none, and therefore exactly the operator-backstop behaviour that predates
|
|
338
|
+
* plan bands. Passing it is what makes a plan's own band bind.
|
|
339
|
+
*
|
|
340
|
+
* ## Refusal is legitimate here, unlike the transactional email carve-out
|
|
341
|
+
*
|
|
342
|
+
* A campaign send is refusable at its band and transactional mail is not,
|
|
343
|
+
* because a blocked password reset locks somebody out of their own account.
|
|
344
|
+
* Nothing assist does is that. It is help, not a person's data and not their
|
|
345
|
+
* access: a refused question means the answer is not given, and a refused
|
|
346
|
+
* build means the screen is built by hand in a besigner that still works. So
|
|
347
|
+
* assist refuses at the band with no carve-out.
|
|
348
|
+
*
|
|
349
|
+
* What is never refused is what costs nothing. A docs-deflected answer and a
|
|
350
|
+
* cache hit spend no tokens and take NO RESERVATION AT ALL — they return
|
|
351
|
+
* before this function is reached — so a workspace at its band keeps getting
|
|
352
|
+
* every answer the docs index can give it. That is not a carve-out inside
|
|
353
|
+
* this gate; it is the reason those paths are ahead of it.
|
|
354
|
+
*
|
|
355
|
+
* ## The band is sold past by default (AGL-2653)
|
|
356
|
+
*
|
|
357
|
+
* Refusing at the band is legitimate; it is no longer the default. A plan
|
|
358
|
+
* with an `extraAssistCreditsUsdPer1k` keeps reserving past its band and
|
|
359
|
+
* `report-usage` bills the excess at that rate, unless the org's own
|
|
360
|
+
* `assistOverage.hardCap` asks for the wall — `assistBandRefuses` is the one
|
|
361
|
+
* place that rule lives. The ceiling below is composed from that answer, and
|
|
362
|
+
* `refusedBy: 'band'` is how a refusal the switch caused is told apart from
|
|
363
|
+
* one the operator's figure caused.
|
|
364
|
+
*
|
|
365
|
+
* ## The Free taste is metered twice (AGL-2925)
|
|
366
|
+
*
|
|
367
|
+
* A Free workspace's band is a wall, and a wall per workspace is not a
|
|
368
|
+
* bound per person. So when `org` resolves to the Free plan the SAME
|
|
369
|
+
* transaction also reads the workspace owner's account document and the
|
|
370
|
+
* platform's day of free spend, and refuses on the account's daily request
|
|
371
|
+
* cap, its refusal pause, its monthly allowance and the platform ceiling —
|
|
372
|
+
* see `assist-free-taste.ts` for each. An admitted free reservation counts
|
|
373
|
+
* the request on the account beside the org's own counters, so the release
|
|
374
|
+
* path hands both back together.
|
|
375
|
+
*
|
|
376
|
+
* ## Allotments sit inside the band (AGL-2942)
|
|
377
|
+
*
|
|
378
|
+
* `subject` names the person asking and the site the request named. Once
|
|
379
|
+
* the workspace's own ceilings — the message cap, the band or budget, the
|
|
380
|
+
* overage cap — have admitted the request, the SAME transaction reads the
|
|
381
|
+
* allotments that apply to that person and site and refuses as `allotment`
|
|
382
|
+
* when a hard one is spent. After the workspace's rungs, so a workspace at
|
|
383
|
+
* its band hears about its band and an allotment can never admit what the
|
|
384
|
+
* band refused; before the Free taste's, which are precautions about the
|
|
385
|
+
* account rather than decisions a manager made. Refusing moves no counter,
|
|
386
|
+
* like every refusal above it. A soft allotment at 80% or 100% admits the
|
|
387
|
+
* request and is announced once the transaction has committed.
|
|
388
|
+
*/
|
|
389
|
+
export declare function reserveAssistMessage(firestore: FirebaseFirestore.Firestore, orgId: string, entitled: boolean, now?: Date, org?: AssistMeteredOrg | null, subject?: AiAllotmentRequestSubject | null): Promise<AssistReservation>;
|
|
390
|
+
/** A reservation with every dollar of provider spend removed. */
|
|
391
|
+
export interface PublicAssistQuota {
|
|
392
|
+
allowed: boolean;
|
|
393
|
+
period: 'day' | 'month';
|
|
394
|
+
used: number;
|
|
395
|
+
limit: number;
|
|
396
|
+
remaining: number;
|
|
397
|
+
refusedBy: AiRefusedBy;
|
|
398
|
+
/**
|
|
399
|
+
* The credit standing, or `null` when the org's plan sells no assist band.
|
|
400
|
+
*
|
|
401
|
+
* Null rather than a converted backstop, because a Free workspace refused
|
|
402
|
+
* at the operator's ceiling has no credit balance to report and telling it
|
|
403
|
+
* "0 of 40,000 credits left" names a band it was never sold.
|
|
404
|
+
*/
|
|
405
|
+
credits: PublicAssistCredits | null;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* The reservation as a CUSTOMER may see it.
|
|
409
|
+
*
|
|
410
|
+
* `AssistReservation` carries `costUsd`, `costLimitUsd` and `budgetUsd`, and
|
|
411
|
+
* all three are our provider bill at the serving model's list rates. Handing
|
|
412
|
+
* the reservation itself to a browser publishes our model costs, and they
|
|
413
|
+
* would move under customers on every model swap. Assist is surfaced in
|
|
414
|
+
* CREDITS, whose meaning is fixed, and this is the one function that crosses
|
|
415
|
+
* that boundary — every route returning quota to a client returns this.
|
|
416
|
+
*
|
|
417
|
+
* `limit` and `remaining` stay MESSAGES, unchanged: the free tier's daily
|
|
418
|
+
* message cap is a real, separately-worded limit that the panel already
|
|
419
|
+
* renders, and folding it into credits would make "10 messages a day"
|
|
420
|
+
* unsayable.
|
|
421
|
+
*
|
|
422
|
+
* The credit view reads against the LOWER of the plan band and the effective
|
|
423
|
+
* ceiling. The band, because it is the quantity the org was sold and the line
|
|
424
|
+
* `report-usage` bills past — an org buying overage (AGL-2653) has no ceiling
|
|
425
|
+
* at all, and reading against `null` would blank its standing at "used 900 of
|
|
426
|
+
* nothing". The ceiling, because an org whose band was undercut by an
|
|
427
|
+
* operator's figure must not be told it has credits left while being refused.
|
|
428
|
+
* `remaining` clamps at zero, so a workspace past its band reads as spent
|
|
429
|
+
* rather than as owed.
|
|
430
|
+
*/
|
|
431
|
+
export declare function publicAssistQuota(reservation: AssistReservation): PublicAssistQuota;
|
|
432
|
+
/**
|
|
433
|
+
* Hand a reservation back when the provider was never reached (AGL-2057): an
|
|
434
|
+
* upstream 502 spent no tokens, so it must not spend one of a free
|
|
435
|
+
* workspace's ten messages a day either.
|
|
436
|
+
*
|
|
437
|
+
* Released against the keys the RESERVATION recorded — see
|
|
438
|
+
* `AssistReservation`. Each counter is read first so neither can be driven
|
|
439
|
+
* below zero, even if the same reservation were released twice: a negative
|
|
440
|
+
* counter is extra capacity, and the release path must not become the
|
|
441
|
+
* laundering route the reservation was added to close.
|
|
442
|
+
*/
|
|
443
|
+
export declare function releaseAssistMessage(firestore: FirebaseFirestore.Firestore, orgId: string, reservation: Pick<AssistReservation, 'allowed' | 'dayKey' | 'monthKey'> & Partial<Pick<AssistReservation, 'free'>>): Promise<void>;
|
|
444
|
+
/**
|
|
445
|
+
* READ-ONLY view of where an org stands against its cap.
|
|
446
|
+
*
|
|
447
|
+
* ⚠️ NOT the enforcement path any more (AGL-2057) — `reserveAssistMessage` is.
|
|
448
|
+
* A read that is followed by a separate write is exactly the shape that let
|
|
449
|
+
* concurrent requests and abandoned streams past the cap; this function is
|
|
450
|
+
* kept for reporting and for tests that want the standing without consuming a
|
|
451
|
+
* message. **Anything that decides whether to call the model must reserve.**
|
|
452
|
+
*
|
|
453
|
+
* Free orgs meter per UTC day; entitled orgs carry the monthly runaway guard.
|
|
454
|
+
*/
|
|
455
|
+
export declare function checkAssistQuota(firestore: FirebaseFirestore.Firestore, orgId: string, entitled: boolean, now?: Date): Promise<AssistQuotaVerdict>;
|
|
456
|
+
/**
|
|
457
|
+
* The DERIVED half of one assist turn: what it cost, what it cited, how it
|
|
458
|
+
* stopped. No prose and no uid, by construction — see the module header.
|
|
459
|
+
*
|
|
460
|
+
* Split out of `AssistExchangeRecord` (AGL-2073) because the besigner copy
|
|
461
|
+
* assistant at `/api/ai/assist` needs the meters WITHOUT the verbatim half.
|
|
462
|
+
* What a customer types into that surface is their own site copy and blog
|
|
463
|
+
* bodies, and retaining it for 180 days is a data flow the published privacy
|
|
464
|
+
* disclosure does not describe. The margin question — what did this org's
|
|
465
|
+
* assist usage cost us — is answered entirely by this record.
|
|
466
|
+
*/
|
|
467
|
+
export interface AssistSignalRecord {
|
|
468
|
+
/** Console route the user asked from, e.g. `/org/acme/hosts`. */
|
|
469
|
+
route: string;
|
|
470
|
+
hostId: string | null;
|
|
471
|
+
model: string;
|
|
472
|
+
/** Capability tier served: 'free' (level 1) or 'entitled' (level 1–2). */
|
|
473
|
+
tier: 'free' | 'entitled';
|
|
474
|
+
usage: AssistTokenUsage;
|
|
475
|
+
/** Docs paths cited in grounding, for the docs-gap mining view. */
|
|
476
|
+
docsPaths: string[];
|
|
477
|
+
/**
|
|
478
|
+
* The model's own `stop_reason` (`end_turn` | `refusal` | `max_tokens` |
|
|
479
|
+
* …), or null when the stream ended without one. Stored because a
|
|
480
|
+
* refusal and a truncation both look like a short answer in the data —
|
|
481
|
+
* and a rising refusal rate is a prompt problem, while a rising
|
|
482
|
+
* max_tokens rate is a ceiling problem. They need different fixes.
|
|
483
|
+
*/
|
|
484
|
+
stopReason: string | null;
|
|
485
|
+
/**
|
|
486
|
+
* True when the answer came from the docs index with NO model call
|
|
487
|
+
* (AGL-2486).
|
|
488
|
+
*
|
|
489
|
+
* Optional only so the two existing callers need not be edited in the same
|
|
490
|
+
* breath; it is written as an explicit boolean either way, never left
|
|
491
|
+
* undefined on the document. An absent field would make "this turn used no
|
|
492
|
+
* model" and "this turn predates the flag" the same value, and the whole
|
|
493
|
+
* point of the field is that an operator can tell how much of the month was
|
|
494
|
+
* free.
|
|
495
|
+
*/
|
|
496
|
+
deflected?: boolean;
|
|
497
|
+
/**
|
|
498
|
+
* The Free taste's attribution (AGL-2925), copied from the reservation
|
|
499
|
+
* that admitted this turn: `null` or absent for a paid workspace, and for
|
|
500
|
+
* a turn that took no reservation. Present, the turn's cost also lands on
|
|
501
|
+
* the platform's day of free spend and — unless the model refused — on
|
|
502
|
+
* the owner's account allowance.
|
|
503
|
+
*/
|
|
504
|
+
free?: FreeAssistAccount | null;
|
|
505
|
+
/**
|
|
506
|
+
* Who asked, for the per-user rollup (AGL-2928) and NOTHING else: the
|
|
507
|
+
* signal document never carries it, for the reason the module header
|
|
508
|
+
* gives. Optional because a meter that cannot say who asked still owes
|
|
509
|
+
* the org its cost; such a request attributes to nobody.
|
|
510
|
+
*/
|
|
511
|
+
uid?: string | null;
|
|
512
|
+
/**
|
|
513
|
+
* What the request was for, as the per-user rollup buckets it. A job
|
|
514
|
+
* step names its job's kind; a meter without one is read off `route`.
|
|
515
|
+
*/
|
|
516
|
+
kind?: AiUsageKind;
|
|
517
|
+
/**
|
|
518
|
+
* How many canvas edits the answer proposed (AGL-2906), on a turn that
|
|
519
|
+
* proposed any. A count and nothing of the edits: the applied-edit door
|
|
520
|
+
* reads it back as the evidence that this turn issued a proposal, and a
|
|
521
|
+
* turn that proposed none carries no field at all.
|
|
522
|
+
*/
|
|
523
|
+
editOps?: number;
|
|
524
|
+
}
|
|
525
|
+
/** A signal PLUS the verbatim half — the question, the answer, the asker. */
|
|
526
|
+
export interface AssistExchangeRecord extends AssistSignalRecord {
|
|
527
|
+
uid: string;
|
|
528
|
+
question: string;
|
|
529
|
+
answer: string;
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Meter one assist turn that keeps NO verbatim record (AGL-2073) — the
|
|
533
|
+
* besigner copy assistant at `/api/ai/assist`.
|
|
534
|
+
*
|
|
535
|
+
* Writes the signal and folds tokens/cost into the monthly rollup, and writes
|
|
536
|
+
* nothing to `assistExchanges`. Same reason the console route splits the two:
|
|
537
|
+
* the loop's corpus was never the words. Here there is no loop to feed and no
|
|
538
|
+
* thumbs to collect, so the words are simply not taken.
|
|
539
|
+
*
|
|
540
|
+
* Like `recordAssistExchange` it counts NO message — the reservation did that
|
|
541
|
+
* before the tokens were spent. Callers should not let a metering failure fail
|
|
542
|
+
* the request: the tokens are already spent either way, and refusing the
|
|
543
|
+
* answer the customer paid for would make an accounting problem a product one.
|
|
544
|
+
*/
|
|
545
|
+
export declare function recordAssistCost(firestore: FirebaseFirestore.Firestore, orgId: string, record: AssistSignalRecord, now?: Date): Promise<string>;
|
|
546
|
+
/**
|
|
547
|
+
* The data loop + meters, one batch: writes the two halves of the exchange
|
|
548
|
+
* and folds tokens/cost into the monthly usage doc. It does NOT count the
|
|
549
|
+
* message — `reserveAssistMessage` already did, before the tokens were spent.
|
|
550
|
+
* Returns the shared id (the feedback route addresses it later). Callers
|
|
551
|
+
* `await` this — an exchange that fails to record should surface in logs,
|
|
552
|
+
* but the batch is one round trip so it does not add meaningful latency.
|
|
553
|
+
*
|
|
554
|
+
* The two halves share one id ON PURPOSE. It is what lets the feedback route
|
|
555
|
+
* keep its single-id signature, and it is what makes an exchange and its
|
|
556
|
+
* signal joinable for as long as both exist — without storing a second
|
|
557
|
+
* pointer that could rot.
|
|
558
|
+
*/
|
|
559
|
+
export declare function recordAssistExchange(firestore: FirebaseFirestore.Firestore, orgId: string, record: AssistExchangeRecord, now?: Date): Promise<string>;
|
|
560
|
+
/**
|
|
561
|
+
* Record explicit thumbs feedback on an exchange. Only the exchange's own
|
|
562
|
+
* org path is addressable, and only the two literal values are accepted —
|
|
563
|
+
* the route validates membership before calling this.
|
|
564
|
+
*
|
|
565
|
+
* The rating lands on the SIGNAL document, not the exchange (AGL-1972). A
|
|
566
|
+
* thumbs-down is the single most valuable row in the data loop and it is not
|
|
567
|
+
* personal content, so it must not be reaped along with the prose that
|
|
568
|
+
* earned it. Existence is checked on the signal too: it is the document
|
|
569
|
+
* being written, and after the exchange expires it is the only one left.
|
|
570
|
+
*/
|
|
571
|
+
export declare function recordAssistFeedback(firestore: FirebaseFirestore.Firestore, orgId: string, exchangeId: string, feedback: 'up' | 'down'): Promise<boolean>;
|