@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,634 @@
|
|
|
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 { checkFormContract, formFieldsCanYieldAnEmail } from "@aglyn/aglyn/app-utils/form-contract";
|
|
18
|
+
import { collectFormFieldNodeIds, FORM_COMPONENT_ID, FORM_FIELD_COMPONENT_ID, FORM_ID_PROP, formFieldDeclsFromNodes, formNodeIdIn, isMarketingConsentFieldName, MARKETING_CONSENT_FORM_FIELD } from "@aglyn/aglyn/app-utils/forms";
|
|
19
|
+
import { decodeStoredNodes } from "@aglyn/aglyn/app-utils/stored-nodes";
|
|
20
|
+
import { CANVAS_ROOT_ELEMENT_ID } from "@aglyn/aglyn/foundation/constants/canvas";
|
|
21
|
+
import { NodeType } from "@aglyn/aglyn/types/nodes";
|
|
22
|
+
import { duplicateResource } from "@aglyn/tenant-data-admin/server/duplicate-resource";
|
|
23
|
+
import { aiSiteSubmissions, aiSiteWords } from "../model/ai-site-job.js";
|
|
24
|
+
import { AI_STEP_TIERS } from "../providers/catalog.js";
|
|
25
|
+
import { AI_ROUTING_TABLE, aiModelForStep } from "../providers/routing.js";
|
|
26
|
+
import { aiDoctrineTreeTool, runValidatedGeneration } from "../runtime/ai-doctrine.js";
|
|
27
|
+
import { AI_PALETTE } from "../runtime/ai-palette.generated.js";
|
|
28
|
+
import { readSiteInventory } from "../runtime/site-inventory.js";
|
|
29
|
+
import { registerAiJobAdmission } from "./ai-job-admission.js";
|
|
30
|
+
import { aiJobDraftId } from "./ai-job-draft-ids.js";
|
|
31
|
+
import { aiDraftAdmissionRefusal, aiDraftAllowanceRefusal, aiSiteSubdomain, readAiDraft, writeAiDraft } from "./ai-job-drafts.js";
|
|
32
|
+
import { aiBracketedFactsNote, aiConfirmedPlan, aiDoctrineReview, aiGenerationSpent, aiJobBriefLine, aiLimitReview, aiModelNodeIds, aiPlanCreation, aiPlanReferenceLines, aiUnspentOutcome } from "./ai-job-generation.js";
|
|
33
|
+
import { aiJobStepBudget } from "./ai-job-budget.js";
|
|
34
|
+
import { registerAiJobStep } from "./ai-jobs.js";
|
|
35
|
+
/**
|
|
36
|
+
* The form step (AGL-2913): the generation step of a `form` job, run once a
|
|
37
|
+
* member confirmed the job's plan.
|
|
38
|
+
*
|
|
39
|
+
* A form is two halves that must agree for its submissions to arrive: the
|
|
40
|
+
* DESIGN a visitor fills in (`rootId`, `nodes`) and the DECLARATION the submit
|
|
41
|
+
* route reads (`fields`, `consentFieldName`, `routing`). `checkFormContract`
|
|
42
|
+
* is the rule that holds them together when a form is published. So the model
|
|
43
|
+
* writes only the design, through `runValidatedGeneration('form', …)`, and
|
|
44
|
+
* everything else is derived from it with the functions the publish paths
|
|
45
|
+
* use:
|
|
46
|
+
*
|
|
47
|
+
* - `fields` is `formFieldDeclsFromNodes` over the design;
|
|
48
|
+
* - a form that can yield an email address gets the platform's marketing
|
|
49
|
+
* consent field (`MARKETING_CONSENT_FORM_FIELD`, the Forms editor preset's own
|
|
50
|
+
* props) in place of any consent-like field the model drew, named as its
|
|
51
|
+
* `consentFieldName`;
|
|
52
|
+
* - `routing` is `{ lead: true }` when the answer proposes a lead, and
|
|
53
|
+
* nothing otherwise. The stored routing has no place for an email list,
|
|
54
|
+
* so a list proposal leaves the form on the Inbox and says, in the output's
|
|
55
|
+
* `note`, how to enroll the people who tick consent — naming a list only
|
|
56
|
+
* when the brief named one. The step reads no list, contact, CRM record or
|
|
57
|
+
* submission, and sends none.
|
|
58
|
+
*
|
|
59
|
+
* The design is then stamped the way the Forms page's Create stamps one — the
|
|
60
|
+
* form node bound to the new form's id, a canvas root above it — and
|
|
61
|
+
* `checkFormContract` runs on it through `extend`, beside the doctrine's own
|
|
62
|
+
* checks, so a design the contract would refuse at publish is asked for again
|
|
63
|
+
* with the violation named.
|
|
64
|
+
*
|
|
65
|
+
* The form lands as a new draft (`ai-job-drafts.ts`) that no page places and
|
|
66
|
+
* nothing promotes. A plan that starts from a copy of a form the site has gets
|
|
67
|
+
* that copy, through the platform's duplicate module, and nothing generated —
|
|
68
|
+
* and because that path reaches no model, `extend` never runs on it, so the
|
|
69
|
+
* step asks `checkFormContract` of the stored copy itself before it reports
|
|
70
|
+
* one (AGL-3024). A copy still bound to the form it was copied from is a
|
|
71
|
+
* failure, never an output.
|
|
72
|
+
*
|
|
73
|
+
* Like the other generation steps, it runs on the job beat, never at an inline
|
|
74
|
+
* door: it registers the least time its lookup rounds, its answer and its
|
|
75
|
+
* re-ask need (AGL-3035), and runs without extended thinking under the routing
|
|
76
|
+
* table's ceiling for a form, which is the doctrine's own.
|
|
77
|
+
*/ /**
|
|
78
|
+
* The longest answer a form may run to: the routing table's `job.form`
|
|
79
|
+
* ceiling, which holds the largest form the output budget admits
|
|
80
|
+
* (`ai-job-form-step.spec.ts` measures it) and is the doctrine's ceiling for
|
|
81
|
+
* the form kind.
|
|
82
|
+
*/ export const AI_JOB_FORM_MAX_TOKENS = AI_ROUTING_TABLE['job.form'].maxTokens;
|
|
83
|
+
/**
|
|
84
|
+
* The form step's time (AGL-3035, AGL-3036): its two inventory-lookup rounds,
|
|
85
|
+
* its answer and its re-ask at that ceiling on the tier `job.form` is served
|
|
86
|
+
* from, fitted to what a beat can give a step.
|
|
87
|
+
*/ export const AI_JOB_FORM_STEP_BUDGET = aiJobStepBudget({
|
|
88
|
+
tier: AI_STEP_TIERS['job.form'],
|
|
89
|
+
maxTokens: AI_JOB_FORM_MAX_TOKENS
|
|
90
|
+
});
|
|
91
|
+
/** The least time one form step needs before it starts. */ export const AI_JOB_FORM_STEP_MINIMUM_MS = AI_JOB_FORM_STEP_BUDGET.minimumMs;
|
|
92
|
+
/** A form's name when the plan names none. */ export const AI_JOB_FORM_DEFAULT_NAME = 'New form';
|
|
93
|
+
/** Where a proposal routes a form's submissions. */ export const AI_FORM_ROUTING_KINDS = [
|
|
94
|
+
'inbox',
|
|
95
|
+
'list',
|
|
96
|
+
'lead'
|
|
97
|
+
];
|
|
98
|
+
/** The most things a note says the brief asked for and a form cannot collect. */ export const AI_FORM_CANNOT_COLLECT_MAX = 3;
|
|
99
|
+
const CANNOT_COLLECT_MAX_CHARS = 60;
|
|
100
|
+
const LIST_NAME_MAX_CHARS = 80;
|
|
101
|
+
/** The node id the platform's consent field takes in a generated design. */ export const AI_FORM_CONSENT_NODE_ID = 'marketingConsentField';
|
|
102
|
+
/** The form step's own instructions, cached after the doctrine. */ export const AI_JOB_FORM_INSTRUCTIONS = [
|
|
103
|
+
{
|
|
104
|
+
text: [
|
|
105
|
+
'You build one form for a website: the fields a visitor fills in and the button that sends them. Answer with submit_form: the whole form as one flat node map, how its submissions are routed, and what the brief asks for that a form cannot collect.',
|
|
106
|
+
'The root is one Form (form) holding its Form Fields (formField) in the order a visitor fills them in. Give the form a submitLabel and a successMessage in the site’s voice.',
|
|
107
|
+
'Every field has a fieldName that is unique in the form and says what it holds in camelCase, such as fullName, email, phone or roofType; a label a visitor reads; and required only when the form cannot do its job without it. Use fieldType email for an email address, textarea for a description, select or radio with options for one choice, checkbox with options for several, and rating for a score. Put each option on its own line and never put a comma inside an option, because a comma starts a new one.',
|
|
108
|
+
'A form collects text, choices and ratings only. When the brief asks for something else, such as a file or photo upload, a signature or a payment, leave it out and name it in cannotCollect.',
|
|
109
|
+
'Never draw a marketing consent, newsletter or subscribe checkbox: when the form asks for an email address, the platform adds its own.',
|
|
110
|
+
'routing.kind is inbox when submissions only need to be read, lead when each one is a sales lead to follow up, and list when the people who send it should join an email list. routing.list is the list’s name only when the brief names one, and null otherwise.'
|
|
111
|
+
].join('\n')
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
const TREE_TOOL = aiDoctrineTreeTool('form');
|
|
115
|
+
/**
|
|
116
|
+
* The doctrine's form tree tool, with the two things a design cannot say: the
|
|
117
|
+
* routing it proposes and what the brief asked for that no field can collect.
|
|
118
|
+
* Structured fields only, so the step writes every sentence a person reads.
|
|
119
|
+
*/ export const AI_JOB_FORM_TOOL = {
|
|
120
|
+
name: TREE_TOOL.name,
|
|
121
|
+
description: 'Submit the form as one flat node map, how its submissions are routed, and what the brief asks for that a form cannot collect.',
|
|
122
|
+
strict: true,
|
|
123
|
+
inputSchema: {
|
|
124
|
+
type: 'object',
|
|
125
|
+
additionalProperties: false,
|
|
126
|
+
required: [
|
|
127
|
+
'tree',
|
|
128
|
+
'routing',
|
|
129
|
+
'cannotCollect'
|
|
130
|
+
],
|
|
131
|
+
properties: {
|
|
132
|
+
tree: TREE_TOOL.inputSchema['properties']['tree'],
|
|
133
|
+
routing: {
|
|
134
|
+
type: 'object',
|
|
135
|
+
additionalProperties: false,
|
|
136
|
+
required: [
|
|
137
|
+
'kind',
|
|
138
|
+
'list'
|
|
139
|
+
],
|
|
140
|
+
properties: {
|
|
141
|
+
kind: {
|
|
142
|
+
type: 'string',
|
|
143
|
+
enum: [
|
|
144
|
+
...AI_FORM_ROUTING_KINDS
|
|
145
|
+
],
|
|
146
|
+
description: 'inbox: submissions are read in the Inbox. lead: each submission with an email address is a sales lead. list: the people who send it should join an email list.'
|
|
147
|
+
},
|
|
148
|
+
list: {
|
|
149
|
+
anyOf: [
|
|
150
|
+
{
|
|
151
|
+
type: 'string'
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
type: 'null'
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
description: 'The email list the brief names, as it names it; null when it names none.'
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
cannotCollect: {
|
|
162
|
+
type: 'array',
|
|
163
|
+
items: {
|
|
164
|
+
type: 'string'
|
|
165
|
+
},
|
|
166
|
+
description: 'What the brief asks the form to collect that its field types cannot, a few words each, such as "photo upload"; empty when there is nothing.'
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
function isRecord(value) {
|
|
172
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
173
|
+
}
|
|
174
|
+
function oneLine(value, max) {
|
|
175
|
+
return value.replace(/\s+/g, ' ').trim().slice(0, max).trim();
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* An answer's routing and gaps: an unknown kind is the Inbox, and the rest is
|
|
179
|
+
* trimmed and capped. Where the person was asked where submissions go, their
|
|
180
|
+
* answer replaces the model's proposal — the whole of the difference a
|
|
181
|
+
* question makes.
|
|
182
|
+
*/ export function parseAiFormAnswer(answer, decisions = {
|
|
183
|
+
submissions: null
|
|
184
|
+
}) {
|
|
185
|
+
var _decisions_submissions;
|
|
186
|
+
const routing = isRecord(answer['routing']) ? answer['routing'] : {};
|
|
187
|
+
const proposed = AI_FORM_ROUTING_KINDS.includes(routing['kind']) ? routing['kind'] : 'inbox';
|
|
188
|
+
const kind = (_decisions_submissions = decisions.submissions) != null ? _decisions_submissions : proposed;
|
|
189
|
+
const list = typeof routing['list'] === 'string' ? oneLine(routing['list'], LIST_NAME_MAX_CHARS) : '';
|
|
190
|
+
const seen = new Set();
|
|
191
|
+
const cannotCollect = [];
|
|
192
|
+
for (const entry of Array.isArray(answer['cannotCollect']) ? answer['cannotCollect'] : []){
|
|
193
|
+
if (typeof entry !== 'string') continue;
|
|
194
|
+
const text = oneLine(entry, CANNOT_COLLECT_MAX_CHARS);
|
|
195
|
+
if (!text || seen.has(text.toLowerCase())) continue;
|
|
196
|
+
seen.add(text.toLowerCase());
|
|
197
|
+
cannotCollect.push(text);
|
|
198
|
+
if (cannotCollect.length === AI_FORM_CANNOT_COLLECT_MAX) break;
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
routing: {
|
|
202
|
+
kind,
|
|
203
|
+
list: kind === 'list' && list ? list : null
|
|
204
|
+
},
|
|
205
|
+
cannotCollect
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The draft a validated design and its answer make: the form node bound to
|
|
210
|
+
* `formId` and captioned `name`, no dataset binding, the platform's consent
|
|
211
|
+
* field when the fields can yield an email address, the canvas root above,
|
|
212
|
+
* and the declaration read off the result. Pure; the input tree is not
|
|
213
|
+
* changed.
|
|
214
|
+
*/ export function aiFormDraft(tree, answer, identity) {
|
|
215
|
+
var _identity_decisions;
|
|
216
|
+
const parsed = parseAiFormAnswer(answer, (_identity_decisions = identity.decisions) != null ? _identity_decisions : {
|
|
217
|
+
submissions: null
|
|
218
|
+
});
|
|
219
|
+
const formNodeId = tree.rootId;
|
|
220
|
+
const nodes = {};
|
|
221
|
+
for (const [id, node] of Object.entries(tree.nodes)){
|
|
222
|
+
var _node_props;
|
|
223
|
+
nodes[id] = _extends({}, node, {
|
|
224
|
+
props: _extends({}, (_node_props = node.props) != null ? _node_props : {}),
|
|
225
|
+
nodes: Array.isArray(node.nodes) ? [
|
|
226
|
+
...node.nodes
|
|
227
|
+
] : []
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
const form = nodes[formNodeId];
|
|
231
|
+
let consentFieldName = null;
|
|
232
|
+
if ((form == null ? void 0 : form.componentId) === FORM_COMPONENT_ID) {
|
|
233
|
+
const props = form.props;
|
|
234
|
+
// A dataset binding decides where every submission is also written; it
|
|
235
|
+
// stays the person's choice, made on the Form element.
|
|
236
|
+
delete props['datasetId'];
|
|
237
|
+
delete props['datasetName'];
|
|
238
|
+
props[FORM_ID_PROP] = identity.formId;
|
|
239
|
+
props['formName'] = identity.name;
|
|
240
|
+
for (const id of collectFormFieldNodeIds(nodes, formNodeId)){
|
|
241
|
+
var _ref;
|
|
242
|
+
var _nodes_id_props, _nodes_id, _nodes_id1;
|
|
243
|
+
const fieldName = (_nodes_id = nodes[id]) == null ? void 0 : (_nodes_id_props = _nodes_id.props) == null ? void 0 : _nodes_id_props['fieldName'];
|
|
244
|
+
if (!isMarketingConsentFieldName(fieldName)) continue;
|
|
245
|
+
const parent = nodes[String((_ref = (_nodes_id1 = nodes[id]) == null ? void 0 : _nodes_id1.parentId) != null ? _ref : '')];
|
|
246
|
+
if (parent && Array.isArray(parent.nodes)) {
|
|
247
|
+
parent.nodes = parent.nodes.filter((child)=>child !== id);
|
|
248
|
+
}
|
|
249
|
+
delete nodes[id];
|
|
250
|
+
}
|
|
251
|
+
if (formFieldsCanYieldAnEmail(formFieldDeclsFromNodes(nodes, formNodeId))) {
|
|
252
|
+
var _AI_PALETTE_FORM_FIELD_COMPONENT_ID;
|
|
253
|
+
nodes[AI_FORM_CONSENT_NODE_ID] = {
|
|
254
|
+
$id: AI_FORM_CONSENT_NODE_ID,
|
|
255
|
+
type: NodeType.NODE,
|
|
256
|
+
componentId: FORM_FIELD_COMPONENT_ID,
|
|
257
|
+
pluginId: (_AI_PALETTE_FORM_FIELD_COMPONENT_ID = AI_PALETTE[FORM_FIELD_COMPONENT_ID]) == null ? void 0 : _AI_PALETTE_FORM_FIELD_COMPONENT_ID.pluginId,
|
|
258
|
+
parentId: formNodeId,
|
|
259
|
+
nodes: [],
|
|
260
|
+
props: _extends({}, MARKETING_CONSENT_FORM_FIELD)
|
|
261
|
+
};
|
|
262
|
+
form.nodes = [
|
|
263
|
+
...form.nodes,
|
|
264
|
+
AI_FORM_CONSENT_NODE_ID
|
|
265
|
+
];
|
|
266
|
+
consentFieldName = MARKETING_CONSENT_FORM_FIELD.fieldName;
|
|
267
|
+
}
|
|
268
|
+
form.parentId = CANVAS_ROOT_ELEMENT_ID;
|
|
269
|
+
}
|
|
270
|
+
nodes[CANVAS_ROOT_ELEMENT_ID] = {
|
|
271
|
+
$id: CANVAS_ROOT_ELEMENT_ID,
|
|
272
|
+
componentId: 'div',
|
|
273
|
+
nodes: [
|
|
274
|
+
formNodeId
|
|
275
|
+
]
|
|
276
|
+
};
|
|
277
|
+
return {
|
|
278
|
+
nodes,
|
|
279
|
+
rootId: CANVAS_ROOT_ELEMENT_ID,
|
|
280
|
+
formNodeId,
|
|
281
|
+
fields: formFieldDeclsFromNodes(nodes, formNodeId),
|
|
282
|
+
consentFieldName,
|
|
283
|
+
routing: parsed.routing.kind === 'lead' ? {
|
|
284
|
+
lead: true
|
|
285
|
+
} : null,
|
|
286
|
+
answer: parsed
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* What a draft would break once published, as building-rule violations
|
|
291
|
+
* (rule 3: a form is built with its fields, validation, consent and routing
|
|
292
|
+
* together): the form contract's findings, a form with no field, and a list
|
|
293
|
+
* proposal on a form that asks for no email address. Offending nodes are
|
|
294
|
+
* named by the ids the model wrote.
|
|
295
|
+
*/ export function aiFormDraftViolations(draft, formId, sourceIds) {
|
|
296
|
+
const violations = checkFormContract({
|
|
297
|
+
form: _extends({}, draft.routing ? {
|
|
298
|
+
routing: draft.routing
|
|
299
|
+
} : {}, draft.consentFieldName ? {
|
|
300
|
+
consentFieldName: draft.consentFieldName
|
|
301
|
+
} : {}),
|
|
302
|
+
formId,
|
|
303
|
+
nodes: draft.nodes,
|
|
304
|
+
formNodeId: draft.formNodeId
|
|
305
|
+
}).map((violation)=>_extends({
|
|
306
|
+
rule: 3,
|
|
307
|
+
code: violation.code,
|
|
308
|
+
message: violation.message
|
|
309
|
+
}, violation.nodeId ? {
|
|
310
|
+
nodeIds: aiModelNodeIds([
|
|
311
|
+
violation.nodeId
|
|
312
|
+
], sourceIds)
|
|
313
|
+
} : {}));
|
|
314
|
+
if (!draft.fields.length) {
|
|
315
|
+
violations.push({
|
|
316
|
+
rule: 3,
|
|
317
|
+
code: 'form-has-no-fields',
|
|
318
|
+
message: 'This form has no named fields, so a visitor has nothing to fill in. Draw the fields the brief asks for.'
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
if (draft.answer.routing.kind === 'list' && !formFieldsCanYieldAnEmail(draft.fields)) {
|
|
322
|
+
violations.push({
|
|
323
|
+
rule: 3,
|
|
324
|
+
code: 'list-routing-has-no-email-field',
|
|
325
|
+
message: 'This form proposes adding the people who send it to an email list, and it asks for no email address. Add an email field, or route its submissions to the Inbox.',
|
|
326
|
+
paths: [
|
|
327
|
+
'routing.kind'
|
|
328
|
+
]
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
return violations;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* The door's check for `extend`, and the draft each admitted tree made: the
|
|
335
|
+
* tree a generation returns is the object its last check saw, so the step
|
|
336
|
+
* writes exactly the draft the contract passed.
|
|
337
|
+
*/ export function aiFormDraftCheck(identity) {
|
|
338
|
+
const drafts = new WeakMap();
|
|
339
|
+
return {
|
|
340
|
+
extend: (tree, answer)=>{
|
|
341
|
+
const draft = aiFormDraft(tree, answer, identity);
|
|
342
|
+
drafts.set(tree, draft);
|
|
343
|
+
return aiFormDraftViolations(draft, identity.formId, tree.sourceIds);
|
|
344
|
+
},
|
|
345
|
+
draftFor: (tree)=>drafts.get(tree)
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* What a job says when the copy it asked for came back naming the form it
|
|
350
|
+
* was copied FROM (AGL-3024). The contract's own sentence follows it and
|
|
351
|
+
* names the consequence; this one names what to do about it.
|
|
352
|
+
*/ export const AI_FORM_COPY_UNBOUND_FAILURE = 'The copy of that form did not take on an identity of its own, so it is on ' + 'the site and not safe to collect with — delete it in Forms and try again.';
|
|
353
|
+
/**
|
|
354
|
+
* Whether the copy the platform just wrote is bound to ITSELF, asked of the
|
|
355
|
+
* document rather than of the answer — `null` when it is, and the sentence a
|
|
356
|
+
* person reads when it is not.
|
|
357
|
+
*
|
|
358
|
+
* ## Why a step that generated nothing still has something to check
|
|
359
|
+
*
|
|
360
|
+
* A "creates X from a copy of Y" plan reaches no model: the copy IS the
|
|
361
|
+
* output, so there is no answer for the doctrine to refuse and `extend`
|
|
362
|
+
* never runs. That left the one thing a copy can get wrong unasked. A form's
|
|
363
|
+
* design names its own form inside itself, and a copy that kept the source's
|
|
364
|
+
* name files every submission under the source — the console's form page
|
|
365
|
+
* banners exactly this, and the job reported Done beside it.
|
|
366
|
+
*
|
|
367
|
+
* So the check is `checkFormContract`, the SAME function the console's
|
|
368
|
+
* banner and the promotion route ask, run here on the stored copy. Not a
|
|
369
|
+
* second predicate shaped like it: a copy this one passed and that one
|
|
370
|
+
* refused would be a form the job called finished and the console called
|
|
371
|
+
* broken, which is the state this exists to make impossible.
|
|
372
|
+
*
|
|
373
|
+
* Narrowed to `form-id-unbound`, and only that, because it is the one
|
|
374
|
+
* violation duplication CAUSES. Every other code the contract can report —
|
|
375
|
+
* an unnamed field, a consent field the design lost — the copy inherited
|
|
376
|
+
* from a form the site already has and the member chose to copy; refusing
|
|
377
|
+
* those would be refusing to copy a form they can already see.
|
|
378
|
+
*/ export async function aiFormCopyUnboundFailure(firestore, copy) {
|
|
379
|
+
var _snapshot_data;
|
|
380
|
+
const snapshot = await firestore.collection('hosts').doc(copy.hostId).collection('forms').doc(copy.formId).get();
|
|
381
|
+
const form = (_snapshot_data = snapshot.data()) != null ? _snapshot_data : null;
|
|
382
|
+
const nodes = decodeStoredNodes(form == null ? void 0 : form.nodes);
|
|
383
|
+
const unbound = checkFormContract({
|
|
384
|
+
form,
|
|
385
|
+
formId: copy.formId,
|
|
386
|
+
nodes: nodes,
|
|
387
|
+
formNodeId: formNodeIdIn(nodes)
|
|
388
|
+
}).find((violation)=>violation.code === 'form-id-unbound');
|
|
389
|
+
return unbound ? `${AI_FORM_COPY_UNBOUND_FAILURE} ${unbound.message}` : null;
|
|
390
|
+
}
|
|
391
|
+
function listOf(items) {
|
|
392
|
+
return items.length < 2 ? items.join('') : `${items.slice(0, -1).join(', ')} and ${items[items.length - 1]}`;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* What the person decides next, in words the step writes itself: a lead
|
|
396
|
+
* routing to keep or switch off, the list a proposal could not store, and what
|
|
397
|
+
* the brief asked for that a form cannot collect. `null` when there is none.
|
|
398
|
+
*/ export function aiFormOutputNote(answer) {
|
|
399
|
+
const sentences = [];
|
|
400
|
+
if (answer.routing.kind === 'lead') {
|
|
401
|
+
sentences.push('Each submission with an email address also files a lead in CRM → Leads; you can switch that off on the form’s page.');
|
|
402
|
+
}
|
|
403
|
+
if (answer.routing.kind === 'list') {
|
|
404
|
+
const list = answer.routing.list ? `your "${answer.routing.list}" list` : 'an email list';
|
|
405
|
+
sentences.push(`Submissions arrive in the Inbox. To add the people who tick "${MARKETING_CONSENT_FORM_FIELD.label}" to ${list}, add an action on form submissions in Automation that enrolls them.`);
|
|
406
|
+
}
|
|
407
|
+
if (answer.cannotCollect.length) {
|
|
408
|
+
sentences.push(`Forms cannot collect ${listOf(answer.cannotCollect)} yet, so this form leaves ${answer.cannotCollect.length === 1 ? 'it' : 'them'} out.`);
|
|
409
|
+
}
|
|
410
|
+
return sentences.length ? sentences.join(' ') : null;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* The form job as the generation's user turn: the name, who fills the form
|
|
414
|
+
* in, the brief, and the confirmed plan.
|
|
415
|
+
*
|
|
416
|
+
* Who the form is for (AGL-2918) is the answer a contact form's FIELDS turn
|
|
417
|
+
* on — a trades business asks where the work is, a practice asks what the
|
|
418
|
+
* appointment is about — and it is not something a brief about a whole site
|
|
419
|
+
* says in a place the form can find. It rides here, in the turn, because it
|
|
420
|
+
* is one site's own words.
|
|
421
|
+
*
|
|
422
|
+
* Where submissions go rides here too, and it is NOT a hint: the step binds
|
|
423
|
+
* the routing to it whatever the model answers. It is stated so the model
|
|
424
|
+
* does not spend its answer proposing something that will be replaced, and
|
|
425
|
+
* so a form told its submissions are leads asks for the address that makes
|
|
426
|
+
* one.
|
|
427
|
+
*/ export function aiJobFormPrompt(job, plan, name, context = {}) {
|
|
428
|
+
var _context_audience;
|
|
429
|
+
const audience = ((_context_audience = context.audience) != null ? _context_audience : '').trim();
|
|
430
|
+
return [
|
|
431
|
+
`Form name: ${name}`,
|
|
432
|
+
audience ? `The people who fill it in: ${audience}` : '',
|
|
433
|
+
context.submissions ? `Where its submissions go: ${SUBMISSION_WORDS[context.submissions]}` : '',
|
|
434
|
+
aiJobBriefLine(job),
|
|
435
|
+
...aiPlanReferenceLines(plan)
|
|
436
|
+
].filter(Boolean).join('\n');
|
|
437
|
+
}
|
|
438
|
+
/** What each decided routing is, said to the model the way the tool says it. */ const SUBMISSION_WORDS = {
|
|
439
|
+
inbox: 'the Inbox, to be read — routing.kind is inbox',
|
|
440
|
+
lead: 'the Inbox, and each one with an email address is a sales lead — routing.kind is lead'
|
|
441
|
+
};
|
|
442
|
+
/** A form job is admitted for a site of the job's own org whose plan has forms, with a form to spare. */ export const aiFormJobAdmission = (context)=>aiDraftAdmissionRefusal(context.firestore, {
|
|
443
|
+
orgId: context.orgId,
|
|
444
|
+
hostId: context.hostId,
|
|
445
|
+
kind: 'form',
|
|
446
|
+
org: context.org
|
|
447
|
+
});
|
|
448
|
+
export function createAiJobFormStep(deps = {}) {
|
|
449
|
+
var _deps_readInventory, _deps_duplicate;
|
|
450
|
+
const readInventory = (_deps_readInventory = deps.readInventory) != null ? _deps_readInventory : readSiteInventory;
|
|
451
|
+
const duplicate = (_deps_duplicate = deps.duplicate) != null ? _deps_duplicate : duplicateResource;
|
|
452
|
+
return async ({ job, now, signal, firestore, modelFor })=>{
|
|
453
|
+
var _ref, _orgSnapshot_data;
|
|
454
|
+
const hostId = job.hostId;
|
|
455
|
+
if (!hostId) throw new Error('a form job names no site, and its admission refuses one');
|
|
456
|
+
const output = (draft, extra = {})=>_extends({
|
|
457
|
+
resource: 'form',
|
|
458
|
+
id: draft.id,
|
|
459
|
+
versionId: draft.versionId,
|
|
460
|
+
hostId,
|
|
461
|
+
hostSubdomain: draft.hostSubdomain,
|
|
462
|
+
label: draft.name
|
|
463
|
+
}, extra.load ? {
|
|
464
|
+
load: extra.load
|
|
465
|
+
} : {}, extra.note ? {
|
|
466
|
+
note: extra.note
|
|
467
|
+
} : {});
|
|
468
|
+
// The switch's answer for this job, else the routing table's (AGL-2942).
|
|
469
|
+
const model = (_ref = modelFor == null ? void 0 : modelFor('job.form')) != null ? _ref : aiModelForStep('job.form');
|
|
470
|
+
// A run cut off after its draft was written reports that draft, found by the id the job recorded.
|
|
471
|
+
const draftId = aiJobDraftId(job, 'form');
|
|
472
|
+
const written = await readAiDraft(firestore, {
|
|
473
|
+
kind: 'form',
|
|
474
|
+
hostId,
|
|
475
|
+
id: draftId
|
|
476
|
+
});
|
|
477
|
+
if (written) return aiUnspentOutcome(model, {
|
|
478
|
+
outputs: [
|
|
479
|
+
output(written)
|
|
480
|
+
]
|
|
481
|
+
});
|
|
482
|
+
const [inventory, orgSnapshot] = await Promise.all([
|
|
483
|
+
readInventory(job.orgId, hostId, {
|
|
484
|
+
firestore
|
|
485
|
+
}),
|
|
486
|
+
firestore.collection('orgs').doc(job.orgId).get()
|
|
487
|
+
]);
|
|
488
|
+
const org = (_orgSnapshot_data = orgSnapshot.data()) != null ? _orgSnapshot_data : null;
|
|
489
|
+
const plan = aiConfirmedPlan(job);
|
|
490
|
+
const creation = aiPlanCreation(plan, 'form');
|
|
491
|
+
const name = (creation == null ? void 0 : creation.name) || AI_JOB_FORM_DEFAULT_NAME;
|
|
492
|
+
// The plan starts from a copy of a form the site has (rule 15): the copy
|
|
493
|
+
// is the draft, and nothing is generated. A source gone since the plan
|
|
494
|
+
// was made is built from the brief instead.
|
|
495
|
+
if ((creation == null ? void 0 : creation.duplicateOf) && inventory.forms.some((form)=>form.id === creation.duplicateOf)) {
|
|
496
|
+
const copy = await duplicate('form', {
|
|
497
|
+
orgId: job.orgId,
|
|
498
|
+
hostId,
|
|
499
|
+
sourceId: creation.duplicateOf,
|
|
500
|
+
name,
|
|
501
|
+
uid: job.createdBy,
|
|
502
|
+
org: org
|
|
503
|
+
});
|
|
504
|
+
if (copy.ok) {
|
|
505
|
+
// The copy is the whole output, so the contract is asked of it here
|
|
506
|
+
// or nowhere: a copy still bound to its source is not a form this
|
|
507
|
+
// job may report as built (AGL-3024).
|
|
508
|
+
const unbound = await aiFormCopyUnboundFailure(firestore, {
|
|
509
|
+
hostId,
|
|
510
|
+
formId: copy.id
|
|
511
|
+
});
|
|
512
|
+
if (unbound) return _extends({}, aiUnspentOutcome(model), {
|
|
513
|
+
failure: unbound
|
|
514
|
+
});
|
|
515
|
+
const hostSubdomain = await aiSiteSubdomain(firestore, hostId);
|
|
516
|
+
return aiUnspentOutcome(model, {
|
|
517
|
+
outputs: [
|
|
518
|
+
output({
|
|
519
|
+
id: copy.id,
|
|
520
|
+
versionId: copy.versionId,
|
|
521
|
+
name: copy.name,
|
|
522
|
+
hostSubdomain
|
|
523
|
+
})
|
|
524
|
+
]
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
if (copy.ok === false && copy.status === 403) {
|
|
528
|
+
return aiUnspentOutcome(model, {
|
|
529
|
+
review: aiLimitReview(copy.error)
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
const allowance = await aiDraftAllowanceRefusal(firestore, {
|
|
534
|
+
kind: 'form',
|
|
535
|
+
hostId,
|
|
536
|
+
org
|
|
537
|
+
});
|
|
538
|
+
if (allowance) return aiUnspentOutcome(model, {
|
|
539
|
+
review: aiLimitReview(allowance)
|
|
540
|
+
});
|
|
541
|
+
// What the person answered about this form, where they were asked
|
|
542
|
+
// (AGL-2918): a scaffold's form unit carries the guided start's inputs.
|
|
543
|
+
const decisions = {
|
|
544
|
+
submissions: aiSiteSubmissions(job.inputs)
|
|
545
|
+
};
|
|
546
|
+
const { audience } = aiSiteWords(job.inputs);
|
|
547
|
+
const check = aiFormDraftCheck({
|
|
548
|
+
formId: draftId,
|
|
549
|
+
name,
|
|
550
|
+
decisions
|
|
551
|
+
});
|
|
552
|
+
const result = await runValidatedGeneration('form', _extends({
|
|
553
|
+
step: 'job.form',
|
|
554
|
+
model,
|
|
555
|
+
instructions: AI_JOB_FORM_INSTRUCTIONS,
|
|
556
|
+
inventory,
|
|
557
|
+
messages: [
|
|
558
|
+
{
|
|
559
|
+
role: 'user',
|
|
560
|
+
content: aiJobFormPrompt(job, plan, name, {
|
|
561
|
+
audience,
|
|
562
|
+
submissions: decisions.submissions
|
|
563
|
+
})
|
|
564
|
+
}
|
|
565
|
+
],
|
|
566
|
+
tool: AI_JOB_FORM_TOOL,
|
|
567
|
+
maxTokens: AI_JOB_FORM_STEP_BUDGET.maxTokens(model),
|
|
568
|
+
thinking: 'off',
|
|
569
|
+
extend: check.extend
|
|
570
|
+
}, signal ? {
|
|
571
|
+
signal
|
|
572
|
+
} : {}));
|
|
573
|
+
const spent = aiGenerationSpent(result);
|
|
574
|
+
if (result.status === 'refused') return _extends({}, spent, {
|
|
575
|
+
refused: true
|
|
576
|
+
});
|
|
577
|
+
if (result.status === 'needs_input') return _extends({}, spent, {
|
|
578
|
+
review: aiDoctrineReview(result)
|
|
579
|
+
});
|
|
580
|
+
const draft = check.draftFor(result.value);
|
|
581
|
+
if (!draft) throw new Error('a form the doctrine admitted has no draft from its check');
|
|
582
|
+
const write = await writeAiDraft(firestore, {
|
|
583
|
+
kind: 'form',
|
|
584
|
+
hostId,
|
|
585
|
+
id: draftId,
|
|
586
|
+
uid: job.createdBy,
|
|
587
|
+
org,
|
|
588
|
+
name,
|
|
589
|
+
nodes: draft.nodes,
|
|
590
|
+
form: {
|
|
591
|
+
rootId: draft.rootId,
|
|
592
|
+
formNodeId: draft.formNodeId,
|
|
593
|
+
fields: draft.fields,
|
|
594
|
+
consentFieldName: draft.consentFieldName,
|
|
595
|
+
routing: draft.routing
|
|
596
|
+
},
|
|
597
|
+
now
|
|
598
|
+
});
|
|
599
|
+
if (write.ok === false) {
|
|
600
|
+
if (write.status === 404) throw new Error(`site ${hostId} vanished while its form was generated`);
|
|
601
|
+
return _extends({}, spent, {
|
|
602
|
+
review: aiLimitReview(write.error)
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
// What the person decides next, then the facts the brief did not give (AGL-3056).
|
|
606
|
+
const note = [
|
|
607
|
+
aiFormOutputNote(draft.answer),
|
|
608
|
+
aiBracketedFactsNote({
|
|
609
|
+
tree: {
|
|
610
|
+
rootId: result.value.rootId,
|
|
611
|
+
nodes: result.value.nodes
|
|
612
|
+
},
|
|
613
|
+
inventory
|
|
614
|
+
})
|
|
615
|
+
].filter(Boolean).join(' ');
|
|
616
|
+
return _extends({}, spent, {
|
|
617
|
+
outputs: [
|
|
618
|
+
output(write, {
|
|
619
|
+
load: result.value.load,
|
|
620
|
+
note
|
|
621
|
+
})
|
|
622
|
+
]
|
|
623
|
+
});
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
export const runAiJobFormStep = createAiJobFormStep();
|
|
627
|
+
/** Registers the form step and the check a form job passes before it is created or resumed. */ export function registerAiFormJob() {
|
|
628
|
+
registerAiJobStep('form', runAiJobFormStep, {
|
|
629
|
+
minimumMs: AI_JOB_FORM_STEP_MINIMUM_MS
|
|
630
|
+
});
|
|
631
|
+
registerAiJobAdmission('form', aiFormJobAdmission);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
//# sourceMappingURL=ai-job-form-step.js.map
|