@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 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-job-seo-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 { hostCollectionKind } from '@aglyn/aglyn/app-utils/collection-kind'\nimport { hostPublicOrigin } from '@aglyn/aglyn/app-utils/host-naming'\nimport {\n buildLlmsTxt,\n type LlmsTxtCollection,\n type LlmsTxtPage,\n} from '@aglyn/aglyn/app-utils/llms-txt'\nimport { nodesReferenceScreen } from '@aglyn/aglyn/app-utils/screen-link-value'\nimport { screenRoutePathToUrl } from '@aglyn/aglyn/app-utils/screen-route'\nimport {\n isScreenIndexable,\n isSearchDiscouraged,\n statusPageScreenIds,\n} from '@aglyn/aglyn/app-utils/search-indexing'\nimport {\n SCREEN_SEO_LISTING_FIELDS,\n isSeoListingFieldKey,\n type SeoListingFieldKey,\n} from '@aglyn/aglyn/app-utils/seo-listing-fields'\nimport { decodeStoredNodes } from '@aglyn/aglyn/app-utils/stored-nodes'\nimport { getTemplateScreenIds } from '@aglyn/tenant-runtime/template-screens'\nimport type { AiJob, AiJobOutput } from '../model/ai-jobs.types'\nimport {\n AI_SEO_FINDING_LABELS,\n AI_SEO_OUTPUT_IDS,\n aiSeoAuditView,\n aiSeoJobTarget,\n type AiSeoAuditReport,\n type AiSeoContentFix,\n type AiSeoFieldsProposal,\n type AiSeoFieldValues,\n type AiSeoPageFix,\n type AiSeoSiteFormField,\n type AiSeoSiteProposal,\n} from '../model/ai-seo'\nimport { aiModelForStep } from '../providers/routing'\nimport type { AiSystemBlock, AiUsage } from '../runtime/ai-runtime'\nimport {\n AI_SEO_AUDIT_MAX_PAGES,\n aiSeoAudit,\n aiSeoAuditBatches,\n aiSeoHeadingDemotions,\n aiSeoNormalizePath,\n parseAiSeoKeywordLines,\n type AiSeoAuditPage,\n} from '../runtime/seo-audit'\nimport {\n runValidatedGeneration,\n type AiGenerationSpend,\n type AiValidatedGeneration,\n} from '../runtime/ai-doctrine'\nimport { AI_SEO_FIELDS_MAX_TOKENS, generateSeoFields } from '../runtime/seo-fields'\nimport {\n AI_SEO_PAGE_TEXT_MAX_CHARS,\n aiSeoPageFacts,\n type AiSeoPageFacts,\n} from '../runtime/seo-page-facts'\nimport {\n AI_SEO_FIXES_TOOL_NAME,\n AI_SEO_SITE_TOOL_NAME,\n aiSeoFixImages,\n aiSeoFixesTool,\n aiSeoKeywordCoverage,\n aiSeoKeywordList,\n aiSeoSiteTool,\n checkAiSeoFixes,\n checkAiSeoSite,\n type AiSeoBatchAnswer,\n type AiSeoBatchPage,\n} from '../tools/ai-seo-tool'\nimport {\n AI_SEO_FIXES_MAX_TOKENS,\n AI_SEO_SITE_MAX_TOKENS,\n aiSeoGenerationMaxTokens,\n} from './ai-job-seo-budget'\nimport type { AiJobStepContext, AiJobStepOutcome, AiJobStepRunner } from './ai-job-text-step'\n\n/**\n * The `seo` step (AGL-2910): search listings and a site audit, as proposals.\n *\n * `inputs.target` says what the job is about:\n *\n * - `screen` — one page's listing, written from the version the person is\n * looking at (`screenId`, `versionId`), for the page's SEO card;\n * - `product` — one product's listing, from the name and description the\n * product editor handed over (`name`, `text`), for the product editor;\n * - `site` — the audit of every published page the sitemap lists, with a\n * proposed fix per finding, structured data for the site's entity, and the\n * agent guidance `/llms.txt` leads with.\n *\n * ## It writes nothing\n *\n * Like every runner, this reads, asks and returns. A listing is served\n * straight from the screen document, the structured data and `/llms.txt`\n * from the host document, and a page's content from its published version,\n * so the values ride on the job's outputs and nothing else: a person puts\n * them in the page's SEO card or the site SEO form and saves them there, and\n * content fixes become a new version only through the apply door.\n *\n * ## An audit, a unit at a time\n *\n * The first pass reads the site — every published page's version and the\n * shared layouts, for the links between them — scores it without a model,\n * records the report, and runs the first unit of generated work. Each later\n * pass runs one more unit: the site-wide proposal, then the page fixes in\n * batches. Every pass is one reservation and one provider exchange, and it\n * asks the machine to continue until nothing is left, so a large site is a\n * few beats of work rather than one request that cannot finish.\n */\n\nexport const AI_SEO_NO_SITE_COPY = 'This SEO job names a site this workspace does not have.'\nexport const AI_SEO_NO_PAGE_COPY = 'This page is no longer on the site.'\nexport const AI_SEO_NO_TARGET_COPY = 'This SEO job does not say what to write about.'\nexport const AI_SEO_NO_PRODUCT_COPY = 'Give the product a name before writing its listing.'\n\n/** Shared layouts an audit reads for the links in a site's navigation. */\nexport const AI_SEO_LAYOUT_SCAN_LIMIT = 20\n\n/** How much of each page a batch of fixes carries. */\nexport const AI_SEO_BATCH_PAGE_TEXT_CHARS = 700\n\n/**\n * Output budgets, declared with the step's time (`ai-job-seo-budget.ts`,\n * AGL-3035). A batch's largest answer — every page with a title, description,\n * heading and image descriptions at their limits — and the site proposal's are\n * measured in `ai-job-seo-step.spec.ts`.\n */\nexport { AI_SEO_FIXES_MAX_TOKENS, AI_SEO_SITE_MAX_TOKENS }\n\n/** Documents read at once. */\nconst READ_CHUNK = 10\n\n/** Pages the site prompt and the llms.txt preview list. */\nconst SITE_PAGES_LISTED = 25\n\n/** The fields a product's listing holds. */\nconst PRODUCT_LISTING_FIELDS: readonly SeoListingFieldKey[] = ['title', 'description']\n\nconst ZERO_USAGE: AiUsage = {\n inputTokens: 0,\n outputTokens: 0,\n cacheReadTokens: 0,\n cacheWriteTokens: 0,\n}\n\ntype Firestore = FirebaseFirestore.Firestore\ntype DocumentReference = FirebaseFirestore.DocumentReference\ntype Spent = Pick<AiJobStepOutcome, 'usage' | 'estCostUsd' | 'model' | 'stopReason'>\n\n/** The host document fields this step reads. */\nexport interface SeoHostDocument {\n orgId?: string\n displayName?: string\n subdomain?: string | null\n cname?: string | null\n screens?: Record<string, string>\n errorScreens?: Record<string, string>\n notFoundScreenId?: string | null\n seo?: {\n title?: string\n description?: string\n discourageSearchEngines?: boolean\n entity?: {\n type?: unknown\n name?: string\n description?: string\n email?: string\n telephone?: string\n contactType?: string\n }\n agent?: { whenToUse?: string; howToUse?: string }\n }\n}\n\n/** The screen document fields this step reads. */\ninterface SeoScreenDocument {\n displayName?: string\n description?: string\n versionId?: string\n visibility?: unknown\n deletedAt?: unknown\n seo?: {\n title?: string\n description?: string\n breadcrumb?: string\n image?: string\n imageAlt?: string\n }\n}\n\nconst str = (value: unknown): string => (typeof value === 'string' ? value.trim() : '')\n\nconst round6 = (value: number): number => Math.round(value * 1_000_000) / 1_000_000\n\nfunction modelOf(context: AiJobStepContext): string {\n return context.modelFor?.('job.seo') ?? aiModelForStep('job.seo')\n}\n\nfunction spentNothing(model: string): Spent {\n return { usage: ZERO_USAGE, estCostUsd: 0, model, stopReason: null }\n}\n\nfunction spentBy(generation: AiGenerationSpend): Spent {\n return {\n usage: generation.usage,\n estCostUsd: generation.estCostUsd,\n model: generation.model,\n stopReason: generation.stopReason,\n }\n}\n\nfunction addSpent(a: Spent, b: Spent): Spent {\n return {\n usage: {\n inputTokens: a.usage.inputTokens + b.usage.inputTokens,\n outputTokens: a.usage.outputTokens + b.usage.outputTokens,\n cacheReadTokens: a.usage.cacheReadTokens + b.usage.cacheReadTokens,\n cacheWriteTokens: a.usage.cacheWriteTokens + b.usage.cacheWriteTokens,\n },\n estCostUsd: round6(a.estCostUsd + b.estCostUsd),\n model: b.model || a.model,\n stopReason: b.stopReason ?? a.stopReason,\n }\n}\n\n/** Through JSON, so no `undefined` reaches the job document's write. */\nconst plain = <T>(value: T): Record<string, unknown> =>\n JSON.parse(JSON.stringify(value)) as Record<string, unknown>\n\n/**\n * The fields a listing job writes: the ones the editor named (`inputs.fields`,\n * comma-separated) that the target's editor holds, or all of those.\n */\nexport function aiSeoRequestedFields(\n raw: unknown,\n allowed: readonly SeoListingFieldKey[],\n): SeoListingFieldKey[] {\n const named = String(raw ?? '')\n .split(',')\n .map((part) => part.trim())\n .filter(isSeoListingFieldKey)\n const wanted = new Set<SeoListingFieldKey>(named.length ? named : allowed)\n return allowed.filter((key) => wanted.has(key))\n}\n\n/** The site's name, as its visitors read it. */\nfunction brandOf(host: SeoHostDocument): string {\n return str(host.seo?.title) || str(host.displayName) || str(host.subdomain)\n}\n\n/** The site a job names, read and checked against the job's org. */\nasync function loadSite(\n firestore: Firestore,\n job: AiJob,\n): Promise<{ host: SeoHostDocument } | { failure: string }> {\n if (!job.hostId) return { failure: AI_SEO_NO_SITE_COPY }\n const snapshot = await firestore.collection('hosts').doc(job.hostId).get()\n const host = snapshot.exists ? (snapshot.data() as SeoHostDocument) : null\n // The route checks the caller's membership of the org the job is metered\n // against, not that the site belongs to it. A site of another org is\n // refused here, before anything about it reaches a prompt.\n if (!host || host.orgId !== job.orgId) return { failure: AI_SEO_NO_SITE_COPY }\n return { host }\n}\n\n/** A version's node map and root, or `null` when it cannot be read. */\nasync function readVersionNodes(\n hostRef: DocumentReference,\n screenId: string,\n versionId: string,\n): Promise<{ nodes: Record<string, unknown>; rootId?: string } | null> {\n if (!versionId) return null\n const snapshot = await hostRef\n .collection('screens')\n .doc(screenId)\n .collection('versions')\n .doc(versionId)\n .get()\n if (!snapshot.exists) return null\n const nodes = decodeStoredNodes<Record<string, unknown>>(snapshot.get('nodes'))\n if (!nodes) return null\n const rootId = snapshot.get('rootId')\n return { nodes, ...(typeof rootId === 'string' ? { rootId } : {}) }\n}\n\n/** Every other page's search title, for a proposal not to repeat. */\nasync function siteTitles(hostRef: DocumentReference, except: ReadonlySet<string>): Promise<string[]> {\n const snapshot = await hostRef.collection('screens').select('seo', 'deletedAt').limit(1000).get()\n return snapshot.docs\n .filter((doc) => !except.has(doc.id) && !doc.get('deletedAt'))\n .map((doc) => str((doc.get('seo') as SeoScreenDocument['seo'])?.title))\n .filter(Boolean)\n}\n\n/* ------------------------------------------------------------------------ *\n * One listing: a page or a product\n * ------------------------------------------------------------------------ */\n\nfunction listingOutcome(\n generation: AiValidatedGeneration<AiSeoFieldValues>,\n job: AiJob,\n subject: AiSeoFieldsProposal['subject'],\n context: {\n keywords: readonly string[]\n facts: AiSeoPageFacts | null\n fields: readonly SeoListingFieldKey[]\n hasImage: boolean\n },\n): AiJobStepOutcome {\n const spent = spentBy(generation)\n if (generation.status === 'refused') return { outputs: [], ...spent, refused: true }\n if (generation.status === 'needs_input') return { outputs: [], ...spent, failure: generation.message }\n const values = generation.value\n const notes: string[] = []\n if (context.fields.includes('imageAlt') && context.hasImage && !values.imageAlt) {\n notes.push('No image description was proposed: nothing on the page says what the picture shows.')\n }\n const proposal: AiSeoFieldsProposal = {\n kind: 'fields',\n subject,\n values,\n keywords: aiSeoKeywordCoverage(context.keywords, {\n title: values.title,\n description: values.description,\n h1: context.facts?.h1s[0]?.text,\n body: context.facts?.text,\n }),\n notes,\n }\n const output: AiJobOutput = {\n resource: 'seo',\n id: AI_SEO_OUTPUT_IDS.fields(subject.kind, subject.id),\n hostId: job.hostId ?? null,\n label: `SEO proposal · ${subject.name}`,\n proposal: plain(proposal),\n }\n return { outputs: [output], ...spent }\n}\n\nasync function runScreenListing(\n context: AiJobStepContext & { firestore: Firestore },\n host: SeoHostDocument,\n): Promise<AiJobStepOutcome> {\n const { job, firestore, signal } = context\n const model = modelOf(context)\n const hostRef = firestore.collection('hosts').doc(job.hostId as string)\n const screenId = str(job.inputs?.['screenId'])\n const snapshot = screenId ? await hostRef.collection('screens').doc(screenId).get() : null\n const screen = snapshot?.exists ? (snapshot.data() as SeoScreenDocument) : null\n if (!screen || screen.deletedAt) {\n return { outputs: [], ...spentNothing(model), failure: AI_SEO_NO_PAGE_COPY }\n }\n\n const versionId = str(job.inputs?.['versionId']) || str(screen.versionId)\n const version = await readVersionNodes(hostRef, screenId, versionId)\n const facts = aiSeoPageFacts(version?.nodes as never, { rootId: version?.rootId })\n const fields = aiSeoRequestedFields(job.inputs?.['fields'], SCREEN_SEO_LISTING_FIELDS)\n const seo = screen.seo ?? {}\n const hasImage = Boolean(str(seo.image))\n // The share image is often a picture the page shows too: its description\n // and the text beside it there are what is known about it.\n const onPage = hasImage ? facts.images.find((image) => image.src === str(seo.image)) : undefined\n const route = host.screens?.[screenId]\n const path = typeof route === 'string' ? screenRoutePathToUrl(route) : null\n const name = str(screen.displayName) || path || 'Untitled page'\n const keywords = aiSeoKeywordList(job.inputs?.['keywords'])\n const generation = await generateSeoFields({\n subject: { kind: 'screen', name, path },\n brand: brandOf(host),\n text: facts.text || str(screen.description),\n fields,\n current: {\n title: str(seo.title),\n description: str(seo.description),\n breadcrumb: str(seo.breadcrumb),\n imageAlt: str(seo.imageAlt),\n },\n image: hasImage ? { alt: str(seo.imageAlt) || onPage?.alt || null, context: onPage?.context || null } : null,\n keywords,\n otherTitles: await siteTitles(hostRef, new Set([screenId])),\n model,\n maxTokens: aiSeoGenerationMaxTokens(model, AI_SEO_FIELDS_MAX_TOKENS),\n ...(signal ? { signal } : {}),\n })\n return listingOutcome(generation, job, { kind: 'screen', id: screenId, name, path }, {\n keywords,\n facts,\n fields,\n hasImage,\n })\n}\n\nasync function runProductListing(\n context: AiJobStepContext & { firestore: Firestore },\n host: SeoHostDocument,\n): Promise<AiJobStepOutcome> {\n const { job, signal } = context\n const model = modelOf(context)\n const name = str(job.inputs?.['name']).slice(0, 200)\n if (!name) return { outputs: [], ...spentNothing(model), failure: AI_SEO_NO_PRODUCT_COPY }\n const fields = aiSeoRequestedFields(job.inputs?.['fields'], PRODUCT_LISTING_FIELDS)\n const keywords = aiSeoKeywordList(job.inputs?.['keywords'])\n const productId = str(job.inputs?.['productId']) || null\n const generation = await generateSeoFields({\n subject: { kind: 'product', name },\n brand: brandOf(host),\n // The product's own words, as its editor handed them over: the product\n // document is the commerce plugin's, and this step never reads it.\n text: str(job.inputs?.['text']).slice(0, AI_SEO_PAGE_TEXT_MAX_CHARS),\n fields,\n current: {\n title: str(job.inputs?.['currentTitle']),\n description: str(job.inputs?.['currentDescription']),\n },\n image: null,\n keywords,\n model,\n maxTokens: aiSeoGenerationMaxTokens(model, AI_SEO_FIELDS_MAX_TOKENS),\n ...(signal ? { signal } : {}),\n })\n return listingOutcome(generation, job, { kind: 'product', id: productId, name }, {\n keywords,\n facts: null,\n fields,\n hasImage: false,\n })\n}\n\n/* ------------------------------------------------------------------------ *\n * The site audit\n * ------------------------------------------------------------------------ */\n\nexport interface AiSeoScannedPage extends AiSeoAuditPage {\n /** The page's node map as audited. */\n nodes: Record<string, unknown> | null\n}\n\nexport interface AiSeoSiteScan {\n pages: AiSeoScannedPage[]\n skipped: number\n notes: string[]\n}\n\n/**\n * Read the site the way its sitemap lists it: every screen the routing map\n * publishes, less the template screens, the status pages and every screen\n * that is not public — through the same shared predicates the tenant's\n * `sitemap.xml` and `/llms.txt` apply, so the audit covers exactly the pages\n * a crawler is handed. Then each page's published version, and the shared\n * layouts, for the links that decide which pages nothing points to.\n */\nexport async function scanAiSeoSite(\n firestore: Firestore,\n hostId: string,\n host: SeoHostDocument,\n rawKeywords: unknown,\n): Promise<AiSeoSiteScan> {\n const hostRef = firestore.collection('hosts').doc(hostId)\n const routing = host.screens ?? {}\n const [screenDocs, templateScreenIds, layoutDocs] = await Promise.all([\n hostRef\n .collection('screens')\n .select('visibility', 'seo', 'description', 'displayName', 'versionId', 'deletedAt')\n .limit(1000)\n .get(),\n getTemplateScreenIds({ hostId }),\n hostRef.collection('layouts').select('versionId').limit(AI_SEO_LAYOUT_SCAN_LIMIT).get(),\n ])\n const screens = new Map(screenDocs.docs.map((doc) => [doc.id, doc.data() as SeoScreenDocument]))\n const excluded = new Set<string>([...statusPageScreenIds(host as never), ...templateScreenIds])\n const published = Object.entries(routing)\n .filter(([screenId]) => !excluded.has(screenId))\n .filter(([screenId]) => {\n const screen = screens.get(screenId)\n return Boolean(screen) && !screen?.deletedAt && isScreenIndexable(screen as never)\n })\n .map(([screenId, route]) => ({ screenId, path: screenRoutePathToUrl(String(route)) }))\n .sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0))\n const audited = published.slice(0, AI_SEO_AUDIT_MAX_PAGES)\n\n const versions = new Map<string, { nodes: Record<string, unknown>; rootId?: string } | null>()\n for (let start = 0; start < audited.length; start += READ_CHUNK) {\n await Promise.all(\n audited.slice(start, start + READ_CHUNK).map(async ({ screenId }) => {\n versions.set(\n screenId,\n await readVersionNodes(hostRef, screenId, str(screens.get(screenId)?.versionId)),\n )\n }),\n )\n }\n const layoutNodes: Record<string, unknown>[] = []\n const layouts = layoutDocs.docs.filter((doc) => str(doc.get('versionId')))\n for (let start = 0; start < layouts.length; start += READ_CHUNK) {\n await Promise.all(\n layouts.slice(start, start + READ_CHUNK).map(async (doc) => {\n const snapshot = await doc.ref.collection('versions').doc(str(doc.get('versionId'))).get()\n const nodes = snapshot.exists\n ? decodeStoredNodes<Record<string, unknown>>(snapshot.get('nodes'))\n : null\n if (nodes) layoutNodes.push(nodes)\n }),\n )\n }\n\n const keywordsByPath = parseAiSeoKeywordLines(rawKeywords)\n const auditedPaths = new Set(audited.map((page) => aiSeoNormalizePath(page.path)))\n const notes = Object.keys(keywordsByPath)\n .filter((path) => !auditedPaths.has(path))\n .map((path) => `Keywords for ${path} were not used: no audited page is published at that address.`)\n\n const pages: AiSeoScannedPage[] = audited.map(({ screenId, path }) => {\n const screen = screens.get(screenId) ?? {}\n const version = versions.get(screenId) ?? null\n const linkedFrom =\n layoutNodes.some((nodes) => nodesReferenceScreen(nodes, screenId)) ||\n audited.some(\n (other) =>\n other.screenId !== screenId &&\n nodesReferenceScreen(versions.get(other.screenId)?.nodes ?? null, screenId),\n )\n return {\n screenId,\n path,\n name: str(screen.displayName) || path,\n versionId: str(screen.versionId) || null,\n seo: screen.seo ?? {},\n description: str(screen.description),\n facts: aiSeoPageFacts(version?.nodes as never, { rootId: version?.rootId }),\n linkedFrom,\n keywords: keywordsByPath[aiSeoNormalizePath(path)] ?? [],\n nodes: version?.nodes ?? null,\n }\n })\n return { pages, skipped: Math.max(0, published.length - audited.length), notes }\n}\n\n/** One unit of generated work an audit still owes. */\nexport type AiSeoAuditUnit =\n | { kind: 'site' }\n | { kind: 'batch'; batch: number; of: number; screenIds: string[] }\n\n/** The units an audit owes after the outputs recorded so far, in the order they run. */\nexport function aiSeoPendingUnits(\n report: AiSeoAuditReport,\n outputs: readonly Pick<AiJobOutput, 'id'>[],\n): AiSeoAuditUnit[] {\n const done = new Set(outputs.map((output) => output.id))\n const units: AiSeoAuditUnit[] = []\n if (report.siteProposal && !done.has(AI_SEO_OUTPUT_IDS.site)) units.push({ kind: 'site' })\n const batches = aiSeoAuditBatches(report)\n batches.forEach((screenIds, index) => {\n if (!done.has(AI_SEO_OUTPUT_IDS.fixes(index + 1))) {\n units.push({ kind: 'batch', batch: index + 1, of: batches.length, screenIds })\n }\n })\n return units\n}\n\ninterface UnitResult {\n output: AiJobOutput\n spent: Spent\n}\n\n/* ---- The site-wide proposal ---------------------------------------------- */\n\nexport const AI_SEO_SITE_INSTRUCTIONS: AiSystemBlock[] = [\n {\n text:\n 'You propose two things for a website: the structured data that says who publishes it, and ' +\n 'the guidance an AI agent reads first in its /llms.txt.\\n\\n' +\n `Answer by calling ${AI_SEO_SITE_TOOL_NAME} exactly once. A reply in prose cannot be used.\\n\\n` +\n 'Rules:\\n' +\n '- Fill only the fields you are told are empty; answer null for every other one.\\n' +\n '- Use only what the pages you are given state. A contact email or telephone number goes in ' +\n 'only when a page shows it exactly; never compose one.\\n' +\n '- The entity description says what the publisher is, in one plain sentence, not what one page ' +\n 'offers.\\n' +\n '- The agent guidance is checkable and specific: the questions this site answers and which ' +\n 'pages answer them. No marketing language: an agent discounts a claim it cannot check.\\n' +\n '- Keep every length the tool states, and write in the language of the pages.',\n cacheBreakpoint: true,\n },\n]\n\n/** The site SEO form fields blank on the site now. */\nexport function aiSeoBlankSiteFields(host: SeoHostDocument): Set<AiSeoSiteFormField> {\n const entity = host.seo?.entity ?? {}\n const agent = host.seo?.agent ?? {}\n const blank = new Set<AiSeoSiteFormField>()\n if (entity.type === undefined || entity.type === null || entity.type === '') blank.add('seo.entity.type')\n if (!str(entity.name)) blank.add('seo.entity.name')\n if (!str(entity.description)) blank.add('seo.entity.description')\n if (!str(entity.email)) blank.add('seo.entity.email')\n if (!str(entity.telephone)) blank.add('seo.entity.telephone')\n if (!str(entity.contactType)) blank.add('seo.entity.contactType')\n if (!str(agent.whenToUse)) blank.add('seo.agent.whenToUse')\n if (!str(agent.howToUse)) blank.add('seo.agent.howToUse')\n return blank\n}\n\n/** The site's content collections, for the llms.txt preview. */\nasync function readContentCollections(hostRef: DocumentReference): Promise<LlmsTxtCollection[]> {\n try {\n const snapshot = await hostRef.collection('collections').select('slug', 'displayName', 'kind').limit(50).get()\n return snapshot.docs\n .filter((doc) => hostCollectionKind(doc.data()) === 'content' && str(doc.get('slug')))\n .map((doc) => ({ slug: str(doc.get('slug')), name: str(doc.get('displayName')) || undefined }))\n } catch {\n // A preview without the feeds is still a preview of the guidance.\n return []\n }\n}\n\n/** `/llms.txt` as it reads with `values` saved over what the site stores now. */\nexport function aiSeoLlmsPreview(\n host: SeoHostDocument,\n values: Partial<Record<AiSeoSiteFormField, string>>,\n pages: readonly LlmsTxtPage[],\n collections: readonly LlmsTxtCollection[],\n): string {\n return buildLlmsTxt({\n siteName: str(host.seo?.title) || str(host.displayName) || 'Site',\n origin: hostPublicOrigin(host) ?? '',\n description: str(host.seo?.description) || undefined,\n agent: {\n whenToUse: values['seo.agent.whenToUse'] ?? host.seo?.agent?.whenToUse,\n howToUse: values['seo.agent.howToUse'] ?? host.seo?.agent?.howToUse,\n },\n pages,\n collections,\n hasSearch: true,\n contactEmail: values['seo.entity.email'] ?? (str(host.seo?.entity?.email) || undefined),\n })\n}\n\nasync function proposeSite(\n context: AiJobStepContext & { firestore: Firestore },\n host: SeoHostDocument,\n scan: AiSeoSiteScan,\n): Promise<UnitResult> {\n const { job, firestore, signal } = context\n const model = modelOf(context)\n const hostRef = firestore.collection('hosts').doc(job.hostId as string)\n const blank = aiSeoBlankSiteFields(host)\n const collections = await readContentCollections(hostRef)\n const topLevel: LlmsTxtPage[] = scan.pages\n .filter((page) => !page.path.replace(/^\\//, '').includes('/'))\n .slice(0, SITE_PAGES_LISTED)\n .map((page) => ({ path: page.path, ...(page.name ? { title: page.name } : {}) }))\n // The pages that say who publishes a site: the home page, and whatever is\n // about the company or how to reach it.\n const telling = scan.pages\n .filter((page) => page.path === '/' || /about|contact|company|team|who/i.test(page.path))\n .slice(0, 4)\n const prompt = [\n `Site: ${brandOf(host) || 'untitled site'}`,\n host.seo?.description ? `Site description: ${str(host.seo.description)}` : '',\n `Empty fields you may fill: ${[...blank].join(', ') || 'none'}`,\n 'Pages:',\n ...scan.pages\n .slice(0, SITE_PAGES_LISTED)\n .map((page) => `- ${page.path} — ${page.name}${str(page.seo.title) ? ` — ${str(page.seo.title)}` : ''}`),\n collections.length\n ? `Content collections: ${collections.map((entry) => entry.name || entry.slug).join(', ')}`\n : '',\n ...telling.flatMap((page) => ['', `Text of ${page.path}:`, page.facts.text.slice(0, 1_200) || '(no text)']),\n ]\n .filter((line) => line !== '')\n .join('\\n')\n const siteText = scan.pages.map((page) => page.facts.text).join('\\n')\n const generation = await runValidatedGeneration('seo-site', {\n step: 'job.seo',\n model,\n instructions: AI_SEO_SITE_INSTRUCTIONS,\n messages: [{ role: 'user', content: prompt }],\n tool: aiSeoSiteTool(),\n maxTokens: aiSeoGenerationMaxTokens(model, AI_SEO_SITE_MAX_TOKENS),\n ...(signal ? { signal } : {}),\n check: (answer) => checkAiSeoSite(answer, { blank, siteText }),\n })\n const proposed = generation.status === 'ok' ? generation.value : { values: {}, notes: [] }\n const notes =\n generation.status === 'ok'\n ? proposed.notes\n : [\n generation.status === 'refused'\n ? 'The AI declined to propose structured data for this site.'\n : generation.message,\n ]\n const site: AiSeoSiteProposal = {\n values: proposed.values,\n llmsPreview: aiSeoLlmsPreview(host, proposed.values, topLevel, collections),\n notes,\n }\n return {\n output: {\n resource: 'seo',\n id: AI_SEO_OUTPUT_IDS.site,\n hostId: job.hostId ?? null,\n label: 'SEO audit · structured data and agent guidance',\n proposal: plain({ kind: 'site', site }),\n },\n spent: spentBy(generation),\n }\n}\n\n/* ---- A batch of page fixes ------------------------------------------------ */\n\nexport const AI_SEO_FIXES_INSTRUCTIONS: AiSystemBlock[] = [\n {\n text:\n 'You fix the search listings and headings of a website’s pages. For each page you are given ' +\n 'what an audit found, what the page shows now, and its text.\\n\\n' +\n `Answer by calling ${AI_SEO_FIXES_TOOL_NAME} exactly once, with one entry per page. A reply in ` +\n 'prose cannot be used.\\n\\n' +\n 'Rules:\\n' +\n '- Fix only what the audit found. Answer null for a value it did not find a problem with.\\n' +\n '- Write only from the page’s own text. Never invent a fact, a price, a name, a place or a claim.\\n' +\n '- A title says what the page is, specifically. No two pages share a title, and none repeats a ' +\n 'title you are told another page uses.\\n' +\n '- A description is one or two sentences telling a searcher what they will find.\\n' +\n '- The main heading names what the page is about in a few plain words.\\n' +\n '- An image description says what the picture most likely shows, from the text beside it. ' +\n 'Leave an image out when the text gives no idea.\\n' +\n '- A target keyword goes in only where the page is about it and it reads naturally: at most ' +\n 'once in a title and once in a description. Never list keywords or repeat a word to rank.\\n' +\n '- Keep every length the tool states, and write in the language of each page.',\n cacheBreakpoint: true,\n },\n]\n\n/** The fixes one page gets: the model's values, its content fixes, and the guidance no fix can give. */\nexport function aiSeoPageFixFor(page: AiSeoBatchPage, answer: AiSeoBatchAnswer | null): AiSeoPageFix {\n const values: AiSeoFieldValues = {}\n if (answer?.title) values.title = answer.title\n if (answer?.description) values.description = answer.description\n const content: AiSeoContentFix[] = []\n for (const alt of answer?.imageAlts ?? []) content.push({ kind: 'image-alt', nodeId: alt.nodeId, alt: alt.alt })\n if (answer?.h1) {\n const first = page.facts.h1s[0]\n const promotable = page.facts.headings.find((heading) => heading.editable && heading.nodeId)\n if (page.codes.has('h1-thin') && first?.editable && first.nodeId) {\n content.push({ kind: 'h1-set', nodeId: first.nodeId, text: answer.h1 })\n } else if (page.codes.has('h1-missing') && promotable?.nodeId) {\n content.push({ kind: 'h1-set', nodeId: promotable.nodeId, text: answer.h1 })\n } else if (page.codes.has('h1-missing')) {\n content.push({ kind: 'h1-insert', text: answer.h1 })\n }\n }\n if (page.codes.has('h1-multiple')) content.push(...aiSeoHeadingDemotions(page.facts))\n const guidance: string[] = []\n if (page.codes.has('orphan')) {\n guidance.push('Link to this page from your navigation or a related page. Where it belongs is yours to choose.')\n }\n return { screenId: page.screenId, values, content, guidance }\n}\n\n/** The user turn for one batch: each page's findings, what it shows now, and its text. */\nexport function aiSeoFixesPrompt(pages: readonly AiSeoBatchPage[], titlesElsewhere: readonly string[]): string {\n const titles = titlesElsewhere.length\n ? `Titles other pages use:\\n${titlesElsewhere.slice(0, 40).map((title) => `- ${title}`).join('\\n')}\\n\\n`\n : ''\n const blocks = pages.map((page) => {\n const lines = [\n `### Page ${page.screenId}: ${page.name} (${page.path})`,\n `Found: ${[...page.codes].map((code) => AI_SEO_FINDING_LABELS[code]).join('; ')}`,\n `Title now: ${str(page.seo?.title) || '(none)'}`,\n `Description now: ${str(page.seo?.description) || '(none)'}`,\n `Main heading now: ${page.facts.h1s[0]?.text || '(none)'}`,\n ]\n if (page.keywords.length) lines.push(`Target keywords: ${page.keywords.join(', ')}`)\n const images = aiSeoFixImages(page)\n if (images.length) {\n lines.push(\n 'Images without a description:',\n ...images.map((image) => `- ${image.nodeId}: beside \"${image.context || 'no text'}\"`),\n )\n }\n lines.push('Text:', page.facts.text.slice(0, AI_SEO_BATCH_PAGE_TEXT_CHARS) || '(no text)')\n return lines.join('\\n')\n })\n return `${titles}${blocks.join('\\n\\n')}`\n}\n\nasync function proposeFixes(\n context: AiJobStepContext & { firestore: Firestore },\n report: AiSeoAuditReport,\n unit: Extract<AiSeoAuditUnit, { kind: 'batch' }>,\n): Promise<UnitResult> {\n const { job, firestore, signal } = context\n const model = modelOf(context)\n const hostRef = firestore.collection('hosts').doc(job.hostId as string)\n const reports = new Map(report.pages.map((page) => [page.screenId, page]))\n // Read now, not as audited: a page edited since keeps its edits, and one\n // deleted since is skipped.\n const loaded = await Promise.all(\n unit.screenIds.map(async (screenId): Promise<AiSeoBatchPage | null> => {\n const pageReport = reports.get(screenId)\n const snapshot = await hostRef.collection('screens').doc(screenId).get()\n const screen = snapshot.exists ? (snapshot.data() as SeoScreenDocument) : null\n if (!pageReport || !screen || screen.deletedAt) return null\n const version = await readVersionNodes(hostRef, screenId, str(screen.versionId))\n return {\n screenId,\n path: pageReport.path,\n name: pageReport.name,\n codes: new Set(pageReport.findings.map((entry) => entry.code)),\n keywords: pageReport.keywords.map((entry) => entry.keyword),\n seo: screen.seo ?? {},\n facts: aiSeoPageFacts(version?.nodes as never, { rootId: version?.rootId }),\n }\n }),\n )\n const pages = loaded.filter((page): page is AiSeoBatchPage => page !== null)\n const titlesElsewhere = await siteTitles(hostRef, new Set(pages.map((page) => page.screenId)))\n\n let spent = spentNothing(model)\n let answers: Record<string, AiSeoBatchAnswer> = {}\n const notes: string[] = []\n if (pages.length) {\n const generation = await runValidatedGeneration('seo-fixes', {\n step: 'job.seo',\n model,\n instructions: AI_SEO_FIXES_INSTRUCTIONS,\n messages: [{ role: 'user', content: aiSeoFixesPrompt(pages, titlesElsewhere) }],\n tool: aiSeoFixesTool(pages.map((page) => page.screenId)),\n // Lowered on a tier too slow to answer a whole batch and ask again\n // inside the least time the step registers.\n maxTokens: aiSeoGenerationMaxTokens(model, AI_SEO_FIXES_MAX_TOKENS),\n ...(signal ? { signal } : {}),\n check: (answer) => checkAiSeoFixes(answer, pages, titlesElsewhere),\n })\n spent = spentBy(generation)\n if (generation.status === 'ok') {\n answers = generation.value\n } else {\n notes.push(\n generation.status === 'refused'\n ? 'The AI declined to propose fixes for these pages.'\n : generation.message,\n )\n }\n }\n const fixes = pages.map((page) => aiSeoPageFixFor(page, answers[page.screenId] ?? null))\n const skipped = unit.screenIds.length - pages.length\n if (skipped > 0) {\n notes.push(`${skipped} ${skipped === 1 ? 'page was' : 'pages were'} deleted since the audit and left out.`)\n }\n return {\n output: {\n resource: 'seo',\n id: AI_SEO_OUTPUT_IDS.fixes(unit.batch),\n hostId: job.hostId ?? null,\n label: `SEO audit · fixes ${unit.batch} of ${unit.of}`,\n proposal: plain({ kind: 'fixes', batch: unit.batch, fixes, notes }),\n },\n spent,\n }\n}\n\nasync function runSiteAuditPass(\n context: AiJobStepContext & { firestore: Firestore },\n host: SeoHostDocument,\n): Promise<AiJobStepOutcome> {\n const { job, firestore } = context\n const model = modelOf(context)\n const recorded = aiSeoAuditView(job.outputs ?? [])\n const outputs: AiJobOutput[] = []\n let spent = spentNothing(model)\n let report: AiSeoAuditReport\n let scan: AiSeoSiteScan | null = null\n if (recorded) {\n report = recorded.report\n } else {\n scan = await scanAiSeoSite(firestore, job.hostId as string, host, job.inputs?.['keywords'])\n report = aiSeoAudit(\n scan.pages,\n {\n discouraged: isSearchDiscouraged(host as never),\n entity: host.seo?.entity ?? {},\n agent: host.seo?.agent ?? {},\n },\n { skipped: scan.skipped },\n )\n report.notes.push(...scan.notes)\n const findings = report.pages.reduce((sum, page) => sum + page.findings.length, report.site.length)\n outputs.push({\n resource: 'seo',\n id: AI_SEO_OUTPUT_IDS.report,\n hostId: job.hostId ?? null,\n label: `SEO audit · ${report.pages.length} ${report.pages.length === 1 ? 'page' : 'pages'} · ${findings} ${findings === 1 ? 'finding' : 'findings'}`,\n proposal: plain(report),\n })\n }\n const units = aiSeoPendingUnits(report, [...(job.outputs ?? []), ...outputs])\n if (!units.length) return { outputs, ...spent }\n const [unit] = units\n const result =\n unit.kind === 'site'\n ? await proposeSite(\n context,\n host,\n scan ?? (await scanAiSeoSite(firestore, job.hostId as string, host, job.inputs?.['keywords'])),\n )\n : await proposeFixes(context, report, unit)\n outputs.push(result.output)\n spent = addSpent(spent, result.spent)\n return { outputs, ...spent, ...(units.length > 1 ? { continue: true } : {}) }\n}\n\nexport const runAiJobSeoStep: AiJobStepRunner = async (context) => {\n const { job, firestore } = context\n if (!firestore) {\n // The machine always hands one in; a runner called without it is a\n // wiring fault, not a customer path.\n throw new Error('the SEO step reads the site it writes about and was given no Firestore')\n }\n const target = aiSeoJobTarget(job.inputs)\n if (!target) return { outputs: [], ...spentNothing(modelOf(context)), failure: AI_SEO_NO_TARGET_COPY }\n const site = await loadSite(firestore, job)\n if ('failure' in site) return { outputs: [], ...spentNothing(modelOf(context)), failure: site.failure }\n const withFirestore = { ...context, firestore }\n switch (target) {\n case 'screen':\n return runScreenListing(withFirestore, site.host)\n case 'product':\n return runProductListing(withFirestore, site.host)\n case 'site':\n return runSiteAuditPass(withFirestore, site.host)\n }\n}\n"],"names":["hostCollectionKind","hostPublicOrigin","buildLlmsTxt","nodesReferenceScreen","screenRoutePathToUrl","isScreenIndexable","isSearchDiscouraged","statusPageScreenIds","SCREEN_SEO_LISTING_FIELDS","isSeoListingFieldKey","decodeStoredNodes","getTemplateScreenIds","AI_SEO_FINDING_LABELS","AI_SEO_OUTPUT_IDS","aiSeoAuditView","aiSeoJobTarget","aiModelForStep","AI_SEO_AUDIT_MAX_PAGES","aiSeoAudit","aiSeoAuditBatches","aiSeoHeadingDemotions","aiSeoNormalizePath","parseAiSeoKeywordLines","runValidatedGeneration","AI_SEO_FIELDS_MAX_TOKENS","generateSeoFields","AI_SEO_PAGE_TEXT_MAX_CHARS","aiSeoPageFacts","AI_SEO_FIXES_TOOL_NAME","AI_SEO_SITE_TOOL_NAME","aiSeoFixImages","aiSeoFixesTool","aiSeoKeywordCoverage","aiSeoKeywordList","aiSeoSiteTool","checkAiSeoFixes","checkAiSeoSite","AI_SEO_FIXES_MAX_TOKENS","AI_SEO_SITE_MAX_TOKENS","aiSeoGenerationMaxTokens","AI_SEO_NO_SITE_COPY","AI_SEO_NO_PAGE_COPY","AI_SEO_NO_TARGET_COPY","AI_SEO_NO_PRODUCT_COPY","AI_SEO_LAYOUT_SCAN_LIMIT","AI_SEO_BATCH_PAGE_TEXT_CHARS","READ_CHUNK","SITE_PAGES_LISTED","PRODUCT_LISTING_FIELDS","ZERO_USAGE","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","str","value","trim","round6","Math","round","modelOf","context","modelFor","spentNothing","model","usage","estCostUsd","stopReason","spentBy","generation","addSpent","a","b","plain","JSON","parse","stringify","aiSeoRequestedFields","raw","allowed","named","String","split","map","part","filter","wanted","Set","length","key","has","brandOf","host","seo","title","displayName","subdomain","loadSite","firestore","job","hostId","failure","snapshot","collection","doc","get","exists","data","orgId","readVersionNodes","hostRef","screenId","versionId","nodes","rootId","siteTitles","except","select","limit","docs","id","Boolean","listingOutcome","subject","spent","status","outputs","refused","message","values","notes","fields","includes","hasImage","imageAlt","push","proposal","kind","keywords","description","h1","facts","h1s","text","body","output","resource","label","name","runScreenListing","screen","signal","inputs","deletedAt","version","image","onPage","images","find","src","undefined","route","screens","path","brand","current","breadcrumb","alt","otherTitles","maxTokens","runProductListing","slice","productId","scanAiSeoSite","rawKeywords","routing","screenDocs","templateScreenIds","layoutDocs","Promise","all","Map","excluded","published","Object","entries","sort","audited","versions","start","set","layoutNodes","layouts","ref","keywordsByPath","auditedPaths","page","keys","pages","linkedFrom","some","other","skipped","max","aiSeoPendingUnits","report","done","units","siteProposal","site","batches","forEach","screenIds","index","fixes","batch","of","AI_SEO_SITE_INSTRUCTIONS","cacheBreakpoint","aiSeoBlankSiteFields","entity","agent","blank","type","add","email","telephone","contactType","whenToUse","howToUse","readContentCollections","slug","aiSeoLlmsPreview","collections","siteName","origin","hasSearch","contactEmail","proposeSite","scan","topLevel","replace","telling","test","prompt","join","entry","flatMap","line","siteText","step","instructions","messages","role","content","tool","check","answer","proposed","llmsPreview","AI_SEO_FIXES_INSTRUCTIONS","aiSeoPageFixFor","imageAlts","nodeId","first","promotable","headings","heading","editable","codes","guidance","aiSeoFixesPrompt","titlesElsewhere","titles","blocks","lines","code","proposeFixes","unit","reports","loaded","pageReport","findings","keyword","answers","runSiteAuditPass","recorded","discouraged","reduce","sum","result","continue","runAiJobSeoStep","Error","target","withFirestore"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,kBAAkB,QAAQ,yCAAwC;AAC3E,SAASC,gBAAgB,QAAQ,qCAAoC;AACrE,SACEC,YAAY,QAGP,kCAAiC;AACxC,SAASC,oBAAoB,QAAQ,2CAA0C;AAC/E,SAASC,oBAAoB,QAAQ,sCAAqC;AAC1E,SACEC,iBAAiB,EACjBC,mBAAmB,EACnBC,mBAAmB,QACd,yCAAwC;AAC/C,SACEC,yBAAyB,EACzBC,oBAAoB,QAEf,4CAA2C;AAClD,SAASC,iBAAiB,QAAQ,sCAAqC;AACvE,SAASC,oBAAoB,QAAQ,yCAAwC;AAE7E,SACEC,qBAAqB,EACrBC,iBAAiB,EACjBC,cAAc,EACdC,cAAc,QAQT,qBAAiB;AACxB,SAASC,cAAc,QAAQ,0BAAsB;AAErD,SACEC,sBAAsB,EACtBC,UAAU,EACVC,iBAAiB,EACjBC,qBAAqB,EACrBC,kBAAkB,EAClBC,sBAAsB,QAEjB,0BAAsB;AAC7B,SACEC,sBAAsB,QAGjB,4BAAwB;AAC/B,SAASC,wBAAwB,EAAEC,iBAAiB,QAAQ,2BAAuB;AACnF,SACEC,0BAA0B,EAC1BC,cAAc,QAET,+BAA2B;AAClC,SACEC,sBAAsB,EACtBC,qBAAqB,EACrBC,cAAc,EACdC,cAAc,EACdC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,EACbC,eAAe,EACfC,cAAc,QAGT,0BAAsB;AAC7B,SACEC,uBAAuB,EACv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|
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 AiBuildPlanCreate, type AiBuildPlanScreen } from '../model/ai-build-plan';
|
|
18
|
+
import type { AiJob, AiJobKind, AiJobOutput, AiJobOutputResource, AiJobPlan } from '../model/ai-jobs.types';
|
|
19
|
+
import { type AiSiteJobInputs } from '../model/ai-site-job';
|
|
20
|
+
import { type AiJobAdmission } from './ai-job-admission';
|
|
21
|
+
import { type AiJobStepContext, type AiJobStepOutcome, type AiJobStepRunner } from './ai-job-text-step';
|
|
22
|
+
import { aiJobStepRunnerFor } from './ai-jobs';
|
|
23
|
+
/**
|
|
24
|
+
* The site scaffold (AGL-2911): the generation step of a `site` job, run once
|
|
25
|
+
* a member confirmed the plan their brief produced.
|
|
26
|
+
*
|
|
27
|
+
* ── It builds nothing itself ─────────────────────────────────────────────
|
|
28
|
+
*
|
|
29
|
+
* A scaffold is a whole site: a palette suggestion, the layout its pages
|
|
30
|
+
* render inside, the contact form they place, four to eight pages with their
|
|
31
|
+
* search listings, and a welcome email. Every one of those is already a job
|
|
32
|
+
* kind with a step of its own, so this step generates nothing and asks no
|
|
33
|
+
* model anything. It works through the confirmed plan one UNIT at a time and
|
|
34
|
+
* hands each unit to the runner registered for the kind that owns it — the
|
|
35
|
+
* theme step for the palette, the page step for a page — under a job of that
|
|
36
|
+
* kind derived from this one.
|
|
37
|
+
*
|
|
38
|
+
* That is why the scaffold cannot drift from the thing it scaffolds: a page
|
|
39
|
+
* it builds is a page job's page, held to the same doctrine, written by the
|
|
40
|
+
* same draft writer, left unpublished by the same rule. A kind whose step
|
|
41
|
+
* this deployment has not loaded is simply not among the units, so nothing
|
|
42
|
+
* here knows which issues have landed.
|
|
43
|
+
*
|
|
44
|
+
* ── One unit a pass ──────────────────────────────────────────────────────
|
|
45
|
+
*
|
|
46
|
+
* The step runs ONE delegated pass and asks the machine to continue, so every
|
|
47
|
+
* pass is one reservation, one provider exchange and one recorded spend, and
|
|
48
|
+
* the org's monthly ceiling binds a scaffold exactly as it binds a chat turn.
|
|
49
|
+
* Credits running out mid-scaffold is therefore the machine's own park: the
|
|
50
|
+
* job waits as `needs_input` with the meter's words, and the beat resumes it
|
|
51
|
+
* where it stopped once the workspace's standing has changed. A pass needs the
|
|
52
|
+
* time its unit's own step needs (`aiSiteJobRunMinimumMs`), so the beat starts
|
|
53
|
+
* a palette change only with a palette change's time left.
|
|
54
|
+
*
|
|
55
|
+
* Where it stopped is read from the job's OUTPUTS rather than kept anywhere:
|
|
56
|
+
* each unit reports exactly one output when it completes, so the units
|
|
57
|
+
* already represented there are the ones already built. A pass interrupted
|
|
58
|
+
* between its work and its record repeats a unit that then finds its own
|
|
59
|
+
* draft and reports it, which is what every step's draft id already gives.
|
|
60
|
+
*
|
|
61
|
+
* ── Never published ──────────────────────────────────────────────────────
|
|
62
|
+
*
|
|
63
|
+
* Nothing here publishes, routes or sends: each delegated step writes the
|
|
64
|
+
* unpublished draft it already wrote for a job of its own kind, and the
|
|
65
|
+
* palette and navigation travel as proposals a member applies.
|
|
66
|
+
*
|
|
67
|
+
* ── The page job builds its creations the same way (AGL-3031) ────────────
|
|
68
|
+
*
|
|
69
|
+
* A page job whose plan creates a layout, forms or components builds them
|
|
70
|
+
* before its page through this same machinery: the units a creation implies
|
|
71
|
+
* (`aiCreationUnit`), where the job stands read from its outputs
|
|
72
|
+
* (`aiSitePendingUnits`), one delegated pass a unit (`aiRunJobUnit`), and the
|
|
73
|
+
* `new:<name>` references resolved to what was built (`aiSiteBuiltRefs`,
|
|
74
|
+
* `aiSiteUnitJob`). There is one loop, and it is the machine's.
|
|
75
|
+
*/
|
|
76
|
+
/** What a scaffold's units are, in the order it builds them; a component is a page job's. */
|
|
77
|
+
export type AiSiteUnitKind = 'theme' | 'layout' | 'form' | 'component' | 'page' | 'email';
|
|
78
|
+
export interface AiSiteUnit {
|
|
79
|
+
kind: AiSiteUnitKind;
|
|
80
|
+
/** The job kind whose registered runner builds it. */
|
|
81
|
+
jobKind: AiJobKind;
|
|
82
|
+
/** The resource the unit reports when it completes. */
|
|
83
|
+
resource: AiJobOutputResource;
|
|
84
|
+
/** Stable within the job: what the unit's derived job and draft are addressed by. */
|
|
85
|
+
slot: string;
|
|
86
|
+
/** The plan screen a page unit builds. */
|
|
87
|
+
screen?: AiBuildPlanScreen;
|
|
88
|
+
/** The creation a theme, layout or form unit builds. */
|
|
89
|
+
creation?: AiBuildPlanCreate;
|
|
90
|
+
/** What the unit is, for the derived job's brief. */
|
|
91
|
+
label: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The unit one creation is built as, under the slot its derived job and draft
|
|
95
|
+
* are addressed by; `null` for a creation no unit builds.
|
|
96
|
+
*/
|
|
97
|
+
export declare function aiCreationUnit(creation: AiBuildPlanCreate, slot: string): AiSiteUnit | null;
|
|
98
|
+
export declare const AI_SITE_NO_PLAN_COPY = "This site job has no confirmed plan to build.";
|
|
99
|
+
/** What a scaffold answers where the step that builds a page is not loaded. */
|
|
100
|
+
export declare const AI_SITE_NO_PAGE_STEP_COPY = "Building a whole site is not available yet.";
|
|
101
|
+
/** A unit that finished without reporting what it built; the scaffold cannot go on. */
|
|
102
|
+
export declare const AI_SITE_UNIT_EMPTY_COPY = "Part of this site could not be built. Try the site brief again.";
|
|
103
|
+
/**
|
|
104
|
+
* The most passes a scaffold's step may take: the largest plan it admits —
|
|
105
|
+
* eight pages of eight sections, its three creations and a welcome email —
|
|
106
|
+
* with nothing to spare, so a runner that never finishes is still bounded
|
|
107
|
+
* while a real site is not.
|
|
108
|
+
*/
|
|
109
|
+
export declare const AI_SITE_MAX_PASSES: number;
|
|
110
|
+
/**
|
|
111
|
+
* The units a plan implies, in build order: the palette first, because a
|
|
112
|
+
* member reads it while the pages are still building; then the layout every
|
|
113
|
+
* page renders inside and the form they place, because a page binds both by
|
|
114
|
+
* id and so needs them to exist; then the pages; then the welcome email,
|
|
115
|
+
* which is about the site rather than part of it.
|
|
116
|
+
*/
|
|
117
|
+
export declare function aiSiteJobUnits(plan: Pick<AiJobPlan, 'create' | 'screens'>, options?: {
|
|
118
|
+
welcomeEmail?: boolean;
|
|
119
|
+
}): AiSiteUnit[];
|
|
120
|
+
/**
|
|
121
|
+
* The units a scaffold still owes after the outputs recorded so far. Each
|
|
122
|
+
* unit reports one output of its own resource when it completes, so the
|
|
123
|
+
* outputs already recorded are consumed against the units in build order.
|
|
124
|
+
*/
|
|
125
|
+
export declare function aiSitePendingUnits(units: readonly AiSiteUnit[], outputs: readonly Pick<AiJobOutput, 'resource'>[]): AiSiteUnit[];
|
|
126
|
+
/**
|
|
127
|
+
* The site's own search listing as the scaffold reports it (AGL-2918), or
|
|
128
|
+
* nothing when the job already reported one or its inputs describe no site.
|
|
129
|
+
*
|
|
130
|
+
* It costs nothing and asks no model: the values are arithmetic on the
|
|
131
|
+
* answers (`aiSiteSeoProposal`), so they ride out on the first pass that
|
|
132
|
+
* builds anything rather than waiting for a pass of their own. Its resource
|
|
133
|
+
* is `seo`, which no unit reports, so it cannot be mistaken for a unit's
|
|
134
|
+
* output by `aiSitePendingUnits` and cannot move where the scaffold thinks
|
|
135
|
+
* it is.
|
|
136
|
+
*/
|
|
137
|
+
export declare function aiSiteSeoOutputs(job: AiJob): AiJobOutput[];
|
|
138
|
+
/** A record an earlier unit created, as a later one references it. */
|
|
139
|
+
export interface AiSiteBuiltRef {
|
|
140
|
+
id: string;
|
|
141
|
+
label: string;
|
|
142
|
+
/** Only what becomes a record a page can name; a palette change is not one. */
|
|
143
|
+
kind: 'layout' | 'form' | 'component';
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* What the scaffold has already created, as the plan's `new:<name>`
|
|
147
|
+
* references resolve to: the id of the record each completed creation wrote.
|
|
148
|
+
* A page unit is told about the layout and the form by id, exactly as a page
|
|
149
|
+
* job is told about records the site already had.
|
|
150
|
+
*/
|
|
151
|
+
export declare function aiSiteBuiltRefs(units: readonly AiSiteUnit[], outputs: readonly Pick<AiJobOutput, 'resource' | 'id' | 'label'>[]): Map<string, AiSiteBuiltRef>;
|
|
152
|
+
type BuiltRefs = ReturnType<typeof aiSiteBuiltRefs>;
|
|
153
|
+
/**
|
|
154
|
+
* The site's own words, as every unit's brief carries them.
|
|
155
|
+
*
|
|
156
|
+
* The audience is here rather than left to the brief's prose (AGL-2918). A
|
|
157
|
+
* guided start writes it into the brief itself, but an agency batch's brief
|
|
158
|
+
* is a member's own sentence and may never mention it, and a theme, a layout
|
|
159
|
+
* or a form asked to serve nobody in particular serves nobody in particular.
|
|
160
|
+
*/
|
|
161
|
+
export declare function aiSiteBriefLines(brief: string, inputs: AiSiteJobInputs): string[];
|
|
162
|
+
/**
|
|
163
|
+
* What the welcome email is told (AGL-2918), beyond that it is a welcome
|
|
164
|
+
* email.
|
|
165
|
+
*
|
|
166
|
+
* The scaffold's email unit used to carry one sentence, and a yes/no toggle
|
|
167
|
+
* decided whether it ran — so the draft was a welcome email for a business
|
|
168
|
+
* in general, to nobody in particular, about nothing that had happened. The
|
|
169
|
+
* two answers it is missing are who wrote in and what now becomes of what
|
|
170
|
+
* they wrote, and the second of those is the person's own routing answer, so
|
|
171
|
+
* the email and the form it acknowledges cannot say different things.
|
|
172
|
+
*
|
|
173
|
+
* ⛔ A DRAFT either way. Nothing here sends, schedules or enrolls anybody:
|
|
174
|
+
* the email step writes an unpublished email design and stops.
|
|
175
|
+
*/
|
|
176
|
+
export declare function aiSiteEmailBriefLines(inputs: Readonly<Record<string, unknown>> | null | undefined): string[];
|
|
177
|
+
/**
|
|
178
|
+
* The id a unit's job is named by, and so the id its draft is written under
|
|
179
|
+
* (AGL-3079): the id the plan entry it builds recorded, or for the welcome
|
|
180
|
+
* email the id recorded on this job's step. A unit that writes no draft — a
|
|
181
|
+
* palette change — and a unit whose plan recorded no id are named by this
|
|
182
|
+
* job's id and the unit's slot, the name every draft of such a plan has.
|
|
183
|
+
*/
|
|
184
|
+
export declare function aiSiteUnitJobId(job: Pick<AiJob, '$id' | 'steps'>, unit: AiSiteUnit): string;
|
|
185
|
+
/**
|
|
186
|
+
* The job a unit is built under: this job's org, site, creator and model,
|
|
187
|
+
* the kind that owns the unit, and a plan narrowed to the unit alone.
|
|
188
|
+
*
|
|
189
|
+
* The derived job carries NO steps and NO outputs of the scaffold's: a page
|
|
190
|
+
* job's step reads its own draft and its own plan, and what the other units
|
|
191
|
+
* produced is not its business. Its `$id` is the id the unit's draft is
|
|
192
|
+
* written under (`aiSiteUnitJobId`), which is what a step with no id of its
|
|
193
|
+
* own recorded names its draft by, so a unit re-run after its write finds its
|
|
194
|
+
* own draft rather than writing a second.
|
|
195
|
+
*
|
|
196
|
+
* A creation unit reuses what the plan reuses less what the plan's screens
|
|
197
|
+
* place themselves (AGL-3031): a component a page's section places is the
|
|
198
|
+
* page's to place, and a layout or a card told to place it would be refused
|
|
199
|
+
* for leaving it out.
|
|
200
|
+
*/
|
|
201
|
+
export declare function aiSiteUnitJob(job: AiJob, unit: AiSiteUnit, built: BuiltRefs): AiJob;
|
|
202
|
+
/**
|
|
203
|
+
* A scaffold is admitted with inputs that read, for a site of the job's own
|
|
204
|
+
* org, and only where this deployment has loaded the step that builds a page:
|
|
205
|
+
* a scaffold whose pages nothing can build is not a scaffold.
|
|
206
|
+
*/
|
|
207
|
+
export declare const aiSiteJobAdmission: AiJobAdmission;
|
|
208
|
+
/** What one delegated pass came to: the unit's spend as the job records it, and whether the unit is built. */
|
|
209
|
+
export interface AiJobUnitPass {
|
|
210
|
+
outcome: AiJobStepOutcome;
|
|
211
|
+
/** The unit reported what it built and asked for no pass of its own. */
|
|
212
|
+
built: boolean;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* One delegated pass (AGL-2911, AGL-3031): the unit handed to the runner of
|
|
216
|
+
* the kind that owns it, under the job derived for it, and its outcome as the
|
|
217
|
+
* delegating job records it. A delegate proposes a plan for its own job,
|
|
218
|
+
* which does not exist, so no plan is carried back. A unit that stopped for a
|
|
219
|
+
* person, refused or failed is the delegating job's stop; a unit that asked
|
|
220
|
+
* for another pass keeps its turn; and a unit that finished without reporting
|
|
221
|
+
* what it built fails with `emptyCopy`, since another pass would ask the same
|
|
222
|
+
* thing again. The tokens it spent are on the bill either way.
|
|
223
|
+
*/
|
|
224
|
+
export declare function aiRunJobUnit(context: AiJobStepContext, input: {
|
|
225
|
+
unit: AiSiteUnit;
|
|
226
|
+
units: readonly AiSiteUnit[];
|
|
227
|
+
runner: AiJobStepRunner;
|
|
228
|
+
emptyCopy: string;
|
|
229
|
+
}): Promise<AiJobUnitPass>;
|
|
230
|
+
export interface AiJobSiteStepDeps {
|
|
231
|
+
/** The runner registry; specs hand in a fake for a kind they drive. */
|
|
232
|
+
runnerFor?: typeof aiJobStepRunnerFor;
|
|
233
|
+
}
|
|
234
|
+
export declare function createAiJobSiteStep(deps?: AiJobSiteStepDeps): AiJobStepRunner;
|
|
235
|
+
export declare const runAiJobSiteStep: AiJobStepRunner;
|
|
236
|
+
/**
|
|
237
|
+
* The least time a scaffold's next pass needs (AGL-3035). The scaffold asks no
|
|
238
|
+
* model itself: each pass hands one unit to the step registered for its kind,
|
|
239
|
+
* under the job derived for it, so it needs what that step registers for that
|
|
240
|
+
* job — a palette change's or a layout's time for those units, a page pass's
|
|
241
|
+
* for a page. A scaffold with nothing left to build, or with no plan it can
|
|
242
|
+
* build, spends nothing, and a page pass's time covers it.
|
|
243
|
+
*/
|
|
244
|
+
export declare function aiSiteJobRunMinimumMs(job: AiJob): number;
|
|
245
|
+
/**
|
|
246
|
+
* Registers the site scaffold with the least time a pass needs — every
|
|
247
|
+
* scaffold builds pages, and a page pass needs the least of any unit — and the
|
|
248
|
+
* time its next pass needs, the passes a whole site's plan may take, and the
|
|
249
|
+
* check a site job passes before it is created or resumed.
|
|
250
|
+
*/
|
|
251
|
+
export declare function registerAiSiteJob(): void;
|
|
252
|
+
export {};
|