@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,931 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2026 Aglyn LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/ import { AI_TEXT_LIMITS, isHeadlineVariant, nodeCapabilityProps } from "./ai-palette.js";
|
|
18
|
+
import { AI_NODE_CAPABILITIES, AI_PALETTE, AI_SURFACES, AI_SX_TOKENS } from "./ai-palette.generated.js";
|
|
19
|
+
import { linealRelationshipPermits } from "@aglyn/aglyn/app-utils/lineal-order";
|
|
20
|
+
import { NODE_MAP_MAX_BYTES, nodeMapBytes } from "@aglyn/aglyn/app-utils/measure-node-map";
|
|
21
|
+
import { parseMediaRef } from "@aglyn/aglyn/app-utils/media-ref";
|
|
22
|
+
import { COMPONENT_PROP_NAME_PATTERN, REUSABLE_INSTANCE_COMPONENT_ID, REUSABLE_INSTANCE_PROP_VALUES_KEY } from "@aglyn/aglyn/app-utils/reusable-component-keys";
|
|
23
|
+
import { createIdUrlSafe } from "@aglyn/aglyn/foundation/constants/app";
|
|
24
|
+
import { CANVAS_ROOT_ELEMENT_ID } from "@aglyn/aglyn/foundation/constants/canvas";
|
|
25
|
+
import { NodeType } from "@aglyn/aglyn/types/nodes";
|
|
26
|
+
import { AI_COMPONENT_VISIBILITY_PROPS, isAiComponentPropToken } from "./ai-component-bindings.js";
|
|
27
|
+
import { sanitizeMarketplaceDefinition } from "@aglyn/aglyn/app-utils/node-definition-sanitizer";
|
|
28
|
+
/**
|
|
29
|
+
* `sx` keys a model may set: spacing, color, typography, layout, borders,
|
|
30
|
+
* display, flex and grid. Fixed rather than derived — MUI's system accepts
|
|
31
|
+
* far more (pseudo-selectors, nested selectors, arbitrary CSS properties)
|
|
32
|
+
* and every one of those is a way to reach outside the element.
|
|
33
|
+
*/ export const AI_SX_ALLOWED_KEYS = new Set([
|
|
34
|
+
// spacing
|
|
35
|
+
'm',
|
|
36
|
+
'mt',
|
|
37
|
+
'mr',
|
|
38
|
+
'mb',
|
|
39
|
+
'ml',
|
|
40
|
+
'mx',
|
|
41
|
+
'my',
|
|
42
|
+
'margin',
|
|
43
|
+
'marginTop',
|
|
44
|
+
'marginRight',
|
|
45
|
+
'marginBottom',
|
|
46
|
+
'marginLeft',
|
|
47
|
+
'p',
|
|
48
|
+
'pt',
|
|
49
|
+
'pr',
|
|
50
|
+
'pb',
|
|
51
|
+
'pl',
|
|
52
|
+
'px',
|
|
53
|
+
'py',
|
|
54
|
+
'padding',
|
|
55
|
+
'paddingTop',
|
|
56
|
+
'paddingRight',
|
|
57
|
+
'paddingBottom',
|
|
58
|
+
'paddingLeft',
|
|
59
|
+
'gap',
|
|
60
|
+
'rowGap',
|
|
61
|
+
'columnGap',
|
|
62
|
+
// color
|
|
63
|
+
'color',
|
|
64
|
+
'bgcolor',
|
|
65
|
+
'backgroundColor',
|
|
66
|
+
'borderColor',
|
|
67
|
+
'opacity',
|
|
68
|
+
// typography
|
|
69
|
+
'typography',
|
|
70
|
+
'fontSize',
|
|
71
|
+
'fontWeight',
|
|
72
|
+
'fontFamily',
|
|
73
|
+
'fontStyle',
|
|
74
|
+
'lineHeight',
|
|
75
|
+
'letterSpacing',
|
|
76
|
+
'textAlign',
|
|
77
|
+
'textTransform',
|
|
78
|
+
'textDecoration',
|
|
79
|
+
'whiteSpace',
|
|
80
|
+
'textOverflow',
|
|
81
|
+
'overflowWrap',
|
|
82
|
+
'wordBreak',
|
|
83
|
+
// layout
|
|
84
|
+
'width',
|
|
85
|
+
'minWidth',
|
|
86
|
+
'maxWidth',
|
|
87
|
+
'height',
|
|
88
|
+
'minHeight',
|
|
89
|
+
'maxHeight',
|
|
90
|
+
'boxSizing',
|
|
91
|
+
'overflow',
|
|
92
|
+
'overflowX',
|
|
93
|
+
'overflowY',
|
|
94
|
+
'position',
|
|
95
|
+
'top',
|
|
96
|
+
'right',
|
|
97
|
+
'bottom',
|
|
98
|
+
'left',
|
|
99
|
+
'zIndex',
|
|
100
|
+
'aspectRatio',
|
|
101
|
+
'objectFit',
|
|
102
|
+
// borders
|
|
103
|
+
'border',
|
|
104
|
+
'borderTop',
|
|
105
|
+
'borderRight',
|
|
106
|
+
'borderBottom',
|
|
107
|
+
'borderLeft',
|
|
108
|
+
'borderWidth',
|
|
109
|
+
'borderStyle',
|
|
110
|
+
'borderRadius',
|
|
111
|
+
'boxShadow',
|
|
112
|
+
// display
|
|
113
|
+
'display',
|
|
114
|
+
'visibility',
|
|
115
|
+
// flex
|
|
116
|
+
'flexDirection',
|
|
117
|
+
'flexWrap',
|
|
118
|
+
'justifyContent',
|
|
119
|
+
'alignItems',
|
|
120
|
+
'alignContent',
|
|
121
|
+
'alignSelf',
|
|
122
|
+
'justifySelf',
|
|
123
|
+
'flex',
|
|
124
|
+
'flexGrow',
|
|
125
|
+
'flexShrink',
|
|
126
|
+
'flexBasis',
|
|
127
|
+
'order',
|
|
128
|
+
// grid
|
|
129
|
+
'gridTemplateColumns',
|
|
130
|
+
'gridTemplateRows',
|
|
131
|
+
'gridColumn',
|
|
132
|
+
'gridRow',
|
|
133
|
+
'gridArea',
|
|
134
|
+
'gridAutoFlow',
|
|
135
|
+
'gridAutoColumns',
|
|
136
|
+
'gridAutoRows',
|
|
137
|
+
'justifyItems',
|
|
138
|
+
'placeItems',
|
|
139
|
+
'placeContent'
|
|
140
|
+
]);
|
|
141
|
+
/**
|
|
142
|
+
* Substrings no string a model wrote may carry, in a prop or an `sx` value.
|
|
143
|
+
* Exported for the theme tool's component style values (AGL-2938), which are
|
|
144
|
+
* the same kind of CSS value written into a theme instead of a node.
|
|
145
|
+
*/ export const HOSTILE_TEXT = /<\s*\/?\s*(script|iframe|object|embed|svg|style|link|meta|base|frame|form|input|img)\b|javascript:|vbscript:|data:text\/html|expression\s*\(|url\s*\(|@import|!important|\bon[a-z]+\s*=/i;
|
|
146
|
+
/**
|
|
147
|
+
* A CSS value a model may write into `sx`: lengths, numbers, keywords,
|
|
148
|
+
* shorthands (`1px solid`), functions with plain arguments (`repeat(3, 1fr)`,
|
|
149
|
+
* `rgba(0, 0, 0, 0.2)`), hex colors and theme tokens. No quotes, no
|
|
150
|
+
* semicolons, no braces, no angle brackets, no colons — which is what keeps
|
|
151
|
+
* a `url(`, a selector or a second declaration out.
|
|
152
|
+
*/ export const SX_VALUE = /^[A-Za-z0-9#.,%()\s\-_/+*]{1,100}$/;
|
|
153
|
+
/**
|
|
154
|
+
* Node fields the sanitizer strips that a model has no business writing —
|
|
155
|
+
* each is a way to reach past the node's own box, and each is named in
|
|
156
|
+
* `repairs` so a route can tell the model what it lost.
|
|
157
|
+
*/ const STRIPPED_NODE_KEYS = [
|
|
158
|
+
'className',
|
|
159
|
+
'interactions',
|
|
160
|
+
'styleOverrides',
|
|
161
|
+
'attrOverrides',
|
|
162
|
+
'presetRef'
|
|
163
|
+
];
|
|
164
|
+
const SCREEN_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
165
|
+
/** The field an icon is picked with; its value carries a drawing no model can write. */ const ICON_PICKER_FIELD = 'icon-picker';
|
|
166
|
+
const MAX_SX_KEYS = 40;
|
|
167
|
+
/** A string prop with no role of its own — a color, a CSS length, an icon id. */ const PLAIN_STRING_MAX = 500;
|
|
168
|
+
const paletteTokens = new Set(AI_SX_TOKENS.palette);
|
|
169
|
+
const breakpoints = new Set(AI_SX_TOKENS.breakpoints);
|
|
170
|
+
const typographyVariants = new Set(AI_SX_TOKENS.typographyVariants);
|
|
171
|
+
function isRecord(value) {
|
|
172
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
173
|
+
}
|
|
174
|
+
/** An `https:` address that parses as one. */ export function isHttpsUrl(value) {
|
|
175
|
+
if (!/^https:\/\//i.test(value)) return false;
|
|
176
|
+
try {
|
|
177
|
+
return new URL(value).protocol === 'https:';
|
|
178
|
+
} catch (unused) {
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/** A path on this site: one leading slash, never a scheme-relative `//`. */ export function isRootRelativePath(value) {
|
|
183
|
+
return /^\/(?!\/)[^\s<>"'`\\]*$/.test(value);
|
|
184
|
+
}
|
|
185
|
+
function sxValueAllowed(key, value) {
|
|
186
|
+
if (typeof value === 'number') return Number.isFinite(value);
|
|
187
|
+
if (typeof value !== 'string') return false;
|
|
188
|
+
const trimmed = value.trim();
|
|
189
|
+
if (!trimmed || HOSTILE_TEXT.test(trimmed)) return false;
|
|
190
|
+
if (paletteTokens.has(trimmed)) return true;
|
|
191
|
+
if (key === 'typography' && typographyVariants.has(trimmed)) return true;
|
|
192
|
+
return SX_VALUE.test(trimmed);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The allowed slice of an `sx` object, with a line per key or value dropped.
|
|
196
|
+
* Responsive objects keep only breakpoint keys; anything deeper — a
|
|
197
|
+
* pseudo-selector, a nested selector, an array — is not a value at all.
|
|
198
|
+
*/ function sanitizeSx(nodeId, sx, repairs) {
|
|
199
|
+
if (!isRecord(sx)) {
|
|
200
|
+
if (sx !== undefined) repairs.push(`${nodeId}: sx is not an object; dropped`);
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
const out = {};
|
|
204
|
+
let kept = 0;
|
|
205
|
+
for (const [key, value] of Object.entries(sx)){
|
|
206
|
+
if (!AI_SX_ALLOWED_KEYS.has(key)) {
|
|
207
|
+
repairs.push(`${nodeId}: sx.${key} is not an allowed style; dropped`);
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
if (kept >= MAX_SX_KEYS) {
|
|
211
|
+
repairs.push(`${nodeId}: sx.${key} is past the ${MAX_SX_KEYS}-key ceiling; dropped`);
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (isRecord(value)) {
|
|
215
|
+
const responsive = {};
|
|
216
|
+
for (const [breakpoint, inner] of Object.entries(value)){
|
|
217
|
+
if (!breakpoints.has(breakpoint)) {
|
|
218
|
+
repairs.push(`${nodeId}: sx.${key}.${breakpoint} is not a breakpoint; dropped`);
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if (!sxValueAllowed(key, inner)) {
|
|
222
|
+
repairs.push(`${nodeId}: sx.${key}.${breakpoint} is not an allowed value; dropped`);
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
responsive[breakpoint] = typeof inner === 'string' ? inner.trim() : inner;
|
|
226
|
+
}
|
|
227
|
+
if (Object.keys(responsive).length) {
|
|
228
|
+
out[key] = responsive;
|
|
229
|
+
kept += 1;
|
|
230
|
+
}
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
if (!sxValueAllowed(key, value)) {
|
|
234
|
+
repairs.push(`${nodeId}: sx.${key} is not an allowed value; dropped`);
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
out[key] = typeof value === 'string' ? value.trim() : value;
|
|
238
|
+
kept += 1;
|
|
239
|
+
}
|
|
240
|
+
return kept ? out : undefined;
|
|
241
|
+
}
|
|
242
|
+
function coerceEnum(schema, value) {
|
|
243
|
+
if (typeof value !== 'string' || !schema.enum) return undefined;
|
|
244
|
+
const wanted = value.trim().toLowerCase();
|
|
245
|
+
return schema.enum.find((option)=>option.toLowerCase() === wanted);
|
|
246
|
+
}
|
|
247
|
+
function coerceBoolean(value) {
|
|
248
|
+
if (typeof value === 'boolean') return value;
|
|
249
|
+
if (value === 'true') return true;
|
|
250
|
+
if (value === 'false') return false;
|
|
251
|
+
return undefined;
|
|
252
|
+
}
|
|
253
|
+
function coerceNumber(schema, value) {
|
|
254
|
+
const parsed = typeof value === 'number' ? value : typeof value === 'string' && value.trim() !== '' ? Number(value) : NaN;
|
|
255
|
+
if (!Number.isFinite(parsed)) return undefined;
|
|
256
|
+
if (schema.type === 'integer' && !Number.isInteger(parsed)) return undefined;
|
|
257
|
+
if (schema.minimum !== undefined && parsed < schema.minimum) return undefined;
|
|
258
|
+
if (schema.maximum !== undefined && parsed > schema.maximum) return undefined;
|
|
259
|
+
return parsed;
|
|
260
|
+
}
|
|
261
|
+
function textLimitFor(entry, name, props) {
|
|
262
|
+
const declared = entry.textLimits[name];
|
|
263
|
+
// A heading's copy is held to the headline ceiling, decided by the variant
|
|
264
|
+
// the same node carries; anything else keeps the ceiling the palette
|
|
265
|
+
// assigned to the prop.
|
|
266
|
+
if (name === 'children' && isHeadlineVariant(props.variant)) {
|
|
267
|
+
return Math.min(declared != null ? declared : AI_TEXT_LIMITS.body, AI_TEXT_LIMITS.headline);
|
|
268
|
+
}
|
|
269
|
+
return declared != null ? declared : AI_TEXT_LIMITS.body;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* One string prop against its role. Returns the value to store, or
|
|
273
|
+
* `undefined` with the reason pushed to `repairs`. A binding token the
|
|
274
|
+
* caller admitted passes a `url` or `media` role whole.
|
|
275
|
+
*/ function sanitizeString(nodeId, entry, name, schema, raw, props, screenIds, assetIds, repairs, bindingTokens = null) {
|
|
276
|
+
let value = raw.trim();
|
|
277
|
+
if (HOSTILE_TEXT.test(value)) {
|
|
278
|
+
repairs.push(`${nodeId}.${name} carried markup or script; dropped`);
|
|
279
|
+
return undefined;
|
|
280
|
+
}
|
|
281
|
+
// An icon is drawn from the path its picker stores beside the id, which a
|
|
282
|
+
// model can never supply, so an icon a model names draws nothing where the
|
|
283
|
+
// page is published (AGL-3054). The site owner picks it.
|
|
284
|
+
if (entry.propFields[name] === ICON_PICKER_FIELD) {
|
|
285
|
+
repairs.push(`${nodeId}.${name} is an icon, which the site owner picks from the library; dropped`);
|
|
286
|
+
return undefined;
|
|
287
|
+
}
|
|
288
|
+
const role = entry.propRoles[name];
|
|
289
|
+
switch(role){
|
|
290
|
+
case 'text':
|
|
291
|
+
{
|
|
292
|
+
const limit = textLimitFor(entry, name, props);
|
|
293
|
+
if (value.length > limit) {
|
|
294
|
+
value = value.slice(0, limit).trimEnd();
|
|
295
|
+
repairs.push(`${nodeId}.${name} was over ${limit} characters; truncated`);
|
|
296
|
+
}
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
case 'url':
|
|
300
|
+
{
|
|
301
|
+
if (bindingTokens == null ? void 0 : bindingTokens.has(value)) break;
|
|
302
|
+
if (!isHttpsUrl(value) && !isRootRelativePath(value)) {
|
|
303
|
+
repairs.push(`${nodeId}.${name} is neither an https: URL nor a path on this site; dropped`);
|
|
304
|
+
return undefined;
|
|
305
|
+
}
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
case 'screen':
|
|
309
|
+
{
|
|
310
|
+
if (screenIds ? !screenIds.has(value) : !SCREEN_ID.test(value)) {
|
|
311
|
+
repairs.push(`${nodeId}.${name} names a screen this site does not have; dropped`);
|
|
312
|
+
return undefined;
|
|
313
|
+
}
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
case 'media':
|
|
317
|
+
{
|
|
318
|
+
if (bindingTokens == null ? void 0 : bindingTokens.has(value)) break;
|
|
319
|
+
if (isHttpsUrl(value)) break;
|
|
320
|
+
const ref = parseMediaRef(value);
|
|
321
|
+
if (!ref || assetIds && !assetIds.has(ref.mediaId)) {
|
|
322
|
+
repairs.push(`${nodeId}.${name} is neither a media reference this site holds nor an https: URL; dropped`);
|
|
323
|
+
return undefined;
|
|
324
|
+
}
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
default:
|
|
328
|
+
{
|
|
329
|
+
if (value.length > PLAIN_STRING_MAX) {
|
|
330
|
+
repairs.push(`${nodeId}.${name} is over ${PLAIN_STRING_MAX} characters; dropped`);
|
|
331
|
+
return undefined;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
if (schema.pattern && !new RegExp(schema.pattern).test(value)) {
|
|
336
|
+
repairs.push(`${nodeId}.${name} does not match its pattern; dropped`);
|
|
337
|
+
return undefined;
|
|
338
|
+
}
|
|
339
|
+
if (schema.minLength !== undefined && value.length < schema.minLength) {
|
|
340
|
+
repairs.push(`${nodeId}.${name} is shorter than ${schema.minLength} characters; dropped`);
|
|
341
|
+
return undefined;
|
|
342
|
+
}
|
|
343
|
+
if (schema.maxLength !== undefined && value.length > schema.maxLength) {
|
|
344
|
+
value = value.slice(0, schema.maxLength).trimEnd();
|
|
345
|
+
repairs.push(`${nodeId}.${name} was over ${schema.maxLength} characters; truncated`);
|
|
346
|
+
}
|
|
347
|
+
return value;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* The element's own declarations plus the node capabilities every element
|
|
351
|
+
* carries (AGL-3156) — repeating, today. Two shapes only, so they are built
|
|
352
|
+
* once each rather than per node: a capability prop is the same on every
|
|
353
|
+
* element with the same child contract.
|
|
354
|
+
*
|
|
355
|
+
* The element wins a name collision. A component that declared a prop of its
|
|
356
|
+
* own under a capability's name would be describing its own attribute, and the
|
|
357
|
+
* validator has to hold it to that.
|
|
358
|
+
*/ const CAPABLE_ENTRIES = new WeakMap();
|
|
359
|
+
function withNodeCapabilities(entry) {
|
|
360
|
+
const cached = CAPABLE_ENTRIES.get(entry);
|
|
361
|
+
if (cached) return cached;
|
|
362
|
+
const capability = nodeCapabilityProps(AI_NODE_CAPABILITIES, entry.acceptsChildren);
|
|
363
|
+
const merged = _extends({}, entry, {
|
|
364
|
+
propsSchema: _extends({}, entry.propsSchema, {
|
|
365
|
+
properties: _extends({}, capability.properties, entry.propsSchema.properties)
|
|
366
|
+
}),
|
|
367
|
+
propRoles: _extends({}, capability.propRoles, entry.propRoles),
|
|
368
|
+
textLimits: _extends({}, capability.textLimits, entry.textLimits)
|
|
369
|
+
});
|
|
370
|
+
CAPABLE_ENTRIES.set(entry, merged);
|
|
371
|
+
return merged;
|
|
372
|
+
}
|
|
373
|
+
function sanitizeProps(nodeId, paletteEntry, raw, screenIds, assetIds, repairs, bindingTokens = null) {
|
|
374
|
+
const entry = withNodeCapabilities(paletteEntry);
|
|
375
|
+
const source = isRecord(raw) ? raw : {};
|
|
376
|
+
const props = {};
|
|
377
|
+
const declared = entry.propsSchema.properties;
|
|
378
|
+
for (const [name, value] of Object.entries(source)){
|
|
379
|
+
// `sx` is read off the node instead; a model that put it here meant the
|
|
380
|
+
// same thing, and the caller has already moved it.
|
|
381
|
+
if (name === 'sx' || value === undefined || value === null) continue;
|
|
382
|
+
const schema = declared[name];
|
|
383
|
+
if (!schema) {
|
|
384
|
+
repairs.push(`${nodeId}.${name} is not a prop of ${entry.displayName}; dropped`);
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
if (schema.enum) {
|
|
388
|
+
const coerced = coerceEnum(schema, value);
|
|
389
|
+
if (coerced === undefined) {
|
|
390
|
+
repairs.push(`${nodeId}.${name} is not one of ${schema.enum.join('|')}; dropped`);
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
if (coerced !== value) {
|
|
394
|
+
repairs.push(`${nodeId}.${name} was spelled "${String(value)}"; normalized to "${coerced}"`);
|
|
395
|
+
}
|
|
396
|
+
props[name] = coerced;
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
switch(schema.type){
|
|
400
|
+
case 'boolean':
|
|
401
|
+
{
|
|
402
|
+
const coerced = coerceBoolean(value);
|
|
403
|
+
if (coerced === undefined) {
|
|
404
|
+
repairs.push(`${nodeId}.${name} is not a boolean; dropped`);
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
props[name] = coerced;
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
case 'number':
|
|
411
|
+
case 'integer':
|
|
412
|
+
{
|
|
413
|
+
const coerced = coerceNumber(schema, value);
|
|
414
|
+
if (coerced === undefined) {
|
|
415
|
+
repairs.push(`${nodeId}.${name} is not a number in range; dropped`);
|
|
416
|
+
continue;
|
|
417
|
+
}
|
|
418
|
+
props[name] = coerced;
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
default:
|
|
422
|
+
{
|
|
423
|
+
const text = typeof value === 'string' ? value : typeof value === 'number' || typeof value === 'boolean' ? String(value) : undefined;
|
|
424
|
+
if (text === undefined) {
|
|
425
|
+
repairs.push(`${nodeId}.${name} is not text; dropped`);
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
const cleaned = sanitizeString(nodeId, entry, name, schema, text, source, screenIds, assetIds, repairs, bindingTokens);
|
|
429
|
+
if (cleaned === undefined) continue;
|
|
430
|
+
props[name] = cleaned;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
for (const name of entry.propsSchema.required){
|
|
435
|
+
if (props[name] === undefined) return {
|
|
436
|
+
missing: name
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
return {
|
|
440
|
+
props
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
/** Surfaces that compose page elements, and so may place a component instance. */ const INSTANCE_SURFACES = new Set([
|
|
444
|
+
'screen',
|
|
445
|
+
'layout',
|
|
446
|
+
'component'
|
|
447
|
+
]);
|
|
448
|
+
const FORM_COMPONENT_ID = 'form';
|
|
449
|
+
/** The instance prop naming the component it places; stored on every instance node. */ export const AI_INSTANCE_REF_PROP = 'refId';
|
|
450
|
+
/**
|
|
451
|
+
* One value an instance fills in for a declared prop, held to what the
|
|
452
|
+
* declaration's type can hold: a picture from the library, a link, a number,
|
|
453
|
+
* a switch, or copy.
|
|
454
|
+
*/ function instancePropValue(nodeId, name, type, raw, assetIds, repairs) {
|
|
455
|
+
if (type === 'number') {
|
|
456
|
+
const parsed = typeof raw === 'number' ? raw : Number(raw);
|
|
457
|
+
if (raw === '' || !Number.isFinite(parsed)) {
|
|
458
|
+
repairs.push(`${nodeId}.propValues.${name} is not a number; dropped`);
|
|
459
|
+
return undefined;
|
|
460
|
+
}
|
|
461
|
+
return parsed;
|
|
462
|
+
}
|
|
463
|
+
if (type === 'boolean') {
|
|
464
|
+
const coerced = coerceBoolean(raw);
|
|
465
|
+
if (coerced === undefined) {
|
|
466
|
+
repairs.push(`${nodeId}.propValues.${name} is not a boolean; dropped`);
|
|
467
|
+
}
|
|
468
|
+
return coerced;
|
|
469
|
+
}
|
|
470
|
+
if (type === 'icon') {
|
|
471
|
+
// A page cannot fill an icon: the pick is an id and the path drawn from
|
|
472
|
+
// it, and a word in its place draws nothing (AGL-3054). The property is
|
|
473
|
+
// left for the site owner to pick.
|
|
474
|
+
repairs.push(`${nodeId}.propValues.${name} is an icon, which the site owner picks from the library; dropped`);
|
|
475
|
+
return undefined;
|
|
476
|
+
}
|
|
477
|
+
if (typeof raw !== 'string' && typeof raw !== 'number' && typeof raw !== 'boolean') {
|
|
478
|
+
repairs.push(`${nodeId}.propValues.${name} is not a value; dropped`);
|
|
479
|
+
return undefined;
|
|
480
|
+
}
|
|
481
|
+
const value = String(raw).trim();
|
|
482
|
+
if (HOSTILE_TEXT.test(value)) {
|
|
483
|
+
repairs.push(`${nodeId}.propValues.${name} carried markup or script; dropped`);
|
|
484
|
+
return undefined;
|
|
485
|
+
}
|
|
486
|
+
if (type === 'image') {
|
|
487
|
+
if (isHttpsUrl(value)) return value;
|
|
488
|
+
const ref = parseMediaRef(value);
|
|
489
|
+
if (!ref || assetIds && !assetIds.has(ref.mediaId)) {
|
|
490
|
+
repairs.push(`${nodeId}.propValues.${name} is neither a media reference this site holds nor an https: URL; dropped`);
|
|
491
|
+
return undefined;
|
|
492
|
+
}
|
|
493
|
+
return value;
|
|
494
|
+
}
|
|
495
|
+
if (type === 'href') {
|
|
496
|
+
if (isHttpsUrl(value) || isRootRelativePath(value)) return value;
|
|
497
|
+
repairs.push(`${nodeId}.propValues.${name} is neither an https: URL nor a path on this site; dropped`);
|
|
498
|
+
return undefined;
|
|
499
|
+
}
|
|
500
|
+
if (value.length > AI_TEXT_LIMITS.body) {
|
|
501
|
+
repairs.push(`${nodeId}.propValues.${name} was over ${AI_TEXT_LIMITS.body} characters; truncated`);
|
|
502
|
+
return value.slice(0, AI_TEXT_LIMITS.body).trimEnd();
|
|
503
|
+
}
|
|
504
|
+
return value;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* The site-record props of one node — an instance's `refId` and
|
|
508
|
+
* `propValues`, a Form's `formId` and `datasetId` — checked against the ids
|
|
509
|
+
* the caller supplied. They leave `props` before the palette pass, which
|
|
510
|
+
* would drop them as undeclared, and come back in `kept` once checked.
|
|
511
|
+
*/ function sanitizeReferenceProps(nodeId, componentId, props, refs, repairs) {
|
|
512
|
+
const rest = _extends({}, props);
|
|
513
|
+
const kept = {};
|
|
514
|
+
if (componentId === REUSABLE_INSTANCE_COMPONENT_ID) {
|
|
515
|
+
var _refs_componentIds;
|
|
516
|
+
const refId = typeof rest[AI_INSTANCE_REF_PROP] === 'string' ? String(rest[AI_INSTANCE_REF_PROP]).trim() : '';
|
|
517
|
+
delete rest[AI_INSTANCE_REF_PROP];
|
|
518
|
+
if (!refId || !((_refs_componentIds = refs.componentIds) == null ? void 0 : _refs_componentIds.has(refId))) {
|
|
519
|
+
return {
|
|
520
|
+
refusal: `Reusable Component (${nodeId}) names a component this site does not have`
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
kept[AI_INSTANCE_REF_PROP] = refId;
|
|
524
|
+
const rawValues = rest[REUSABLE_INSTANCE_PROP_VALUES_KEY];
|
|
525
|
+
delete rest[REUSABLE_INSTANCE_PROP_VALUES_KEY];
|
|
526
|
+
if (rawValues !== undefined && !isRecord(rawValues)) {
|
|
527
|
+
repairs.push(`${nodeId}.propValues is not an object; dropped`);
|
|
528
|
+
}
|
|
529
|
+
const declared = refs.componentProps[refId];
|
|
530
|
+
const values = {};
|
|
531
|
+
for (const [name, raw] of Object.entries(isRecord(rawValues) ? rawValues : {})){
|
|
532
|
+
var _ref;
|
|
533
|
+
if (raw === undefined || raw === null) continue;
|
|
534
|
+
if (!COMPONENT_PROP_NAME_PATTERN.test(name)) {
|
|
535
|
+
repairs.push(`${nodeId}.propValues.${name} is not a prop name; dropped`);
|
|
536
|
+
continue;
|
|
537
|
+
}
|
|
538
|
+
if (declared && !(name in declared)) {
|
|
539
|
+
repairs.push(`${nodeId}.propValues.${name} is not a prop of that component; dropped`);
|
|
540
|
+
continue;
|
|
541
|
+
}
|
|
542
|
+
if (refs.definesComponent && isAiComponentPropToken(raw)) {
|
|
543
|
+
// A property of the component being defined, handed on whole; the
|
|
544
|
+
// component step's check holds it to the kind this prop declares.
|
|
545
|
+
values[name] = raw.trim();
|
|
546
|
+
continue;
|
|
547
|
+
}
|
|
548
|
+
const value = instancePropValue(nodeId, name, (_ref = declared == null ? void 0 : declared[name]) != null ? _ref : 'text', raw, refs.assetIds, repairs);
|
|
549
|
+
if (value !== undefined) values[name] = value;
|
|
550
|
+
}
|
|
551
|
+
if (Object.keys(values).length) kept[REUSABLE_INSTANCE_PROP_VALUES_KEY] = values;
|
|
552
|
+
return {
|
|
553
|
+
props: rest,
|
|
554
|
+
kept
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
if (componentId === FORM_COMPONENT_ID) {
|
|
558
|
+
const bindings = [
|
|
559
|
+
[
|
|
560
|
+
'formId',
|
|
561
|
+
refs.formIds,
|
|
562
|
+
'form'
|
|
563
|
+
],
|
|
564
|
+
[
|
|
565
|
+
'datasetId',
|
|
566
|
+
refs.datasetIds,
|
|
567
|
+
'dataset'
|
|
568
|
+
]
|
|
569
|
+
];
|
|
570
|
+
for (const [prop, ids, record] of bindings){
|
|
571
|
+
const raw = rest[prop];
|
|
572
|
+
delete rest[prop];
|
|
573
|
+
if (raw === undefined || raw === null || raw === '') continue;
|
|
574
|
+
const id = typeof raw === 'string' ? raw.trim() : '';
|
|
575
|
+
if (id && (ids == null ? void 0 : ids.has(id))) {
|
|
576
|
+
kept[prop] = id;
|
|
577
|
+
} else {
|
|
578
|
+
repairs.push(`${nodeId}.${prop} names a ${record} this site does not have; dropped`);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
return {
|
|
583
|
+
props: rest,
|
|
584
|
+
kept
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
function refusalCode(error) {
|
|
588
|
+
if (/too large/i.test(error)) return 'too-large';
|
|
589
|
+
if (/cannot be published/i.test(error)) return 'component';
|
|
590
|
+
return 'structure';
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Whether the root the model wrote is the surface's root: the canvas wrapper
|
|
594
|
+
* for a document surface (which the sanitizer exempts by the same shape), or
|
|
595
|
+
* the named component otherwise.
|
|
596
|
+
*/ function rootMatches(surfaceRoot, componentId) {
|
|
597
|
+
if (surfaceRoot === 'div') {
|
|
598
|
+
return componentId == null || componentId === '' || componentId === 'div';
|
|
599
|
+
}
|
|
600
|
+
return componentId === surfaceRoot;
|
|
601
|
+
}
|
|
602
|
+
export function validateAiNodeTree(input, surface, context) {
|
|
603
|
+
try {
|
|
604
|
+
return validate(input, surface, context);
|
|
605
|
+
} catch (error) {
|
|
606
|
+
return {
|
|
607
|
+
ok: false,
|
|
608
|
+
code: 'invalid-input',
|
|
609
|
+
error: `The tree could not be read: ${error instanceof Error ? error.message : String(error)}`
|
|
610
|
+
};
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* One element's prop and style patch, held to the rules `validateAiNodeTree`
|
|
615
|
+
* holds an element it places — for an edit to an element already on the
|
|
616
|
+
* canvas, where there is no tree to validate.
|
|
617
|
+
*
|
|
618
|
+
* The same passes run: unknown props dropped, enums coerced, every string
|
|
619
|
+
* held to its role and screened for markup, `sx` held to the key set and the
|
|
620
|
+
* value grammar. The one difference is `required`: a patch is merged over the
|
|
621
|
+
* props the element already has, so a required prop the patch does not name
|
|
622
|
+
* is not missing.
|
|
623
|
+
*/ export function validateAiNodePatch(componentId, patch, context) {
|
|
624
|
+
const entry = AI_PALETTE[componentId];
|
|
625
|
+
if (!entry) {
|
|
626
|
+
return {
|
|
627
|
+
ok: false,
|
|
628
|
+
code: 'component',
|
|
629
|
+
error: `Component "${componentId}" is not in the palette`
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
const repairs = [];
|
|
633
|
+
const props = sanitizeProps(componentId, _extends({}, entry, {
|
|
634
|
+
propsSchema: _extends({}, entry.propsSchema, {
|
|
635
|
+
required: []
|
|
636
|
+
})
|
|
637
|
+
}), patch.props, (context == null ? void 0 : context.screenIds) ? new Set(context.screenIds) : null, (context == null ? void 0 : context.assetIds) ? new Set(context.assetIds) : null, repairs);
|
|
638
|
+
const sx = patch.sx === undefined ? undefined : sanitizeSx(componentId, patch.sx, repairs);
|
|
639
|
+
return {
|
|
640
|
+
ok: true,
|
|
641
|
+
props: 'props' in props ? props.props : {},
|
|
642
|
+
sx,
|
|
643
|
+
repairs
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
function validate(input, surface, context) {
|
|
647
|
+
var _ref;
|
|
648
|
+
const definition = AI_SURFACES[surface];
|
|
649
|
+
if (!definition) {
|
|
650
|
+
return {
|
|
651
|
+
ok: false,
|
|
652
|
+
code: 'invalid-input',
|
|
653
|
+
error: `Unknown surface "${surface}"`
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
if (!isRecord(input) || typeof input.rootId !== 'string' || !isRecord(input.nodes)) {
|
|
657
|
+
return {
|
|
658
|
+
ok: false,
|
|
659
|
+
code: 'invalid-input',
|
|
660
|
+
error: 'Expected an object with a string rootId and a nodes map'
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
const rootId = input.rootId;
|
|
664
|
+
const nodes = input.nodes;
|
|
665
|
+
const root = nodes[rootId];
|
|
666
|
+
if (!isRecord(root)) {
|
|
667
|
+
return {
|
|
668
|
+
ok: false,
|
|
669
|
+
code: 'structure',
|
|
670
|
+
error: 'Definition has no root node'
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
if (!rootMatches(definition.root, root.componentId)) {
|
|
674
|
+
return {
|
|
675
|
+
ok: false,
|
|
676
|
+
code: 'root',
|
|
677
|
+
error: `A ${surface} starts with ${definition.root === 'div' ? 'the document wrapper' : `"${definition.root}"`}, not "${String(root.componentId)}"`
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
// The sanitizer keeps only the persisted node keys, and `sx` is not one of
|
|
681
|
+
// them for a listing. Read it off every node first — from the node field
|
|
682
|
+
// or from `props.sx`, which a model writes just as readily — and put it
|
|
683
|
+
// back, checked, on the nodes that survive.
|
|
684
|
+
const sxByNodeId = new Map();
|
|
685
|
+
const hiddenByNodeId = new Set();
|
|
686
|
+
for (const [id, node] of Object.entries(nodes)){
|
|
687
|
+
if (!isRecord(node)) continue;
|
|
688
|
+
const sx = node.sx !== undefined ? node.sx : isRecord(node.props) ? node.props.sx : undefined;
|
|
689
|
+
if (sx !== undefined) sxByNodeId.set(id, sx);
|
|
690
|
+
if (node.hidden === true) hiddenByNodeId.add(id);
|
|
691
|
+
}
|
|
692
|
+
// A DAM reference (a `media:` value) is not a URL the sanitizer's
|
|
693
|
+
// `src` policy admits — a listing must not carry another tenant's asset —
|
|
694
|
+
// but on the tenant's own page it is exactly what an image should name.
|
|
695
|
+
// Lift those values out before sanitizing and hand them back to the prop
|
|
696
|
+
// pass, which holds them to the asset set the caller supplied.
|
|
697
|
+
// A binding token the caller admitted (AGL-2909) is lifted the same way:
|
|
698
|
+
// `{{entry.coverImage}}` is no address the sanitizer knows, and the prop
|
|
699
|
+
// pass holds it to the tokens the caller named.
|
|
700
|
+
const bindingTokens = (context == null ? void 0 : context.bindingTokens) ? new Set(context.bindingTokens) : null;
|
|
701
|
+
// A reusable component's own property tokens (AGL-2908) are lifted too, and
|
|
702
|
+
// kept as written rather than handed back to the prop pass: `{{prop.variant}}`
|
|
703
|
+
// is no value a dropdown, a switch, an address or a visibility directive
|
|
704
|
+
// admits. Copy keeps its tokens without lifting, as the text they are.
|
|
705
|
+
const definesComponent = (context == null ? void 0 : context.definesComponent) === true;
|
|
706
|
+
const mediaByNodeId = new Map();
|
|
707
|
+
const boundByNodeId = new Map();
|
|
708
|
+
const forSanitizer = {};
|
|
709
|
+
for (const [id, node] of Object.entries(nodes)){
|
|
710
|
+
var _ref1;
|
|
711
|
+
if (!isRecord(node) || !isRecord(node.props)) {
|
|
712
|
+
forSanitizer[id] = node;
|
|
713
|
+
continue;
|
|
714
|
+
}
|
|
715
|
+
const entry = AI_PALETTE[String(node.componentId)];
|
|
716
|
+
const roles = (_ref1 = entry == null ? void 0 : entry.propRoles) != null ? _ref1 : {};
|
|
717
|
+
const props = _extends({}, node.props);
|
|
718
|
+
const lifted = {};
|
|
719
|
+
const bound = {};
|
|
720
|
+
for (const [key, value] of Object.entries(props)){
|
|
721
|
+
if (typeof value !== 'string') continue;
|
|
722
|
+
const role = roles[key];
|
|
723
|
+
if (definesComponent && isAiComponentPropToken(value) && (AI_COMPONENT_VISIBILITY_PROPS.includes(key) || (entry == null ? void 0 : entry.propsSchema.properties[key]) !== undefined && role !== 'text')) {
|
|
724
|
+
bound[key] = value.trim();
|
|
725
|
+
delete props[key];
|
|
726
|
+
continue;
|
|
727
|
+
}
|
|
728
|
+
if (role === 'media' && parseMediaRef(value.trim()) || (role === 'media' || role === 'url') && (bindingTokens == null ? void 0 : bindingTokens.has(value.trim()))) {
|
|
729
|
+
lifted[key] = value;
|
|
730
|
+
delete props[key];
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
if (Object.keys(lifted).length) mediaByNodeId.set(id, lifted);
|
|
734
|
+
if (Object.keys(bound).length) boundByNodeId.set(id, bound);
|
|
735
|
+
forSanitizer[id] = _extends({}, node, {
|
|
736
|
+
props
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
const refs = {
|
|
740
|
+
componentIds: (context == null ? void 0 : context.componentIds) ? new Set(context.componentIds) : null,
|
|
741
|
+
componentProps: (_ref = context == null ? void 0 : context.componentProps) != null ? _ref : {},
|
|
742
|
+
formIds: (context == null ? void 0 : context.formIds) ? new Set(context.formIds) : null,
|
|
743
|
+
datasetIds: (context == null ? void 0 : context.datasetIds) ? new Set(context.datasetIds) : null,
|
|
744
|
+
assetIds: (context == null ? void 0 : context.assetIds) ? new Set(context.assetIds) : null,
|
|
745
|
+
definesComponent
|
|
746
|
+
};
|
|
747
|
+
// An instance is admitted only where the caller grounded it in the site's
|
|
748
|
+
// components; the reference itself is checked on the node below.
|
|
749
|
+
const allow = refs.componentIds && INSTANCE_SURFACES.has(surface) ? [
|
|
750
|
+
...definition.allow,
|
|
751
|
+
REUSABLE_INSTANCE_COMPONENT_ID
|
|
752
|
+
] : definition.allow;
|
|
753
|
+
const sanitized = sanitizeMarketplaceDefinition({
|
|
754
|
+
rootId,
|
|
755
|
+
nodes: forSanitizer
|
|
756
|
+
}, {
|
|
757
|
+
componentIds: allow
|
|
758
|
+
});
|
|
759
|
+
if (sanitized.ok === false) {
|
|
760
|
+
return {
|
|
761
|
+
ok: false,
|
|
762
|
+
code: refusalCode(sanitized.error),
|
|
763
|
+
error: sanitized.error
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
const screenIds = (context == null ? void 0 : context.screenIds) ? new Set(context.screenIds) : null;
|
|
767
|
+
const assetIds = refs.assetIds;
|
|
768
|
+
const repairs = [];
|
|
769
|
+
const output = {};
|
|
770
|
+
const rootIsWrapper = rootMatches('div', root.componentId) && definition.root === 'div';
|
|
771
|
+
const minted = new Map();
|
|
772
|
+
const mint = (id)=>{
|
|
773
|
+
const fresh = id === rootId && rootIsWrapper ? CANVAS_ROOT_ELEMENT_ID : createIdUrlSafe();
|
|
774
|
+
minted.set(id, fresh);
|
|
775
|
+
return fresh;
|
|
776
|
+
};
|
|
777
|
+
/** Each visited node's parent by the model's own ids, for the parentId check. */ const parentOf = new Map();
|
|
778
|
+
const queue = [
|
|
779
|
+
{
|
|
780
|
+
id: rootId,
|
|
781
|
+
parentId: null
|
|
782
|
+
}
|
|
783
|
+
];
|
|
784
|
+
mint(rootId);
|
|
785
|
+
while(queue.length){
|
|
786
|
+
var _node_nodes;
|
|
787
|
+
const { id, parentId } = queue.shift();
|
|
788
|
+
const node = sanitized.nodes[id];
|
|
789
|
+
const entry = AI_PALETTE[node.componentId];
|
|
790
|
+
if (!entry) {
|
|
791
|
+
return {
|
|
792
|
+
ok: false,
|
|
793
|
+
code: 'component',
|
|
794
|
+
error: `Component "${node.componentId}" is not in the palette`
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
const newId = minted.get(id);
|
|
798
|
+
const raw = nodes[id];
|
|
799
|
+
if (isRecord(raw)) {
|
|
800
|
+
// The sanitizer drops silently; the model is told what went.
|
|
801
|
+
for (const key of STRIPPED_NODE_KEYS){
|
|
802
|
+
if (raw[key] !== undefined) {
|
|
803
|
+
repairs.push(`${id}.${key} is not something a generated node may set; dropped`);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
if (raw.hidden !== undefined && typeof raw.hidden !== 'boolean') {
|
|
807
|
+
repairs.push(`${id}.hidden is not a boolean; dropped`);
|
|
808
|
+
}
|
|
809
|
+
if (raw.nodes !== undefined && !Array.isArray(raw.nodes)) {
|
|
810
|
+
repairs.push(`${id}.nodes is not a list of child ids; its children were dropped`);
|
|
811
|
+
}
|
|
812
|
+
if (raw.parentId !== undefined && raw.parentId !== null && raw.parentId !== (parentId === null ? null : parentOf.get(id))) {
|
|
813
|
+
repairs.push(`${id}.parentId disagreed with where the tree places it; recomputed`);
|
|
814
|
+
}
|
|
815
|
+
if (isRecord(raw.props)) {
|
|
816
|
+
var _mediaByNodeId_get, _boundByNodeId_get;
|
|
817
|
+
const lifted = (_mediaByNodeId_get = mediaByNodeId.get(id)) != null ? _mediaByNodeId_get : {};
|
|
818
|
+
const kept = (_boundByNodeId_get = boundByNodeId.get(id)) != null ? _boundByNodeId_get : {};
|
|
819
|
+
for (const key of Object.keys(raw.props)){
|
|
820
|
+
var _node_props;
|
|
821
|
+
if (key !== 'sx' && lifted[key] === undefined && kept[key] === undefined && ((_node_props = node.props) == null ? void 0 : _node_props[key]) === undefined && raw.props[key] !== undefined) {
|
|
822
|
+
repairs.push(`${id}.${key} was an unsafe handler, address or markup; dropped`);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
const children = [];
|
|
828
|
+
for (const childId of (_node_nodes = node.nodes) != null ? _node_nodes : []){
|
|
829
|
+
if (minted.has(childId)) {
|
|
830
|
+
repairs.push(`${childId} was listed under more than one parent; the later listing was dropped`);
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
const child = sanitized.nodes[childId];
|
|
834
|
+
if (!child) continue;
|
|
835
|
+
const childEntry = AI_PALETTE[child.componentId];
|
|
836
|
+
if (!childEntry) {
|
|
837
|
+
return {
|
|
838
|
+
ok: false,
|
|
839
|
+
code: 'component',
|
|
840
|
+
error: `Component "${child.componentId}" is not in the palette`
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
if (!entry.acceptsChildren) {
|
|
844
|
+
return {
|
|
845
|
+
ok: false,
|
|
846
|
+
code: 'lineage',
|
|
847
|
+
error: `${entry.displayName} (${id}) cannot hold other elements, but lists ${childId}`
|
|
848
|
+
};
|
|
849
|
+
}
|
|
850
|
+
if (!linealRelationshipPermits({
|
|
851
|
+
componentId: child.componentId,
|
|
852
|
+
pluginId: childEntry.pluginId,
|
|
853
|
+
restrictParent: childEntry.restrictParent
|
|
854
|
+
}, {
|
|
855
|
+
componentId: node.componentId,
|
|
856
|
+
pluginId: entry.pluginId,
|
|
857
|
+
restrictChildren: entry.restrictChildren
|
|
858
|
+
})) {
|
|
859
|
+
return {
|
|
860
|
+
ok: false,
|
|
861
|
+
code: 'lineage',
|
|
862
|
+
error: `${childEntry.displayName} (${childId}) cannot be placed inside ${entry.displayName} (${id})`
|
|
863
|
+
};
|
|
864
|
+
}
|
|
865
|
+
children.push(mint(childId));
|
|
866
|
+
parentOf.set(childId, id);
|
|
867
|
+
queue.push({
|
|
868
|
+
id: childId,
|
|
869
|
+
parentId: newId
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
const reference = sanitizeReferenceProps(id, node.componentId, _extends({}, node.props, mediaByNodeId.get(id)), refs, repairs);
|
|
873
|
+
if ('refusal' in reference) {
|
|
874
|
+
return {
|
|
875
|
+
ok: false,
|
|
876
|
+
code: 'reference',
|
|
877
|
+
error: reference.refusal
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
// A required prop the component binds is present: its value is the token.
|
|
881
|
+
const boundProps = boundByNodeId.get(id);
|
|
882
|
+
const propsResult = sanitizeProps(id, boundProps ? _extends({}, entry, {
|
|
883
|
+
propsSchema: _extends({}, entry.propsSchema, {
|
|
884
|
+
required: entry.propsSchema.required.filter((name)=>boundProps[name] === undefined)
|
|
885
|
+
})
|
|
886
|
+
}) : entry, reference.props, screenIds, assetIds, repairs, bindingTokens);
|
|
887
|
+
if ('missing' in propsResult) {
|
|
888
|
+
return {
|
|
889
|
+
ok: false,
|
|
890
|
+
code: 'required-prop',
|
|
891
|
+
error: `${entry.displayName} (${id}) is missing its required "${propsResult.missing}" prop`
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
const sx = sanitizeSx(id, sxByNodeId.get(id), repairs);
|
|
895
|
+
output[newId] = _extends({
|
|
896
|
+
$id: newId,
|
|
897
|
+
type: NodeType.NODE,
|
|
898
|
+
componentId: node.componentId,
|
|
899
|
+
pluginId: entry.pluginId,
|
|
900
|
+
parentId,
|
|
901
|
+
nodes: children,
|
|
902
|
+
props: _extends({}, propsResult.props, reference.kept, boundProps)
|
|
903
|
+
}, sx ? {
|
|
904
|
+
sx
|
|
905
|
+
} : {}, hiddenByNodeId.has(id) ? {
|
|
906
|
+
hidden: true
|
|
907
|
+
} : {});
|
|
908
|
+
}
|
|
909
|
+
// The save's own measurement (msgpack), not a JSON string length: the
|
|
910
|
+
// ceiling is stated in those bytes, and a UTF-16 length reads multi-byte
|
|
911
|
+
// copy as smaller than the document the save will refuse.
|
|
912
|
+
const bytes = nodeMapBytes(output);
|
|
913
|
+
if (bytes > NODE_MAP_MAX_BYTES) {
|
|
914
|
+
return {
|
|
915
|
+
ok: false,
|
|
916
|
+
code: 'too-large',
|
|
917
|
+
error: `The tree is ${bytes} bytes; the stored ceiling is ${NODE_MAP_MAX_BYTES}`
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
const sourceIds = {};
|
|
921
|
+
for (const [source, fresh] of minted)sourceIds[fresh] = source;
|
|
922
|
+
return {
|
|
923
|
+
ok: true,
|
|
924
|
+
rootId: minted.get(rootId),
|
|
925
|
+
nodes: output,
|
|
926
|
+
repairs,
|
|
927
|
+
sourceIds
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
//# sourceMappingURL=ai-node-tree.js.map
|