@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,340 @@
|
|
|
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 { checkQuota } from "@aglyn/aglyn/app-utils/plan-entitlements";
|
|
18
|
+
import { aiModelForStep } from "../providers/routing.js";
|
|
19
|
+
import { readSiteInventory } from "../runtime/site-inventory.js";
|
|
20
|
+
import { aiCampaignAudienceNote, readAiListSendTime, resolveAiEmailProducts, suggestAiCampaignList } from "./ai-email-bindings.js";
|
|
21
|
+
import { registerAiJobAdmission } from "./ai-job-admission.js";
|
|
22
|
+
import { aiJobDraftId } from "./ai-job-draft-ids.js";
|
|
23
|
+
import { aiSiteSubdomain } from "./ai-job-drafts.js";
|
|
24
|
+
import { aiConfirmedPlan, aiDoctrineReview, aiGenerationSpent, aiLimitReview, aiUnspentOutcome } from "./ai-job-generation.js";
|
|
25
|
+
import { AI_EMAIL_DESIGN_RESOURCE, AI_EMAIL_PLUGIN_ID, AI_EMAIL_SAVE_FAILURE_COPY, AI_JOB_EMAIL_STEP_BUDGETS, aiEmailDesignContent, aiEmailDesignOutput, aiJobInputName, generateAiEmail } from "./ai-job-email-step.js";
|
|
26
|
+
import { aiPluginDraftAdmissionRefusal, aiPluginDraftWriter } from "./ai-job-plugin-drafts.js";
|
|
27
|
+
import { registerAiJobStep } from "./ai-jobs.js";
|
|
28
|
+
/**
|
|
29
|
+
* The campaign step (AGL-2912): one brief becomes an email design AND the
|
|
30
|
+
* draft campaign that would send it.
|
|
31
|
+
*
|
|
32
|
+
* A campaign is an unplanned kind — there is one thing to build and a plan
|
|
33
|
+
* over it would be a plan of one — so the job runs this step alone, and the
|
|
34
|
+
* design it writes is the email step's, generated through `generateAiEmail`
|
|
35
|
+
* so both kinds obey the same doctrine and the same email rules.
|
|
36
|
+
*
|
|
37
|
+
* ## Nothing is sent, and nothing is aimed
|
|
38
|
+
*
|
|
39
|
+
* The campaign is written `draft`, with no audience, no schedule and no
|
|
40
|
+
* sender: a draft campaign is not a queued one, the scheduled processor
|
|
41
|
+
* queries `status == 'scheduled'`, and the send route is the only thing that
|
|
42
|
+
* mails a campaign. Choosing WHO receives it stays a person's decision, so
|
|
43
|
+
* the model is never shown the org's lists, its contacts or what past sends
|
|
44
|
+
* did. Code reads the list the brief names and the send time that list's own
|
|
45
|
+
* history suggests, AFTER the answer, and both reach the person as the
|
|
46
|
+
* output's `note` — never the prompt.
|
|
47
|
+
*
|
|
48
|
+
* ## Where campaign email begins
|
|
49
|
+
*
|
|
50
|
+
* A site whose plan sends no campaign email can still generate email designs;
|
|
51
|
+
* the campaign is the part that needs somewhere to send. So the step gates on
|
|
52
|
+
* the same entitlement the composer and the send route read, and stops the
|
|
53
|
+
* job for a person rather than failing it. The refusal names no plan, because
|
|
54
|
+
* the billing page is the one place that does.
|
|
55
|
+
*
|
|
56
|
+
* ## Run again and it finds its drafts
|
|
57
|
+
*
|
|
58
|
+
* Each write is keyed by the id the job recorded for its draft when it was
|
|
59
|
+
* created, so a run cut off between them finds what it wrote: two drafts are
|
|
60
|
+
* reported, a design alone is drafted into a campaign from the copy the
|
|
61
|
+
* design already stores, and neither spends.
|
|
62
|
+
*/ /** The id the marketing plugin is registered under. */ export const AI_CAMPAIGN_PLUGIN_ID = 'marketing';
|
|
63
|
+
/** The resource the marketing plugin writes a draft campaign under. */ export const AI_CAMPAIGN_RESOURCE = 'campaign';
|
|
64
|
+
/** A campaign's name when neither the job nor its subject lines give one. */ export const AI_JOB_CAMPAIGN_DEFAULT_NAME = 'New campaign';
|
|
65
|
+
/** A job's failure when the site has no campaign writer. */ export const AI_CAMPAIGN_UNAVAILABLE_COPY = 'Campaigns are not available on this site.';
|
|
66
|
+
/** A job's failure when a campaign whose email was written could not be drafted. */ export const AI_CAMPAIGN_SAVE_FAILURE_COPY = 'The email was written but the campaign could not be drafted. Try the job again.';
|
|
67
|
+
/**
|
|
68
|
+
* What a person is told when their plan sends no campaign email. It names the
|
|
69
|
+
* page that sells the answer rather than a plan, so the one place plan names
|
|
70
|
+
* are written stays the one place they are read.
|
|
71
|
+
*/ export const AI_CAMPAIGN_PLAN_REFUSAL = 'Campaign email is not included on this workspace’s plan. ' + 'Upgrade in Billing to send campaigns, or generate an email design on its own.';
|
|
72
|
+
/** Whether this workspace may send campaign email at all: the composer's and the send route's check. */ export function aiCampaignPlanAllows(org) {
|
|
73
|
+
return checkQuota(org, 'emailSendsPerMonth', 0).allowed;
|
|
74
|
+
}
|
|
75
|
+
/** The campaign as the job's output, carrying what the person still decides. */ export function aiCampaignOutput(record, place, note) {
|
|
76
|
+
return _extends({
|
|
77
|
+
resource: 'campaign',
|
|
78
|
+
id: record.id,
|
|
79
|
+
versionId: null,
|
|
80
|
+
hostId: place.hostId,
|
|
81
|
+
hostSubdomain: place.hostSubdomain,
|
|
82
|
+
label: record.name
|
|
83
|
+
}, note ? {
|
|
84
|
+
note
|
|
85
|
+
} : {});
|
|
86
|
+
}
|
|
87
|
+
/** The subject lines and preheaders a written design already stores. */ export function aiCampaignCopyFromDesign(record) {
|
|
88
|
+
var _ref, _ref1;
|
|
89
|
+
var _record_facts, _record_facts1, _record_facts2, _record_facts3;
|
|
90
|
+
const lines = (value)=>Array.isArray(value) ? value.filter((entry)=>typeof entry === 'string') : [];
|
|
91
|
+
const subject = String((_ref = (_record_facts = record.facts) == null ? void 0 : _record_facts['subject']) != null ? _ref : '');
|
|
92
|
+
const preheader = String((_ref1 = (_record_facts1 = record.facts) == null ? void 0 : _record_facts1['preheader']) != null ? _ref1 : '');
|
|
93
|
+
const subjects = lines((_record_facts2 = record.facts) == null ? void 0 : _record_facts2['subjectVariants']);
|
|
94
|
+
const preheaders = lines((_record_facts3 = record.facts) == null ? void 0 : _record_facts3['preheaderVariants']);
|
|
95
|
+
return {
|
|
96
|
+
subjects: subjects.length ? subjects : subject ? [
|
|
97
|
+
subject
|
|
98
|
+
] : [],
|
|
99
|
+
preheaders: preheaders.length ? preheaders : preheader ? [
|
|
100
|
+
preheader
|
|
101
|
+
] : []
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/** The campaign's content: the design it sends, and the copy the send fills its headers from. */ export function aiCampaignDraftContent(designId, copy) {
|
|
105
|
+
var _copy_subjects_, _copy_preheaders_;
|
|
106
|
+
return {
|
|
107
|
+
templateScreenId: designId,
|
|
108
|
+
subject: (_copy_subjects_ = copy.subjects[0]) != null ? _copy_subjects_ : '',
|
|
109
|
+
preheader: (_copy_preheaders_ = copy.preheaders[0]) != null ? _copy_preheaders_ : '',
|
|
110
|
+
subjectVariants: copy.subjects,
|
|
111
|
+
preheaderVariants: copy.preheaders
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** A campaign job's name: what the member asked for, else its strongest subject line. */ export function aiCampaignName(job, copy) {
|
|
115
|
+
return aiJobInputName(job) || copy.subjects[0] || AI_JOB_CAMPAIGN_DEFAULT_NAME;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* A campaign job is admitted for a site of its org with email and marketing
|
|
119
|
+
* on, room for a design and a campaign, and a plan that sends campaign email.
|
|
120
|
+
*/ export const aiCampaignJobAdmission = (context)=>aiPluginDraftAdmissionRefusal(context, {
|
|
121
|
+
kind: 'campaign',
|
|
122
|
+
drafts: [
|
|
123
|
+
{
|
|
124
|
+
resource: AI_EMAIL_DESIGN_RESOURCE,
|
|
125
|
+
pluginId: AI_EMAIL_PLUGIN_ID,
|
|
126
|
+
label: 'Email'
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
resource: AI_CAMPAIGN_RESOURCE,
|
|
130
|
+
pluginId: AI_CAMPAIGN_PLUGIN_ID,
|
|
131
|
+
label: 'Marketing'
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
ownCheck: async ()=>aiCampaignPlanAllows(context.org) ? null : {
|
|
135
|
+
status: 403,
|
|
136
|
+
error: AI_CAMPAIGN_PLAN_REFUSAL
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
/** Both drafts, or the refusal that stands in for a writer the site has not got. */ function writers(writerFor) {
|
|
140
|
+
const design = writerFor(AI_EMAIL_DESIGN_RESOURCE);
|
|
141
|
+
const campaign = writerFor(AI_CAMPAIGN_RESOURCE);
|
|
142
|
+
if (!design) return AI_CAMPAIGN_UNAVAILABLE_COPY;
|
|
143
|
+
if (!campaign) return AI_CAMPAIGN_UNAVAILABLE_COPY;
|
|
144
|
+
return {
|
|
145
|
+
design,
|
|
146
|
+
campaign
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
export function createAiJobCampaignStep(deps = {}) {
|
|
150
|
+
var _deps_readInventory, _deps_writerFor;
|
|
151
|
+
const readInventory = (_deps_readInventory = deps.readInventory) != null ? _deps_readInventory : readSiteInventory;
|
|
152
|
+
const writerFor = (_deps_writerFor = deps.writerFor) != null ? _deps_writerFor : aiPluginDraftWriter;
|
|
153
|
+
return async ({ job, now, signal, firestore, modelFor })=>{
|
|
154
|
+
var _ref, _orgSnapshot_data;
|
|
155
|
+
const hostId = job.hostId;
|
|
156
|
+
if (!hostId) throw new Error('a campaign job names no site, and its admission refuses one');
|
|
157
|
+
// The switch's answer for this job, else the routing table's (AGL-2942).
|
|
158
|
+
const model = (_ref = modelFor == null ? void 0 : modelFor('job.campaign')) != null ? _ref : aiModelForStep('job.campaign');
|
|
159
|
+
const found = writers(writerFor);
|
|
160
|
+
if (typeof found === 'string') return _extends({}, aiUnspentOutcome(model), {
|
|
161
|
+
failure: found
|
|
162
|
+
});
|
|
163
|
+
const { design, campaign } = found;
|
|
164
|
+
// What an earlier run of this same job already wrote, under the ids the job recorded.
|
|
165
|
+
const designId = aiJobDraftId(job, 'email');
|
|
166
|
+
const [writtenDesign, writtenCampaign, hostSubdomain] = await Promise.all([
|
|
167
|
+
design.read({
|
|
168
|
+
hostId,
|
|
169
|
+
id: designId
|
|
170
|
+
}),
|
|
171
|
+
campaign.read({
|
|
172
|
+
hostId,
|
|
173
|
+
id: aiJobDraftId(job, 'campaign')
|
|
174
|
+
}),
|
|
175
|
+
aiSiteSubdomain(firestore, hostId)
|
|
176
|
+
]);
|
|
177
|
+
const place = {
|
|
178
|
+
hostId,
|
|
179
|
+
hostSubdomain
|
|
180
|
+
};
|
|
181
|
+
if (writtenDesign && writtenCampaign) {
|
|
182
|
+
return aiUnspentOutcome(model, {
|
|
183
|
+
outputs: [
|
|
184
|
+
aiEmailDesignOutput(writtenDesign, place, null),
|
|
185
|
+
aiCampaignOutput(writtenCampaign, place, null)
|
|
186
|
+
]
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
const orgSnapshot = await firestore.collection('orgs').doc(job.orgId).get();
|
|
190
|
+
const org = (_orgSnapshot_data = orgSnapshot.data()) != null ? _orgSnapshot_data : null;
|
|
191
|
+
// Asked again here because a plan can change between admission and the run.
|
|
192
|
+
if (!aiCampaignPlanAllows(org)) {
|
|
193
|
+
return aiUnspentOutcome(model, {
|
|
194
|
+
review: aiLimitReview(AI_CAMPAIGN_PLAN_REFUSAL)
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
const context = {
|
|
198
|
+
orgId: job.orgId,
|
|
199
|
+
hostId,
|
|
200
|
+
uid: job.createdBy,
|
|
201
|
+
org,
|
|
202
|
+
now
|
|
203
|
+
};
|
|
204
|
+
// Who it is for and when to send it: read from the site, told to the
|
|
205
|
+
// person, and never sent to the model.
|
|
206
|
+
const list = await suggestAiCampaignList({
|
|
207
|
+
hostId,
|
|
208
|
+
brief: job.brief
|
|
209
|
+
});
|
|
210
|
+
const sendTime = list ? await readAiListSendTime(firestore, {
|
|
211
|
+
hostId,
|
|
212
|
+
listId: list.id
|
|
213
|
+
}) : null;
|
|
214
|
+
const note = aiCampaignAudienceNote(list, sendTime);
|
|
215
|
+
// A design an earlier run wrote is drafted into its campaign, unspent.
|
|
216
|
+
if (writtenDesign) {
|
|
217
|
+
return draftCampaign({
|
|
218
|
+
campaign,
|
|
219
|
+
context,
|
|
220
|
+
job,
|
|
221
|
+
copy: aiCampaignCopyFromDesign(writtenDesign),
|
|
222
|
+
designId: writtenDesign.id,
|
|
223
|
+
spent: aiUnspentOutcome(model),
|
|
224
|
+
outputs: [
|
|
225
|
+
aiEmailDesignOutput(writtenDesign, place, null)
|
|
226
|
+
],
|
|
227
|
+
place,
|
|
228
|
+
note
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
const [inventory, products] = await Promise.all([
|
|
232
|
+
readInventory(job.orgId, hostId, {
|
|
233
|
+
firestore
|
|
234
|
+
}),
|
|
235
|
+
resolveAiEmailProducts(firestore, {
|
|
236
|
+
hostId,
|
|
237
|
+
brief: job.brief,
|
|
238
|
+
inputs: job.inputs
|
|
239
|
+
})
|
|
240
|
+
]);
|
|
241
|
+
const refusal = await design.refusal(context);
|
|
242
|
+
if (refusal) {
|
|
243
|
+
return refusal.status === 403 ? aiUnspentOutcome(model, {
|
|
244
|
+
review: aiLimitReview(refusal.error)
|
|
245
|
+
}) : _extends({}, aiUnspentOutcome(model), {
|
|
246
|
+
failure: refusal.error
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
const asked = aiJobInputName(job);
|
|
250
|
+
const generated = await generateAiEmail(_extends({
|
|
251
|
+
job,
|
|
252
|
+
step: 'job.campaign',
|
|
253
|
+
model,
|
|
254
|
+
heading: asked ? `Campaign name: ${asked}` : null,
|
|
255
|
+
plan: aiConfirmedPlan(job),
|
|
256
|
+
inventory,
|
|
257
|
+
hostId,
|
|
258
|
+
products,
|
|
259
|
+
design
|
|
260
|
+
}, signal ? {
|
|
261
|
+
signal
|
|
262
|
+
} : {}));
|
|
263
|
+
const { result } = generated;
|
|
264
|
+
const spent = aiGenerationSpent(result);
|
|
265
|
+
if (result.status === 'refused') return _extends({}, spent, {
|
|
266
|
+
refused: true
|
|
267
|
+
});
|
|
268
|
+
if (result.status === 'needs_input') return _extends({}, spent, {
|
|
269
|
+
review: aiDoctrineReview(result)
|
|
270
|
+
});
|
|
271
|
+
if (!generated.copy || !generated.nodes) return _extends({}, spent, {
|
|
272
|
+
failure: AI_EMAIL_SAVE_FAILURE_COPY
|
|
273
|
+
});
|
|
274
|
+
const { copy } = generated;
|
|
275
|
+
const name = aiCampaignName(job, copy);
|
|
276
|
+
const write = await design.write(_extends({}, context, {
|
|
277
|
+
id: designId,
|
|
278
|
+
name,
|
|
279
|
+
content: aiEmailDesignContent(generated.nodes, copy)
|
|
280
|
+
}));
|
|
281
|
+
if (write.ok === false) {
|
|
282
|
+
return write.status === 403 ? _extends({}, spent, {
|
|
283
|
+
review: aiLimitReview(write.error)
|
|
284
|
+
}) : _extends({}, spent, {
|
|
285
|
+
failure: AI_EMAIL_SAVE_FAILURE_COPY
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
return draftCampaign({
|
|
289
|
+
campaign,
|
|
290
|
+
context,
|
|
291
|
+
job,
|
|
292
|
+
copy,
|
|
293
|
+
designId: write.id,
|
|
294
|
+
spent,
|
|
295
|
+
outputs: [
|
|
296
|
+
aiEmailDesignOutput(write, place, null)
|
|
297
|
+
],
|
|
298
|
+
place,
|
|
299
|
+
note
|
|
300
|
+
});
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Drafts the campaign around a design that exists. A campaign that cannot be
|
|
305
|
+
* drafted reports NO outputs: the design on its own is not what the job was
|
|
306
|
+
* asked for, and a run that names it would read as finished.
|
|
307
|
+
*/ async function draftCampaign(input) {
|
|
308
|
+
const write = await input.campaign.write(_extends({}, input.context, {
|
|
309
|
+
id: aiJobDraftId(input.job, 'campaign'),
|
|
310
|
+
name: aiCampaignName(input.job, input.copy),
|
|
311
|
+
content: aiCampaignDraftContent(input.designId, input.copy)
|
|
312
|
+
}));
|
|
313
|
+
if (write.ok === false) {
|
|
314
|
+
return write.status === 403 ? _extends({}, input.spent, {
|
|
315
|
+
review: aiLimitReview(write.error)
|
|
316
|
+
}) : _extends({}, input.spent, {
|
|
317
|
+
failure: AI_CAMPAIGN_SAVE_FAILURE_COPY
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
return _extends({}, input.spent, {
|
|
321
|
+
outputs: [
|
|
322
|
+
...input.outputs,
|
|
323
|
+
aiCampaignOutput(write, input.place, input.note)
|
|
324
|
+
]
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
export const runAiJobCampaignStep = createAiJobCampaignStep();
|
|
328
|
+
/**
|
|
329
|
+
* The least time one campaign step needs before it starts (AGL-3035): the
|
|
330
|
+
* email generation it drafts the campaign's design with, on the campaign's own
|
|
331
|
+
* routing row. Writing the draft campaign asks no model.
|
|
332
|
+
*/ export const AI_JOB_CAMPAIGN_STEP_MINIMUM_MS = AI_JOB_EMAIL_STEP_BUDGETS['job.campaign'].minimumMs;
|
|
333
|
+
/** Registers the campaign step and the check a campaign job passes before it is created or resumed. */ export function registerAiCampaignJob() {
|
|
334
|
+
registerAiJobStep('campaign', runAiJobCampaignStep, {
|
|
335
|
+
minimumMs: AI_JOB_CAMPAIGN_STEP_MINIMUM_MS
|
|
336
|
+
});
|
|
337
|
+
registerAiJobAdmission('campaign', aiCampaignJobAdmission);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
//# sourceMappingURL=ai-job-campaign-step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-job-campaign-step.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 { checkQuota } from '@aglyn/aglyn/app-utils/plan-entitlements'\nimport type { AglynOrgBilling } from '@aglyn/aglyn/foundation/definitions/org-billing.types'\nimport type {\n PluginDraftRecord,\n PluginResourceDraftWriter,\n} from '@aglyn/aglyn/plugin-manager/plugin-resource-drafts'\nimport type { AiJob, AiJobOutput } from '../model/ai-jobs.types'\nimport { aiModelForStep } from '../providers/routing'\nimport { readSiteInventory } from '../runtime/site-inventory'\nimport {\n aiCampaignAudienceNote,\n readAiListSendTime,\n resolveAiEmailProducts,\n suggestAiCampaignList,\n} from './ai-email-bindings'\nimport { registerAiJobAdmission, type AiJobAdmission } from './ai-job-admission'\nimport { aiJobDraftId } from './ai-job-draft-ids'\nimport { aiSiteSubdomain } from './ai-job-drafts'\nimport {\n aiConfirmedPlan,\n aiDoctrineReview,\n aiGenerationSpent,\n aiLimitReview,\n aiUnspentOutcome,\n} from './ai-job-generation'\nimport {\n AI_EMAIL_DESIGN_RESOURCE,\n AI_EMAIL_PLUGIN_ID,\n AI_EMAIL_SAVE_FAILURE_COPY,\n AI_JOB_EMAIL_STEP_BUDGETS,\n aiEmailDesignContent,\n aiEmailDesignOutput,\n aiJobInputName,\n generateAiEmail,\n type AiEmailCopy,\n} from './ai-job-email-step'\nimport {\n aiPluginDraftAdmissionRefusal,\n aiPluginDraftWriter,\n type AiPluginDraftWriterLookup,\n} from './ai-job-plugin-drafts'\nimport type { AiJobStepOutcome, AiJobStepRunner } from './ai-job-text-step'\nimport { registerAiJobStep } from './ai-jobs'\n\n/**\n * The campaign step (AGL-2912): one brief becomes an email design AND the\n * draft campaign that would send it.\n *\n * A campaign is an unplanned kind — there is one thing to build and a plan\n * over it would be a plan of one — so the job runs this step alone, and the\n * design it writes is the email step's, generated through `generateAiEmail`\n * so both kinds obey the same doctrine and the same email rules.\n *\n * ## Nothing is sent, and nothing is aimed\n *\n * The campaign is written `draft`, with no audience, no schedule and no\n * sender: a draft campaign is not a queued one, the scheduled processor\n * queries `status == 'scheduled'`, and the send route is the only thing that\n * mails a campaign. Choosing WHO receives it stays a person's decision, so\n * the model is never shown the org's lists, its contacts or what past sends\n * did. Code reads the list the brief names and the send time that list's own\n * history suggests, AFTER the answer, and both reach the person as the\n * output's `note` — never the prompt.\n *\n * ## Where campaign email begins\n *\n * A site whose plan sends no campaign email can still generate email designs;\n * the campaign is the part that needs somewhere to send. So the step gates on\n * the same entitlement the composer and the send route read, and stops the\n * job for a person rather than failing it. The refusal names no plan, because\n * the billing page is the one place that does.\n *\n * ## Run again and it finds its drafts\n *\n * Each write is keyed by the id the job recorded for its draft when it was\n * created, so a run cut off between them finds what it wrote: two drafts are\n * reported, a design alone is drafted into a campaign from the copy the\n * design already stores, and neither spends.\n */\n\n/** The id the marketing plugin is registered under. */\nexport const AI_CAMPAIGN_PLUGIN_ID = 'marketing'\n\n/** The resource the marketing plugin writes a draft campaign under. */\nexport const AI_CAMPAIGN_RESOURCE = 'campaign'\n\n/** A campaign's name when neither the job nor its subject lines give one. */\nexport const AI_JOB_CAMPAIGN_DEFAULT_NAME = 'New campaign'\n\n/** A job's failure when the site has no campaign writer. */\nexport const AI_CAMPAIGN_UNAVAILABLE_COPY = 'Campaigns are not available on this site.'\n\n/** A job's failure when a campaign whose email was written could not be drafted. */\nexport const AI_CAMPAIGN_SAVE_FAILURE_COPY =\n 'The email was written but the campaign could not be drafted. Try the job again.'\n\n/**\n * What a person is told when their plan sends no campaign email. It names the\n * page that sells the answer rather than a plan, so the one place plan names\n * are written stays the one place they are read.\n */\nexport const AI_CAMPAIGN_PLAN_REFUSAL =\n 'Campaign email is not included on this workspace’s plan. ' +\n 'Upgrade in Billing to send campaigns, or generate an email design on its own.'\n\n/** Whether this workspace may send campaign email at all: the composer's and the send route's check. */\nexport function aiCampaignPlanAllows(org: object | null): boolean {\n return checkQuota(org as Partial<AglynOrgBilling> | null, 'emailSendsPerMonth', 0).allowed\n}\n\n/** The campaign as the job's output, carrying what the person still decides. */\nexport function aiCampaignOutput(\n record: PluginDraftRecord,\n place: { hostId: string; hostSubdomain: string | null },\n note: string | null,\n): AiJobOutput {\n return {\n resource: 'campaign',\n id: record.id,\n versionId: null,\n hostId: place.hostId,\n hostSubdomain: place.hostSubdomain,\n label: record.name,\n ...(note ? { note } : {}),\n }\n}\n\n/** The subject lines and preheaders a written design already stores. */\nexport function aiCampaignCopyFromDesign(record: PluginDraftRecord): AiEmailCopy {\n const lines = (value: unknown): string[] =>\n Array.isArray(value) ? value.filter((entry): entry is string => typeof entry === 'string') : []\n const subject = String(record.facts?.['subject'] ?? '')\n const preheader = String(record.facts?.['preheader'] ?? '')\n const subjects = lines(record.facts?.['subjectVariants'])\n const preheaders = lines(record.facts?.['preheaderVariants'])\n return {\n subjects: subjects.length ? subjects : subject ? [subject] : [],\n preheaders: preheaders.length ? preheaders : preheader ? [preheader] : [],\n }\n}\n\n/** The campaign's content: the design it sends, and the copy the send fills its headers from. */\nexport function aiCampaignDraftContent(\n designId: string,\n copy: AiEmailCopy,\n): Record<string, unknown> {\n return {\n templateScreenId: designId,\n subject: copy.subjects[0] ?? '',\n preheader: copy.preheaders[0] ?? '',\n subjectVariants: copy.subjects,\n preheaderVariants: copy.preheaders,\n }\n}\n\n/** A campaign job's name: what the member asked for, else its strongest subject line. */\nexport function aiCampaignName(job: Pick<AiJob, 'inputs'>, copy: AiEmailCopy): string {\n return aiJobInputName(job) || copy.subjects[0] || AI_JOB_CAMPAIGN_DEFAULT_NAME\n}\n\n/**\n * A campaign job is admitted for a site of its org with email and marketing\n * on, room for a design and a campaign, and a plan that sends campaign email.\n */\nexport const aiCampaignJobAdmission: AiJobAdmission = (context) =>\n aiPluginDraftAdmissionRefusal(context, {\n kind: 'campaign',\n drafts: [\n { resource: AI_EMAIL_DESIGN_RESOURCE, pluginId: AI_EMAIL_PLUGIN_ID, label: 'Email' },\n { resource: AI_CAMPAIGN_RESOURCE, pluginId: AI_CAMPAIGN_PLUGIN_ID, label: 'Marketing' },\n ],\n ownCheck: async () =>\n aiCampaignPlanAllows(context.org)\n ? null\n : { status: 403, error: AI_CAMPAIGN_PLAN_REFUSAL },\n })\n\nexport interface AiJobCampaignStepDeps {\n /** The inventory reader; specs hand in a fake. */\n readInventory?: typeof readSiteInventory\n /** How a resource's draft writer is found; the core's registry otherwise. */\n writerFor?: AiPluginDraftWriterLookup\n}\n\n/** Both drafts, or the refusal that stands in for a writer the site has not got. */\nfunction writers(\n writerFor: AiPluginDraftWriterLookup,\n): { design: PluginResourceDraftWriter; campaign: PluginResourceDraftWriter } | string {\n const design = writerFor(AI_EMAIL_DESIGN_RESOURCE)\n const campaign = writerFor(AI_CAMPAIGN_RESOURCE)\n if (!design) return AI_CAMPAIGN_UNAVAILABLE_COPY\n if (!campaign) return AI_CAMPAIGN_UNAVAILABLE_COPY\n return { design, campaign }\n}\n\nexport function createAiJobCampaignStep(deps: AiJobCampaignStepDeps = {}): AiJobStepRunner {\n const readInventory = deps.readInventory ?? readSiteInventory\n const writerFor = deps.writerFor ?? aiPluginDraftWriter\n return async ({ job, now, signal, firestore, modelFor }): Promise<AiJobStepOutcome> => {\n const hostId = job.hostId\n if (!hostId) throw new Error('a campaign job names no site, and its admission refuses one')\n // The switch's answer for this job, else the routing table's (AGL-2942).\n const model = modelFor?.('job.campaign') ?? aiModelForStep('job.campaign')\n const found = writers(writerFor)\n if (typeof found === 'string') return { ...aiUnspentOutcome(model), failure: found }\n const { design, campaign } = found\n\n // What an earlier run of this same job already wrote, under the ids the job recorded.\n const designId = aiJobDraftId(job, 'email')\n const [writtenDesign, writtenCampaign, hostSubdomain] = await Promise.all([\n design.read({ hostId, id: designId }),\n campaign.read({ hostId, id: aiJobDraftId(job, 'campaign') }),\n aiSiteSubdomain(firestore, hostId),\n ])\n const place = { hostId, hostSubdomain }\n if (writtenDesign && writtenCampaign) {\n return aiUnspentOutcome(model, {\n outputs: [\n aiEmailDesignOutput(writtenDesign, place, null),\n aiCampaignOutput(writtenCampaign, place, null),\n ],\n })\n }\n\n const orgSnapshot = await firestore.collection('orgs').doc(job.orgId).get()\n const org = (orgSnapshot.data() ?? null) as Record<string, unknown> | null\n // Asked again here because a plan can change between admission and the run.\n if (!aiCampaignPlanAllows(org)) {\n return aiUnspentOutcome(model, { review: aiLimitReview(AI_CAMPAIGN_PLAN_REFUSAL) })\n }\n const context = { orgId: job.orgId, hostId, uid: job.createdBy, org, now }\n\n // Who it is for and when to send it: read from the site, told to the\n // person, and never sent to the model.\n const list = await suggestAiCampaignList({ hostId, brief: job.brief })\n const sendTime = list ? await readAiListSendTime(firestore, { hostId, listId: list.id }) : null\n const note = aiCampaignAudienceNote(list, sendTime)\n\n // A design an earlier run wrote is drafted into its campaign, unspent.\n if (writtenDesign) {\n return draftCampaign({\n campaign,\n context,\n job,\n copy: aiCampaignCopyFromDesign(writtenDesign),\n designId: writtenDesign.id,\n spent: aiUnspentOutcome(model),\n outputs: [aiEmailDesignOutput(writtenDesign, place, null)],\n place,\n note,\n })\n }\n\n const [inventory, products] = await Promise.all([\n readInventory(job.orgId, hostId, { firestore }),\n resolveAiEmailProducts(firestore, { hostId, brief: job.brief, inputs: job.inputs }),\n ])\n const refusal = await design.refusal(context)\n if (refusal) {\n return refusal.status === 403\n ? aiUnspentOutcome(model, { review: aiLimitReview(refusal.error) })\n : { ...aiUnspentOutcome(model), failure: refusal.error }\n }\n\n const asked = aiJobInputName(job)\n const generated = await generateAiEmail({\n job,\n step: 'job.campaign',\n model,\n heading: asked ? `Campaign name: ${asked}` : null,\n plan: aiConfirmedPlan(job),\n inventory,\n hostId,\n products,\n design,\n ...(signal ? { signal } : {}),\n })\n const { result } = generated\n const spent = aiGenerationSpent(result)\n if (result.status === 'refused') return { ...spent, refused: true }\n if (result.status === 'needs_input') return { ...spent, review: aiDoctrineReview(result) }\n if (!generated.copy || !generated.nodes) return { ...spent, failure: AI_EMAIL_SAVE_FAILURE_COPY }\n\n const { copy } = generated\n const name = aiCampaignName(job, copy)\n const write = await design.write({\n ...context,\n id: designId,\n name,\n content: aiEmailDesignContent(generated.nodes, copy),\n })\n if (write.ok === false) {\n return write.status === 403\n ? { ...spent, review: aiLimitReview(write.error) }\n : { ...spent, failure: AI_EMAIL_SAVE_FAILURE_COPY }\n }\n return draftCampaign({\n campaign,\n context,\n job,\n copy,\n designId: write.id,\n spent,\n outputs: [aiEmailDesignOutput(write, place, null)],\n place,\n note,\n })\n }\n}\n\ninterface AiCampaignDraftInput {\n campaign: PluginResourceDraftWriter\n context: { orgId: string; hostId: string; uid: string; org: Record<string, unknown> | null; now: Date }\n job: AiJob\n copy: AiEmailCopy\n designId: string\n /** What the generation cost, or an unspent outcome for a run that reached no model. */\n spent: Pick<AiJobStepOutcome, 'outputs' | 'usage' | 'estCostUsd' | 'model' | 'stopReason'>\n /** The design's output, reported beside the campaign once it is drafted. */\n outputs: AiJobOutput[]\n place: { hostId: string; hostSubdomain: string | null }\n note: string\n}\n\n/**\n * Drafts the campaign around a design that exists. A campaign that cannot be\n * drafted reports NO outputs: the design on its own is not what the job was\n * asked for, and a run that names it would read as finished.\n */\nasync function draftCampaign(input: AiCampaignDraftInput): Promise<AiJobStepOutcome> {\n const write = await input.campaign.write({\n ...input.context,\n id: aiJobDraftId(input.job, 'campaign'),\n name: aiCampaignName(input.job, input.copy),\n content: aiCampaignDraftContent(input.designId, input.copy),\n })\n if (write.ok === false) {\n return write.status === 403\n ? { ...input.spent, review: aiLimitReview(write.error) }\n : { ...input.spent, failure: AI_CAMPAIGN_SAVE_FAILURE_COPY }\n }\n return {\n ...input.spent,\n outputs: [...input.outputs, aiCampaignOutput(write, input.place, input.note)],\n }\n}\n\nexport const runAiJobCampaignStep = createAiJobCampaignStep()\n\n/**\n * The least time one campaign step needs before it starts (AGL-3035): the\n * email generation it drafts the campaign's design with, on the campaign's own\n * routing row. Writing the draft campaign asks no model.\n */\nexport const AI_JOB_CAMPAIGN_STEP_MINIMUM_MS = AI_JOB_EMAIL_STEP_BUDGETS['job.campaign'].minimumMs\n\n/** Registers the campaign step and the check a campaign job passes before it is created or resumed. */\nexport function registerAiCampaignJob(): void {\n registerAiJobStep('campaign', runAiJobCampaignStep, { minimumMs: AI_JOB_CAMPAIGN_STEP_MINIMUM_MS })\n registerAiJobAdmission('campaign', aiCampaignJobAdmission)\n}\n"],"names":["checkQuota","aiModelForStep","readSiteInventory","aiCampaignAudienceNote","readAiListSendTime","resolveAiEmailProducts","suggestAiCampaignList","registerAiJobAdmission","aiJobDraftId","aiSiteSubdomain","aiConfirmedPlan","aiDoctrineReview","aiGenerationSpent","aiLimitReview","aiUnspentOutcome","AI_EMAIL_DESIGN_RESOURCE","AI_EMAIL_PLUGIN_ID","AI_EMAIL_SAVE_FAILURE_COPY","AI_JOB_EMAIL_STEP_BUDGETS","aiEmailDesignContent","aiEmailDesignOutput","aiJobInputName","generateAiEmail","aiPluginDraftAdmissionRefusal","aiPluginDraftWriter","registerAiJobStep","AI_CAMPAIGN_PLUGIN_ID","AI_CAMPAIGN_RESOURCE","AI_JOB_CAMPAIGN_DEFAULT_NAME","AI_CAMPAIGN_UNAVAILABLE_COPY","AI_CAMPAIGN_SAVE_FAILURE_COPY","AI_CAMPAIGN_PLAN_REFUSAL","aiCampaignPlanAllows","org","allowed","aiCampaignOutput","record","place","note","resource","id","versionId","hostId","hostSubdomain","label","name","aiCampaignCopyFromDesign","lines","value","Array","isArray","filter","entry","subject","String","facts","preheader","subjects","preheaders","length","aiCampaignDraftContent","designId","copy","templateScreenId","subjectVariants","preheaderVariants","aiCampaignName","job","aiCampaignJobAdmission","context","kind","drafts","pluginId","ownCheck","status","error","writers","writerFor","design","campaign","createAiJobCampaignStep","deps","readInventory","now","signal","firestore","modelFor","orgSnapshot","Error","model","found","failure","writtenDesign","writtenCampaign","Promise","all","read","outputs","collection","doc","orgId","get","data","review","uid","createdBy","list","brief","sendTime","listId","draftCampaign","spent","inventory","products","inputs","refusal","asked","generated","step","heading","plan","result","refused","nodes","write","content","ok","input","runAiJobCampaignStep","AI_JOB_CAMPAIGN_STEP_MINIMUM_MS","minimumMs","registerAiCampaignJob"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,UAAU,QAAQ,2CAA0C;AAOrE,SAASC,cAAc,QAAQ,0BAAsB;AACrD,SAASC,iBAAiB,QAAQ,+BAA2B;AAC7D,SACEC,sBAAsB,EACtBC,kBAAkB,EAClBC,sBAAsB,EACtBC,qBAAqB,QAChB,yBAAqB;AAC5B,SAASC,sBAAsB,QAA6B,wBAAoB;AAChF,SAASC,YAAY,QAAQ,wBAAoB;AACjD,SAASC,eAAe,QAAQ,qBAAiB;AACjD,SACEC,eAAe,EACfC,gBAAgB,EAChBC,iBAAiB,EACjBC,aAAa,EACbC,gBAAgB,QACX,yBAAqB;AAC5B,SACEC,wBAAwB,EACxBC,kBAAkB,EAClBC,0BAA0B,EAC1BC,yBAAyB,EACzBC,oBAAoB,EACpBC,mBAAmB,EACnBC,cAAc,EACdC,eAAe,QAEV,yBAAqB;AAC5B,SACEC,6BAA6B,EAC7BC,mBAAmB,QAEd,4BAAwB;AAE/B,SAASC,iBAAiB,QAAQ,eAAW;AAE7C;;;;;;;;;;;;;;;;;;;;;;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1D,OAAO;QAChB7B,IAAIhC,aAAauH,MAAM5D,GAAG,EAAE;QAC5BtB,MAAMqB,eAAe6D,MAAM5D,GAAG,EAAE4D,MAAMjE,IAAI;QAC1C+D,SAASjE,uBAAuBmE,MAAMlE,QAAQ,EAAEkE,MAAMjE,IAAI;;IAE5D,IAAI8D,MAAME,EAAE,KAAK,OAAO;QACtB,OAAOF,MAAMlD,MAAM,KAAK,MACpB,aAAKqD,MAAMhB,KAAK;YAAER,QAAQ1F,cAAc+G,MAAMjD,KAAK;aACnD,aAAKoD,MAAMhB,KAAK;YAAEpB,SAAS7D;;IACjC;IACA,OAAO,aACFiG,MAAMhB,KAAK;QACdd,SAAS;eAAI8B,MAAM9B,OAAO;YAAE9D,iBAAiByF,OAAOG,MAAM1F,KAAK,EAAE0F,MAAMzF,IAAI;SAAE;;AAEjF;AAEA,OAAO,MAAM0F,uBAAuBhD,0BAAyB;AAE7D;;;;CAIC,GACD,OAAO,MAAMiD,kCAAkC/G,yBAAyB,CAAC,eAAe,CAACgH,SAAS,CAAA;AAElG,qGAAqG,GACrG,OAAO,SAASC;IACd1G,kBAAkB,YAAYuG,sBAAsB;QAAEE,WAAWD;IAAgC;IACjG1H,uBAAuB,YAAY6D;AACrC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
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 { ReusableComponentProp } from '@aglyn/aglyn/foundation/definitions/platform.types';
|
|
18
|
+
import type { AiJobPlan } from '../model/ai-jobs.types';
|
|
19
|
+
import type { AiSiteInventory } from '../model/ai-site-inventory';
|
|
20
|
+
import type { AiValidatedTree } from '../runtime/ai-doctrine';
|
|
21
|
+
import { type AiDoctrineViolation } from '../runtime/ai-doctrine-validators';
|
|
22
|
+
/**
|
|
23
|
+
* The highest heading a component may carry (AGL-3057): a page section opens
|
|
24
|
+
* with its own h2, and whatever the section places sits under it.
|
|
25
|
+
*/
|
|
26
|
+
export declare const AI_COMPONENT_TOP_HEADING_LEVEL = 3;
|
|
27
|
+
/** One `name:type` field of the confirmed plan's component; `type` is empty when the field names none. */
|
|
28
|
+
export interface AiPlannedComponentField {
|
|
29
|
+
name: string;
|
|
30
|
+
type: string;
|
|
31
|
+
}
|
|
32
|
+
/** The fields the confirmed plan lists for its component, read from `name:type`, each name once. */
|
|
33
|
+
export declare function aiPlannedComponentFields(plan: AiJobPlan | null): AiPlannedComponentField[];
|
|
34
|
+
/** The property names the confirmed plan lists for its component, from its `name:type` fields. */
|
|
35
|
+
export declare function aiPlannedComponentProps(plan: AiJobPlan | null): string[];
|
|
36
|
+
/**
|
|
37
|
+
* The component door's check of its bindings, on a tree the doctrine admitted
|
|
38
|
+
* and the properties the same answer declared: every token names a declared
|
|
39
|
+
* property on a field of its kind, every property is bound, an icon is never
|
|
40
|
+
* shown as words, a part is hidden by a `Hide …` Yes / no that defaults to No,
|
|
41
|
+
* and a default fits the field it fills. `refused` names properties the answer
|
|
42
|
+
* declared and the reading refused, which are reported there and not again
|
|
43
|
+
* here.
|
|
44
|
+
*/
|
|
45
|
+
export declare function aiComponentBindingViolations(tree: Pick<AiValidatedTree, 'rootId' | 'nodes' | 'sourceIds'>, props: readonly ReusableComponentProp[], inventory: AiSiteInventory | null, refused?: readonly string[]): AiDoctrineViolation[];
|
|
46
|
+
/**
|
|
47
|
+
* Rule 7: the properties the confirmed plan lists for the component are
|
|
48
|
+
* declared, and a field the plan lists as an icon is an icon property, so
|
|
49
|
+
* the plan and the binding checks ask for the same thing (AGL-3054).
|
|
50
|
+
*/
|
|
51
|
+
export declare function aiPlannedPropViolations(plan: AiJobPlan | null, props: readonly Pick<ReusableComponentProp, 'name' | 'type'>[]): AiDoctrineViolation[];
|
|
52
|
+
/**
|
|
53
|
+
* Rule 11 on a component's own outline (AGL-3057). A page's outline check
|
|
54
|
+
* reads an instance as one node, and the site inventory carries no component
|
|
55
|
+
* tree to read in its place, so a component's h2 renders beside the h2 that
|
|
56
|
+
* opens the section placing it, and the page reads h2, h2, h2. The component
|
|
57
|
+
* is held to headings a section can hold instead: h3 or below. A component
|
|
58
|
+
* that would be a whole section, its own h2 and all, is refused the same way:
|
|
59
|
+
* that section is built on the page.
|
|
60
|
+
*/
|
|
61
|
+
export declare function aiComponentHeadingViolations(tree: Pick<AiValidatedTree, 'rootId' | 'nodes' | 'sourceIds'>): AiDoctrineViolation[];
|
|
62
|
+
/** Rule 14 on the copy a component shows until a page sets it. */
|
|
63
|
+
export declare function aiComponentDefaultCopyViolations(props: readonly ReusableComponentProp[]): AiDoctrineViolation[];
|
|
64
|
+
/**
|
|
65
|
+
* Every check the component door adds to the doctrine's, on a tree it
|
|
66
|
+
* admitted and the answer the tree came in. `onProps` receives the properties
|
|
67
|
+
* that answer declared, so the step keeps the declaration of the answer the
|
|
68
|
+
* loop keeps — the last one it checked.
|
|
69
|
+
*/
|
|
70
|
+
export declare function aiComponentCheck(input: {
|
|
71
|
+
inventory: AiSiteInventory | null;
|
|
72
|
+
plan: AiJobPlan | null;
|
|
73
|
+
onProps: (props: ReusableComponentProp[]) => void;
|
|
74
|
+
}): (tree: AiValidatedTree, answer: Record<string, unknown>) => AiDoctrineViolation[];
|