@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,860 @@
|
|
|
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 { ACTION_MAX_CONDITIONS, ACTION_MAX_STEPS, CONTACT_TAG_MAX_LENGTH, FLOW_TIMED_OUT_FIELD, FLOW_WAIT_MAX_MINUTES, FLOW_WAIT_MIN_MINUTES, HOST_ACTION_STEP_LABELS, TRIGGER_COMBINATORS, TRIGGER_CONDITION_OPS } from "@aglyn/aglyn/app-utils/actions";
|
|
18
|
+
import { CONTACT_LIFECYCLE_STAGE_LABELS, CONTACT_LIFECYCLE_STAGES, CRM_ACTIVITY_KINDS, CRM_TASK_KINDS, CRM_TASK_MAX_DUE_DAYS } from "@aglyn/aglyn/app-utils/crm";
|
|
19
|
+
import { HOST_EVENT_PAYLOAD_KEYS, HOST_EVENT_TYPES } from "@aglyn/aglyn/app-utils/workflows";
|
|
20
|
+
import { AI_AUTOMATION_NEED_LABELS, AI_AUTOMATION_STEP_NEEDS, AI_AUTOMATION_STEP_TYPES, AI_AUTOMATION_TRIGGER_NEEDS, AI_AUTOMATION_UNSUPPORTED, AI_AUTOMATION_UNSUPPORTED_NEED, aiAutomationTriggerLabel } from "../model/ai-workflow-job.js";
|
|
21
|
+
import { HOSTILE_TEXT } from "../runtime/ai-node-tree.js";
|
|
22
|
+
/**
|
|
23
|
+
* The two tools a `workflow` job answers through (AGL-2919).
|
|
24
|
+
*
|
|
25
|
+
* `submit_automation` carries one automation in the Actions editor's own
|
|
26
|
+
* vocabulary — a trigger from the host events, conditions over the fields the
|
|
27
|
+
* trigger carries, and steps from the automation step types — with every
|
|
28
|
+
* record it names written as WORDS. The step resolves those words against the
|
|
29
|
+
* site after the answer, so the model is never shown the site's lists,
|
|
30
|
+
* campaigns, workflows, webhooks or pipeline stages, and never writes an id it
|
|
31
|
+
* could only have invented.
|
|
32
|
+
*
|
|
33
|
+
* `submit_explanation` carries a plain-words account of one automation, or of
|
|
34
|
+
* why one of its runs failed.
|
|
35
|
+
*
|
|
36
|
+
* Both schemas are strict: every object forbids extra keys and requires every
|
|
37
|
+
* key it has, and nothing in either is a `null`. Where a step may go without
|
|
38
|
+
* something, the absence is an empty list or an empty string: a step that
|
|
39
|
+
* always runs has an empty `when`, a notEmpty condition compares against
|
|
40
|
+
* nothing, and an answer that builds an automation leaves `unsupported`
|
|
41
|
+
* empty. Bounds a strict schema cannot state are stated in the descriptions
|
|
42
|
+
* and held by the readers below, whose refusals name the field so the one
|
|
43
|
+
* re-ask can fix it.
|
|
44
|
+
*
|
|
45
|
+
* A provider that constrains decoding compiles every strict schema of a
|
|
46
|
+
* request into a grammar, and refuses one whose grammar grows past its size
|
|
47
|
+
* (`AiToolSchemaLimits`). So the steps' union carries as little repetition as
|
|
48
|
+
* a grammar can be made to hold:
|
|
49
|
+
*
|
|
50
|
+
* - a step is its guard and its action, `{ when, action }`, so the condition
|
|
51
|
+
* is compiled once for the whole union instead of once per variant;
|
|
52
|
+
* - a variant serves every step type that carries the same fields, named for
|
|
53
|
+
* what they hold: the six steps that name a record share `reference`, and
|
|
54
|
+
* the three that carry one line share `text`;
|
|
55
|
+
* - every field stays required and every vocabulary stays an enum, so the
|
|
56
|
+
* model is still decoded into the Actions editor's words.
|
|
57
|
+
*
|
|
58
|
+
* Ten variants carry all seventeen step types, and the reader below maps the
|
|
59
|
+
* shared fields back onto the step's own key.
|
|
60
|
+
*/ export const AI_AUTOMATION_TOOL_NAME = 'submit_automation';
|
|
61
|
+
export const AI_WORKFLOW_EXPLANATION_TOOL_NAME = 'submit_explanation';
|
|
62
|
+
/** The longest automation name the Actions editor stores. */ export const AI_AUTOMATION_NAME_MAX_CHARS = 60;
|
|
63
|
+
/** The longest subject the executor sends. */ export const AI_AUTOMATION_SUBJECT_MAX_CHARS = 200;
|
|
64
|
+
/** The longest email text the executor sends. */ export const AI_AUTOMATION_BODY_MAX_CHARS = 5000;
|
|
65
|
+
/** The longest title, message or record name a step carries. */ export const AI_AUTOMATION_TEXT_MAX_CHARS = 300;
|
|
66
|
+
/** The longest words naming a record. */ export const AI_AUTOMATION_REFERENCE_MAX_CHARS = 100;
|
|
67
|
+
/** The longest condition value. */ export const AI_AUTOMATION_VALUE_MAX_CHARS = 200;
|
|
68
|
+
/** The most notes an answer keeps, and the longest. */ export const AI_AUTOMATION_NOTES_MAX = 3;
|
|
69
|
+
export const AI_AUTOMATION_NOTE_MAX_CHARS = 300;
|
|
70
|
+
/**
|
|
71
|
+
* The longest a whole answer may be, written out as JSON: what the routing
|
|
72
|
+
* ceiling for `job.workflow` holds at three characters a token with as much
|
|
73
|
+
* again to think in (`ai-job-workflow-step.spec.ts` measures it). Ten steps
|
|
74
|
+
* with two emails of a paragraph or two each come to about 2,400, each step
|
|
75
|
+
* carrying only its own fields.
|
|
76
|
+
*/ export const AI_AUTOMATION_ANSWER_MAX_CHARS = 6000;
|
|
77
|
+
/** The explanation's bounds. */ export const AI_WORKFLOW_SUMMARY_MAX_CHARS = 400;
|
|
78
|
+
export const AI_WORKFLOW_POINTS_MAX = 8;
|
|
79
|
+
export const AI_WORKFLOW_SUGGESTIONS_MAX = 4;
|
|
80
|
+
export const AI_WORKFLOW_LINE_MAX_CHARS = 300;
|
|
81
|
+
const SEVERITIES = [
|
|
82
|
+
'info',
|
|
83
|
+
'success',
|
|
84
|
+
'warning',
|
|
85
|
+
'error'
|
|
86
|
+
];
|
|
87
|
+
/**
|
|
88
|
+
* What the schema defines once and refers to where it is used: a condition,
|
|
89
|
+
* which the trigger and every step's guard share, and the guard itself.
|
|
90
|
+
*/ const DEFINITIONS = {
|
|
91
|
+
condition: {
|
|
92
|
+
type: 'object',
|
|
93
|
+
additionalProperties: false,
|
|
94
|
+
required: [
|
|
95
|
+
'field',
|
|
96
|
+
'op',
|
|
97
|
+
'value'
|
|
98
|
+
],
|
|
99
|
+
properties: {
|
|
100
|
+
field: {
|
|
101
|
+
type: 'string',
|
|
102
|
+
description: 'The field of the event the condition reads, as the trigger lists its fields.'
|
|
103
|
+
},
|
|
104
|
+
op: {
|
|
105
|
+
type: 'string',
|
|
106
|
+
enum: [
|
|
107
|
+
...TRIGGER_CONDITION_OPS
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
value: {
|
|
111
|
+
type: 'string',
|
|
112
|
+
description: 'What equals or contains compares against; empty for notEmpty.'
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
event: {
|
|
117
|
+
type: 'string',
|
|
118
|
+
enum: [
|
|
119
|
+
...HOST_EVENT_TYPES
|
|
120
|
+
],
|
|
121
|
+
description: 'One of the things that happen on a site.'
|
|
122
|
+
},
|
|
123
|
+
// A list rather than a condition or `null`: a step goes without one by an
|
|
124
|
+
// empty list, which costs no union.
|
|
125
|
+
when: {
|
|
126
|
+
type: 'array',
|
|
127
|
+
description: 'At most one condition: the step runs only when it holds. Empty when the step always runs.',
|
|
128
|
+
items: {
|
|
129
|
+
$ref: '#/$defs/condition'
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
/** The steps that name one of the site's records, which they all name the same way. */ const REFERENCE_STEPS = [
|
|
134
|
+
'enrollList',
|
|
135
|
+
'assignCampaign',
|
|
136
|
+
'runWorkflow',
|
|
137
|
+
'datasetAppend',
|
|
138
|
+
'updateDataset',
|
|
139
|
+
'webhookPost'
|
|
140
|
+
];
|
|
141
|
+
/** The steps whose only field is the one line they carry. */ const TEXT_STEPS = [
|
|
142
|
+
'notifyAdmins',
|
|
143
|
+
'addContactTag',
|
|
144
|
+
'assignContactOwner'
|
|
145
|
+
];
|
|
146
|
+
/** The key each `reference` step fills in the answer the reader gives back. */ const REFERENCE_KEY = {
|
|
147
|
+
enrollList: 'list',
|
|
148
|
+
assignCampaign: 'campaign',
|
|
149
|
+
runWorkflow: 'workflow',
|
|
150
|
+
datasetAppend: 'dataset',
|
|
151
|
+
updateDataset: 'dataset',
|
|
152
|
+
webhookPost: 'webhook'
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* The key each step's one line fills in the answer the reader gives back. Six
|
|
156
|
+
* step types carry one line between them, so the schema asks for all six
|
|
157
|
+
* under `text` and the reader puts each back where the automation keeps it.
|
|
158
|
+
*/ const TEXT_KEY = {
|
|
159
|
+
notifyAdmins: 'title',
|
|
160
|
+
addContactTag: 'tag',
|
|
161
|
+
assignContactOwner: 'owner',
|
|
162
|
+
siteAlert: 'message',
|
|
163
|
+
createCrmTask: 'title',
|
|
164
|
+
logCrmActivity: 'body'
|
|
165
|
+
};
|
|
166
|
+
const minutes = (what)=>({
|
|
167
|
+
type: 'integer',
|
|
168
|
+
description: `${what}, in whole minutes from ${FLOW_WAIT_MIN_MINUTES} to ${FLOW_WAIT_MAX_MINUTES}; an hour is 60 and a day 1440.`
|
|
169
|
+
});
|
|
170
|
+
/**
|
|
171
|
+
* One variant of the steps' union: the step types it serves, and the fields
|
|
172
|
+
* every one of them carries, each required and never nullable. A type belongs
|
|
173
|
+
* to exactly one variant, so the type a step names settles which fields it
|
|
174
|
+
* writes.
|
|
175
|
+
*/ function stepVariant(types, fields) {
|
|
176
|
+
return {
|
|
177
|
+
type: 'object',
|
|
178
|
+
additionalProperties: false,
|
|
179
|
+
required: [
|
|
180
|
+
'type',
|
|
181
|
+
...Object.keys(fields)
|
|
182
|
+
],
|
|
183
|
+
properties: _extends({
|
|
184
|
+
type: {
|
|
185
|
+
type: 'string',
|
|
186
|
+
enum: [
|
|
187
|
+
...types
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
}, fields)
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
/** Every step type an automation may carry, grouped by the fields it needs. */ export const AI_AUTOMATION_STEP_VARIANTS = [
|
|
194
|
+
stepVariant([
|
|
195
|
+
...REFERENCE_STEPS
|
|
196
|
+
], {
|
|
197
|
+
reference: {
|
|
198
|
+
type: 'string',
|
|
199
|
+
description: 'The record the step acts on — the email list, campaign, workflow, dataset or outbound webhook — in the words of the description, such as "newsletter". Never an id.'
|
|
200
|
+
}
|
|
201
|
+
}),
|
|
202
|
+
stepVariant([
|
|
203
|
+
...TEXT_STEPS
|
|
204
|
+
], {
|
|
205
|
+
text: {
|
|
206
|
+
type: 'string',
|
|
207
|
+
description: `The one line the step carries: for notifyAdmins what the admins read, for addContactTag the tag (at most ${CONTACT_TAG_MAX_LENGTH} characters), and for assignContactOwner "round robin" or the teammate’s email address the description gives.`
|
|
208
|
+
}
|
|
209
|
+
}),
|
|
210
|
+
stepVariant([
|
|
211
|
+
'sendEmail'
|
|
212
|
+
], {
|
|
213
|
+
subject: {
|
|
214
|
+
type: 'string',
|
|
215
|
+
description: 'The subject line.'
|
|
216
|
+
},
|
|
217
|
+
body: {
|
|
218
|
+
type: 'string',
|
|
219
|
+
description: 'The email, as plain text.'
|
|
220
|
+
},
|
|
221
|
+
toField: {
|
|
222
|
+
type: 'string',
|
|
223
|
+
description: 'The event field holding the address: "email" unless the description names another.'
|
|
224
|
+
}
|
|
225
|
+
}),
|
|
226
|
+
stepVariant([
|
|
227
|
+
'siteAlert'
|
|
228
|
+
], {
|
|
229
|
+
text: {
|
|
230
|
+
type: 'string',
|
|
231
|
+
description: 'What the visitor reads.'
|
|
232
|
+
},
|
|
233
|
+
severity: {
|
|
234
|
+
type: 'string',
|
|
235
|
+
enum: [
|
|
236
|
+
...SEVERITIES
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
}),
|
|
240
|
+
stepVariant([
|
|
241
|
+
'wait'
|
|
242
|
+
], {
|
|
243
|
+
minutes: minutes('How long to wait')
|
|
244
|
+
}),
|
|
245
|
+
stepVariant([
|
|
246
|
+
'waitForEvent'
|
|
247
|
+
], {
|
|
248
|
+
event: {
|
|
249
|
+
$ref: '#/$defs/event'
|
|
250
|
+
},
|
|
251
|
+
minutes: minutes('When to give up')
|
|
252
|
+
}),
|
|
253
|
+
stepVariant([
|
|
254
|
+
'exitFlow'
|
|
255
|
+
], {}),
|
|
256
|
+
stepVariant([
|
|
257
|
+
'setContactStage'
|
|
258
|
+
], {
|
|
259
|
+
stage: {
|
|
260
|
+
type: 'string',
|
|
261
|
+
enum: [
|
|
262
|
+
...CONTACT_LIFECYCLE_STAGES
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
}),
|
|
266
|
+
stepVariant([
|
|
267
|
+
'createCrmTask'
|
|
268
|
+
], {
|
|
269
|
+
text: {
|
|
270
|
+
type: 'string',
|
|
271
|
+
description: 'The task.'
|
|
272
|
+
},
|
|
273
|
+
taskKind: {
|
|
274
|
+
type: 'string',
|
|
275
|
+
enum: [
|
|
276
|
+
...CRM_TASK_KINDS
|
|
277
|
+
]
|
|
278
|
+
},
|
|
279
|
+
dueInDays: {
|
|
280
|
+
type: 'integer',
|
|
281
|
+
description: `Days from the run, 0 for today, at most ${CRM_TASK_MAX_DUE_DAYS}.`
|
|
282
|
+
}
|
|
283
|
+
}),
|
|
284
|
+
stepVariant([
|
|
285
|
+
'logCrmActivity'
|
|
286
|
+
], {
|
|
287
|
+
activityKind: {
|
|
288
|
+
type: 'string',
|
|
289
|
+
enum: [
|
|
290
|
+
...CRM_ACTIVITY_KINDS
|
|
291
|
+
]
|
|
292
|
+
},
|
|
293
|
+
text: {
|
|
294
|
+
type: 'string',
|
|
295
|
+
description: 'What happened.'
|
|
296
|
+
}
|
|
297
|
+
})
|
|
298
|
+
];
|
|
299
|
+
/** The automation tool. The same bytes on every request, so it sits inside the cached prefix. */ export function aiAutomationTool() {
|
|
300
|
+
return {
|
|
301
|
+
name: AI_AUTOMATION_TOOL_NAME,
|
|
302
|
+
description: `Submit one automation: its trigger, the conditions on it, and its steps in order. Written out, the whole automation is at most ${AI_AUTOMATION_ANSWER_MAX_CHARS} characters, so keep its emails short.`,
|
|
303
|
+
strict: true,
|
|
304
|
+
inputSchema: {
|
|
305
|
+
type: 'object',
|
|
306
|
+
additionalProperties: false,
|
|
307
|
+
required: [
|
|
308
|
+
'name',
|
|
309
|
+
'trigger',
|
|
310
|
+
'steps',
|
|
311
|
+
'notes',
|
|
312
|
+
'unsupported'
|
|
313
|
+
],
|
|
314
|
+
properties: {
|
|
315
|
+
name: {
|
|
316
|
+
type: 'string',
|
|
317
|
+
description: `A short name for the automation, at most ${AI_AUTOMATION_NAME_MAX_CHARS} characters.`
|
|
318
|
+
},
|
|
319
|
+
trigger: {
|
|
320
|
+
type: 'object',
|
|
321
|
+
additionalProperties: false,
|
|
322
|
+
required: [
|
|
323
|
+
'event',
|
|
324
|
+
'conditions',
|
|
325
|
+
'combinator'
|
|
326
|
+
],
|
|
327
|
+
properties: {
|
|
328
|
+
event: {
|
|
329
|
+
$ref: '#/$defs/event'
|
|
330
|
+
},
|
|
331
|
+
conditions: {
|
|
332
|
+
type: 'array',
|
|
333
|
+
description: `What the event must meet: at most ${ACTION_MAX_CONDITIONS} conditions, empty when it runs every time.`,
|
|
334
|
+
items: {
|
|
335
|
+
$ref: '#/$defs/condition'
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
combinator: {
|
|
339
|
+
type: 'string',
|
|
340
|
+
enum: [
|
|
341
|
+
...TRIGGER_COMBINATORS
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
steps: {
|
|
347
|
+
type: 'array',
|
|
348
|
+
description: `The steps in order, at most ${ACTION_MAX_STEPS}. Each is when it runs and what it does, and the action carries only the fields its type takes. Empty only with unsupported.`,
|
|
349
|
+
items: {
|
|
350
|
+
type: 'object',
|
|
351
|
+
additionalProperties: false,
|
|
352
|
+
required: [
|
|
353
|
+
'when',
|
|
354
|
+
'action'
|
|
355
|
+
],
|
|
356
|
+
properties: {
|
|
357
|
+
when: {
|
|
358
|
+
$ref: '#/$defs/when'
|
|
359
|
+
},
|
|
360
|
+
action: {
|
|
361
|
+
anyOf: AI_AUTOMATION_STEP_VARIANTS
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
notes: {
|
|
367
|
+
type: 'array',
|
|
368
|
+
description: `What the person must decide that the automation cannot hold; at most ${AI_AUTOMATION_NOTES_MAX} short sentences.`,
|
|
369
|
+
items: {
|
|
370
|
+
type: 'string'
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
unsupported: {
|
|
374
|
+
type: 'string',
|
|
375
|
+
enum: [
|
|
376
|
+
'',
|
|
377
|
+
...AI_AUTOMATION_UNSUPPORTED
|
|
378
|
+
],
|
|
379
|
+
description: 'Why no automation can be built from this description; empty when one is built.'
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
$defs: DEFINITIONS
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
/** The explanation tool. */ export function aiWorkflowExplanationTool() {
|
|
387
|
+
return {
|
|
388
|
+
name: AI_WORKFLOW_EXPLANATION_TOOL_NAME,
|
|
389
|
+
description: 'Submit the explanation, in plain words for someone who does not write code.',
|
|
390
|
+
strict: true,
|
|
391
|
+
inputSchema: {
|
|
392
|
+
type: 'object',
|
|
393
|
+
additionalProperties: false,
|
|
394
|
+
required: [
|
|
395
|
+
'summary',
|
|
396
|
+
'points',
|
|
397
|
+
'suggestions'
|
|
398
|
+
],
|
|
399
|
+
properties: {
|
|
400
|
+
summary: {
|
|
401
|
+
type: 'string',
|
|
402
|
+
description: `One or two sentences, at most ${AI_WORKFLOW_SUMMARY_MAX_CHARS} characters.`
|
|
403
|
+
},
|
|
404
|
+
points: {
|
|
405
|
+
type: 'array',
|
|
406
|
+
description: `At most ${AI_WORKFLOW_POINTS_MAX}, one sentence each.`,
|
|
407
|
+
items: {
|
|
408
|
+
type: 'string'
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
suggestions: {
|
|
412
|
+
type: 'array',
|
|
413
|
+
description: `At most ${AI_WORKFLOW_SUGGESTIONS_MAX}, one sentence each; empty when there is nothing to suggest.`,
|
|
414
|
+
items: {
|
|
415
|
+
type: 'string'
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
/** The codes that say an answer could not be read as an automation at all. */ export const AI_AUTOMATION_UNREADABLE_CODES = [
|
|
423
|
+
'automation-shape',
|
|
424
|
+
'automation-trigger',
|
|
425
|
+
'automation-step-type'
|
|
426
|
+
];
|
|
427
|
+
/** The codes that say an answer is larger than an automation may be. */ export const AI_AUTOMATION_OVERSIZE_CODES = [
|
|
428
|
+
'automation-too-many-steps',
|
|
429
|
+
'automation-too-many-conditions',
|
|
430
|
+
'automation-too-long'
|
|
431
|
+
];
|
|
432
|
+
/** The address field a step reads when it names none. */ const DEFAULT_TO_FIELD = 'email';
|
|
433
|
+
const FIELD_NAME = /^[A-Za-z_][A-Za-z0-9_.-]{0,63}$/;
|
|
434
|
+
const EMAIL_ADDRESS = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
435
|
+
const ROUND_ROBIN = /^\s*round[\s-]*robin\s*$/i;
|
|
436
|
+
function isRecord(value) {
|
|
437
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
438
|
+
}
|
|
439
|
+
/** A string trimmed to one space between words, or `null` for none. */ function textOf(value) {
|
|
440
|
+
if (typeof value !== 'string') return null;
|
|
441
|
+
const clean = value.replace(/[ \t]+/g, ' ').trim();
|
|
442
|
+
return clean ? clean : null;
|
|
443
|
+
}
|
|
444
|
+
/** The fields a trigger's conditions and its steps' guards may read. */ function fieldsFor(event) {
|
|
445
|
+
// A form submission carries every field the form collects, which no fixed
|
|
446
|
+
// list names, so any field name is readable on it.
|
|
447
|
+
if (event === 'formSubmission') return null;
|
|
448
|
+
const keys = HOST_EVENT_PAYLOAD_KEYS[event];
|
|
449
|
+
return (keys == null ? void 0 : keys.length) ? keys : null;
|
|
450
|
+
}
|
|
451
|
+
function refuse(reader, code, message, path, value) {
|
|
452
|
+
reader.violations.push({
|
|
453
|
+
rule: null,
|
|
454
|
+
code,
|
|
455
|
+
message,
|
|
456
|
+
paths: [
|
|
457
|
+
path
|
|
458
|
+
]
|
|
459
|
+
});
|
|
460
|
+
if (reader.offending.length < 6) reader.offending.push([
|
|
461
|
+
path,
|
|
462
|
+
value
|
|
463
|
+
]);
|
|
464
|
+
}
|
|
465
|
+
function readCondition(reader, raw, path, event, guard) {
|
|
466
|
+
if (!isRecord(raw)) {
|
|
467
|
+
refuse(reader, 'automation-shape', 'A condition is not an object with a field, an op and a value.', path, raw);
|
|
468
|
+
return null;
|
|
469
|
+
}
|
|
470
|
+
const field = textOf(raw['field']);
|
|
471
|
+
const op = raw['op'];
|
|
472
|
+
if (!field || !FIELD_NAME.test(field)) {
|
|
473
|
+
refuse(reader, 'automation-condition', 'Name the event field the condition reads.', path, raw);
|
|
474
|
+
return null;
|
|
475
|
+
}
|
|
476
|
+
if (!TRIGGER_CONDITION_OPS.includes(op)) {
|
|
477
|
+
refuse(reader, 'automation-condition', `The condition on "${field}" needs equals, contains or notEmpty.`, path, raw);
|
|
478
|
+
return null;
|
|
479
|
+
}
|
|
480
|
+
if (event === 'formSubmission' && field === 'formId') {
|
|
481
|
+
refuse(reader, 'automation-condition', 'A form submission names its form by formName, the form’s name as the site lists it.', path, raw);
|
|
482
|
+
return null;
|
|
483
|
+
}
|
|
484
|
+
// A step's guard may also read whether the wait before it ran out of time.
|
|
485
|
+
const readable = fieldsFor(event);
|
|
486
|
+
if (readable && !readable.includes(field) && !(guard && field === FLOW_TIMED_OUT_FIELD)) {
|
|
487
|
+
refuse(reader, 'automation-condition', `The trigger "${aiAutomationTriggerLabel(event)}" does not carry "${field}". It carries: ${readable.join(', ')}.`, path, raw);
|
|
488
|
+
return null;
|
|
489
|
+
}
|
|
490
|
+
const value = textOf(raw['value']);
|
|
491
|
+
if (op !== 'notEmpty' && !value) {
|
|
492
|
+
refuse(reader, 'automation-condition', `The condition on "${field}" needs the value it compares against.`, path, raw);
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
if (value && value.length > AI_AUTOMATION_VALUE_MAX_CHARS) {
|
|
496
|
+
refuse(reader, 'automation-too-long', `The value the condition on "${field}" compares against is too long.`, path, raw);
|
|
497
|
+
return null;
|
|
498
|
+
}
|
|
499
|
+
if (field === 'lifecycleStage' || field === 'previousStage') {
|
|
500
|
+
const stage = value ? lifecycleStageOf(value) : null;
|
|
501
|
+
if (op !== 'notEmpty' && !stage) {
|
|
502
|
+
refuse(reader, 'automation-condition', `A lifecycle stage is one of: ${CONTACT_LIFECYCLE_STAGES.join(', ')}.`, path, raw);
|
|
503
|
+
return null;
|
|
504
|
+
}
|
|
505
|
+
return {
|
|
506
|
+
field,
|
|
507
|
+
op: op,
|
|
508
|
+
value: op === 'notEmpty' ? null : stage
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
return {
|
|
512
|
+
field,
|
|
513
|
+
op: op,
|
|
514
|
+
value: op === 'notEmpty' ? null : value
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
/** A lifecycle stage by its id or its label, case aside. */ export function lifecycleStageOf(value) {
|
|
518
|
+
var _CONTACT_LIFECYCLE_STAGES_find;
|
|
519
|
+
const wanted = value.trim().toLowerCase();
|
|
520
|
+
return (_CONTACT_LIFECYCLE_STAGES_find = CONTACT_LIFECYCLE_STAGES.find((stage)=>stage === wanted || CONTACT_LIFECYCLE_STAGE_LABELS[stage].toLowerCase() === wanted)) != null ? _CONTACT_LIFECYCLE_STAGES_find : null;
|
|
521
|
+
}
|
|
522
|
+
function requireText(reader, step, key, max, path, what) {
|
|
523
|
+
const value = textOf(step[key]);
|
|
524
|
+
if (!value) {
|
|
525
|
+
refuse(reader, 'automation-step-field', `${what} needs ${key}.`, path, step);
|
|
526
|
+
return null;
|
|
527
|
+
}
|
|
528
|
+
if (value.length > max) {
|
|
529
|
+
refuse(reader, 'automation-too-long', `${what}: ${key} is longer than ${max} characters.`, path, step);
|
|
530
|
+
return null;
|
|
531
|
+
}
|
|
532
|
+
if (HOSTILE_TEXT.test(value)) {
|
|
533
|
+
refuse(reader, 'automation-markup', `${what}: write ${key} as plain text, with no HTML or script.`, path, step);
|
|
534
|
+
return null;
|
|
535
|
+
}
|
|
536
|
+
return value;
|
|
537
|
+
}
|
|
538
|
+
function wholeNumber(value) {
|
|
539
|
+
return typeof value === 'number' && Number.isInteger(value) ? value : null;
|
|
540
|
+
}
|
|
541
|
+
function readStep(reader, raw, index, event, capabilities) {
|
|
542
|
+
const path = `steps[${index}]`;
|
|
543
|
+
if (!isRecord(raw)) {
|
|
544
|
+
refuse(reader, 'automation-shape', `Step ${index + 1} is not an object.`, path, raw);
|
|
545
|
+
return null;
|
|
546
|
+
}
|
|
547
|
+
// A step is its guard and its action: `{ when, action }`. An answer that
|
|
548
|
+
// writes the action's own fields beside `when` reads the same, so a model
|
|
549
|
+
// that flattens the step does not spend the one re-ask.
|
|
550
|
+
const action = raw['action'];
|
|
551
|
+
const fields = isRecord(action) ? _extends({}, action, {
|
|
552
|
+
when: raw['when']
|
|
553
|
+
}) : raw;
|
|
554
|
+
const type = fields['type'];
|
|
555
|
+
if (!AI_AUTOMATION_STEP_TYPES.includes(type)) {
|
|
556
|
+
refuse(reader, 'automation-step-type', `Step ${index + 1} is not one of the steps offered: ${AI_AUTOMATION_STEP_TYPES.join(', ')}.`, path, fields);
|
|
557
|
+
return null;
|
|
558
|
+
}
|
|
559
|
+
const stepType = type;
|
|
560
|
+
const what = `Step ${index + 1} (${HOST_ACTION_STEP_LABELS[stepType]})`;
|
|
561
|
+
const need = AI_AUTOMATION_STEP_NEEDS[stepType];
|
|
562
|
+
if (need && !capabilities[need]) {
|
|
563
|
+
refuse(reader, 'automation-plan', `${what} needs ${AI_AUTOMATION_NEED_LABELS[need]}, which this workspace does not have. Leave it out, or answer with unsupported "needs-${need}".`, path, fields);
|
|
564
|
+
return null;
|
|
565
|
+
}
|
|
566
|
+
const before = reader.violations.length;
|
|
567
|
+
const step = {
|
|
568
|
+
type: stepType,
|
|
569
|
+
when: null,
|
|
570
|
+
list: null,
|
|
571
|
+
campaign: null,
|
|
572
|
+
workflow: null,
|
|
573
|
+
webhook: null,
|
|
574
|
+
dataset: null,
|
|
575
|
+
subject: null,
|
|
576
|
+
body: null,
|
|
577
|
+
toField: null,
|
|
578
|
+
title: null,
|
|
579
|
+
message: null,
|
|
580
|
+
severity: null,
|
|
581
|
+
minutes: null,
|
|
582
|
+
event: null,
|
|
583
|
+
stage: null,
|
|
584
|
+
tag: null,
|
|
585
|
+
owner: null,
|
|
586
|
+
taskKind: null,
|
|
587
|
+
dueInDays: null,
|
|
588
|
+
activityKind: null
|
|
589
|
+
};
|
|
590
|
+
// A step's `when` is a list of at most one condition; a lone condition, or
|
|
591
|
+
// none, reads as the list it stands for.
|
|
592
|
+
const when = fields['when'];
|
|
593
|
+
const guards = Array.isArray(when) ? when : when === null || when === undefined ? [] : [
|
|
594
|
+
when
|
|
595
|
+
];
|
|
596
|
+
if (guards.length > 1) {
|
|
597
|
+
refuse(reader, 'automation-condition', `${what}: when holds one condition at most.`, `${path}.when`, when);
|
|
598
|
+
} else if (guards.length === 1) {
|
|
599
|
+
step.when = readCondition(reader, guards[0], `${path}.when`, event, true);
|
|
600
|
+
}
|
|
601
|
+
// The six steps that name a record share `reference`, and the three that
|
|
602
|
+
// carry one line share `text`; an answer that writes the step's own key
|
|
603
|
+
// instead — `list`, `tag`, `owner` — reads the same.
|
|
604
|
+
const shared = (key, own)=>{
|
|
605
|
+
var _fields_key;
|
|
606
|
+
return (_fields_key = fields[key]) != null ? _fields_key : fields[own];
|
|
607
|
+
};
|
|
608
|
+
const own = TEXT_KEY[stepType];
|
|
609
|
+
const text = own ? {
|
|
610
|
+
text: shared('text', own)
|
|
611
|
+
} : fields;
|
|
612
|
+
switch(stepType){
|
|
613
|
+
case 'sendEmail':
|
|
614
|
+
{
|
|
615
|
+
step.subject = requireText(reader, fields, 'subject', AI_AUTOMATION_SUBJECT_MAX_CHARS, path, what);
|
|
616
|
+
step.body = requireText(reader, fields, 'body', AI_AUTOMATION_BODY_MAX_CHARS, path, what);
|
|
617
|
+
const toField = textOf(fields['toField']);
|
|
618
|
+
if (toField && !FIELD_NAME.test(toField)) {
|
|
619
|
+
refuse(reader, 'automation-step-field', `${what}: toField names the event field holding the address.`, path, fields);
|
|
620
|
+
} else {
|
|
621
|
+
step.toField = toField && toField !== DEFAULT_TO_FIELD ? toField : null;
|
|
622
|
+
}
|
|
623
|
+
break;
|
|
624
|
+
}
|
|
625
|
+
case 'notifyAdmins':
|
|
626
|
+
step.title = requireText(reader, text, 'text', AI_AUTOMATION_SUBJECT_MAX_CHARS, path, what);
|
|
627
|
+
break;
|
|
628
|
+
case 'enrollList':
|
|
629
|
+
case 'assignCampaign':
|
|
630
|
+
case 'runWorkflow':
|
|
631
|
+
case 'webhookPost':
|
|
632
|
+
case 'datasetAppend':
|
|
633
|
+
case 'updateDataset':
|
|
634
|
+
step[REFERENCE_KEY[stepType]] = requireText(reader, {
|
|
635
|
+
reference: shared('reference', REFERENCE_KEY[stepType])
|
|
636
|
+
}, 'reference', AI_AUTOMATION_REFERENCE_MAX_CHARS, path, what);
|
|
637
|
+
break;
|
|
638
|
+
case 'siteAlert':
|
|
639
|
+
{
|
|
640
|
+
step.message = requireText(reader, text, 'text', AI_AUTOMATION_TEXT_MAX_CHARS, path, what);
|
|
641
|
+
const severity = fields['severity'];
|
|
642
|
+
step.severity = SEVERITIES.includes(severity) ? severity : 'info';
|
|
643
|
+
break;
|
|
644
|
+
}
|
|
645
|
+
case 'wait':
|
|
646
|
+
case 'waitForEvent':
|
|
647
|
+
{
|
|
648
|
+
const minutes = wholeNumber(fields['minutes']);
|
|
649
|
+
if (minutes === null || minutes < FLOW_WAIT_MIN_MINUTES || minutes > FLOW_WAIT_MAX_MINUTES) {
|
|
650
|
+
refuse(reader, 'automation-step-field', `${what} needs minutes, a whole number from ${FLOW_WAIT_MIN_MINUTES} to ${FLOW_WAIT_MAX_MINUTES}.`, path, fields);
|
|
651
|
+
} else {
|
|
652
|
+
step.minutes = minutes;
|
|
653
|
+
}
|
|
654
|
+
if (stepType === 'waitForEvent') {
|
|
655
|
+
const waited = fields['event'];
|
|
656
|
+
if (!HOST_EVENT_TYPES.includes(waited)) {
|
|
657
|
+
refuse(reader, 'automation-step-field', `${what} needs the event it waits for.`, path, fields);
|
|
658
|
+
} else {
|
|
659
|
+
step.event = waited;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
break;
|
|
663
|
+
}
|
|
664
|
+
case 'exitFlow':
|
|
665
|
+
break;
|
|
666
|
+
case 'setContactStage':
|
|
667
|
+
{
|
|
668
|
+
const stage = fields['stage'];
|
|
669
|
+
if (!CONTACT_LIFECYCLE_STAGES.includes(stage)) {
|
|
670
|
+
refuse(reader, 'automation-step-field', `${what} needs the lifecycle stage to set.`, path, fields);
|
|
671
|
+
} else {
|
|
672
|
+
step.stage = stage;
|
|
673
|
+
}
|
|
674
|
+
break;
|
|
675
|
+
}
|
|
676
|
+
case 'addContactTag':
|
|
677
|
+
step.tag = requireText(reader, text, 'text', CONTACT_TAG_MAX_LENGTH, path, what);
|
|
678
|
+
break;
|
|
679
|
+
case 'assignContactOwner':
|
|
680
|
+
{
|
|
681
|
+
const owner = textOf(text['text']);
|
|
682
|
+
if (!owner || !(ROUND_ROBIN.test(owner) || EMAIL_ADDRESS.test(owner))) {
|
|
683
|
+
refuse(reader, 'automation-owner', `${what}: give the owner as "round robin", or as the teammate’s email address the description gives. A teammate named without one goes in notes, not in a step.`, path, fields);
|
|
684
|
+
} else {
|
|
685
|
+
step.owner = ROUND_ROBIN.test(owner) ? 'round robin' : owner;
|
|
686
|
+
}
|
|
687
|
+
break;
|
|
688
|
+
}
|
|
689
|
+
case 'createCrmTask':
|
|
690
|
+
{
|
|
691
|
+
step.title = requireText(reader, text, 'text', AI_AUTOMATION_SUBJECT_MAX_CHARS, path, what);
|
|
692
|
+
const kind = fields['taskKind'];
|
|
693
|
+
const due = wholeNumber(fields['dueInDays']);
|
|
694
|
+
if (!CRM_TASK_KINDS.includes(kind)) {
|
|
695
|
+
refuse(reader, 'automation-step-field', `${what} needs taskKind.`, path, fields);
|
|
696
|
+
} else {
|
|
697
|
+
step.taskKind = kind;
|
|
698
|
+
}
|
|
699
|
+
if (due === null || due < 0 || due > CRM_TASK_MAX_DUE_DAYS) {
|
|
700
|
+
refuse(reader, 'automation-step-field', `${what} needs dueInDays, from 0 to ${CRM_TASK_MAX_DUE_DAYS}.`, path, fields);
|
|
701
|
+
} else {
|
|
702
|
+
step.dueInDays = due;
|
|
703
|
+
}
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
case 'logCrmActivity':
|
|
707
|
+
{
|
|
708
|
+
const kind = fields['activityKind'];
|
|
709
|
+
if (!CRM_ACTIVITY_KINDS.includes(kind)) {
|
|
710
|
+
refuse(reader, 'automation-step-field', `${what} needs activityKind.`, path, fields);
|
|
711
|
+
} else {
|
|
712
|
+
step.activityKind = kind;
|
|
713
|
+
}
|
|
714
|
+
step.body = requireText(reader, text, 'text', AI_AUTOMATION_TEXT_MAX_CHARS, path, what);
|
|
715
|
+
break;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
return reader.violations.length === before ? step : null;
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* The automation tool's answer read and held to the vocabulary and to what
|
|
722
|
+
* this workspace can run — the check the doctrine's loop runs on each answer,
|
|
723
|
+
* beside rule 13. `value` is the automation when nothing is refused.
|
|
724
|
+
*/ export function readAiAutomationAnswer(answer, capabilities) {
|
|
725
|
+
var _textOf;
|
|
726
|
+
const reader = {
|
|
727
|
+
violations: [],
|
|
728
|
+
offending: []
|
|
729
|
+
};
|
|
730
|
+
const done = (value)=>_extends({
|
|
731
|
+
value: reader.violations.length ? null : value,
|
|
732
|
+
violations: reader.violations
|
|
733
|
+
}, reader.offending.length ? {
|
|
734
|
+
offending: Object.fromEntries(reader.offending)
|
|
735
|
+
} : {});
|
|
736
|
+
const notes = (Array.isArray(answer['notes']) ? answer['notes'] : []).map(textOf).filter((note)=>note !== null && !HOSTILE_TEXT.test(note)).slice(0, AI_AUTOMATION_NOTES_MAX).map((note)=>note.slice(0, AI_AUTOMATION_NOTE_MAX_CHARS));
|
|
737
|
+
const name = ((_textOf = textOf(answer['name'])) != null ? _textOf : '').slice(0, AI_AUTOMATION_NAME_MAX_CHARS);
|
|
738
|
+
const written = JSON.stringify(answer).length;
|
|
739
|
+
if (written > AI_AUTOMATION_ANSWER_MAX_CHARS) {
|
|
740
|
+
refuse(reader, 'automation-too-long', `Written out, the automation is ${written} characters, over the ${AI_AUTOMATION_ANSWER_MAX_CHARS} it may be. Shorten its emails and messages, or use fewer steps.`, 'steps', written);
|
|
741
|
+
return done(null);
|
|
742
|
+
}
|
|
743
|
+
// An answer that builds an automation leaves `unsupported` empty, which the
|
|
744
|
+
// schema states as an empty string rather than a `null`.
|
|
745
|
+
const unsupported = answer['unsupported'];
|
|
746
|
+
if (unsupported !== null && unsupported !== undefined && unsupported !== '') {
|
|
747
|
+
if (!AI_AUTOMATION_UNSUPPORTED.includes(unsupported)) {
|
|
748
|
+
refuse(reader, 'automation-shape', 'unsupported is empty, or one of the reasons offered.', 'unsupported', unsupported);
|
|
749
|
+
return done(null);
|
|
750
|
+
}
|
|
751
|
+
const need = AI_AUTOMATION_UNSUPPORTED_NEED[unsupported];
|
|
752
|
+
if (need && capabilities[need]) {
|
|
753
|
+
refuse(reader, 'automation-unsupported', `This workspace has ${AI_AUTOMATION_NEED_LABELS[need]}: build the automation with it.`, 'unsupported', unsupported);
|
|
754
|
+
return done(null);
|
|
755
|
+
}
|
|
756
|
+
return done({
|
|
757
|
+
name,
|
|
758
|
+
trigger: {
|
|
759
|
+
event: HOST_EVENT_TYPES[0],
|
|
760
|
+
conditions: [],
|
|
761
|
+
combinator: 'and'
|
|
762
|
+
},
|
|
763
|
+
steps: [],
|
|
764
|
+
notes,
|
|
765
|
+
unsupported: unsupported
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
const trigger = answer['trigger'];
|
|
769
|
+
const steps = answer['steps'];
|
|
770
|
+
if (!isRecord(trigger) || !Array.isArray(steps)) {
|
|
771
|
+
refuse(reader, 'automation-shape', 'The answer has no trigger and steps.', 'trigger', trigger);
|
|
772
|
+
return done(null);
|
|
773
|
+
}
|
|
774
|
+
const event = trigger['event'];
|
|
775
|
+
if (!HOST_EVENT_TYPES.includes(event)) {
|
|
776
|
+
refuse(reader, 'automation-trigger', 'The trigger is not one of the events offered.', 'trigger.event', event);
|
|
777
|
+
return done(null);
|
|
778
|
+
}
|
|
779
|
+
const hostEvent = event;
|
|
780
|
+
const need = AI_AUTOMATION_TRIGGER_NEEDS[hostEvent];
|
|
781
|
+
if (need && !capabilities[need]) {
|
|
782
|
+
refuse(reader, 'automation-plan', `The trigger "${aiAutomationTriggerLabel(hostEvent)}" needs ${AI_AUTOMATION_NEED_LABELS[need]}, which this workspace does not have. Pick another trigger, or answer with unsupported "needs-${need}".`, 'trigger.event', event);
|
|
783
|
+
return done(null);
|
|
784
|
+
}
|
|
785
|
+
const rawConditions = Array.isArray(trigger['conditions']) ? trigger['conditions'] : [];
|
|
786
|
+
if (rawConditions.length > ACTION_MAX_CONDITIONS) {
|
|
787
|
+
refuse(reader, 'automation-too-many-conditions', `A trigger holds at most ${ACTION_MAX_CONDITIONS} conditions.`, 'trigger.conditions', rawConditions.length);
|
|
788
|
+
}
|
|
789
|
+
const conditions = rawConditions.slice(0, ACTION_MAX_CONDITIONS).map((raw, index)=>readCondition(reader, raw, `trigger.conditions[${index}]`, hostEvent, false)).filter((condition)=>condition !== null);
|
|
790
|
+
const combinator = TRIGGER_COMBINATORS.includes(trigger['combinator']) ? trigger['combinator'] : 'and';
|
|
791
|
+
if (!steps.length) {
|
|
792
|
+
refuse(reader, 'automation-shape', 'An automation has at least one step; answer unsupported when none fits.', 'steps', steps);
|
|
793
|
+
}
|
|
794
|
+
if (steps.length > ACTION_MAX_STEPS) {
|
|
795
|
+
refuse(reader, 'automation-too-many-steps', `An automation holds at most ${ACTION_MAX_STEPS} steps.`, 'steps', steps.length);
|
|
796
|
+
}
|
|
797
|
+
const read = steps.slice(0, ACTION_MAX_STEPS).map((raw, index)=>readStep(reader, raw, index, hostEvent, capabilities)).filter((step)=>step !== null);
|
|
798
|
+
return done({
|
|
799
|
+
name,
|
|
800
|
+
trigger: {
|
|
801
|
+
event: hostEvent,
|
|
802
|
+
conditions,
|
|
803
|
+
combinator
|
|
804
|
+
},
|
|
805
|
+
steps: read,
|
|
806
|
+
notes,
|
|
807
|
+
unsupported: null
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
/** Whether a line carries an email address, which nothing an explanation was shown holds. */ const CARRIES_ADDRESS = /[^\s@]+@[^\s@]+\.[^\s@]+/;
|
|
811
|
+
function lines(value, max) {
|
|
812
|
+
return (Array.isArray(value) ? value : []).map(textOf).filter((line)=>line !== null).slice(0, max).map((line)=>line.slice(0, AI_WORKFLOW_LINE_MAX_CHARS));
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* The explanation tool's answer: a summary, and at most so many points and
|
|
816
|
+
* suggestions, each cut to a line. Refused when it has no summary, or carries
|
|
817
|
+
* markup or an address — plain words for a person, about a record whose
|
|
818
|
+
* personal details were removed before the model saw it.
|
|
819
|
+
*/ export function readAiWorkflowExplanation(answer) {
|
|
820
|
+
var _textOf;
|
|
821
|
+
const summary = ((_textOf = textOf(answer['summary'])) != null ? _textOf : '').slice(0, AI_WORKFLOW_SUMMARY_MAX_CHARS);
|
|
822
|
+
const value = {
|
|
823
|
+
summary,
|
|
824
|
+
points: lines(answer['points'], AI_WORKFLOW_POINTS_MAX),
|
|
825
|
+
suggestions: lines(answer['suggestions'], AI_WORKFLOW_SUGGESTIONS_MAX)
|
|
826
|
+
};
|
|
827
|
+
const violations = [];
|
|
828
|
+
if (!summary) {
|
|
829
|
+
violations.push({
|
|
830
|
+
rule: null,
|
|
831
|
+
code: 'explanation-shape',
|
|
832
|
+
message: 'The explanation has no summary.'
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
const all = [
|
|
836
|
+
value.summary,
|
|
837
|
+
...value.points,
|
|
838
|
+
...value.suggestions
|
|
839
|
+
];
|
|
840
|
+
if (all.some((line)=>HOSTILE_TEXT.test(line))) {
|
|
841
|
+
violations.push({
|
|
842
|
+
rule: null,
|
|
843
|
+
code: 'explanation-markup',
|
|
844
|
+
message: 'Write the explanation as plain text, with no HTML or script.'
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
if (all.some((line)=>CARRIES_ADDRESS.test(line))) {
|
|
848
|
+
violations.push({
|
|
849
|
+
rule: null,
|
|
850
|
+
code: 'explanation-address',
|
|
851
|
+
message: 'The explanation names an email address. Describe the person or the teammate instead.'
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
return {
|
|
855
|
+
value: violations.length ? null : value,
|
|
856
|
+
violations
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
//# sourceMappingURL=ai-workflow-tool.js.map
|