@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,369 @@
|
|
|
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 { parseMediaRef } from "@aglyn/aglyn/app-utils/media-ref";
|
|
18
|
+
import { COMPONENT_PROP_NAME_PATTERN } from "@aglyn/aglyn/app-utils/reusable-component-keys";
|
|
19
|
+
import { FieldComponentType } from "@aglyn/aglyn/foundation/definitions/components.types";
|
|
20
|
+
import { REUSABLE_PROP_KINDS } from "@aglyn/aglyn/foundation/definitions/property-kinds";
|
|
21
|
+
import { aiDoctrineTreeTool } from "../runtime/ai-doctrine.js";
|
|
22
|
+
import { HOSTILE_TEXT, isHttpsUrl, isRootRelativePath } from "../runtime/ai-node-tree.js";
|
|
23
|
+
import { AI_TEXT_LIMITS } from "../runtime/ai-palette.js";
|
|
24
|
+
const STYLE_REASON = 'Styling comes from the theme and the component’s own styles (rules 5 and 12); a page restyles one placement with an override, not a property.';
|
|
25
|
+
const RECORD_REASON = 'A pick from the site’s own records is made where a page places the component (rule 8), never invented as a generated default.';
|
|
26
|
+
const PLUGIN_REASON = 'Plugin settings belong to the plugin’s own element, which a generated component never places.';
|
|
27
|
+
/**
|
|
28
|
+
* Why each property kind the dialog declares is not offered to a model.
|
|
29
|
+
* Keyed by every kind outside the offered ones, so the table is complete by
|
|
30
|
+
* type.
|
|
31
|
+
*/ export const AI_COMPONENT_PROP_KINDS_NOT_OFFERED = {
|
|
32
|
+
[FieldComponentType.MARKDOWN]: 'Long text binds to the same formatted-document fields, with a default a brief can write.',
|
|
33
|
+
[FieldComponentType.DATA_TABLE]: 'A table is rows and columns a page fills in, not one value a brief describes.',
|
|
34
|
+
[FieldComponentType.SLIDER]: 'Number binds to every slider, without the range settings a Slider property must declare.',
|
|
35
|
+
[FieldComponentType.CHECKBOX]: 'Yes / no binds to every switch and single tick box, and no generated element offers a list of tick boxes.',
|
|
36
|
+
[FieldComponentType.RADIO]: 'Choice binds to every field Radio buttons binds to, with its answers checked in one place.',
|
|
37
|
+
[FieldComponentType.TOGGLE_BUTTON]: 'Choice binds to every field Toggle buttons binds to, with its answers checked in one place.',
|
|
38
|
+
[FieldComponentType.DUAL_LIST_SELECT]: 'A pick list holds several answers, and no generated element offers a field that takes several.',
|
|
39
|
+
[FieldComponentType.COLOR_PICKER]: 'Colors come from the theme (rule 5); a page recolors one placement with an override, not a property.',
|
|
40
|
+
[FieldComponentType.CSS_DIMENSION]: STYLE_REASON,
|
|
41
|
+
[FieldComponentType.CSS_BORDER]: STYLE_REASON,
|
|
42
|
+
[FieldComponentType.CSS_GRADIENT]: STYLE_REASON,
|
|
43
|
+
[FieldComponentType.BREAKPOINT_SPAN]: STYLE_REASON,
|
|
44
|
+
[FieldComponentType.PRESET_CHOICE]: STYLE_REASON,
|
|
45
|
+
[FieldComponentType.THEME_SCALE]: STYLE_REASON,
|
|
46
|
+
[FieldComponentType.DATE_PICKER]: 'A date is a fact the brief would have to give (rule 14), not copy a component shows until a page sets it.',
|
|
47
|
+
[FieldComponentType.TIME_PICKER]: 'A time is a fact the brief would have to give (rule 14), not copy a component shows until a page sets it.',
|
|
48
|
+
[FieldComponentType.NODE_SELECT]: RECORD_REASON,
|
|
49
|
+
[FieldComponentType.PRODUCT_SELECT]: RECORD_REASON,
|
|
50
|
+
[FieldComponentType.COLLECTION_SELECT]: RECORD_REASON,
|
|
51
|
+
[FieldComponentType.CATEGORY_SELECT]: RECORD_REASON,
|
|
52
|
+
[FieldComponentType.DATASET_SELECT]: RECORD_REASON,
|
|
53
|
+
[FieldComponentType.DATASET_FIELD_SELECT]: RECORD_REASON,
|
|
54
|
+
[FieldComponentType.FORM_SELECT]: 'A form is placed by its id from the Forms page (rule 3), never chosen through a generated property.',
|
|
55
|
+
[FieldComponentType.PLUGIN_SELECT]: PLUGIN_REASON,
|
|
56
|
+
[FieldComponentType.PLUGIN_SETTINGS]: PLUGIN_REASON
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* The kinds a generated component may declare: the dialog's table less the
|
|
60
|
+
* kinds above, in the dialog's own order.
|
|
61
|
+
*/ export const AI_COMPONENT_PROP_KINDS = Object.keys(REUSABLE_PROP_KINDS).filter((type)=>!Object.prototype.hasOwnProperty.call(AI_COMPONENT_PROP_KINDS_NOT_OFFERED, type));
|
|
62
|
+
/**
|
|
63
|
+
* The kinds a property proposed for a section already on a page may take
|
|
64
|
+
* (AGL-3054): every offered kind but an Icon. That door reads each default off
|
|
65
|
+
* the live field it binds, and an icon's default is drawn from a path the
|
|
66
|
+
* picker stores beside its id, which the field it reads does not carry.
|
|
67
|
+
*/ export const AI_COMPONENT_SELECTION_PROP_KINDS = AI_COMPONENT_PROP_KINDS.filter((type)=>type !== 'icon');
|
|
68
|
+
/** The kinds as a model reads them: the stored type and the name a page reads. */ export function aiComponentPropKindWords(kinds = AI_COMPONENT_PROP_KINDS) {
|
|
69
|
+
return kinds.map((type)=>`${type} (${REUSABLE_PROP_KINDS[type].label})`).join(', ');
|
|
70
|
+
}
|
|
71
|
+
export const AI_COMPONENT_TOOL_NAME = 'submit_component';
|
|
72
|
+
/** The most properties one generated component declares. */ export const AI_COMPONENT_MAX_PROPS = 20;
|
|
73
|
+
const NAME_MAX = 40;
|
|
74
|
+
const LABEL_MAX = 80;
|
|
75
|
+
const HELP_MAX = 200;
|
|
76
|
+
const ANSWER_MAX = 100;
|
|
77
|
+
/**
|
|
78
|
+
* The strict tool a component arrives through: the doctrine's tree, as the
|
|
79
|
+
* doctrine's own component tool carries it, and the properties beside it.
|
|
80
|
+
* Every field of a property is required and flat, because optional
|
|
81
|
+
* properties are not portable across strict tool implementations; a kind
|
|
82
|
+
* that has no answers sends `[]`.
|
|
83
|
+
*/ export function aiComponentTool() {
|
|
84
|
+
const doctrine = aiDoctrineTreeTool('component');
|
|
85
|
+
const tree = doctrine.inputSchema.properties['tree'];
|
|
86
|
+
return {
|
|
87
|
+
name: AI_COMPONENT_TOOL_NAME,
|
|
88
|
+
description: 'Submit the reusable component: its tree as one flat node map, and every property the tree binds.',
|
|
89
|
+
strict: true,
|
|
90
|
+
inputSchema: {
|
|
91
|
+
type: 'object',
|
|
92
|
+
additionalProperties: false,
|
|
93
|
+
required: [
|
|
94
|
+
'tree',
|
|
95
|
+
'props'
|
|
96
|
+
],
|
|
97
|
+
properties: {
|
|
98
|
+
tree,
|
|
99
|
+
props: {
|
|
100
|
+
type: 'array',
|
|
101
|
+
description: 'Every property the tree binds with {{prop.<name>}}, in the order a page sets them.',
|
|
102
|
+
items: {
|
|
103
|
+
type: 'object',
|
|
104
|
+
additionalProperties: false,
|
|
105
|
+
required: [
|
|
106
|
+
'name',
|
|
107
|
+
'type',
|
|
108
|
+
'label',
|
|
109
|
+
'description',
|
|
110
|
+
'defaultValue',
|
|
111
|
+
'options'
|
|
112
|
+
],
|
|
113
|
+
properties: {
|
|
114
|
+
name: {
|
|
115
|
+
type: 'string',
|
|
116
|
+
description: 'Letters, digits and underscores, starting with a letter; bound as {{prop.<name>}}.'
|
|
117
|
+
},
|
|
118
|
+
type: {
|
|
119
|
+
type: 'string',
|
|
120
|
+
enum: [
|
|
121
|
+
...AI_COMPONENT_PROP_KINDS
|
|
122
|
+
],
|
|
123
|
+
description: `The kind, as type (the name a page reads): ${aiComponentPropKindWords()}.`
|
|
124
|
+
},
|
|
125
|
+
label: {
|
|
126
|
+
type: 'string',
|
|
127
|
+
description: 'The words a page reads beside the field.'
|
|
128
|
+
},
|
|
129
|
+
description: {
|
|
130
|
+
type: 'string',
|
|
131
|
+
description: 'Help beside the field, or "".'
|
|
132
|
+
},
|
|
133
|
+
defaultValue: {
|
|
134
|
+
type: 'string',
|
|
135
|
+
description: 'What the component shows until a page sets it: copy for text and richText, a screen id from the site inventory or "" for href, "" for image and icon, a number for number, "true" or "false" for boolean, one answer’s value for choice.'
|
|
136
|
+
},
|
|
137
|
+
options: {
|
|
138
|
+
type: 'array',
|
|
139
|
+
description: 'The answers of a choice; [] for every other kind.',
|
|
140
|
+
items: {
|
|
141
|
+
type: 'object',
|
|
142
|
+
additionalProperties: false,
|
|
143
|
+
required: [
|
|
144
|
+
'value',
|
|
145
|
+
'label'
|
|
146
|
+
],
|
|
147
|
+
properties: {
|
|
148
|
+
value: {
|
|
149
|
+
type: 'string',
|
|
150
|
+
description: 'What the bound field receives: one of the values that field lists.'
|
|
151
|
+
},
|
|
152
|
+
label: {
|
|
153
|
+
type: 'string',
|
|
154
|
+
description: 'What a page picks.'
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
const isRecord = (value)=>typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
167
|
+
/** A scalar the answer wrote, as trimmed text. */ function scalar(value) {
|
|
168
|
+
return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean' ? String(value).trim() : '';
|
|
169
|
+
}
|
|
170
|
+
/** A default as the kind stores it, or why it cannot be one. */ function readDefault(type, raw, options, scope) {
|
|
171
|
+
const value = scalar(raw);
|
|
172
|
+
if (HOSTILE_TEXT.test(value)) return {
|
|
173
|
+
error: 'carries markup or script',
|
|
174
|
+
rule: 1
|
|
175
|
+
};
|
|
176
|
+
// Nothing set is a default of its own: the kind's "not set".
|
|
177
|
+
if (!value) return {
|
|
178
|
+
value: undefined
|
|
179
|
+
};
|
|
180
|
+
switch(type){
|
|
181
|
+
case 'text':
|
|
182
|
+
case 'richText':
|
|
183
|
+
return value.length > AI_TEXT_LIMITS.body ? {
|
|
184
|
+
error: `runs past ${AI_TEXT_LIMITS.body} characters`,
|
|
185
|
+
rule: 1
|
|
186
|
+
} : {
|
|
187
|
+
value
|
|
188
|
+
};
|
|
189
|
+
case 'icon':
|
|
190
|
+
// The picker stores an icon with the drawing a model cannot name, so
|
|
191
|
+
// the site owner picks it where a page places the component.
|
|
192
|
+
return {
|
|
193
|
+
error: 'is an icon, which the site owner picks; leave it ""',
|
|
194
|
+
rule: 1
|
|
195
|
+
};
|
|
196
|
+
case 'image':
|
|
197
|
+
if (/^https?:\/\//i.test(value)) {
|
|
198
|
+
return {
|
|
199
|
+
error: 'links a picture from another website; leave it empty for an upload',
|
|
200
|
+
rule: 9
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
return parseMediaRef(value) ? {
|
|
204
|
+
value
|
|
205
|
+
} : {
|
|
206
|
+
error: 'is not a picture from the media library; leave it empty for an upload',
|
|
207
|
+
rule: 9
|
|
208
|
+
};
|
|
209
|
+
case 'href':
|
|
210
|
+
return scope.screenIds.has(value) || isRootRelativePath(value) || isHttpsUrl(value) ? {
|
|
211
|
+
value
|
|
212
|
+
} : {
|
|
213
|
+
error: 'is neither a screen id from the site inventory, a path on this site nor an https: address',
|
|
214
|
+
rule: 1
|
|
215
|
+
};
|
|
216
|
+
case 'number':
|
|
217
|
+
{
|
|
218
|
+
const parsed = Number(value);
|
|
219
|
+
return Number.isFinite(parsed) ? {
|
|
220
|
+
value: parsed
|
|
221
|
+
} : {
|
|
222
|
+
error: 'is not a number',
|
|
223
|
+
rule: 1
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
case 'boolean':
|
|
227
|
+
if (value === 'true') return {
|
|
228
|
+
value: true
|
|
229
|
+
};
|
|
230
|
+
if (value === 'false') return {
|
|
231
|
+
value: false
|
|
232
|
+
};
|
|
233
|
+
return {
|
|
234
|
+
error: 'is neither true nor false',
|
|
235
|
+
rule: 1
|
|
236
|
+
};
|
|
237
|
+
case 'choice':
|
|
238
|
+
return options.some((option)=>option.value === value) ? {
|
|
239
|
+
value
|
|
240
|
+
} : {
|
|
241
|
+
error: 'is not the value of one of its answers',
|
|
242
|
+
rule: 1
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* The properties a component answer declares, read into the shape the
|
|
248
|
+
* Properties dialog stores, with a finding for everything that would not
|
|
249
|
+
* save there or would not read as the brief's own copy.
|
|
250
|
+
*/ export function readAiComponentProps(answer, scope) {
|
|
251
|
+
const raw = answer['props'];
|
|
252
|
+
if (!Array.isArray(raw)) {
|
|
253
|
+
return {
|
|
254
|
+
props: [],
|
|
255
|
+
refused: [],
|
|
256
|
+
violations: [
|
|
257
|
+
{
|
|
258
|
+
rule: 1,
|
|
259
|
+
code: 'props-missing',
|
|
260
|
+
message: 'The component came without its list of properties. Declare every property the tree binds, or an empty list.',
|
|
261
|
+
paths: [
|
|
262
|
+
'props'
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
]
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
const violations = [];
|
|
269
|
+
const finding = (code, message, path, rule = 1)=>{
|
|
270
|
+
violations.push({
|
|
271
|
+
rule,
|
|
272
|
+
code,
|
|
273
|
+
message,
|
|
274
|
+
paths: [
|
|
275
|
+
path
|
|
276
|
+
]
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
if (raw.length > AI_COMPONENT_MAX_PROPS) {
|
|
280
|
+
finding('props-over-limit', `The component declares ${raw.length} properties, and one component declares at most ${AI_COMPONENT_MAX_PROPS}. Keep a property for each value that differs between placements.`, 'props');
|
|
281
|
+
}
|
|
282
|
+
const kindNames = AI_COMPONENT_PROP_KINDS.map((type)=>REUSABLE_PROP_KINDS[type].label);
|
|
283
|
+
const props = [];
|
|
284
|
+
const seen = new Set();
|
|
285
|
+
raw.slice(0, AI_COMPONENT_MAX_PROPS).forEach((entry, index)=>{
|
|
286
|
+
const at = `props[${index}]`;
|
|
287
|
+
if (!isRecord(entry)) {
|
|
288
|
+
finding('prop-shape', 'A property could not be read. Give each one a name, a kind and a default.', at);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const name = scalar(entry['name']);
|
|
292
|
+
const called = name ? `"${name}"` : `number ${index + 1}`;
|
|
293
|
+
if (!COMPONENT_PROP_NAME_PATTERN.test(name) || name.length > NAME_MAX) {
|
|
294
|
+
finding('prop-name', `The property ${called} is not a name a property can have. Use letters, digits and underscores, starting with a letter, in ${NAME_MAX} characters or fewer.`, `${at}.name`);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
if (seen.has(name)) {
|
|
298
|
+
finding('prop-duplicate', `Two properties are named "${name}". Give each property its own name.`, `${at}.name`);
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
seen.add(name);
|
|
302
|
+
const type = scalar(entry['type']);
|
|
303
|
+
if (!AI_COMPONENT_PROP_KINDS.includes(type)) {
|
|
304
|
+
finding('prop-kind', `The property "${name}" is a kind a generated component does not declare. Use one of: ${kindNames.join(', ')}.`, `${at}.type`);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
const options = [];
|
|
308
|
+
if (type === 'choice') {
|
|
309
|
+
const answers = Array.isArray(entry['options']) ? entry['options'] : [];
|
|
310
|
+
const values = new Set();
|
|
311
|
+
for (const option of answers){
|
|
312
|
+
const value = isRecord(option) ? scalar(option['value']).slice(0, ANSWER_MAX) : '';
|
|
313
|
+
const label = isRecord(option) ? scalar(option['label']).slice(0, LABEL_MAX) : '';
|
|
314
|
+
if (!value || HOSTILE_TEXT.test(value) || HOSTILE_TEXT.test(label)) {
|
|
315
|
+
finding('prop-answers', `Every answer of "${name}" needs a plain value.`, `${at}.options`);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
if (values.has(value)) {
|
|
319
|
+
finding('prop-answers', `Two answers of "${name}" share the value "${value}".`, `${at}.options`);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
values.add(value);
|
|
323
|
+
options.push(_extends({
|
|
324
|
+
value
|
|
325
|
+
}, label && label !== value ? {
|
|
326
|
+
label
|
|
327
|
+
} : {}));
|
|
328
|
+
}
|
|
329
|
+
if (!options.length) {
|
|
330
|
+
finding('prop-answers', `The Choice "${name}" lists no answers. Give it the answers a page picks from.`, `${at}.options`);
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
const read = readDefault(type, entry['defaultValue'], options, scope);
|
|
335
|
+
if ('error' in read) {
|
|
336
|
+
finding('prop-default', `The default of "${name}" ${read.error}.`, `${at}.defaultValue`, read.rule);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const label = scalar(entry['label']).slice(0, LABEL_MAX);
|
|
340
|
+
const description = scalar(entry['description']).slice(0, HELP_MAX);
|
|
341
|
+
if (HOSTILE_TEXT.test(label) || HOSTILE_TEXT.test(description)) {
|
|
342
|
+
finding('prop-shape', `The label or help of "${name}" carries markup or script.`, at);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
props.push(_extends({
|
|
346
|
+
name,
|
|
347
|
+
type
|
|
348
|
+
}, label ? {
|
|
349
|
+
label
|
|
350
|
+
} : {}, description ? {
|
|
351
|
+
description
|
|
352
|
+
} : {}, read.value !== undefined ? {
|
|
353
|
+
defaultValue: read.value
|
|
354
|
+
} : {}, type === 'choice' ? {
|
|
355
|
+
options
|
|
356
|
+
} : {}));
|
|
357
|
+
});
|
|
358
|
+
// A name that read, and was then refused for its kind, answers, default or label.
|
|
359
|
+
const refused = [
|
|
360
|
+
...seen
|
|
361
|
+
].filter((name)=>!props.some((prop)=>prop.name === name));
|
|
362
|
+
return {
|
|
363
|
+
props,
|
|
364
|
+
refused,
|
|
365
|
+
violations
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
//# sourceMappingURL=ai-component-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/tools/ai-component-tool.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 { parseMediaRef } from '@aglyn/aglyn/app-utils/media-ref'\nimport { COMPONENT_PROP_NAME_PATTERN } from '@aglyn/aglyn/app-utils/reusable-component-keys'\nimport { FieldComponentType } from '@aglyn/aglyn/foundation/definitions/components.types'\nimport type {\n ReusableComponentProp,\n ReusableComponentPropOption,\n ReusableComponentPropType,\n ReusableComponentPropValue,\n} from '@aglyn/aglyn/foundation/definitions/platform.types'\nimport { REUSABLE_PROP_KINDS } from '@aglyn/aglyn/foundation/definitions/property-kinds'\nimport type { AiTool } from '../providers/contract'\nimport { aiDoctrineTreeTool } from '../runtime/ai-doctrine'\nimport type {\n AiDoctrineRuleNumber,\n AiDoctrineViolation,\n} from '../runtime/ai-doctrine-validators'\nimport { HOSTILE_TEXT, isHttpsUrl, isRootRelativePath } from '../runtime/ai-node-tree'\nimport { AI_TEXT_LIMITS } from '../runtime/ai-palette'\n\n/**\n * The tool a generated reusable component arrives through (AGL-2908), and\n * the reading of the properties it declares.\n *\n * ── The kinds are the Properties dialog's ────────────────────────────────\n *\n * FILE ▸ Properties… declares a property as one of `REUSABLE_PROP_KINDS`,\n * and so does this tool: the kinds it offers are that table less the ones\n * `AI_COMPONENT_PROP_KINDS_NOT_OFFERED` names, each with the reason it is\n * left out, and a spec holds the two in both directions. A kind added to the\n * dialog does not compile here until it is offered or given a reason.\n *\n * What is offered is what a generated element can carry and a brief can\n * fill: copy (Text, Long text), a picture (Image), a link (Link), an icon\n * the site owner picks (Icon), a number (Number), a switch or a part's\n * visibility (Yes / no), and a setting with fixed answers (Choice).\n *\n * ── A declaration as the dialog saves one ────────────────────────────────\n *\n * `readAiComponentProps` returns each property in the shape the dialog's\n * cleaner stores: trimmed, with only the fields its kind uses, and a default\n * in the kind's own type — a Yes / no a real `true` or `false`, a Number a\n * number. Every refusal is a building-rule finding the doctrine's re-ask\n * quotes by its path.\n */\n\ntype OfferedKind = 'text' | 'richText' | 'image' | 'href' | 'icon' | 'number' | 'boolean' | 'choice'\n\nconst STYLE_REASON =\n 'Styling comes from the theme and the component’s own styles (rules 5 and 12); a page restyles one placement with an override, not a property.'\nconst RECORD_REASON =\n 'A pick from the site’s own records is made where a page places the component (rule 8), never invented as a generated default.'\nconst PLUGIN_REASON =\n 'Plugin settings belong to the plugin’s own element, which a generated component never places.'\n\n/**\n * Why each property kind the dialog declares is not offered to a model.\n * Keyed by every kind outside the offered ones, so the table is complete by\n * type.\n */\nexport const AI_COMPONENT_PROP_KINDS_NOT_OFFERED: Readonly<\n Record<Exclude<ReusableComponentPropType, OfferedKind>, string>\n> = {\n [FieldComponentType.MARKDOWN]:\n 'Long text binds to the same formatted-document fields, with a default a brief can write.',\n [FieldComponentType.DATA_TABLE]:\n 'A table is rows and columns a page fills in, not one value a brief describes.',\n [FieldComponentType.SLIDER]:\n 'Number binds to every slider, without the range settings a Slider property must declare.',\n [FieldComponentType.CHECKBOX]:\n 'Yes / no binds to every switch and single tick box, and no generated element offers a list of tick boxes.',\n [FieldComponentType.RADIO]:\n 'Choice binds to every field Radio buttons binds to, with its answers checked in one place.',\n [FieldComponentType.TOGGLE_BUTTON]:\n 'Choice binds to every field Toggle buttons binds to, with its answers checked in one place.',\n [FieldComponentType.DUAL_LIST_SELECT]:\n 'A pick list holds several answers, and no generated element offers a field that takes several.',\n [FieldComponentType.COLOR_PICKER]:\n 'Colors come from the theme (rule 5); a page recolors one placement with an override, not a property.',\n [FieldComponentType.CSS_DIMENSION]: STYLE_REASON,\n [FieldComponentType.CSS_BORDER]: STYLE_REASON,\n [FieldComponentType.CSS_GRADIENT]: STYLE_REASON,\n [FieldComponentType.BREAKPOINT_SPAN]: STYLE_REASON,\n [FieldComponentType.PRESET_CHOICE]: STYLE_REASON,\n [FieldComponentType.THEME_SCALE]: STYLE_REASON,\n [FieldComponentType.DATE_PICKER]:\n 'A date is a fact the brief would have to give (rule 14), not copy a component shows until a page sets it.',\n [FieldComponentType.TIME_PICKER]:\n 'A time is a fact the brief would have to give (rule 14), not copy a component shows until a page sets it.',\n [FieldComponentType.NODE_SELECT]: RECORD_REASON,\n [FieldComponentType.PRODUCT_SELECT]: RECORD_REASON,\n [FieldComponentType.COLLECTION_SELECT]: RECORD_REASON,\n [FieldComponentType.CATEGORY_SELECT]: RECORD_REASON,\n [FieldComponentType.DATASET_SELECT]: RECORD_REASON,\n [FieldComponentType.DATASET_FIELD_SELECT]: RECORD_REASON,\n [FieldComponentType.FORM_SELECT]:\n 'A form is placed by its id from the Forms page (rule 3), never chosen through a generated property.',\n [FieldComponentType.PLUGIN_SELECT]: PLUGIN_REASON,\n [FieldComponentType.PLUGIN_SETTINGS]: PLUGIN_REASON,\n}\n\n/**\n * The kinds a generated component may declare: the dialog's table less the\n * kinds above, in the dialog's own order.\n */\nexport const AI_COMPONENT_PROP_KINDS: readonly OfferedKind[] = (\n Object.keys(REUSABLE_PROP_KINDS) as ReusableComponentPropType[]\n).filter(\n (type): type is OfferedKind =>\n !Object.prototype.hasOwnProperty.call(AI_COMPONENT_PROP_KINDS_NOT_OFFERED, type),\n)\n\nexport type AiComponentPropKind = OfferedKind\n\n/**\n * The kinds a property proposed for a section already on a page may take\n * (AGL-3054): every offered kind but an Icon. That door reads each default off\n * the live field it binds, and an icon's default is drawn from a path the\n * picker stores beside its id, which the field it reads does not carry.\n */\nexport const AI_COMPONENT_SELECTION_PROP_KINDS: readonly AiComponentPropKind[] =\n AI_COMPONENT_PROP_KINDS.filter((type) => type !== 'icon')\n\n/** The kinds as a model reads them: the stored type and the name a page reads. */\nexport function aiComponentPropKindWords(\n kinds: readonly AiComponentPropKind[] = AI_COMPONENT_PROP_KINDS,\n): string {\n return kinds.map((type) => `${type} (${REUSABLE_PROP_KINDS[type].label})`).join(', ')\n}\n\nexport const AI_COMPONENT_TOOL_NAME = 'submit_component'\n\n/** The most properties one generated component declares. */\nexport const AI_COMPONENT_MAX_PROPS = 20\n\nconst NAME_MAX = 40\nconst LABEL_MAX = 80\nconst HELP_MAX = 200\nconst ANSWER_MAX = 100\n\n/**\n * The strict tool a component arrives through: the doctrine's tree, as the\n * doctrine's own component tool carries it, and the properties beside it.\n * Every field of a property is required and flat, because optional\n * properties are not portable across strict tool implementations; a kind\n * that has no answers sends `[]`.\n */\nexport function aiComponentTool(): AiTool {\n const doctrine = aiDoctrineTreeTool('component')\n const tree = (doctrine.inputSchema as { properties: Record<string, unknown> }).properties['tree']\n return {\n name: AI_COMPONENT_TOOL_NAME,\n description:\n 'Submit the reusable component: its tree as one flat node map, and every property the tree binds.',\n strict: true,\n inputSchema: {\n type: 'object',\n additionalProperties: false,\n required: ['tree', 'props'],\n properties: {\n tree,\n props: {\n type: 'array',\n description:\n 'Every property the tree binds with {{prop.<name>}}, in the order a page sets them.',\n items: {\n type: 'object',\n additionalProperties: false,\n required: ['name', 'type', 'label', 'description', 'defaultValue', 'options'],\n properties: {\n name: {\n type: 'string',\n description:\n 'Letters, digits and underscores, starting with a letter; bound as {{prop.<name>}}.',\n },\n type: {\n type: 'string',\n enum: [...AI_COMPONENT_PROP_KINDS],\n description: `The kind, as type (the name a page reads): ${aiComponentPropKindWords()}.`,\n },\n label: { type: 'string', description: 'The words a page reads beside the field.' },\n description: { type: 'string', description: 'Help beside the field, or \"\".' },\n defaultValue: {\n type: 'string',\n description:\n 'What the component shows until a page sets it: copy for text and richText, a screen id from the site inventory or \"\" for href, \"\" for image and icon, a number for number, \"true\" or \"false\" for boolean, one answer’s value for choice.',\n },\n options: {\n type: 'array',\n description: 'The answers of a choice; [] for every other kind.',\n items: {\n type: 'object',\n additionalProperties: false,\n required: ['value', 'label'],\n properties: {\n value: {\n type: 'string',\n description: 'What the bound field receives: one of the values that field lists.',\n },\n label: { type: 'string', description: 'What a page picks.' },\n },\n },\n },\n },\n },\n },\n },\n },\n }\n}\n\nexport interface AiComponentPropsScope {\n /** The screens a Link default may name: the site inventory's. */\n screenIds: ReadonlySet<string>\n}\n\nexport interface AiComponentPropsReading {\n /** Every property that could be read, as the Properties dialog stores one. */\n props: ReusableComponentProp[]\n /**\n * The names of properties that were declared under a usable name and\n * refused for something else — their kind, answers, default or label — so\n * a check of the tree does not report their tokens a second time.\n */\n refused: string[]\n violations: AiDoctrineViolation[]\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\n\n/** A scalar the answer wrote, as trimmed text. */\nfunction scalar(value: unknown): string {\n return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean'\n ? String(value).trim()\n : ''\n}\n\ntype DefaultReading =\n | { value: ReusableComponentPropValue | undefined }\n | { error: string; rule: AiDoctrineRuleNumber }\n\n/** A default as the kind stores it, or why it cannot be one. */\nfunction readDefault(\n type: OfferedKind,\n raw: unknown,\n options: readonly ReusableComponentPropOption[],\n scope: AiComponentPropsScope,\n): DefaultReading {\n const value = scalar(raw)\n if (HOSTILE_TEXT.test(value)) return { error: 'carries markup or script', rule: 1 }\n // Nothing set is a default of its own: the kind's \"not set\".\n if (!value) return { value: undefined }\n switch (type) {\n case 'text':\n case 'richText':\n return value.length > AI_TEXT_LIMITS.body\n ? { error: `runs past ${AI_TEXT_LIMITS.body} characters`, rule: 1 }\n : { value }\n case 'icon':\n // The picker stores an icon with the drawing a model cannot name, so\n // the site owner picks it where a page places the component.\n return { error: 'is an icon, which the site owner picks; leave it \"\"', rule: 1 }\n case 'image':\n if (/^https?:\\/\\//i.test(value)) {\n return { error: 'links a picture from another website; leave it empty for an upload', rule: 9 }\n }\n return parseMediaRef(value)\n ? { value }\n : { error: 'is not a picture from the media library; leave it empty for an upload', rule: 9 }\n case 'href':\n return scope.screenIds.has(value) || isRootRelativePath(value) || isHttpsUrl(value)\n ? { value }\n : {\n error: 'is neither a screen id from the site inventory, a path on this site nor an https: address',\n rule: 1,\n }\n case 'number': {\n const parsed = Number(value)\n return Number.isFinite(parsed) ? { value: parsed } : { error: 'is not a number', rule: 1 }\n }\n case 'boolean':\n if (value === 'true') return { value: true }\n if (value === 'false') return { value: false }\n return { error: 'is neither true nor false', rule: 1 }\n case 'choice':\n return options.some((option) => option.value === value)\n ? { value }\n : { error: 'is not the value of one of its answers', rule: 1 }\n }\n}\n\n/**\n * The properties a component answer declares, read into the shape the\n * Properties dialog stores, with a finding for everything that would not\n * save there or would not read as the brief's own copy.\n */\nexport function readAiComponentProps(\n answer: Record<string, unknown>,\n scope: AiComponentPropsScope,\n): AiComponentPropsReading {\n const raw = answer['props']\n if (!Array.isArray(raw)) {\n return {\n props: [],\n refused: [],\n violations: [\n {\n rule: 1,\n code: 'props-missing',\n message:\n 'The component came without its list of properties. Declare every property the tree binds, or an empty list.',\n paths: ['props'],\n },\n ],\n }\n }\n const violations: AiDoctrineViolation[] = []\n const finding = (\n code: string,\n message: string,\n path: string,\n rule: AiDoctrineRuleNumber = 1,\n ): void => {\n violations.push({ rule, code, message, paths: [path] })\n }\n if (raw.length > AI_COMPONENT_MAX_PROPS) {\n finding(\n 'props-over-limit',\n `The component declares ${raw.length} properties, and one component declares at most ${AI_COMPONENT_MAX_PROPS}. Keep a property for each value that differs between placements.`,\n 'props',\n )\n }\n const kindNames = AI_COMPONENT_PROP_KINDS.map((type) => REUSABLE_PROP_KINDS[type].label)\n const props: ReusableComponentProp[] = []\n const seen = new Set<string>()\n raw.slice(0, AI_COMPONENT_MAX_PROPS).forEach((entry, index) => {\n const at = `props[${index}]`\n if (!isRecord(entry)) {\n finding('prop-shape', 'A property could not be read. Give each one a name, a kind and a default.', at)\n return\n }\n const name = scalar(entry['name'])\n const called = name ? `\"${name}\"` : `number ${index + 1}`\n if (!COMPONENT_PROP_NAME_PATTERN.test(name) || name.length > NAME_MAX) {\n finding(\n 'prop-name',\n `The property ${called} is not a name a property can have. Use letters, digits and underscores, starting with a letter, in ${NAME_MAX} characters or fewer.`,\n `${at}.name`,\n )\n return\n }\n if (seen.has(name)) {\n finding('prop-duplicate', `Two properties are named \"${name}\". Give each property its own name.`, `${at}.name`)\n return\n }\n seen.add(name)\n const type = scalar(entry['type']) as OfferedKind\n if (!AI_COMPONENT_PROP_KINDS.includes(type)) {\n finding(\n 'prop-kind',\n `The property \"${name}\" is a kind a generated component does not declare. Use one of: ${kindNames.join(', ')}.`,\n `${at}.type`,\n )\n return\n }\n const options: ReusableComponentPropOption[] = []\n if (type === 'choice') {\n const answers = Array.isArray(entry['options']) ? entry['options'] : []\n const values = new Set<string>()\n for (const option of answers) {\n const value = isRecord(option) ? scalar(option['value']).slice(0, ANSWER_MAX) : ''\n const label = isRecord(option) ? scalar(option['label']).slice(0, LABEL_MAX) : ''\n if (!value || HOSTILE_TEXT.test(value) || HOSTILE_TEXT.test(label)) {\n finding('prop-answers', `Every answer of \"${name}\" needs a plain value.`, `${at}.options`)\n return\n }\n if (values.has(value)) {\n finding('prop-answers', `Two answers of \"${name}\" share the value \"${value}\".`, `${at}.options`)\n return\n }\n values.add(value)\n options.push({ value, ...(label && label !== value ? { label } : {}) })\n }\n if (!options.length) {\n finding(\n 'prop-answers',\n `The Choice \"${name}\" lists no answers. Give it the answers a page picks from.`,\n `${at}.options`,\n )\n return\n }\n }\n const read = readDefault(type, entry['defaultValue'], options, scope)\n if ('error' in read) {\n finding('prop-default', `The default of \"${name}\" ${read.error}.`, `${at}.defaultValue`, read.rule)\n return\n }\n const label = scalar(entry['label']).slice(0, LABEL_MAX)\n const description = scalar(entry['description']).slice(0, HELP_MAX)\n if (HOSTILE_TEXT.test(label) || HOSTILE_TEXT.test(description)) {\n finding('prop-shape', `The label or help of \"${name}\" carries markup or script.`, at)\n return\n }\n props.push({\n name,\n type,\n ...(label ? { label } : {}),\n ...(description ? { description } : {}),\n ...(read.value !== undefined ? { defaultValue: read.value } : {}),\n ...(type === 'choice' ? { options } : {}),\n })\n })\n // A name that read, and was then refused for its kind, answers, default or label.\n const refused = [...seen].filter((name) => !props.some((prop) => prop.name === name))\n return { props, refused, violations }\n}\n"],"names":["parseMediaRef","COMPONENT_PROP_NAME_PATTERN","FieldComponentType","REUSABLE_PROP_KINDS","aiDoctrineTreeTool","HOSTILE_TEXT","isHttpsUrl","isRootRelativePath","AI_TEXT_LIMITS","STYLE_REASON","RECORD_REASON","PLUGIN_REASON","AI_COMPONENT_PROP_KINDS_NOT_OFFERED","MARKDOWN","DATA_TABLE","SLIDER","CHECKBOX","RADIO","TOGGLE_BUTTON","DUAL_LIST_SELECT","COLOR_PICKER","CSS_DIMENSION","CSS_BORDER","CSS_GRADIENT","BREAKPOINT_SPAN","PRESET_CHOICE","THEME_SCALE","DATE_PICKER","TIME_PICKER","NODE_SELECT","PRODUCT_SELECT","COLLECTION_SELECT","CATEGORY_SELECT","DATASET_SELECT","DATASET_FIELD_SELECT","FORM_SELECT","PLUGIN_SELECT","PLUGIN_SETTINGS","AI_COMPONENT_PROP_KINDS","Object","keys","filter","type","prototype","hasOwnProperty","call","AI_COMPONENT_SELECTION_PROP_KINDS","aiComponentPropKindWords","kinds","map","label","join","AI_COMPONENT_TOOL_NAME","AI_COMPONENT_MAX_PROPS","NAME_MAX","LABEL_MAX","HELP_MAX","ANSWER_MAX","aiComponentTool","doctrine","tree","inputSchema","properties","name","description","strict","additionalProperties","required","props","items","enum","defaultValue","options","value","isRecord","Array","isArray","scalar","String","trim","readDefault","raw","scope","test","error","rule","undefined","length","body","screenIds","has","parsed","Number","isFinite","some","option","readAiComponentProps","answer","refused","violations","code","message","paths","finding","path","push","kindNames","seen","Set","slice","forEach","entry","index","at","called","add","includes","answers","values","read","prop"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,aAAa,QAAQ,mCAAkC;AAChE,SAASC,2BAA2B,QAAQ,iDAAgD;AAC5F,SAASC,kBAAkB,QAAQ,uDAAsD;AAOzF,SAASC,mBAAmB,QAAQ,qDAAoD;AAExF,SAASC,kBAAkB,QAAQ,4BAAwB;AAK3D,SAASC,YAAY,EAAEC,UAAU,EAAEC,kBAAkB,QAAQ,6BAAyB;AACtF,SAASC,cAAc,QAAQ,2BAAuB;AA8BtD,MAAMC,eACJ;AACF,MAAMC,gBACJ;AACF,MAAMC,gBACJ;AAEF;;;;CAIC,GACD,OAAO,MAAMC,sCAET;IACF,CAACV,mBAAmBW,QAAQ,CAAC,EAC3B;IACF,CAACX,mBAAmBY,UAAU,CAAC,EAC7B;IACF,CAACZ,mBAAmBa,MAAM,CAAC,EACzB;IACF,CAACb,mBAAmBc,QAAQ,CAAC,EAC3B;IACF,CAACd,mBAAmBe,KAAK,CAAC,EACxB;IACF,CAACf,mBAAmBgB,aAAa,CAAC,EAChC;IACF,CAAChB,mBAAmBiB,gBAAgB,CAAC,EACnC;IACF,CAACjB,mBAAmBkB,YAAY,CAAC,EAC/B;IACF,CAAClB,mBAAmBmB,aAAa,CAAC,EAAEZ;IACpC,CAACP,mBAAmBoB,UAAU,CAAC,EAAEb;IACjC,CAACP,mBAAmBqB,YAAY,CAAC,EAAEd;IACnC,CAACP,mB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;QAAM,IAAI,CAAC,GACrBc,cAAc;YAAEA;QAAY,IAAI,CAAC,GACjCuD,KAAK9C,KAAK,KAAKa,YAAY;YAAEf,cAAcgD,KAAK9C,KAAK;QAAC,IAAI,CAAC,GAC3D/B,SAAS,WAAW;YAAE8B;QAAQ,IAAI,CAAC;IAE3C;IACA,kFAAkF;IAClF,MAAM0B,UAAU;WAAIS;KAAK,CAAClE,MAAM,CAAC,CAACsB,OAAS,CAACK,MAAM0B,IAAI,CAAC,CAAC0B,OAASA,KAAKzD,IAAI,KAAKA;IAC/E,OAAO;QAAEK;QAAO8B;QAASC;IAAW;AACtC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type { ConsoleImportColumn } from '@aglyn/aglyn/plugin-manager/record-zone-props';
|
|
18
|
+
import { type AiCrmColumnMatch, type AiCrmNextStep, type AiCrmRecordKind } from '../model/ai-crm';
|
|
19
|
+
import type { AiTool } from '../providers/contract';
|
|
20
|
+
import type { AiDoctrineViolation } from '../runtime/ai-doctrine-validators';
|
|
21
|
+
/**
|
|
22
|
+
* The strict tools CRM by AI answers through (AGL-2917), and the checks that
|
|
23
|
+
* hold each answer to what the CRM can take.
|
|
24
|
+
*
|
|
25
|
+
* - `propose_record_insight` — a record's summary, and by kind: the next step
|
|
26
|
+
* as a task (a contact, company or deal), a stage (a deal), a lead's
|
|
27
|
+
* standing. One schema per kind, so no answer carries a field its record
|
|
28
|
+
* cannot use, and each keeps its nullable fields to the one or two a member
|
|
29
|
+
* may legitimately be offered nothing for.
|
|
30
|
+
* - `propose_email_draft` — a subject and a plain-text message.
|
|
31
|
+
* - `propose_column_matches` — the columns of a file matched to import fields.
|
|
32
|
+
*
|
|
33
|
+
* A strict schema forbids extra keys, requires every key, says "no value" with
|
|
34
|
+
* `null`, and accepts no length keyword, so every length is stated in a
|
|
35
|
+
* description and enforced here. A check returns a value only when nothing in
|
|
36
|
+
* the answer is broken, and otherwise the violations and the parts at fault,
|
|
37
|
+
* for the generation call's one re-ask.
|
|
38
|
+
*/
|
|
39
|
+
export declare const AI_CRM_RECORD_TOOL_NAME = "propose_record_insight";
|
|
40
|
+
export declare const AI_CRM_EMAIL_TOOL_NAME = "propose_email_draft";
|
|
41
|
+
export declare const AI_CRM_MAPPING_TOOL_NAME = "propose_column_matches";
|
|
42
|
+
/** The record tool for one kind of record. */
|
|
43
|
+
export declare function aiCrmRecordTool(kind: AiCrmRecordKind): AiTool;
|
|
44
|
+
export declare const AI_CRM_EMAIL_TOOL: AiTool;
|
|
45
|
+
export declare const AI_CRM_MAPPING_TOOL: AiTool;
|
|
46
|
+
export interface AiCrmCheckResult<T> {
|
|
47
|
+
value: T | null;
|
|
48
|
+
violations: AiDoctrineViolation[];
|
|
49
|
+
offending?: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
type Facts = Readonly<Record<string, unknown>>;
|
|
52
|
+
/** What the record facts say a check needs: a deal's stages and status, and every record's open tasks. */
|
|
53
|
+
export interface AiCrmRecordCheckContext {
|
|
54
|
+
kind: AiCrmRecordKind;
|
|
55
|
+
/** The deal's stage, and its pipeline's stages in order. */
|
|
56
|
+
stageId?: string;
|
|
57
|
+
status?: string;
|
|
58
|
+
stages?: ReadonlyArray<{
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
kind: string;
|
|
62
|
+
}>;
|
|
63
|
+
/** The titles of the record's open tasks, which a next step may not repeat. */
|
|
64
|
+
openTaskTitles?: readonly string[];
|
|
65
|
+
}
|
|
66
|
+
export interface AiCrmRecordAnswer {
|
|
67
|
+
summary: string;
|
|
68
|
+
nextStep: AiCrmNextStep | null;
|
|
69
|
+
stage: {
|
|
70
|
+
stageId: string;
|
|
71
|
+
stageName: string;
|
|
72
|
+
reason: string;
|
|
73
|
+
} | null;
|
|
74
|
+
standing: string | null;
|
|
75
|
+
}
|
|
76
|
+
/** What a record's facts say its check needs. */
|
|
77
|
+
export declare function aiCrmRecordCheckContext(kind: AiCrmRecordKind, facts: Facts): AiCrmRecordCheckContext;
|
|
78
|
+
/** A record answer held to the record it is about. */
|
|
79
|
+
export declare function checkAiCrmRecord(answer: Record<string, unknown>, context: AiCrmRecordCheckContext): AiCrmCheckResult<AiCrmRecordAnswer>;
|
|
80
|
+
/** The merge fields an email from a record may use: never an address. */
|
|
81
|
+
export declare function aiCrmEmailMergeFields(kind: AiCrmRecordKind): string[];
|
|
82
|
+
/** Whether text writes a phone number: a run of ten digits or more that is not a list of days. */
|
|
83
|
+
export declare function aiCrmWritesPhoneNumber(text: string): boolean;
|
|
84
|
+
export interface AiCrmEmailAnswer {
|
|
85
|
+
subject: string;
|
|
86
|
+
body: string;
|
|
87
|
+
}
|
|
88
|
+
/** An email answer held to the composer and to what a person may be sent. */
|
|
89
|
+
export declare function checkAiCrmEmail(answer: Record<string, unknown>, context: {
|
|
90
|
+
mergeFields: readonly string[];
|
|
91
|
+
}): AiCrmCheckResult<AiCrmEmailAnswer>;
|
|
92
|
+
/** One field an import may fill, as the CRM's catalog lists it. */
|
|
93
|
+
export interface AiCrmImportField {
|
|
94
|
+
key: string;
|
|
95
|
+
label: string;
|
|
96
|
+
type: string;
|
|
97
|
+
required: boolean;
|
|
98
|
+
}
|
|
99
|
+
/** An import catalog's fields as the facts report them, in the order they are numbered. */
|
|
100
|
+
export declare function aiCrmImportFields(facts: Facts): AiCrmImportField[];
|
|
101
|
+
/** A mapping answer held to the file's columns and the import's fields. */
|
|
102
|
+
export declare function checkAiCrmMapping(answer: Record<string, unknown>, context: {
|
|
103
|
+
columns: readonly ConsoleImportColumn[];
|
|
104
|
+
fields: readonly AiCrmImportField[];
|
|
105
|
+
}): AiCrmCheckResult<AiCrmColumnMatch[]>;
|
|
106
|
+
export {};
|