@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,530 @@
|
|
|
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, HOST_ACTION_STEP_LABELS } from "@aglyn/aglyn/app-utils/actions";
|
|
18
|
+
import { CONTACT_LIFECYCLE_STAGES, CRM_TASK_MAX_DUE_DAYS } from "@aglyn/aglyn/app-utils/crm";
|
|
19
|
+
import { HOST_EVENT_PAYLOAD_KEYS } from "@aglyn/aglyn/app-utils/workflows";
|
|
20
|
+
import { isHostPluginEnabled } from "@aglyn/aglyn/plugin-manager/enabled-plugins";
|
|
21
|
+
import { filterEnabledPluginsByReleaseFlags } from "@aglyn/tenant-data-admin/server/release-flags";
|
|
22
|
+
import { resolveOrgIdForHost } from "@aglyn/tenant-data-admin/server/organizations";
|
|
23
|
+
import { aiAutomationDraft, aiAutomationDraftNote } from "../model/ai-automation-draft.js";
|
|
24
|
+
import { aiActionOutline, aiActionRecordKinds, aiRunOutline, aiWorkflowExplanationText, aiWorkflowOutline } from "../model/ai-automation-outline.js";
|
|
25
|
+
import { AI_AUTOMATION_NEED_LABELS, AI_AUTOMATION_RESOURCE, AI_AUTOMATION_STEP_NEEDS, AI_AUTOMATION_STEP_TYPES, AI_AUTOMATION_TRIGGER_NEEDS, AI_AUTOMATION_TRIGGERS, AI_AUTOMATION_UNSUPPORTED_COPY, AI_WORKFLOW_GONE_COPY, AI_WORKFLOW_NO_DRAFT_COPY, AI_WORKFLOW_NO_EXPLANATION_COPY, AI_WORKFLOW_NO_SITE_COPY, AI_WORKFLOW_RUN_GONE_COPY, AI_WORKFLOW_RUN_NOT_FAILED_COPY, AI_WORKFLOW_SAVE_FAILURE_COPY, AI_WORKFLOW_UNAVAILABLE_COPY, AI_WORKFLOWS_PLUGIN_ID, aiAutomationCapabilities, aiAutomationTriggerLabel, parseAiWorkflowJobInputs } from "../model/ai-workflow-job.js";
|
|
26
|
+
import { AI_STEP_TIERS } from "../providers/catalog.js";
|
|
27
|
+
import { AI_ROUTING_TABLE, aiModelForStep } from "../providers/routing.js";
|
|
28
|
+
import { runValidatedGeneration } from "../runtime/ai-doctrine.js";
|
|
29
|
+
import { AI_AUTOMATION_TOOL_NAME, AI_WORKFLOW_EXPLANATION_TOOL_NAME, aiAutomationTool, aiWorkflowExplanationTool, readAiAutomationAnswer, readAiWorkflowExplanation } from "../tools/ai-workflow-tool.js";
|
|
30
|
+
import { registerAiJobAdmission } from "./ai-job-admission.js";
|
|
31
|
+
import { aiJobStepBudget } from "./ai-job-budget.js";
|
|
32
|
+
import { aiJobDraftId } from "./ai-job-draft-ids.js";
|
|
33
|
+
import { aiDoctrineReview, aiGenerationSpent, aiLimitReview, aiUnspentOutcome } from "./ai-job-generation.js";
|
|
34
|
+
import { aiPluginDraftAdmissionRefusal, aiPluginDraftUnavailable, aiPluginDraftWriter } from "./ai-job-plugin-drafts.js";
|
|
35
|
+
import { AI_JOB_BRIEF_MAX_CHARS } from "./ai-job-text-step.js";
|
|
36
|
+
import { registerAiJobStep } from "./ai-jobs.js";
|
|
37
|
+
import { readAiAutomationRecords, readAiWorkflowFunctions, readAiWorkflowRun, readAiWorkflowTarget } from "./ai-workflow-records.js";
|
|
38
|
+
/**
|
|
39
|
+
* The `workflow` step (AGL-2919): an automation drafted from a description,
|
|
40
|
+
* or a saved automation explained.
|
|
41
|
+
*
|
|
42
|
+
* ## Drafting
|
|
43
|
+
*
|
|
44
|
+
* The model is shown the platform's automation vocabulary — every trigger with
|
|
45
|
+
* the fields it carries, every step with the fields it takes — in a cached
|
|
46
|
+
* block, and in the user turn what this workspace can run, the site's forms
|
|
47
|
+
* and datasets by name, and the description. It answers through
|
|
48
|
+
* `submit_automation`, and the answer is held to the vocabulary and to what
|
|
49
|
+
* the workspace can run before anything is written.
|
|
50
|
+
*
|
|
51
|
+
* A record the description names — a list, a campaign, a workflow, a webhook,
|
|
52
|
+
* a dataset, a form, a deal stage — is answered in the description's WORDS,
|
|
53
|
+
* and looked up among the site's records in code, after the answer
|
|
54
|
+
* (`model/ai-automation-draft.ts`). The model is never shown the site's lists,
|
|
55
|
+
* campaigns, workflows, webhooks or pipelines. Words that name no record, or
|
|
56
|
+
* more than one, are kept as a placeholder the person fills in.
|
|
57
|
+
*
|
|
58
|
+
* The automation is written through the workflows plugin's draft writer —
|
|
59
|
+
* that plugin's stored shape, validator, role, plan and cap — keyed by the
|
|
60
|
+
* job's id, and it is written OFF. A run cut off after the write finds its
|
|
61
|
+
* draft and spends nothing.
|
|
62
|
+
*
|
|
63
|
+
* ## Explaining
|
|
64
|
+
*
|
|
65
|
+
* The model is shown an outline of the saved automation, and for a failed run
|
|
66
|
+
* what the run history recorded about it (`model/ai-automation-outline.ts`):
|
|
67
|
+
* never the stored documents, never an email address, never a run's event
|
|
68
|
+
* payload. It answers through `submit_explanation`, which becomes a `text`
|
|
69
|
+
* output. Nothing is changed.
|
|
70
|
+
*/ /** The longest an explanation or a draft's generation may take reading the site first. */ export const AI_WORKFLOW_RECORDS_READ_MS = 4000;
|
|
71
|
+
/**
|
|
72
|
+
* The step's time (AGL-3035): its answer and its re-ask at the routing
|
|
73
|
+
* table's `job.workflow` ceiling on the tier the step is served from. It sends
|
|
74
|
+
* no site inventory block, so it makes no lookup; its own reads — the records
|
|
75
|
+
* a draft is matched against, or the automation and run an explanation
|
|
76
|
+
* reads — are the declared `AI_WORKFLOW_RECORDS_READ_MS`.
|
|
77
|
+
*/ export const AI_JOB_WORKFLOW_STEP_BUDGET = aiJobStepBudget({
|
|
78
|
+
tier: AI_STEP_TIERS['job.workflow'],
|
|
79
|
+
maxTokens: AI_ROUTING_TABLE['job.workflow'].maxTokens,
|
|
80
|
+
lookups: 0,
|
|
81
|
+
ownReadsMs: AI_WORKFLOW_RECORDS_READ_MS
|
|
82
|
+
});
|
|
83
|
+
/** The least time one workflow step needs before it starts. */ export const AI_JOB_WORKFLOW_STEP_MINIMUM_MS = AI_JOB_WORKFLOW_STEP_BUDGET.minimumMs;
|
|
84
|
+
/** The routing table's answer for `job.workflow`. */ export function aiJobWorkflowModel() {
|
|
85
|
+
return aiModelForStep('job.workflow');
|
|
86
|
+
}
|
|
87
|
+
/** How many forms and datasets the user turn lists, and how many fields a form. */ export const AI_WORKFLOW_FORMS_LISTED = 40;
|
|
88
|
+
export const AI_WORKFLOW_FORM_FIELDS_LISTED = 20;
|
|
89
|
+
export const AI_WORKFLOW_DATASETS_LISTED = 40;
|
|
90
|
+
// ── The vocabulary, for the model ─────────────────────────────────────────
|
|
91
|
+
const STEP_USES = {
|
|
92
|
+
sendEmail: 'emails the person the event is about. Fields: subject, body (plain text), toField',
|
|
93
|
+
notifyAdmins: 'notifies the site’s admins in the console. Fields: text (what the admins read)',
|
|
94
|
+
enrollList: 'adds the person to an email list. Fields: reference (the list)',
|
|
95
|
+
assignCampaign: 'files the person under a campaign. Fields: reference (the campaign)',
|
|
96
|
+
runWorkflow: 'runs one of the site’s workflows. Fields: reference (the workflow)',
|
|
97
|
+
datasetAppend: 'saves the event as a new record in a dataset. Fields: reference (the dataset)',
|
|
98
|
+
updateDataset: 'updates the event’s record in a dataset. Fields: reference (the dataset)',
|
|
99
|
+
webhookPost: 'sends the event to one of the site’s outbound webhooks. Fields: reference (the webhook)',
|
|
100
|
+
siteAlert: 'shows the visitor who caused the event a short message. Fields: text (the message), severity',
|
|
101
|
+
wait: 'waits before the next step. Fields: minutes',
|
|
102
|
+
waitForEvent: 'waits until something else happens to the same person, or gives up. Fields: event, minutes',
|
|
103
|
+
exitFlow: 'ends the automation here; with a when it is a branch. Fields: none',
|
|
104
|
+
setContactStage: 'sets the person’s lifecycle stage. Fields: stage',
|
|
105
|
+
addContactTag: 'tags the person. Fields: text (the tag)',
|
|
106
|
+
assignContactOwner: 'gives the person an owner. Fields: text (the owner)',
|
|
107
|
+
createCrmTask: 'creates a follow-up task. Fields: text (the task), taskKind, dueInDays',
|
|
108
|
+
logCrmActivity: 'logs what happened on the person’s record. Fields: activityKind, text (what happened)'
|
|
109
|
+
};
|
|
110
|
+
function triggerLine(event) {
|
|
111
|
+
var _HOST_EVENT_PAYLOAD_KEYS_event;
|
|
112
|
+
const fields = event === 'formSubmission' ? 'formName (the form’s name, as the request lists it), path, and every field the form collects, by its field name' : ((_HOST_EVENT_PAYLOAD_KEYS_event = HOST_EVENT_PAYLOAD_KEYS[event]) != null ? _HOST_EVENT_PAYLOAD_KEYS_event : []).join(', ') || 'none';
|
|
113
|
+
const need = AI_AUTOMATION_TRIGGER_NEEDS[event];
|
|
114
|
+
return `- ${event} (${aiAutomationTriggerLabel(event)}). Fields: ${fields}.${need ? ` Needs ${AI_AUTOMATION_NEED_LABELS[need]}.` : ''}`;
|
|
115
|
+
}
|
|
116
|
+
function stepLine(type) {
|
|
117
|
+
const need = AI_AUTOMATION_STEP_NEEDS[type];
|
|
118
|
+
return `- ${type} (${HOST_ACTION_STEP_LABELS[type]}) ${STEP_USES[type]}.${need ? ` Needs ${AI_AUTOMATION_NEED_LABELS[need]}.` : ''}`;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The drafting instructions, byte-identical on every request so they cache.
|
|
122
|
+
* Built from the platform's own trigger and step catalogs, so the vocabulary
|
|
123
|
+
* the model is shown is the vocabulary the answer is held to.
|
|
124
|
+
*/ export const AI_JOB_WORKFLOW_DRAFT_INSTRUCTIONS = [
|
|
125
|
+
{
|
|
126
|
+
text: [
|
|
127
|
+
`You turn a description into one automation for the Actions page of a website builder: something that happens on the site (the trigger), the conditions it must meet, and the steps that run, in order. Answer by calling ${AI_AUTOMATION_TOOL_NAME} exactly once. A reply in prose cannot be used.`,
|
|
128
|
+
'',
|
|
129
|
+
'A step is written as when it runs and what it does: a when beside an action that carries its type and only that type’s fields. Use only these triggers and steps; each step lists the fields its action takes, and it carries only those.',
|
|
130
|
+
'',
|
|
131
|
+
'Triggers, with the fields their conditions can read:',
|
|
132
|
+
...AI_AUTOMATION_TRIGGERS.map(triggerLine),
|
|
133
|
+
'',
|
|
134
|
+
'Steps:',
|
|
135
|
+
...AI_AUTOMATION_STEP_TYPES.map(stepLine),
|
|
136
|
+
'',
|
|
137
|
+
'Rules:',
|
|
138
|
+
'- A step that names a list, campaign, workflow, webhook or dataset writes it as reference, in the description’s own words, such as "newsletter". The platform finds the site’s record by those words. Never write an id for one.',
|
|
139
|
+
'- A form is named by the id or the name the request lists: formId on contactCreated, formName on formSubmission. A form the description names that the request does not list is written in the description’s words.',
|
|
140
|
+
'- A deal stage in a condition on stageId or previousStageId is written as the stage’s name.',
|
|
141
|
+
`- A lifecycle stage is one of: ${CONTACT_LIFECYCLE_STAGES.join(', ')}. A new lead is the stage lead.`,
|
|
142
|
+
`- The trigger holds at most ${ACTION_MAX_CONDITIONS} conditions; combinator is and unless the description means any of them. A step's when holds one condition of its own at most, over the same fields. After waitForEvent, when on the field "${FLOW_TIMED_OUT_FIELD}" with notEmpty means the wait ran out of time.`,
|
|
143
|
+
`- At most ${ACTION_MAX_STEPS} steps. minutes are whole minutes, at most ${FLOW_WAIT_MAX_MINUTES}; dueInDays is from 0 to ${CRM_TASK_MAX_DUE_DAYS}; addContactTag’s text is at most ${CONTACT_TAG_MAX_LENGTH} characters.`,
|
|
144
|
+
'- assignContactOwner’s text is "round robin", or the teammate’s email address when the description gives one. A teammate named without an address goes in notes.',
|
|
145
|
+
'- Write an email’s subject and body, and any text a person reads, in the site’s voice and the language of the description. Where the description lacks a fact such as a phone number, an address or a price, write a short description of it in square brackets instead of inventing it.',
|
|
146
|
+
'- A trigger or a step the request says this workspace cannot use is never used. When the description needs one, or needs something no trigger or step here does, answer with unsupported set to the reason, no steps, and trigger event formSubmission with no conditions. unsupported is empty on every automation that is built.',
|
|
147
|
+
'- notes holds what the person must decide that the automation cannot hold, in at most three short sentences; empty when there is nothing.',
|
|
148
|
+
'- The automation is drafted switched off, and a person reviews it and switches it on. Never ask to turn it on or to run it.'
|
|
149
|
+
].join('\n'),
|
|
150
|
+
cacheBreakpoint: true
|
|
151
|
+
}
|
|
152
|
+
];
|
|
153
|
+
/** The explaining instructions, byte-identical on every request so they cache. */ export const AI_JOB_WORKFLOW_EXPLAIN_INSTRUCTIONS = [
|
|
154
|
+
{
|
|
155
|
+
text: [
|
|
156
|
+
`You explain an automation on a website builder to the person who owns the site, in plain words for someone who does not write code. You are shown the automation as it is set up — what starts it, its conditions and its steps in order — and, when you are asked why a run failed, what the run history recorded about that run. Answer by calling ${AI_WORKFLOW_EXPLANATION_TOOL_NAME} exactly once.`,
|
|
157
|
+
'',
|
|
158
|
+
'- summary: in one or two sentences, what the automation does; or, for a failed run, the most likely reason it failed.',
|
|
159
|
+
'- points: what happens, step by step, in the order it happens; or, for a failed run, what the run did and where it went wrong. One sentence each.',
|
|
160
|
+
'- suggestions: what the person can check or change — a list, campaign or workflow the site no longer has, a condition that can never match, a placeholder nobody has filled in, a step the plan does not include. For a failed run, how to fix it. Empty when there is nothing to suggest.',
|
|
161
|
+
'',
|
|
162
|
+
'Rules:',
|
|
163
|
+
'- Explain only what you are shown. Never guess at settings, records or history you were not given, and never say you changed anything: you change nothing.',
|
|
164
|
+
'- Name triggers and steps the way you are shown them, not by internal names.',
|
|
165
|
+
'- A value in square brackets is a placeholder nobody has filled in yet.',
|
|
166
|
+
'- Personal details were removed from what you are shown, and are written as [email address] or a named teammate. Never ask for them.',
|
|
167
|
+
'- Write plain text, with no markdown and no HTML.'
|
|
168
|
+
].join('\n'),
|
|
169
|
+
cacheBreakpoint: true
|
|
170
|
+
}
|
|
171
|
+
];
|
|
172
|
+
// ── The user turns ────────────────────────────────────────────────────────
|
|
173
|
+
function yesNo(value) {
|
|
174
|
+
return value ? 'yes' : 'no';
|
|
175
|
+
}
|
|
176
|
+
/** What a draft is asked from: the workspace's reach, the site's forms and datasets, and the brief. */ export function aiJobWorkflowDraftPrompt(input) {
|
|
177
|
+
const { crm, webhooks, bookings } = input.capabilities;
|
|
178
|
+
const forms = input.records.forms.slice(0, AI_WORKFLOW_FORMS_LISTED);
|
|
179
|
+
const datasets = input.records.datasets.slice(0, AI_WORKFLOW_DATASETS_LISTED);
|
|
180
|
+
return [
|
|
181
|
+
`This workspace can use: the CRM — ${yesNo(crm)}; webhooks — ${yesNo(webhooks)}; bookings — ${yesNo(bookings)}.`,
|
|
182
|
+
'Forms on this site (id · name · fields):',
|
|
183
|
+
...forms.length ? forms.map((form)=>`- ${form.id} · ${form.name} · ${form.fields.slice(0, AI_WORKFLOW_FORM_FIELDS_LISTED).join(', ') || 'no fields'}`) : [
|
|
184
|
+
'- none'
|
|
185
|
+
],
|
|
186
|
+
'Datasets on this site (name):',
|
|
187
|
+
...datasets.length ? datasets.map((dataset)=>`- ${dataset.name}`) : [
|
|
188
|
+
'- none'
|
|
189
|
+
],
|
|
190
|
+
`Brief: ${input.brief.slice(0, AI_JOB_BRIEF_MAX_CHARS)}`
|
|
191
|
+
].join('\n');
|
|
192
|
+
}
|
|
193
|
+
/** What an explanation is asked from: the mode, the outlines, and the member's question. */ export function aiJobWorkflowExplainPrompt(input) {
|
|
194
|
+
return [
|
|
195
|
+
input.mode === 'diagnose' ? 'Asked: why a run of this automation failed.' : 'Asked: what this automation does.',
|
|
196
|
+
input.outline,
|
|
197
|
+
...input.run ? [
|
|
198
|
+
input.run
|
|
199
|
+
] : [],
|
|
200
|
+
`Question: ${input.brief.slice(0, AI_JOB_BRIEF_MAX_CHARS)}`
|
|
201
|
+
].join('\n\n');
|
|
202
|
+
}
|
|
203
|
+
/** The routing row's thinking and effort, as a generation input spells them. */ function routedEffort() {
|
|
204
|
+
const row = AI_ROUTING_TABLE['job.workflow'];
|
|
205
|
+
return _extends({}, row.thinking ? {
|
|
206
|
+
thinking: row.thinking
|
|
207
|
+
} : {}, row.effort ? {
|
|
208
|
+
effort: row.effort
|
|
209
|
+
} : {});
|
|
210
|
+
}
|
|
211
|
+
/** The draft generation as the doctrine's loop runs it; the eval harness records one through this same call. */ export function aiJobWorkflowDraftGeneration(request) {
|
|
212
|
+
const check = (answer)=>readAiAutomationAnswer(answer, request.capabilities);
|
|
213
|
+
return _extends({
|
|
214
|
+
step: 'job.workflow',
|
|
215
|
+
model: request.model,
|
|
216
|
+
instructions: AI_JOB_WORKFLOW_DRAFT_INSTRUCTIONS,
|
|
217
|
+
messages: [
|
|
218
|
+
{
|
|
219
|
+
role: 'user',
|
|
220
|
+
content: aiJobWorkflowDraftPrompt(request)
|
|
221
|
+
}
|
|
222
|
+
],
|
|
223
|
+
tool: aiAutomationTool(),
|
|
224
|
+
maxTokens: AI_JOB_WORKFLOW_STEP_BUDGET.maxTokens(request.model)
|
|
225
|
+
}, routedEffort(), request.signal ? {
|
|
226
|
+
signal: request.signal
|
|
227
|
+
} : {}, {
|
|
228
|
+
check
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
/** The explanation generation as the doctrine's loop runs it. */ export function aiJobWorkflowExplainGeneration(request) {
|
|
232
|
+
return _extends({
|
|
233
|
+
step: 'job.workflow',
|
|
234
|
+
model: request.model,
|
|
235
|
+
instructions: AI_JOB_WORKFLOW_EXPLAIN_INSTRUCTIONS,
|
|
236
|
+
messages: [
|
|
237
|
+
{
|
|
238
|
+
role: 'user',
|
|
239
|
+
content: aiJobWorkflowExplainPrompt(request)
|
|
240
|
+
}
|
|
241
|
+
],
|
|
242
|
+
tool: aiWorkflowExplanationTool(),
|
|
243
|
+
maxTokens: AI_JOB_WORKFLOW_STEP_BUDGET.maxTokens(request.model)
|
|
244
|
+
}, routedEffort(), request.signal ? {
|
|
245
|
+
signal: request.signal
|
|
246
|
+
} : {}, {
|
|
247
|
+
check: readAiWorkflowExplanation
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
/** A job label: the automation's name in quotes, cut to a line. */ function quotedName(name) {
|
|
251
|
+
const clean = name.replace(/\s+/g, ' ').trim();
|
|
252
|
+
return `“${clean.length > 60 ? `${clean.slice(0, 60)}…` : clean}”`;
|
|
253
|
+
}
|
|
254
|
+
export function createAiJobWorkflowStep(deps = {}) {
|
|
255
|
+
var _deps_writerFor, _deps_readRecords, _deps_readTarget, _deps_readRun, _deps_readFunctions;
|
|
256
|
+
const writerFor = (_deps_writerFor = deps.writerFor) != null ? _deps_writerFor : aiPluginDraftWriter;
|
|
257
|
+
const readRecords = (_deps_readRecords = deps.readRecords) != null ? _deps_readRecords : readAiAutomationRecords;
|
|
258
|
+
const readTarget = (_deps_readTarget = deps.readTarget) != null ? _deps_readTarget : readAiWorkflowTarget;
|
|
259
|
+
const readRun = (_deps_readRun = deps.readRun) != null ? _deps_readRun : readAiWorkflowRun;
|
|
260
|
+
const readFunctions = (_deps_readFunctions = deps.readFunctions) != null ? _deps_readFunctions : readAiWorkflowFunctions;
|
|
261
|
+
return async ({ job, now, signal, firestore, org, modelFor })=>{
|
|
262
|
+
var _ref, _ref1;
|
|
263
|
+
// The switch's answer for this job, else the routing table's (AGL-2942).
|
|
264
|
+
const model = (_ref = modelFor == null ? void 0 : modelFor('job.workflow')) != null ? _ref : aiJobWorkflowModel();
|
|
265
|
+
const unspent = (failure)=>_extends({}, aiUnspentOutcome(model), {
|
|
266
|
+
failure
|
|
267
|
+
});
|
|
268
|
+
const inputs = parseAiWorkflowJobInputs(job.inputs);
|
|
269
|
+
if (typeof inputs === 'string') return unspent(inputs);
|
|
270
|
+
const hostId = job.hostId;
|
|
271
|
+
if (!hostId) return unspent(AI_WORKFLOW_NO_SITE_COPY);
|
|
272
|
+
// The door checks the caller's membership of the org the job is metered
|
|
273
|
+
// against; the site is checked against that org here, before anything
|
|
274
|
+
// about it is read into a prompt.
|
|
275
|
+
const host = await firestore.collection('hosts').doc(hostId).get();
|
|
276
|
+
if (!host.exists || host.get('orgId') !== job.orgId) return unspent(AI_WORKFLOW_NO_SITE_COPY);
|
|
277
|
+
const subdomain = host.get('subdomain');
|
|
278
|
+
const hostSubdomain = typeof subdomain === 'string' && subdomain ? subdomain : null;
|
|
279
|
+
const orgData = (_ref1 = org != null ? org : (await firestore.collection('orgs').doc(job.orgId).get()).data()) != null ? _ref1 : null;
|
|
280
|
+
const capabilities = aiAutomationCapabilities(orgData);
|
|
281
|
+
if (inputs.mode === 'draft') {
|
|
282
|
+
const writer = writerFor(AI_AUTOMATION_RESOURCE);
|
|
283
|
+
if (!writer) return unspent(AI_WORKFLOW_UNAVAILABLE_COPY);
|
|
284
|
+
const place = {
|
|
285
|
+
hostId,
|
|
286
|
+
hostSubdomain
|
|
287
|
+
};
|
|
288
|
+
// What an earlier run of this same job already wrote, under the id the job recorded.
|
|
289
|
+
const draftId = aiJobDraftId(job, 'workflow');
|
|
290
|
+
const written = await writer.read({
|
|
291
|
+
hostId,
|
|
292
|
+
id: draftId
|
|
293
|
+
});
|
|
294
|
+
if (written) {
|
|
295
|
+
return aiUnspentOutcome(model, {
|
|
296
|
+
outputs: [
|
|
297
|
+
draftOutput(written.id, written.name, place, 'It is off until you switch it on.')
|
|
298
|
+
]
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
const context = {
|
|
302
|
+
orgId: job.orgId,
|
|
303
|
+
hostId,
|
|
304
|
+
uid: job.createdBy,
|
|
305
|
+
org: orgData,
|
|
306
|
+
now
|
|
307
|
+
};
|
|
308
|
+
const refusal = await writer.refusal(context);
|
|
309
|
+
if (refusal) {
|
|
310
|
+
return refusal.status === 403 ? aiUnspentOutcome(model, {
|
|
311
|
+
review: aiLimitReview(refusal.error)
|
|
312
|
+
}) : unspent(refusal.error);
|
|
313
|
+
}
|
|
314
|
+
const records = await readRecords(firestore, {
|
|
315
|
+
orgId: job.orgId,
|
|
316
|
+
hostId,
|
|
317
|
+
crm: capabilities.crm
|
|
318
|
+
});
|
|
319
|
+
const generation = await runValidatedGeneration('workflow', aiJobWorkflowDraftGeneration(_extends({
|
|
320
|
+
brief: job.brief,
|
|
321
|
+
capabilities,
|
|
322
|
+
records,
|
|
323
|
+
model
|
|
324
|
+
}, signal ? {
|
|
325
|
+
signal
|
|
326
|
+
} : {})));
|
|
327
|
+
const spent = _extends({}, aiGenerationSpent(generation), generation.effort ? {
|
|
328
|
+
effort: generation.effort
|
|
329
|
+
} : {});
|
|
330
|
+
if (generation.status === 'refused') return _extends({}, spent, {
|
|
331
|
+
refused: true
|
|
332
|
+
});
|
|
333
|
+
if (generation.status === 'needs_input') return _extends({}, spent, {
|
|
334
|
+
review: aiDoctrineReview(generation)
|
|
335
|
+
});
|
|
336
|
+
const answer = generation.value;
|
|
337
|
+
if (answer.unsupported) return _extends({}, spent, {
|
|
338
|
+
failure: AI_AUTOMATION_UNSUPPORTED_COPY[answer.unsupported]
|
|
339
|
+
});
|
|
340
|
+
if (!answer.steps.length) return _extends({}, spent, {
|
|
341
|
+
failure: AI_WORKFLOW_NO_DRAFT_COPY
|
|
342
|
+
});
|
|
343
|
+
const draft = aiAutomationDraft(answer, records);
|
|
344
|
+
const write = await writer.write(_extends({}, context, {
|
|
345
|
+
id: draftId,
|
|
346
|
+
name: draft.action.name,
|
|
347
|
+
content: {
|
|
348
|
+
action: draft.action
|
|
349
|
+
}
|
|
350
|
+
}));
|
|
351
|
+
if (write.ok === false) {
|
|
352
|
+
return write.status === 403 ? _extends({}, spent, {
|
|
353
|
+
review: aiLimitReview(write.error)
|
|
354
|
+
}) : _extends({}, spent, {
|
|
355
|
+
failure: AI_WORKFLOW_SAVE_FAILURE_COPY
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
return _extends({}, spent, {
|
|
359
|
+
outputs: [
|
|
360
|
+
draftOutput(write.id, write.name, place, aiAutomationDraftNote(draft, answer.notes))
|
|
361
|
+
]
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
const target = await readTarget(firestore, {
|
|
365
|
+
hostId,
|
|
366
|
+
type: inputs.targetType,
|
|
367
|
+
id: inputs.targetId
|
|
368
|
+
});
|
|
369
|
+
if (!target) return unspent(AI_WORKFLOW_GONE_COPY);
|
|
370
|
+
let run = null;
|
|
371
|
+
if (inputs.mode === 'diagnose') {
|
|
372
|
+
const read = await readRun(firestore, {
|
|
373
|
+
hostId,
|
|
374
|
+
targetId: inputs.targetId,
|
|
375
|
+
runId: inputs.runId
|
|
376
|
+
});
|
|
377
|
+
if (read.ok === false) {
|
|
378
|
+
return unspent(read.reason === 'gone' ? AI_WORKFLOW_RUN_GONE_COPY : AI_WORKFLOW_RUN_NOT_FAILED_COPY);
|
|
379
|
+
}
|
|
380
|
+
run = read.run;
|
|
381
|
+
}
|
|
382
|
+
// Only the kinds of record the automation's steps name are read, to say
|
|
383
|
+
// whether each still exists.
|
|
384
|
+
const outline = target.type === 'action' ? aiActionOutline(target.action, await readRecords(firestore, {
|
|
385
|
+
orgId: job.orgId,
|
|
386
|
+
hostId,
|
|
387
|
+
crm: false,
|
|
388
|
+
only: aiActionRecordKinds(target.action)
|
|
389
|
+
})) : aiWorkflowOutline(target.workflow, await readFunctions(firestore, hostId));
|
|
390
|
+
const generation = await runValidatedGeneration('workflow', aiJobWorkflowExplainGeneration(_extends({
|
|
391
|
+
brief: job.brief,
|
|
392
|
+
mode: inputs.mode,
|
|
393
|
+
outline,
|
|
394
|
+
run: run ? aiRunOutline(run) : null,
|
|
395
|
+
model
|
|
396
|
+
}, signal ? {
|
|
397
|
+
signal
|
|
398
|
+
} : {})));
|
|
399
|
+
const spent = _extends({}, aiGenerationSpent(generation), generation.effort ? {
|
|
400
|
+
effort: generation.effort
|
|
401
|
+
} : {});
|
|
402
|
+
if (generation.status === 'refused') return _extends({}, spent, {
|
|
403
|
+
refused: true
|
|
404
|
+
});
|
|
405
|
+
if (generation.status === 'needs_input') return _extends({}, spent, {
|
|
406
|
+
failure: AI_WORKFLOW_NO_EXPLANATION_COPY
|
|
407
|
+
});
|
|
408
|
+
const output = {
|
|
409
|
+
resource: 'text',
|
|
410
|
+
// An explanation has no document of its own; the id names what it is
|
|
411
|
+
// within the job, as a text output's `draft` does.
|
|
412
|
+
id: inputs.mode === 'diagnose' ? 'diagnosis' : 'explanation',
|
|
413
|
+
hostId,
|
|
414
|
+
hostSubdomain,
|
|
415
|
+
label: inputs.mode === 'diagnose' ? `Why a run of ${quotedName(target.name)} failed` : `How ${quotedName(target.name)} works`,
|
|
416
|
+
text: aiWorkflowExplanationText(generation.value, inputs.mode)
|
|
417
|
+
};
|
|
418
|
+
return _extends({}, spent, {
|
|
419
|
+
outputs: [
|
|
420
|
+
output
|
|
421
|
+
]
|
|
422
|
+
});
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
function draftOutput(id, name, place, note) {
|
|
426
|
+
return {
|
|
427
|
+
resource: 'workflow',
|
|
428
|
+
id,
|
|
429
|
+
versionId: null,
|
|
430
|
+
hostId: place.hostId,
|
|
431
|
+
hostSubdomain: place.hostSubdomain,
|
|
432
|
+
label: name,
|
|
433
|
+
note
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
export const runAiJobWorkflowStep = createAiJobWorkflowStep();
|
|
437
|
+
// ── Admission ─────────────────────────────────────────────────────────────
|
|
438
|
+
/** Whether the workflows plugin runs on this site: switched on, and past its release flag. */ async function workflowsPluginRefusal(context, hostId) {
|
|
439
|
+
var _data;
|
|
440
|
+
const host = (_data = (await context.firestore.collection('hosts').doc(hostId).get()).data()) != null ? _data : null;
|
|
441
|
+
const org = context.org;
|
|
442
|
+
const released = await filterEnabledPluginsByReleaseFlags([
|
|
443
|
+
AI_WORKFLOWS_PLUGIN_ID
|
|
444
|
+
], {
|
|
445
|
+
orgId: context.orgId,
|
|
446
|
+
authorization: null
|
|
447
|
+
});
|
|
448
|
+
return released.includes(AI_WORKFLOWS_PLUGIN_ID) && isHostPluginEnabled(org, host, AI_WORKFLOWS_PLUGIN_ID) ? null : {
|
|
449
|
+
status: 403,
|
|
450
|
+
error: aiPluginDraftUnavailable('Automation')
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* A workflow job is admitted for a site of its org with the Automation plugin
|
|
455
|
+
* on. A draft also needs the draft writer and the member's room and role in
|
|
456
|
+
* its own words; an explanation needs the automation it names to exist, and
|
|
457
|
+
* a run's explanation a failed run of it.
|
|
458
|
+
*/ export function createAiWorkflowJobAdmission(deps = {}) {
|
|
459
|
+
var _deps_readTarget, _deps_readRun;
|
|
460
|
+
const readTarget = (_deps_readTarget = deps.readTarget) != null ? _deps_readTarget : readAiWorkflowTarget;
|
|
461
|
+
const readRun = (_deps_readRun = deps.readRun) != null ? _deps_readRun : readAiWorkflowRun;
|
|
462
|
+
return async (context)=>{
|
|
463
|
+
const inputs = parseAiWorkflowJobInputs(context.inputs);
|
|
464
|
+
if (typeof inputs === 'string') return {
|
|
465
|
+
status: 400,
|
|
466
|
+
error: inputs
|
|
467
|
+
};
|
|
468
|
+
if (inputs.mode === 'draft') {
|
|
469
|
+
return aiPluginDraftAdmissionRefusal(context, _extends({
|
|
470
|
+
kind: 'workflow',
|
|
471
|
+
drafts: [
|
|
472
|
+
{
|
|
473
|
+
resource: AI_AUTOMATION_RESOURCE,
|
|
474
|
+
pluginId: AI_WORKFLOWS_PLUGIN_ID,
|
|
475
|
+
label: 'Automation'
|
|
476
|
+
}
|
|
477
|
+
]
|
|
478
|
+
}, deps.writerFor ? {
|
|
479
|
+
writerFor: deps.writerFor
|
|
480
|
+
} : {}));
|
|
481
|
+
}
|
|
482
|
+
const hostId = context.hostId;
|
|
483
|
+
if (!hostId) return {
|
|
484
|
+
status: 400,
|
|
485
|
+
error: 'Open the site the automation is on before asking about it'
|
|
486
|
+
};
|
|
487
|
+
const owner = await resolveOrgIdForHost(hostId);
|
|
488
|
+
if (!owner || owner !== context.orgId) return {
|
|
489
|
+
status: 404,
|
|
490
|
+
error: 'Unknown site'
|
|
491
|
+
};
|
|
492
|
+
const plugin = await workflowsPluginRefusal(context, hostId);
|
|
493
|
+
if (plugin) return plugin;
|
|
494
|
+
const target = await readTarget(context.firestore, {
|
|
495
|
+
hostId,
|
|
496
|
+
type: inputs.targetType,
|
|
497
|
+
id: inputs.targetId
|
|
498
|
+
});
|
|
499
|
+
if (!target) return {
|
|
500
|
+
status: 404,
|
|
501
|
+
error: AI_WORKFLOW_GONE_COPY
|
|
502
|
+
};
|
|
503
|
+
if (inputs.mode === 'diagnose') {
|
|
504
|
+
const run = await readRun(context.firestore, {
|
|
505
|
+
hostId,
|
|
506
|
+
targetId: inputs.targetId,
|
|
507
|
+
runId: inputs.runId
|
|
508
|
+
});
|
|
509
|
+
if (run.ok === false) {
|
|
510
|
+
return run.reason === 'gone' ? {
|
|
511
|
+
status: 404,
|
|
512
|
+
error: AI_WORKFLOW_RUN_GONE_COPY
|
|
513
|
+
} : {
|
|
514
|
+
status: 400,
|
|
515
|
+
error: AI_WORKFLOW_RUN_NOT_FAILED_COPY
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
return null;
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
export const aiWorkflowJobAdmission = createAiWorkflowJobAdmission();
|
|
523
|
+
/** Registers the workflow step and the check a workflow job passes before it is created or resumed. */ export function registerAiWorkflowJob() {
|
|
524
|
+
registerAiJobStep('workflow', runAiJobWorkflowStep, {
|
|
525
|
+
minimumMs: AI_JOB_WORKFLOW_STEP_MINIMUM_MS
|
|
526
|
+
});
|
|
527
|
+
registerAiJobAdmission('workflow', aiWorkflowJobAdmission);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
//# sourceMappingURL=ai-job-workflow-step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-job-workflow-step.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ACTION_MAX_CONDITIONS,\n ACTION_MAX_STEPS,\n CONTACT_TAG_MAX_LENGTH,\n FLOW_TIMED_OUT_FIELD,\n FLOW_WAIT_MAX_MINUTES,\n HOST_ACTION_STEP_LABELS,\n} from '@aglyn/aglyn/app-utils/actions'\nimport { CONTACT_LIFECYCLE_STAGES, CRM_TASK_MAX_DUE_DAYS } from '@aglyn/aglyn/app-utils/crm'\nimport { HOST_EVENT_PAYLOAD_KEYS, type HostEventType } from '@aglyn/aglyn/app-utils/workflows'\nimport { isHostPluginEnabled } from '@aglyn/aglyn/plugin-manager/enabled-plugins'\nimport { filterEnabledPluginsByReleaseFlags } from '@aglyn/tenant-data-admin/server/release-flags'\nimport { resolveOrgIdForHost } from '@aglyn/tenant-data-admin/server/organizations'\nimport {\n aiAutomationDraft,\n aiAutomationDraftNote,\n type AiAutomationRecords,\n} from '../model/ai-automation-draft'\nimport {\n aiActionOutline,\n aiActionRecordKinds,\n aiRunOutline,\n aiWorkflowExplanationText,\n aiWorkflowOutline,\n type AiRunRecord,\n} from '../model/ai-automation-outline'\nimport type { AiJobOutput } from '../model/ai-jobs.types'\nimport {\n AI_AUTOMATION_NEED_LABELS,\n AI_AUTOMATION_RESOURCE,\n AI_AUTOMATION_STEP_NEEDS,\n AI_AUTOMATION_STEP_TYPES,\n AI_AUTOMATION_TRIGGER_NEEDS,\n AI_AUTOMATION_TRIGGERS,\n AI_AUTOMATION_UNSUPPORTED_COPY,\n AI_WORKFLOW_GONE_COPY,\n AI_WORKFLOW_NO_DRAFT_COPY,\n AI_WORKFLOW_NO_EXPLANATION_COPY,\n AI_WORKFLOW_NO_SITE_COPY,\n AI_WORKFLOW_RUN_GONE_COPY,\n AI_WORKFLOW_RUN_NOT_FAILED_COPY,\n AI_WORKFLOW_SAVE_FAILURE_COPY,\n AI_WORKFLOW_UNAVAILABLE_COPY,\n AI_WORKFLOWS_PLUGIN_ID,\n aiAutomationCapabilities,\n aiAutomationTriggerLabel,\n parseAiWorkflowJobInputs,\n type AiAutomationCapabilities,\n type AiAutomationStepType,\n} from '../model/ai-workflow-job'\nimport { AI_STEP_TIERS } from '../providers/catalog'\nimport { AI_ROUTING_TABLE, aiModelForStep } from '../providers/routing'\nimport {\n runValidatedGeneration,\n type AiCustomGenerationInput,\n type AiGenerationCheck,\n} from '../runtime/ai-doctrine'\nimport type { AiSystemBlock } from '../runtime/ai-runtime'\nimport {\n AI_AUTOMATION_TOOL_NAME,\n AI_WORKFLOW_EXPLANATION_TOOL_NAME,\n aiAutomationTool,\n aiWorkflowExplanationTool,\n readAiAutomationAnswer,\n readAiWorkflowExplanation,\n type AiAutomationAnswer,\n type AiWorkflowExplanation,\n} from '../tools/ai-workflow-tool'\nimport { registerAiJobAdmission, type AiJobAdmission, type AiJobAdmissionRefusal } from './ai-job-admission'\nimport { aiJobStepBudget } from './ai-job-budget'\nimport { aiJobDraftId } from './ai-job-draft-ids'\nimport { aiDoctrineReview, aiGenerationSpent, aiLimitReview, aiUnspentOutcome } from './ai-job-generation'\nimport {\n aiPluginDraftAdmissionRefusal,\n aiPluginDraftUnavailable,\n aiPluginDraftWriter,\n type AiPluginDraftWriterLookup,\n} from './ai-job-plugin-drafts'\nimport { AI_JOB_BRIEF_MAX_CHARS, type AiJobStepOutcome, type AiJobStepRunner } from './ai-job-text-step'\nimport { registerAiJobStep } from './ai-jobs'\nimport {\n readAiAutomationRecords,\n readAiWorkflowFunctions,\n readAiWorkflowRun,\n readAiWorkflowTarget,\n} from './ai-workflow-records'\n\n/**\n * The `workflow` step (AGL-2919): an automation drafted from a description,\n * or a saved automation explained.\n *\n * ## Drafting\n *\n * The model is shown the platform's automation vocabulary — every trigger with\n * the fields it carries, every step with the fields it takes — in a cached\n * block, and in the user turn what this workspace can run, the site's forms\n * and datasets by name, and the description. It answers through\n * `submit_automation`, and the answer is held to the vocabulary and to what\n * the workspace can run before anything is written.\n *\n * A record the description names — a list, a campaign, a workflow, a webhook,\n * a dataset, a form, a deal stage — is answered in the description's WORDS,\n * and looked up among the site's records in code, after the answer\n * (`model/ai-automation-draft.ts`). The model is never shown the site's lists,\n * campaigns, workflows, webhooks or pipelines. Words that name no record, or\n * more than one, are kept as a placeholder the person fills in.\n *\n * The automation is written through the workflows plugin's draft writer —\n * that plugin's stored shape, validator, role, plan and cap — keyed by the\n * job's id, and it is written OFF. A run cut off after the write finds its\n * draft and spends nothing.\n *\n * ## Explaining\n *\n * The model is shown an outline of the saved automation, and for a failed run\n * what the run history recorded about it (`model/ai-automation-outline.ts`):\n * never the stored documents, never an email address, never a run's event\n * payload. It answers through `submit_explanation`, which becomes a `text`\n * output. Nothing is changed.\n */\n\n/** The longest an explanation or a draft's generation may take reading the site first. */\nexport const AI_WORKFLOW_RECORDS_READ_MS = 4_000\n\n/**\n * The step's time (AGL-3035): its answer and its re-ask at the routing\n * table's `job.workflow` ceiling on the tier the step is served from. It sends\n * no site inventory block, so it makes no lookup; its own reads — the records\n * a draft is matched against, or the automation and run an explanation\n * reads — are the declared `AI_WORKFLOW_RECORDS_READ_MS`.\n */\nexport const AI_JOB_WORKFLOW_STEP_BUDGET = aiJobStepBudget({\n tier: AI_STEP_TIERS['job.workflow'],\n maxTokens: AI_ROUTING_TABLE['job.workflow'].maxTokens,\n lookups: 0,\n ownReadsMs: AI_WORKFLOW_RECORDS_READ_MS,\n})\n\n/** The least time one workflow step needs before it starts. */\nexport const AI_JOB_WORKFLOW_STEP_MINIMUM_MS = AI_JOB_WORKFLOW_STEP_BUDGET.minimumMs\n\n/** The routing table's answer for `job.workflow`. */\nexport function aiJobWorkflowModel(): string {\n return aiModelForStep('job.workflow')\n}\n\n/** How many forms and datasets the user turn lists, and how many fields a form. */\nexport const AI_WORKFLOW_FORMS_LISTED = 40\nexport const AI_WORKFLOW_FORM_FIELDS_LISTED = 20\nexport const AI_WORKFLOW_DATASETS_LISTED = 40\n\n// ── The vocabulary, for the model ─────────────────────────────────────────\n\nconst STEP_USES: Readonly<Record<AiAutomationStepType, string>> = {\n sendEmail: 'emails the person the event is about. Fields: subject, body (plain text), toField',\n notifyAdmins: 'notifies the site’s admins in the console. Fields: text (what the admins read)',\n enrollList: 'adds the person to an email list. Fields: reference (the list)',\n assignCampaign: 'files the person under a campaign. Fields: reference (the campaign)',\n runWorkflow: 'runs one of the site’s workflows. Fields: reference (the workflow)',\n datasetAppend: 'saves the event as a new record in a dataset. Fields: reference (the dataset)',\n updateDataset: 'updates the event’s record in a dataset. Fields: reference (the dataset)',\n webhookPost: 'sends the event to one of the site’s outbound webhooks. Fields: reference (the webhook)',\n siteAlert: 'shows the visitor who caused the event a short message. Fields: text (the message), severity',\n wait: 'waits before the next step. Fields: minutes',\n waitForEvent: 'waits until something else happens to the same person, or gives up. Fields: event, minutes',\n exitFlow: 'ends the automation here; with a when it is a branch. Fields: none',\n setContactStage: 'sets the person’s lifecycle stage. Fields: stage',\n addContactTag: 'tags the person. Fields: text (the tag)',\n assignContactOwner: 'gives the person an owner. Fields: text (the owner)',\n createCrmTask: 'creates a follow-up task. Fields: text (the task), taskKind, dueInDays',\n logCrmActivity: 'logs what happened on the person’s record. Fields: activityKind, text (what happened)',\n}\n\nfunction triggerLine(event: HostEventType): string {\n const fields =\n event === 'formSubmission'\n ? 'formName (the form’s name, as the request lists it), path, and every field the form collects, by its field name'\n : (HOST_EVENT_PAYLOAD_KEYS[event] ?? []).join(', ') || 'none'\n const need = AI_AUTOMATION_TRIGGER_NEEDS[event]\n return `- ${event} (${aiAutomationTriggerLabel(event)}). Fields: ${fields}.${\n need ? ` Needs ${AI_AUTOMATION_NEED_LABELS[need]}.` : ''\n }`\n}\n\nfunction stepLine(type: AiAutomationStepType): string {\n const need = AI_AUTOMATION_STEP_NEEDS[type]\n return `- ${type} (${HOST_ACTION_STEP_LABELS[type]}) ${STEP_USES[type]}.${\n need ? ` Needs ${AI_AUTOMATION_NEED_LABELS[need]}.` : ''\n }`\n}\n\n/**\n * The drafting instructions, byte-identical on every request so they cache.\n * Built from the platform's own trigger and step catalogs, so the vocabulary\n * the model is shown is the vocabulary the answer is held to.\n */\nexport const AI_JOB_WORKFLOW_DRAFT_INSTRUCTIONS: readonly AiSystemBlock[] = [\n {\n text: [\n `You turn a description into one automation for the Actions page of a website builder: something that happens on the site (the trigger), the conditions it must meet, and the steps that run, in order. Answer by calling ${AI_AUTOMATION_TOOL_NAME} exactly once. A reply in prose cannot be used.`,\n '',\n 'A step is written as when it runs and what it does: a when beside an action that carries its type and only that type’s fields. Use only these triggers and steps; each step lists the fields its action takes, and it carries only those.',\n '',\n 'Triggers, with the fields their conditions can read:',\n ...AI_AUTOMATION_TRIGGERS.map(triggerLine),\n '',\n 'Steps:',\n ...AI_AUTOMATION_STEP_TYPES.map(stepLine),\n '',\n 'Rules:',\n '- A step that names a list, campaign, workflow, webhook or dataset writes it as reference, in the description’s own words, such as \"newsletter\". The platform finds the site’s record by those words. Never write an id for one.',\n '- A form is named by the id or the name the request lists: formId on contactCreated, formName on formSubmission. A form the description names that the request does not list is written in the description’s words.',\n '- A deal stage in a condition on stageId or previousStageId is written as the stage’s name.',\n `- A lifecycle stage is one of: ${CONTACT_LIFECYCLE_STAGES.join(', ')}. A new lead is the stage lead.`,\n `- The trigger holds at most ${ACTION_MAX_CONDITIONS} conditions; combinator is and unless the description means any of them. A step's when holds one condition of its own at most, over the same fields. After waitForEvent, when on the field \"${FLOW_TIMED_OUT_FIELD}\" with notEmpty means the wait ran out of time.`,\n `- At most ${ACTION_MAX_STEPS} steps. minutes are whole minutes, at most ${FLOW_WAIT_MAX_MINUTES}; dueInDays is from 0 to ${CRM_TASK_MAX_DUE_DAYS}; addContactTag’s text is at most ${CONTACT_TAG_MAX_LENGTH} characters.`,\n '- assignContactOwner’s text is \"round robin\", or the teammate’s email address when the description gives one. A teammate named without an address goes in notes.',\n '- Write an email’s subject and body, and any text a person reads, in the site’s voice and the language of the description. Where the description lacks a fact such as a phone number, an address or a price, write a short description of it in square brackets instead of inventing it.',\n '- A trigger or a step the request says this workspace cannot use is never used. When the description needs one, or needs something no trigger or step here does, answer with unsupported set to the reason, no steps, and trigger event formSubmission with no conditions. unsupported is empty on every automation that is built.',\n '- notes holds what the person must decide that the automation cannot hold, in at most three short sentences; empty when there is nothing.',\n '- The automation is drafted switched off, and a person reviews it and switches it on. Never ask to turn it on or to run it.',\n ].join('\\n'),\n cacheBreakpoint: true,\n },\n]\n\n/** The explaining instructions, byte-identical on every request so they cache. */\nexport const AI_JOB_WORKFLOW_EXPLAIN_INSTRUCTIONS: readonly AiSystemBlock[] = [\n {\n text: [\n `You explain an automation on a website builder to the person who owns the site, in plain words for someone who does not write code. You are shown the automation as it is set up — what starts it, its conditions and its steps in order — and, when you are asked why a run failed, what the run history recorded about that run. Answer by calling ${AI_WORKFLOW_EXPLANATION_TOOL_NAME} exactly once.`,\n '',\n '- summary: in one or two sentences, what the automation does; or, for a failed run, the most likely reason it failed.',\n '- points: what happens, step by step, in the order it happens; or, for a failed run, what the run did and where it went wrong. One sentence each.',\n '- suggestions: what the person can check or change — a list, campaign or workflow the site no longer has, a condition that can never match, a placeholder nobody has filled in, a step the plan does not include. For a failed run, how to fix it. Empty when there is nothing to suggest.',\n '',\n 'Rules:',\n '- Explain only what you are shown. Never guess at settings, records or history you were not given, and never say you changed anything: you change nothing.',\n '- Name triggers and steps the way you are shown them, not by internal names.',\n '- A value in square brackets is a placeholder nobody has filled in yet.',\n '- Personal details were removed from what you are shown, and are written as [email address] or a named teammate. Never ask for them.',\n '- Write plain text, with no markdown and no HTML.',\n ].join('\\n'),\n cacheBreakpoint: true,\n },\n]\n\n// ── The user turns ────────────────────────────────────────────────────────\n\nfunction yesNo(value: boolean): string {\n return value ? 'yes' : 'no'\n}\n\n/** What a draft is asked from: the workspace's reach, the site's forms and datasets, and the brief. */\nexport function aiJobWorkflowDraftPrompt(input: {\n brief: string\n capabilities: AiAutomationCapabilities\n records: Pick<AiAutomationRecords, 'forms' | 'datasets'>\n}): string {\n const { crm, webhooks, bookings } = input.capabilities\n const forms = input.records.forms.slice(0, AI_WORKFLOW_FORMS_LISTED)\n const datasets = input.records.datasets.slice(0, AI_WORKFLOW_DATASETS_LISTED)\n return [\n `This workspace can use: the CRM — ${yesNo(crm)}; webhooks — ${yesNo(webhooks)}; bookings — ${yesNo(bookings)}.`,\n 'Forms on this site (id · name · fields):',\n ...(forms.length\n ? forms.map(\n (form) =>\n `- ${form.id} · ${form.name} · ${form.fields.slice(0, AI_WORKFLOW_FORM_FIELDS_LISTED).join(', ') || 'no fields'}`,\n )\n : ['- none']),\n 'Datasets on this site (name):',\n ...(datasets.length ? datasets.map((dataset) => `- ${dataset.name}`) : ['- none']),\n `Brief: ${input.brief.slice(0, AI_JOB_BRIEF_MAX_CHARS)}`,\n ].join('\\n')\n}\n\n/** What an explanation is asked from: the mode, the outlines, and the member's question. */\nexport function aiJobWorkflowExplainPrompt(input: {\n brief: string\n mode: 'explain' | 'diagnose'\n outline: string\n run: string | null\n}): string {\n return [\n input.mode === 'diagnose'\n ? 'Asked: why a run of this automation failed.'\n : 'Asked: what this automation does.',\n input.outline,\n ...(input.run ? [input.run] : []),\n `Question: ${input.brief.slice(0, AI_JOB_BRIEF_MAX_CHARS)}`,\n ].join('\\n\\n')\n}\n\n/** The routing row's thinking and effort, as a generation input spells them. */\nfunction routedEffort(): Pick<AiCustomGenerationInput<unknown>, 'thinking' | 'effort'> {\n const row = AI_ROUTING_TABLE['job.workflow']\n return {\n ...(row.thinking ? { thinking: row.thinking } : {}),\n ...(row.effort ? { effort: row.effort } : {}),\n }\n}\n\n/** The draft generation as the doctrine's loop runs it; the eval harness records one through this same call. */\nexport function aiJobWorkflowDraftGeneration(request: {\n brief: string\n capabilities: AiAutomationCapabilities\n records: Pick<AiAutomationRecords, 'forms' | 'datasets'>\n model: string\n signal?: AbortSignal\n}): AiCustomGenerationInput<AiAutomationAnswer> {\n const check: AiGenerationCheck<AiAutomationAnswer> = (answer) =>\n readAiAutomationAnswer(answer, request.capabilities)\n return {\n step: 'job.workflow',\n model: request.model,\n instructions: AI_JOB_WORKFLOW_DRAFT_INSTRUCTIONS,\n messages: [{ role: 'user', content: aiJobWorkflowDraftPrompt(request) }],\n tool: aiAutomationTool(),\n maxTokens: AI_JOB_WORKFLOW_STEP_BUDGET.maxTokens(request.model),\n ...routedEffort(),\n ...(request.signal ? { signal: request.signal } : {}),\n check,\n }\n}\n\n/** The explanation generation as the doctrine's loop runs it. */\nexport function aiJobWorkflowExplainGeneration(request: {\n brief: string\n mode: 'explain' | 'diagnose'\n outline: string\n run: string | null\n model: string\n signal?: AbortSignal\n}): AiCustomGenerationInput<AiWorkflowExplanation> {\n return {\n step: 'job.workflow',\n model: request.model,\n instructions: AI_JOB_WORKFLOW_EXPLAIN_INSTRUCTIONS,\n messages: [{ role: 'user', content: aiJobWorkflowExplainPrompt(request) }],\n tool: aiWorkflowExplanationTool(),\n maxTokens: AI_JOB_WORKFLOW_STEP_BUDGET.maxTokens(request.model),\n ...routedEffort(),\n ...(request.signal ? { signal: request.signal } : {}),\n check: readAiWorkflowExplanation,\n }\n}\n\n// ── The runner ────────────────────────────────────────────────────────────\n\nexport interface AiJobWorkflowStepDeps {\n /** How the automation draft writer is found; the core's registry otherwise. */\n writerFor?: AiPluginDraftWriterLookup\n readRecords?: typeof readAiAutomationRecords\n readTarget?: typeof readAiWorkflowTarget\n readRun?: typeof readAiWorkflowRun\n readFunctions?: typeof readAiWorkflowFunctions\n}\n\n/** A job label: the automation's name in quotes, cut to a line. */\nfunction quotedName(name: string): string {\n const clean = name.replace(/\\s+/g, ' ').trim()\n return `“${clean.length > 60 ? `${clean.slice(0, 60)}…` : clean}”`\n}\n\nexport function createAiJobWorkflowStep(deps: AiJobWorkflowStepDeps = {}): AiJobStepRunner {\n const writerFor = deps.writerFor ?? aiPluginDraftWriter\n const readRecords = deps.readRecords ?? readAiAutomationRecords\n const readTarget = deps.readTarget ?? readAiWorkflowTarget\n const readRun = deps.readRun ?? readAiWorkflowRun\n const readFunctions = deps.readFunctions ?? readAiWorkflowFunctions\n return async ({ job, now, signal, firestore, org, modelFor }): Promise<AiJobStepOutcome> => {\n // The switch's answer for this job, else the routing table's (AGL-2942).\n const model = modelFor?.('job.workflow') ?? aiJobWorkflowModel()\n const unspent = (failure: string): AiJobStepOutcome => ({ ...aiUnspentOutcome(model), failure })\n const inputs = parseAiWorkflowJobInputs(job.inputs)\n if (typeof inputs === 'string') return unspent(inputs)\n const hostId = job.hostId\n if (!hostId) return unspent(AI_WORKFLOW_NO_SITE_COPY)\n // The door checks the caller's membership of the org the job is metered\n // against; the site is checked against that org here, before anything\n // about it is read into a prompt.\n const host = await firestore.collection('hosts').doc(hostId).get()\n if (!host.exists || host.get('orgId') !== job.orgId) return unspent(AI_WORKFLOW_NO_SITE_COPY)\n const subdomain = host.get('subdomain')\n const hostSubdomain = typeof subdomain === 'string' && subdomain ? subdomain : null\n const orgData = (org ?? (await firestore.collection('orgs').doc(job.orgId).get()).data() ?? null) as Record<\n string,\n unknown\n > | null\n const capabilities = aiAutomationCapabilities(orgData)\n\n if (inputs.mode === 'draft') {\n const writer = writerFor(AI_AUTOMATION_RESOURCE)\n if (!writer) return unspent(AI_WORKFLOW_UNAVAILABLE_COPY)\n const place = { hostId, hostSubdomain }\n // What an earlier run of this same job already wrote, under the id the job recorded.\n const draftId = aiJobDraftId(job, 'workflow')\n const written = await writer.read({ hostId, id: draftId })\n if (written) {\n return aiUnspentOutcome(model, {\n outputs: [draftOutput(written.id, written.name, place, 'It is off until you switch it on.')],\n })\n }\n const context = { orgId: job.orgId, hostId, uid: job.createdBy, org: orgData, now }\n const refusal = await writer.refusal(context)\n if (refusal) {\n return refusal.status === 403\n ? aiUnspentOutcome(model, { review: aiLimitReview(refusal.error) })\n : unspent(refusal.error)\n }\n const records = await readRecords(firestore, { orgId: job.orgId, hostId, crm: capabilities.crm })\n const generation = await runValidatedGeneration(\n 'workflow',\n aiJobWorkflowDraftGeneration({\n brief: job.brief,\n capabilities,\n records,\n model,\n ...(signal ? { signal } : {}),\n }),\n )\n const spent = { ...aiGenerationSpent(generation), ...(generation.effort ? { effort: generation.effort } : {}) }\n if (generation.status === 'refused') return { ...spent, refused: true }\n if (generation.status === 'needs_input') return { ...spent, review: aiDoctrineReview(generation) }\n const answer = generation.value\n if (answer.unsupported) return { ...spent, failure: AI_AUTOMATION_UNSUPPORTED_COPY[answer.unsupported] }\n if (!answer.steps.length) return { ...spent, failure: AI_WORKFLOW_NO_DRAFT_COPY }\n const draft = aiAutomationDraft(answer, records)\n const write = await writer.write({\n ...context,\n id: draftId,\n name: draft.action.name,\n content: { action: draft.action },\n })\n if (write.ok === false) {\n return write.status === 403\n ? { ...spent, review: aiLimitReview(write.error) }\n : { ...spent, failure: AI_WORKFLOW_SAVE_FAILURE_COPY }\n }\n return {\n ...spent,\n outputs: [draftOutput(write.id, write.name, place, aiAutomationDraftNote(draft, answer.notes))],\n }\n }\n\n const target = await readTarget(firestore, { hostId, type: inputs.targetType, id: inputs.targetId })\n if (!target) return unspent(AI_WORKFLOW_GONE_COPY)\n let run: AiRunRecord | null = null\n if (inputs.mode === 'diagnose') {\n const read = await readRun(firestore, { hostId, targetId: inputs.targetId, runId: inputs.runId })\n if (read.ok === false) {\n return unspent(read.reason === 'gone' ? AI_WORKFLOW_RUN_GONE_COPY : AI_WORKFLOW_RUN_NOT_FAILED_COPY)\n }\n run = read.run\n }\n // Only the kinds of record the automation's steps name are read, to say\n // whether each still exists.\n const outline =\n target.type === 'action'\n ? aiActionOutline(\n target.action,\n await readRecords(firestore, {\n orgId: job.orgId,\n hostId,\n crm: false,\n only: aiActionRecordKinds(target.action),\n }),\n )\n : aiWorkflowOutline(target.workflow, await readFunctions(firestore, hostId))\n const generation = await runValidatedGeneration(\n 'workflow',\n aiJobWorkflowExplainGeneration({\n brief: job.brief,\n mode: inputs.mode,\n outline,\n run: run ? aiRunOutline(run) : null,\n model,\n ...(signal ? { signal } : {}),\n }),\n )\n const spent = { ...aiGenerationSpent(generation), ...(generation.effort ? { effort: generation.effort } : {}) }\n if (generation.status === 'refused') return { ...spent, refused: true }\n if (generation.status === 'needs_input') return { ...spent, failure: AI_WORKFLOW_NO_EXPLANATION_COPY }\n const output: AiJobOutput = {\n resource: 'text',\n // An explanation has no document of its own; the id names what it is\n // within the job, as a text output's `draft` does.\n id: inputs.mode === 'diagnose' ? 'diagnosis' : 'explanation',\n hostId,\n hostSubdomain,\n label:\n inputs.mode === 'diagnose'\n ? `Why a run of ${quotedName(target.name)} failed`\n : `How ${quotedName(target.name)} works`,\n text: aiWorkflowExplanationText(generation.value, inputs.mode),\n }\n return { ...spent, outputs: [output] }\n }\n}\n\nfunction draftOutput(\n id: string,\n name: string,\n place: { hostId: string; hostSubdomain: string | null },\n note: string,\n): AiJobOutput {\n return {\n resource: 'workflow',\n id,\n versionId: null,\n hostId: place.hostId,\n hostSubdomain: place.hostSubdomain,\n label: name,\n note,\n }\n}\n\nexport const runAiJobWorkflowStep = createAiJobWorkflowStep()\n\n// ── Admission ─────────────────────────────────────────────────────────────\n\n/** Whether the workflows plugin runs on this site: switched on, and past its release flag. */\nasync function workflowsPluginRefusal(\n context: Parameters<AiJobAdmission>[0],\n hostId: string,\n): Promise<AiJobAdmissionRefusal | null> {\n const host = (await context.firestore.collection('hosts').doc(hostId).get()).data() ?? null\n const org = context.org as { enabledPlugins?: string[] } | null\n const released = await filterEnabledPluginsByReleaseFlags([AI_WORKFLOWS_PLUGIN_ID], {\n orgId: context.orgId,\n authorization: null,\n })\n return released.includes(AI_WORKFLOWS_PLUGIN_ID) && isHostPluginEnabled(org, host, AI_WORKFLOWS_PLUGIN_ID)\n ? null\n : { status: 403, error: aiPluginDraftUnavailable('Automation') }\n}\n\nexport interface AiWorkflowJobAdmissionDeps {\n readTarget?: typeof readAiWorkflowTarget\n readRun?: typeof readAiWorkflowRun\n writerFor?: AiPluginDraftWriterLookup\n}\n\n/**\n * A workflow job is admitted for a site of its org with the Automation plugin\n * on. A draft also needs the draft writer and the member's room and role in\n * its own words; an explanation needs the automation it names to exist, and\n * a run's explanation a failed run of it.\n */\nexport function createAiWorkflowJobAdmission(deps: AiWorkflowJobAdmissionDeps = {}): AiJobAdmission {\n const readTarget = deps.readTarget ?? readAiWorkflowTarget\n const readRun = deps.readRun ?? readAiWorkflowRun\n return async (context) => {\n const inputs = parseAiWorkflowJobInputs(context.inputs)\n if (typeof inputs === 'string') return { status: 400, error: inputs }\n if (inputs.mode === 'draft') {\n return aiPluginDraftAdmissionRefusal(context, {\n kind: 'workflow',\n drafts: [{ resource: AI_AUTOMATION_RESOURCE, pluginId: AI_WORKFLOWS_PLUGIN_ID, label: 'Automation' }],\n ...(deps.writerFor ? { writerFor: deps.writerFor } : {}),\n })\n }\n const hostId = context.hostId\n if (!hostId) return { status: 400, error: 'Open the site the automation is on before asking about it' }\n const owner = await resolveOrgIdForHost(hostId)\n if (!owner || owner !== context.orgId) return { status: 404, error: 'Unknown site' }\n const plugin = await workflowsPluginRefusal(context, hostId)\n if (plugin) return plugin\n const target = await readTarget(context.firestore, { hostId, type: inputs.targetType, id: inputs.targetId })\n if (!target) return { status: 404, error: AI_WORKFLOW_GONE_COPY }\n if (inputs.mode === 'diagnose') {\n const run = await readRun(context.firestore, { hostId, targetId: inputs.targetId, runId: inputs.runId })\n if (run.ok === false) {\n return run.reason === 'gone'\n ? { status: 404, error: AI_WORKFLOW_RUN_GONE_COPY }\n : { status: 400, error: AI_WORKFLOW_RUN_NOT_FAILED_COPY }\n }\n }\n return null\n }\n}\n\nexport const aiWorkflowJobAdmission = createAiWorkflowJobAdmission()\n\n/** Registers the workflow step and the check a workflow job passes before it is created or resumed. */\nexport function registerAiWorkflowJob(): void {\n registerAiJobStep('workflow', runAiJobWorkflowStep, { minimumMs: AI_JOB_WORKFLOW_STEP_MINIMUM_MS })\n registerAiJobAdmission('workflow', aiWorkflowJobAdmission)\n}\n"],"names":["ACTION_MAX_CONDITIONS","ACTION_MAX_STEPS","CONTACT_TAG_MAX_LENGTH","FLOW_TIMED_OUT_FIELD","FLOW_WAIT_MAX_MINUTES","HOST_ACTION_STEP_LABELS","CONTACT_LIFECYCLE_STAGES","CRM_TASK_MAX_DUE_DAYS","HOST_EVENT_PAYLOAD_KEYS","isHostPluginEnabled","filterEnabledPluginsByReleaseFlags","resolveOrgIdForHost","aiAutomationDraft","aiAutomationDraftNote","aiActionOutline","aiActionRecordKinds","aiRunOutline","aiWorkflowExplanationText","aiWorkflowOutline","AI_AUTOMATION_NEED_LABELS","AI_AUTOMATION_RESOURCE","AI_AUTOMATION_STEP_NEEDS","AI_AUTOMATION_STEP_TYPES","AI_AUTOMATION_TRIGGER_NEEDS","AI_AUTOMATION_TRIGGERS","AI_AUTOMATION_UNSUPPORTED_COPY","AI_WORKFLOW_GONE_COPY","AI_WORKFLOW_NO_DRAFT_COPY","AI_WORKFLOW_NO_EXPLANATION_COPY","AI_WORKFLOW_NO_SITE_COPY","AI_WORKFLOW_RUN_GONE_COPY","AI_WORKFLOW_RUN_NOT_FAILED_COPY","AI_WORKFLOW_SAVE_FAILURE_COPY","AI_WORKFLOW_UNAVAILABLE_COPY","AI_WORKFLOWS_PLUGIN_ID","aiAutomationCapabilities","aiAutomationTriggerLabel","parseAiWorkflowJobInputs","AI_STEP_TIERS","AI_ROUTING_TABLE","aiModelForStep","runValidatedGeneration","AI_AUTOMATION_TOOL_NAME","AI_WORKFLOW_EXPLANATION_TOOL_NAME","aiAutomationTool","aiWorkflowExplanationTool","readAiAutomationAnswer","readAiWorkflowExplanation","registerAiJobAdmission","aiJobStepBudget","aiJobDraftId","aiDoctrineReview","aiGenerationSpent","aiLimitReview","aiUnspentOutcome","aiPluginDraftAdmissionRefusal","aiPluginDraftUnavailable","aiPluginDraftWriter","AI_JOB_BRIEF_MAX_CHARS","registerAiJobStep","readAiAutomationRecords","readAiWorkflowFunctions","readAiWorkflowRun","readAiWorkflowTarget","AI_WORKFLOW_RECORDS_READ_MS","AI_JOB_WORKFLOW_STEP_BUDGET","tier","maxTokens","lookups","ownReadsMs","AI_JOB_WORKFLOW_STEP_MINIMUM_MS","minimumMs","aiJobWorkflowModel","AI_WORKFLOW_FORMS_LISTED","AI_WORKFLOW_FORM_FIELDS_LISTED","AI_WORKFLOW_DATASETS_LISTED","STEP_USES","sendEmail","notifyAdmins","enrollList","assignCampaign","runWorkflow","datasetAppend","updateDataset","webhookPost","siteAlert","wait","waitForEvent","exitFlow","setContactStage","addContactTag","assignContactOwner","createCrmTask","logCrmActivity","triggerLine","event","fields","join","need","stepLine","type","AI_JOB_WORKFLOW_DRAFT_INSTRUCTIONS","text","map","cacheBreakpoint","AI_JOB_WORKFLOW_EXPLAIN_INSTRUCTIONS","yesNo","value","aiJobWorkflowDraftPrompt","input","crm","webhooks","bookings","capabilities","forms","records","slice","datasets","length","form","id","name","dataset","brief","aiJobWorkflowExplainPrompt","mode","outline","run","routedEffort","row","thinking","effort","aiJobWorkflowDraftGeneration","request","check","answer","step","model","instructions","messages","role","content","tool","signal","aiJobWorkflowExplainGeneration","quotedName","clean","replace","trim","createAiJobWorkflowStep","deps","writerFor","readRecords","readTarget","readRun","readFunctions","job","now","firestore","org","modelFor","unspent","failure","inputs","hostId","host","collection","doc","get","exists","orgId","subdomain","hostSubdomain","orgData","data","writer","place","draftId","written","read","outputs","draftOutput","context","uid","createdBy","refusal","status","review","error","generation","spent","refused","unsupported","steps","draft","write","action","ok","notes","target","targetType","targetId","runId","reason","only","workflow","output","resource","label","note","versionId","runAiJobWorkflowStep","workflowsPluginRefusal","released","authorization","includes","createAiWorkflowJobAdmission","kind","drafts","pluginId","owner","plugin","aiWorkflowJobAdmission","registerAiWorkflowJob"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,qBAAqB,EACrBC,gBAAgB,EAChBC,sBAAsB,EACtBC,oBAAoB,EACpBC,qBAAqB,EACrBC,uBAAuB,QAClB,iCAAgC;AACvC,SAASC,wBAAwB,EAAEC,qBAAqB,QAAQ,6BAA4B;AAC5F,SAASC,uBAAuB,QAA4B,mCAAkC;AAC9F,SAASC,mBAAmB,QAAQ,8CAA6C;AACjF,SAASC,kCAAkC,QAAQ,gDAA+C;AAClG,SAASC,mBAAmB,QAAQ,gDAA+C;AACnF,SACEC,iBAAiB,EACjBC,qBAAqB,QAEhB,kCAA8B;AACrC,SACEC,eAAe,EACfC,mBAAmB,EACnBC,YAAY,EACZC,yBAAyB,EACzBC,iBAAiB,QAEZ,oCAAgC;AAEvC,SACEC,yBAAyB,EACzBC,sBAAsB,EACtBC,wBAAwB,EACxBC,wBAAwB,EACxBC,2BAA2B,EAC3BC,sBAAsB,EACtBC,8BAA8B,EAC9BC,qBAAqB,EACrBC,yBAAyB,EACzBC,+BAA+B,EAC/BC,wBAAwB,EACxBC,yBAAyB,EACzBC,+BAA+B,EAC/BC,6BAA6B,EAC7BC,4BAA4B,EAC5BC,sBAAsB,EACtBC,wBAAwB,EACxBC,wBAAwB,EACxBC,wBAAwB,QA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