@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,562 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { COMPONENT_OVERRIDES_FIELD, SYSTEM_FONT_VALUE, THEME_EDITOR_CONTROLS, THEME_EDITOR_MEDIA_QUERIES, themeEditorControl } from "@aglyn/shared-ui-theme/util/theme-editor-fields";
|
|
17
|
+
import { AI_SX_ALLOWED_KEYS, HOSTILE_TEXT, SX_VALUE } from "../runtime/ai-node-tree.js";
|
|
18
|
+
/**
|
|
19
|
+
* The theme tool (AGL-2938): the one structured-output tool a theme job asks
|
|
20
|
+
* the model to call, DERIVED from the theme editor's field catalog.
|
|
21
|
+
*
|
|
22
|
+
* Every property of the schema carries editor controls, and every editor
|
|
23
|
+
* control is carried by a property — `ai-theme-tool.spec.ts` holds both
|
|
24
|
+
* directions — so the model is offered exactly what a person editing the
|
|
25
|
+
* theme is offered: the same color tokens, the same fonts, the same bounds
|
|
26
|
+
* and the same component whitelist. A control added to the editor fails that
|
|
27
|
+
* spec until it is offered here too.
|
|
28
|
+
*
|
|
29
|
+
* The schema is strict, which on the providers that enforce it means every
|
|
30
|
+
* object forbids extra keys, every key is required, and "no change" is said
|
|
31
|
+
* with `null`. Numeric bounds are not keywords a strict schema accepts, so
|
|
32
|
+
* they are stated in the descriptions and enforced by
|
|
33
|
+
* {@link parseAiThemeToolInput}, from the same catalog entries.
|
|
34
|
+
*/ export const AI_THEME_TOOL_NAME = 'propose_theme_changes';
|
|
35
|
+
/** The value that returns a color or a number to its default. */ export const AI_THEME_TOOL_DEFAULT = 'default';
|
|
36
|
+
/** The catalog's color controls, which the `colors` property carries. */ export const AI_THEME_COLOR_CONTROLS = THEME_EDITOR_CONTROLS.filter((control)=>control.kind === 'color');
|
|
37
|
+
/** How many component override leaves one call may carry. */ export const AI_THEME_TOOL_MAX_COMPONENT_LEAVES = 40;
|
|
38
|
+
/** The longest summary a proposal keeps. */ export const AI_THEME_SUMMARY_MAX_CHARS = 300;
|
|
39
|
+
/**
|
|
40
|
+
* Which schema property carries which editor controls. `colors` carries
|
|
41
|
+
* every color control in both schemes; the rest carry one control each, and
|
|
42
|
+
* the two component properties both carry the JSON overrides control.
|
|
43
|
+
*/ export const AI_THEME_TOOL_PROPERTIES = [
|
|
44
|
+
{
|
|
45
|
+
property: 'colors',
|
|
46
|
+
controls: AI_THEME_COLOR_CONTROLS.map((control)=>control.id)
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
property: 'darkScheme',
|
|
50
|
+
controls: [
|
|
51
|
+
'darkScheme'
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
property: 'fontFamily',
|
|
56
|
+
controls: [
|
|
57
|
+
'fontFamily'
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
property: 'borderRadius',
|
|
62
|
+
controls: [
|
|
63
|
+
'borderRadius'
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
property: 'spacing',
|
|
68
|
+
controls: [
|
|
69
|
+
'spacing'
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
property: 'navHeightMobile',
|
|
74
|
+
controls: [
|
|
75
|
+
'navHeight.xs'
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
property: 'navHeightDesktop',
|
|
80
|
+
controls: [
|
|
81
|
+
'navHeight.sm'
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
property: 'componentOverrides',
|
|
86
|
+
controls: [
|
|
87
|
+
'components'
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
property: 'resetComponentOverrides',
|
|
92
|
+
controls: [
|
|
93
|
+
'components'
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
];
|
|
97
|
+
/** Properties that carry no editor control: what the call says about itself. */ export const AI_THEME_TOOL_META_PROPERTIES = [
|
|
98
|
+
'summary'
|
|
99
|
+
];
|
|
100
|
+
/**
|
|
101
|
+
* Parity between the editor's catalog and the tool, in both directions: the
|
|
102
|
+
* controls the tool does not offer, and the control ids it offers that the
|
|
103
|
+
* catalog does not have. Both are empty, or the tool and the editor offer
|
|
104
|
+
* different things.
|
|
105
|
+
*/ export function aiThemeToolParity(controls = THEME_EDITOR_CONTROLS) {
|
|
106
|
+
const offered = new Set(AI_THEME_TOOL_PROPERTIES.flatMap((entry)=>entry.controls));
|
|
107
|
+
const catalog = new Set(controls.map((control)=>control.id));
|
|
108
|
+
return {
|
|
109
|
+
unoffered: [
|
|
110
|
+
...catalog
|
|
111
|
+
].filter((id)=>!offered.has(id)),
|
|
112
|
+
unknown: [
|
|
113
|
+
...offered
|
|
114
|
+
].filter((id)=>!catalog.has(id))
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The style properties a component override may set: the node validator's
|
|
119
|
+
* allowlist less the `sx` shorthands (`p`, `bgcolor`, `typography`…), which a
|
|
120
|
+
* style override does not expand.
|
|
121
|
+
*/ const SX_SHORTHANDS = new Set([
|
|
122
|
+
'm',
|
|
123
|
+
'mt',
|
|
124
|
+
'mr',
|
|
125
|
+
'mb',
|
|
126
|
+
'ml',
|
|
127
|
+
'mx',
|
|
128
|
+
'my',
|
|
129
|
+
'p',
|
|
130
|
+
'pt',
|
|
131
|
+
'pr',
|
|
132
|
+
'pb',
|
|
133
|
+
'pl',
|
|
134
|
+
'px',
|
|
135
|
+
'py',
|
|
136
|
+
'bgcolor',
|
|
137
|
+
'typography'
|
|
138
|
+
]);
|
|
139
|
+
export const AI_THEME_STYLE_PROPERTIES = [
|
|
140
|
+
...AI_SX_ALLOWED_KEYS
|
|
141
|
+
].filter((key)=>!SX_SHORTHANDS.has(key));
|
|
142
|
+
/**
|
|
143
|
+
* The component props a theme may set a default for: the ones that choose
|
|
144
|
+
* among a component's own looks. Nothing that changes what an element IS — an
|
|
145
|
+
* `href`, a `component`, a handler — is a theme's to default.
|
|
146
|
+
*/ export const AI_THEME_DEFAULT_PROPS = [
|
|
147
|
+
'align',
|
|
148
|
+
'centered',
|
|
149
|
+
'color',
|
|
150
|
+
'disableElevation',
|
|
151
|
+
'disableRipple',
|
|
152
|
+
'elevation',
|
|
153
|
+
'fullWidth',
|
|
154
|
+
'gutterBottom',
|
|
155
|
+
'indicatorColor',
|
|
156
|
+
'margin',
|
|
157
|
+
'noWrap',
|
|
158
|
+
'size',
|
|
159
|
+
'square',
|
|
160
|
+
'textColor',
|
|
161
|
+
'underline',
|
|
162
|
+
'variant'
|
|
163
|
+
];
|
|
164
|
+
/** A literal color written as a hex or a color function. */ const LITERAL_COLOR = /#[0-9a-f]{3,8}\b|\b(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\s*\(/i;
|
|
165
|
+
/** The CSS named colors, which are literal colors as surely as a hex is. */ const NAMED_COLORS = new Set(('aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue ' + 'blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk ' + 'crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki ' + 'darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen ' + 'darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue ' + 'dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite ' + 'gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki ' + 'lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan ' + 'lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen ' + 'lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen ' + 'magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen ' + 'mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream ' + 'mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid ' + 'palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum ' + 'powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown ' + 'seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen ' + 'steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen').split(' '));
|
|
166
|
+
/** Whether a CSS value carries a literal color, which belongs to the palette. */ export function carriesLiteralColor(value) {
|
|
167
|
+
var _value_toLowerCase_match;
|
|
168
|
+
if (LITERAL_COLOR.test(value)) return true;
|
|
169
|
+
return ((_value_toLowerCase_match = value.toLowerCase().match(/[a-z]+/g)) != null ? _value_toLowerCase_match : []).some((word)=>NAMED_COLORS.has(word));
|
|
170
|
+
}
|
|
171
|
+
const HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
172
|
+
const IDENTIFIER = /^[A-Za-z][A-Za-z0-9]{0,63}$/;
|
|
173
|
+
const PROP_TOKEN = /^[A-Za-z][A-Za-z0-9-]{0,39}$/;
|
|
174
|
+
const nullable = (schema)=>({
|
|
175
|
+
anyOf: [
|
|
176
|
+
schema,
|
|
177
|
+
{
|
|
178
|
+
type: 'null'
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
});
|
|
182
|
+
const rangeText = (control)=>`from ${control.min} to ${control.max}`;
|
|
183
|
+
function numberProperty(id, what) {
|
|
184
|
+
const control = themeEditorControl(id);
|
|
185
|
+
return {
|
|
186
|
+
anyOf: [
|
|
187
|
+
{
|
|
188
|
+
type: 'integer'
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
type: 'string',
|
|
192
|
+
enum: [
|
|
193
|
+
AI_THEME_TOOL_DEFAULT
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
type: 'null'
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
description: `${what}, in px, a whole number ${rangeText(control)}. ` + `"${AI_THEME_TOOL_DEFAULT}" returns it to the theme default; null leaves it as it is.`
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function colorValue(scheme) {
|
|
204
|
+
return {
|
|
205
|
+
anyOf: [
|
|
206
|
+
{
|
|
207
|
+
type: 'string'
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
type: 'null'
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
description: `The ${scheme} scheme's value: a hex color #rrggbb, "${AI_THEME_TOOL_DEFAULT}" to return ` + `it to the theme default, or null to leave the ${scheme} value as it is.`
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The tool, built from the catalog. Deterministic for a given catalog, so its
|
|
218
|
+
* bytes are the same on every request and it sits inside the cached prefix.
|
|
219
|
+
*/ export function aiThemeTool() {
|
|
220
|
+
const darkScheme = themeEditorControl('darkScheme');
|
|
221
|
+
const fontFamily = themeEditorControl('fontFamily');
|
|
222
|
+
const properties = {
|
|
223
|
+
summary: {
|
|
224
|
+
type: 'string',
|
|
225
|
+
description: 'One sentence, in the language of the brief, naming what this proposal changes.'
|
|
226
|
+
},
|
|
227
|
+
colors: {
|
|
228
|
+
type: 'array',
|
|
229
|
+
description: 'Color changes, one entry per token. Give the light and the dark value together: a ' + 'color changed for one scheme and left unsaid for the other is half a change.',
|
|
230
|
+
items: {
|
|
231
|
+
type: 'object',
|
|
232
|
+
properties: {
|
|
233
|
+
token: {
|
|
234
|
+
type: 'string',
|
|
235
|
+
enum: AI_THEME_COLOR_CONTROLS.map((control)=>control.token),
|
|
236
|
+
description: 'A palette color (primary, secondary, tertiary, surface, error, warning, info, ' + 'success), a background (background.default is the page, background.paper cards ' + 'and menus), a text color, a pale accent tint, or the divider.'
|
|
237
|
+
},
|
|
238
|
+
light: colorValue('light'),
|
|
239
|
+
dark: colorValue('dark')
|
|
240
|
+
},
|
|
241
|
+
required: [
|
|
242
|
+
'token',
|
|
243
|
+
'light',
|
|
244
|
+
'dark'
|
|
245
|
+
],
|
|
246
|
+
additionalProperties: false
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
darkScheme: nullable({
|
|
250
|
+
type: 'string',
|
|
251
|
+
enum: darkScheme.options,
|
|
252
|
+
description: '"auto" lets visitors in dark mode see the dark scheme; "off" keeps every visitor on ' + 'light. null leaves it as it is.'
|
|
253
|
+
}),
|
|
254
|
+
fontFamily: nullable({
|
|
255
|
+
type: 'string',
|
|
256
|
+
enum: fontFamily.options,
|
|
257
|
+
description: `The site's font, from the curated list; "${SYSTEM_FONT_VALUE}" is the theme default. ` + 'null leaves it as it is.'
|
|
258
|
+
}),
|
|
259
|
+
borderRadius: numberProperty('borderRadius', 'The corner radius'),
|
|
260
|
+
spacing: numberProperty('spacing', 'The spacing unit every gap and padding is a multiple of'),
|
|
261
|
+
navHeightMobile: numberProperty('navHeight.xs', 'The navigation bar height on phones'),
|
|
262
|
+
navHeightDesktop: numberProperty('navHeight.sm', 'The navigation bar height from the tablet breakpoint up'),
|
|
263
|
+
componentOverrides: {
|
|
264
|
+
type: 'array',
|
|
265
|
+
description: 'Component styles beyond the palette and typography, one leaf each. A style names a ' + 'slot and a camelCase CSS property; a default names a prop. A style never carries a ' + 'literal color: color belongs to the palette.',
|
|
266
|
+
items: {
|
|
267
|
+
type: 'object',
|
|
268
|
+
properties: {
|
|
269
|
+
component: {
|
|
270
|
+
type: 'string',
|
|
271
|
+
enum: [
|
|
272
|
+
...COMPONENT_OVERRIDES_FIELD.components
|
|
273
|
+
]
|
|
274
|
+
},
|
|
275
|
+
target: {
|
|
276
|
+
type: 'string',
|
|
277
|
+
enum: [
|
|
278
|
+
'styleOverrides',
|
|
279
|
+
'defaultProps'
|
|
280
|
+
]
|
|
281
|
+
},
|
|
282
|
+
slot: nullable({
|
|
283
|
+
type: 'string',
|
|
284
|
+
description: 'The style slot (root, contained, h1); null for a default prop.'
|
|
285
|
+
}),
|
|
286
|
+
property: {
|
|
287
|
+
type: 'string',
|
|
288
|
+
description: 'A camelCase CSS property for a style, or the prop for a default.'
|
|
289
|
+
},
|
|
290
|
+
media: nullable({
|
|
291
|
+
type: 'string',
|
|
292
|
+
enum: Object.keys(THEME_EDITOR_MEDIA_QUERIES),
|
|
293
|
+
description: 'Scopes a style to phones or to wider screens; null for every width.'
|
|
294
|
+
}),
|
|
295
|
+
value: {
|
|
296
|
+
anyOf: [
|
|
297
|
+
{
|
|
298
|
+
type: 'string'
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
type: 'number'
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
type: 'boolean'
|
|
305
|
+
}
|
|
306
|
+
]
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
required: [
|
|
310
|
+
'component',
|
|
311
|
+
'target',
|
|
312
|
+
'slot',
|
|
313
|
+
'property',
|
|
314
|
+
'media',
|
|
315
|
+
'value'
|
|
316
|
+
],
|
|
317
|
+
additionalProperties: false
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
resetComponentOverrides: {
|
|
321
|
+
type: 'boolean',
|
|
322
|
+
description: "true drops the site's own component overrides before any above apply, so the theme's " + 'defaults show again.'
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
return {
|
|
326
|
+
name: AI_THEME_TOOL_NAME,
|
|
327
|
+
description: "Propose changes to the site's theme. Name only the controls the brief is about; every " + 'control left out keeps its current value. Call this once.',
|
|
328
|
+
strict: true,
|
|
329
|
+
inputSchema: {
|
|
330
|
+
type: 'object',
|
|
331
|
+
properties,
|
|
332
|
+
required: Object.keys(properties),
|
|
333
|
+
additionalProperties: false
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
const isRecord = (value)=>typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
338
|
+
const quoted = (value)=>`"${String(value).slice(0, 40)}"`;
|
|
339
|
+
/** `#abc` or `#aabbcc` as the editor's picker writes it: six lowercase digits. */ export function normalizeThemeHex(value) {
|
|
340
|
+
const trimmed = value.trim();
|
|
341
|
+
if (!HEX.test(trimmed)) return null;
|
|
342
|
+
const digits = trimmed.slice(1).toLowerCase();
|
|
343
|
+
return `#${digits.length === 3 ? digits.replace(/./g, (digit)=>digit + digit) : digits}`;
|
|
344
|
+
}
|
|
345
|
+
function parseColorValue(raw, where, dropped) {
|
|
346
|
+
if (raw === null || raw === undefined) return undefined;
|
|
347
|
+
if (raw === AI_THEME_TOOL_DEFAULT) return null;
|
|
348
|
+
const hex = typeof raw === 'string' ? normalizeThemeHex(raw) : null;
|
|
349
|
+
if (hex) return hex;
|
|
350
|
+
dropped.push(`${where}: ${quoted(raw)} is not a hex color`);
|
|
351
|
+
return undefined;
|
|
352
|
+
}
|
|
353
|
+
function parseNumber(raw, id, dropped, notes) {
|
|
354
|
+
if (raw === null || raw === undefined) return undefined;
|
|
355
|
+
if (raw === AI_THEME_TOOL_DEFAULT) return null;
|
|
356
|
+
const control = themeEditorControl(id);
|
|
357
|
+
if (typeof raw !== 'number' || !Number.isFinite(raw)) {
|
|
358
|
+
dropped.push(`${control.label}: ${quoted(raw)} is not a number`);
|
|
359
|
+
return undefined;
|
|
360
|
+
}
|
|
361
|
+
const bounded = Math.min(control.max, Math.max(control.min, Math.round(raw)));
|
|
362
|
+
if (bounded !== raw) {
|
|
363
|
+
notes.push(`${control.label}: ${raw} is outside ${rangeText(control)}, so ${bounded} is proposed.`);
|
|
364
|
+
}
|
|
365
|
+
return bounded;
|
|
366
|
+
}
|
|
367
|
+
function parseComponentLeaf(raw, index, dropped) {
|
|
368
|
+
var _raw_component, _raw_property;
|
|
369
|
+
const where = `componentOverrides[${index}]`;
|
|
370
|
+
if (!isRecord(raw)) {
|
|
371
|
+
dropped.push(`${where}: not an object`);
|
|
372
|
+
return null;
|
|
373
|
+
}
|
|
374
|
+
const component = String((_raw_component = raw['component']) != null ? _raw_component : '');
|
|
375
|
+
if (!COMPONENT_OVERRIDES_FIELD.components.includes(component)) {
|
|
376
|
+
dropped.push(`${where}: ${component || 'the component'} is not one a theme may override`);
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
379
|
+
const target = raw['target'] === 'defaultProps' || raw['target'] === 'styleOverrides' ? raw['target'] : null;
|
|
380
|
+
if (!target) {
|
|
381
|
+
dropped.push(`${where}: target must be styleOverrides or defaultProps`);
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
384
|
+
const property = String((_raw_property = raw['property']) != null ? _raw_property : '');
|
|
385
|
+
const value = raw['value'];
|
|
386
|
+
const named = `${component}.${property || '?'}`;
|
|
387
|
+
if (target === 'defaultProps') {
|
|
388
|
+
if (!AI_THEME_DEFAULT_PROPS.includes(property)) {
|
|
389
|
+
dropped.push(`${named}: not a prop a theme may set a default for`);
|
|
390
|
+
return null;
|
|
391
|
+
}
|
|
392
|
+
const valid = typeof value === 'boolean' || typeof value === 'number' && Number.isFinite(value) || typeof value === 'string' && PROP_TOKEN.test(value);
|
|
393
|
+
if (!valid) {
|
|
394
|
+
dropped.push(`${named}: ${quoted(value)} is not a value a prop default may take`);
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
return {
|
|
398
|
+
component: component,
|
|
399
|
+
target,
|
|
400
|
+
slot: null,
|
|
401
|
+
property,
|
|
402
|
+
media: null,
|
|
403
|
+
value: value
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
if (!AI_THEME_STYLE_PROPERTIES.includes(property)) {
|
|
407
|
+
dropped.push(`${named}: not a style a theme may set`);
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
const slot = raw['slot'] === null || raw['slot'] === undefined ? 'root' : String(raw['slot']);
|
|
411
|
+
if (!IDENTIFIER.test(slot)) {
|
|
412
|
+
dropped.push(`${named}: ${quoted(slot)} is not a style slot`);
|
|
413
|
+
return null;
|
|
414
|
+
}
|
|
415
|
+
const media = raw['media'] === null || raw['media'] === undefined ? null : String(raw['media']) in THEME_EDITOR_MEDIA_QUERIES ? raw['media'] : undefined;
|
|
416
|
+
if (media === undefined) {
|
|
417
|
+
dropped.push(`${named}: media must be mobile, desktop or null`);
|
|
418
|
+
return null;
|
|
419
|
+
}
|
|
420
|
+
if (typeof value === 'number') {
|
|
421
|
+
if (!Number.isFinite(value)) {
|
|
422
|
+
dropped.push(`${named}: not a finite number`);
|
|
423
|
+
return null;
|
|
424
|
+
}
|
|
425
|
+
return {
|
|
426
|
+
component: component,
|
|
427
|
+
target,
|
|
428
|
+
slot,
|
|
429
|
+
property,
|
|
430
|
+
media,
|
|
431
|
+
value
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
if (typeof value !== 'string') {
|
|
435
|
+
dropped.push(`${named}: a style takes a string or a number`);
|
|
436
|
+
return null;
|
|
437
|
+
}
|
|
438
|
+
const trimmed = value.trim();
|
|
439
|
+
if (!trimmed || HOSTILE_TEXT.test(trimmed) || !SX_VALUE.test(trimmed)) {
|
|
440
|
+
dropped.push(`${named}: ${quoted(trimmed)} is not a value a style may take`);
|
|
441
|
+
return null;
|
|
442
|
+
}
|
|
443
|
+
if (carriesLiteralColor(trimmed)) {
|
|
444
|
+
dropped.push(`${named}: a color belongs to the palette, not to a component style`);
|
|
445
|
+
return null;
|
|
446
|
+
}
|
|
447
|
+
return {
|
|
448
|
+
component: component,
|
|
449
|
+
target,
|
|
450
|
+
slot,
|
|
451
|
+
property,
|
|
452
|
+
media,
|
|
453
|
+
value: trimmed
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* A tool call's input, held to the editor's constraints: tokens and fonts
|
|
458
|
+
* from the catalog, hex colors as the picker writes them, numbers inside the
|
|
459
|
+
* editor's bounds, and component leaves on the whitelist with safe values
|
|
460
|
+
* and no literal color. What does not hold is dropped and named rather than
|
|
461
|
+
* guessed at; a number out of bounds is brought inside them and named.
|
|
462
|
+
*/ export function parseAiThemeToolInput(input) {
|
|
463
|
+
var _input_summary;
|
|
464
|
+
var _themeEditorControl_options;
|
|
465
|
+
const dropped = [];
|
|
466
|
+
const notes = [];
|
|
467
|
+
const changes = [];
|
|
468
|
+
const summary = String((_input_summary = input['summary']) != null ? _input_summary : '').trim().slice(0, AI_THEME_SUMMARY_MAX_CHARS);
|
|
469
|
+
const colorControls = new Set(AI_THEME_COLOR_CONTROLS.map((control)=>control.id));
|
|
470
|
+
const rawColors = Array.isArray(input['colors']) ? input['colors'] : [];
|
|
471
|
+
const seen = new Set();
|
|
472
|
+
for (const [index, entry] of rawColors.slice(0, AI_THEME_COLOR_CONTROLS.length * 2).entries()){
|
|
473
|
+
var _entry_token;
|
|
474
|
+
if (!isRecord(entry)) {
|
|
475
|
+
dropped.push(`colors[${index}]: not an object`);
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
const control = `color.${String((_entry_token = entry['token']) != null ? _entry_token : '')}`;
|
|
479
|
+
if (!colorControls.has(control)) {
|
|
480
|
+
dropped.push(`colors[${index}]: ${quoted(entry['token'])} is not a theme color`);
|
|
481
|
+
continue;
|
|
482
|
+
}
|
|
483
|
+
if (seen.has(control)) {
|
|
484
|
+
dropped.push(`${control}: named twice; the first value is kept`);
|
|
485
|
+
continue;
|
|
486
|
+
}
|
|
487
|
+
seen.add(control);
|
|
488
|
+
for (const scheme of [
|
|
489
|
+
'light',
|
|
490
|
+
'dark'
|
|
491
|
+
]){
|
|
492
|
+
const value = parseColorValue(entry[scheme], `${control} (${scheme})`, dropped);
|
|
493
|
+
if (value === undefined) continue;
|
|
494
|
+
changes.push({
|
|
495
|
+
control: control,
|
|
496
|
+
scheme,
|
|
497
|
+
value
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
const darkScheme = input['darkScheme'];
|
|
502
|
+
if (darkScheme === 'auto' || darkScheme === 'off') {
|
|
503
|
+
changes.push({
|
|
504
|
+
control: 'darkScheme',
|
|
505
|
+
scheme: null,
|
|
506
|
+
value: darkScheme === 'off' ? 'off' : null
|
|
507
|
+
});
|
|
508
|
+
} else if (darkScheme !== null && darkScheme !== undefined) {
|
|
509
|
+
dropped.push(`darkScheme: ${quoted(darkScheme)} is not auto or off`);
|
|
510
|
+
}
|
|
511
|
+
const fontFamily = input['fontFamily'];
|
|
512
|
+
if (typeof fontFamily === 'string' && ((_themeEditorControl_options = themeEditorControl('fontFamily').options) == null ? void 0 : _themeEditorControl_options.includes(fontFamily))) {
|
|
513
|
+
changes.push({
|
|
514
|
+
control: 'fontFamily',
|
|
515
|
+
scheme: null,
|
|
516
|
+
value: fontFamily === SYSTEM_FONT_VALUE ? null : fontFamily
|
|
517
|
+
});
|
|
518
|
+
} else if (fontFamily !== null && fontFamily !== undefined) {
|
|
519
|
+
dropped.push(`fontFamily: ${quoted(fontFamily)} is not in the font list`);
|
|
520
|
+
}
|
|
521
|
+
const numbers = [
|
|
522
|
+
[
|
|
523
|
+
'borderRadius',
|
|
524
|
+
'borderRadius'
|
|
525
|
+
],
|
|
526
|
+
[
|
|
527
|
+
'spacing',
|
|
528
|
+
'spacing'
|
|
529
|
+
],
|
|
530
|
+
[
|
|
531
|
+
'navHeightMobile',
|
|
532
|
+
'navHeight.xs'
|
|
533
|
+
],
|
|
534
|
+
[
|
|
535
|
+
'navHeightDesktop',
|
|
536
|
+
'navHeight.sm'
|
|
537
|
+
]
|
|
538
|
+
];
|
|
539
|
+
for (const [property, control] of numbers){
|
|
540
|
+
const value = parseNumber(input[property], control, dropped, notes);
|
|
541
|
+
if (value !== undefined) changes.push({
|
|
542
|
+
control,
|
|
543
|
+
scheme: null,
|
|
544
|
+
value
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
const rawLeaves = Array.isArray(input['componentOverrides']) ? input['componentOverrides'] : [];
|
|
548
|
+
if (rawLeaves.length > AI_THEME_TOOL_MAX_COMPONENT_LEAVES) {
|
|
549
|
+
dropped.push(`componentOverrides: ${rawLeaves.length - AI_THEME_TOOL_MAX_COMPONENT_LEAVES} past the ` + `${AI_THEME_TOOL_MAX_COMPONENT_LEAVES}-leaf limit`);
|
|
550
|
+
}
|
|
551
|
+
const components = rawLeaves.slice(0, AI_THEME_TOOL_MAX_COMPONENT_LEAVES).map((leaf, index)=>parseComponentLeaf(leaf, index, dropped)).filter((leaf)=>leaf !== null);
|
|
552
|
+
return {
|
|
553
|
+
summary,
|
|
554
|
+
changes,
|
|
555
|
+
components,
|
|
556
|
+
resetComponents: input['resetComponentOverrides'] === true,
|
|
557
|
+
dropped,
|
|
558
|
+
notes
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
//# sourceMappingURL=ai-theme-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/tools/ai-theme-tool.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { HostThemeScheme } from '@aglyn/shared-data-types'\nimport {\n COMPONENT_OVERRIDES_FIELD,\n SYSTEM_FONT_VALUE,\n THEME_EDITOR_CONTROLS,\n THEME_EDITOR_MEDIA_QUERIES,\n themeEditorControl,\n type ThemeColorToken,\n type ThemeComponentOverrideLeaf,\n type ThemeEditorControl,\n type ThemeEditorControlId,\n type ThemeEditorMedia,\n} from '@aglyn/shared-ui-theme/util/theme-editor-fields'\nimport type { AiThemeControlChange, AiThemeValueControl } from '../model/ai-theme-proposal'\nimport type { AiTool } from '../providers/contract'\nimport { AI_SX_ALLOWED_KEYS, HOSTILE_TEXT, SX_VALUE } from '../runtime/ai-node-tree'\n\n/**\n * The theme tool (AGL-2938): the one structured-output tool a theme job asks\n * the model to call, DERIVED from the theme editor's field catalog.\n *\n * Every property of the schema carries editor controls, and every editor\n * control is carried by a property — `ai-theme-tool.spec.ts` holds both\n * directions — so the model is offered exactly what a person editing the\n * theme is offered: the same color tokens, the same fonts, the same bounds\n * and the same component whitelist. A control added to the editor fails that\n * spec until it is offered here too.\n *\n * The schema is strict, which on the providers that enforce it means every\n * object forbids extra keys, every key is required, and \"no change\" is said\n * with `null`. Numeric bounds are not keywords a strict schema accepts, so\n * they are stated in the descriptions and enforced by\n * {@link parseAiThemeToolInput}, from the same catalog entries.\n */\n\nexport const AI_THEME_TOOL_NAME = 'propose_theme_changes'\n\n/** The value that returns a color or a number to its default. */\nexport const AI_THEME_TOOL_DEFAULT = 'default'\n\n/** The catalog's color controls, which the `colors` property carries. */\nexport const AI_THEME_COLOR_CONTROLS: readonly ThemeEditorControl[] = THEME_EDITOR_CONTROLS.filter(\n (control) => control.kind === 'color',\n)\n\n/** How many component override leaves one call may carry. */\nexport const AI_THEME_TOOL_MAX_COMPONENT_LEAVES = 40\n\n/** The longest summary a proposal keeps. */\nexport const AI_THEME_SUMMARY_MAX_CHARS = 300\n\n/**\n * Which schema property carries which editor controls. `colors` carries\n * every color control in both schemes; the rest carry one control each, and\n * the two component properties both carry the JSON overrides control.\n */\nexport const AI_THEME_TOOL_PROPERTIES: ReadonlyArray<{\n property: string\n controls: readonly ThemeEditorControlId[]\n}> = [\n { property: 'colors', controls: AI_THEME_COLOR_CONTROLS.map((control) => control.id) },\n { property: 'darkScheme', controls: ['darkScheme'] },\n { property: 'fontFamily', controls: ['fontFamily'] },\n { property: 'borderRadius', controls: ['borderRadius'] },\n { property: 'spacing', controls: ['spacing'] },\n { property: 'navHeightMobile', controls: ['navHeight.xs'] },\n { property: 'navHeightDesktop', controls: ['navHeight.sm'] },\n { property: 'componentOverrides', controls: ['components'] },\n { property: 'resetComponentOverrides', controls: ['components'] },\n]\n\n/** Properties that carry no editor control: what the call says about itself. */\nexport const AI_THEME_TOOL_META_PROPERTIES = ['summary'] as const\n\n/**\n * Parity between the editor's catalog and the tool, in both directions: the\n * controls the tool does not offer, and the control ids it offers that the\n * catalog does not have. Both are empty, or the tool and the editor offer\n * different things.\n */\nexport function aiThemeToolParity(\n controls: ReadonlyArray<Pick<ThemeEditorControl, 'id'>> = THEME_EDITOR_CONTROLS,\n): { unoffered: string[]; unknown: string[] } {\n const offered = new Set<string>(AI_THEME_TOOL_PROPERTIES.flatMap((entry) => entry.controls))\n const catalog = new Set<string>(controls.map((control) => control.id))\n return {\n unoffered: [...catalog].filter((id) => !offered.has(id)),\n unknown: [...offered].filter((id) => !catalog.has(id)),\n }\n}\n\n/**\n * The style properties a component override may set: the node validator's\n * allowlist less the `sx` shorthands (`p`, `bgcolor`, `typography`…), which a\n * style override does not expand.\n */\nconst SX_SHORTHANDS = new Set([\n 'm', 'mt', 'mr', 'mb', 'ml', 'mx', 'my',\n 'p', 'pt', 'pr', 'pb', 'pl', 'px', 'py',\n 'bgcolor', 'typography',\n])\nexport const AI_THEME_STYLE_PROPERTIES: readonly string[] = [...AI_SX_ALLOWED_KEYS].filter(\n (key) => !SX_SHORTHANDS.has(key),\n)\n\n/**\n * The component props a theme may set a default for: the ones that choose\n * among a component's own looks. Nothing that changes what an element IS — an\n * `href`, a `component`, a handler — is a theme's to default.\n */\nexport const AI_THEME_DEFAULT_PROPS: readonly string[] = [\n 'align',\n 'centered',\n 'color',\n 'disableElevation',\n 'disableRipple',\n 'elevation',\n 'fullWidth',\n 'gutterBottom',\n 'indicatorColor',\n 'margin',\n 'noWrap',\n 'size',\n 'square',\n 'textColor',\n 'underline',\n 'variant',\n]\n\n/** A literal color written as a hex or a color function. */\nconst LITERAL_COLOR = /#[0-9a-f]{3,8}\\b|\\b(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\\s*\\(/i\n\n/** The CSS named colors, which are literal colors as surely as a hex is. */\nconst NAMED_COLORS: ReadonlySet<string> = new Set(\n (\n 'aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue ' +\n 'blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk ' +\n 'crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki ' +\n 'darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen ' +\n 'darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue ' +\n 'dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite ' +\n 'gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki ' +\n 'lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan ' +\n 'lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen ' +\n 'lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen ' +\n 'magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen ' +\n 'mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream ' +\n 'mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid ' +\n 'palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum ' +\n 'powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown ' +\n 'seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen ' +\n 'steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen'\n ).split(' '),\n)\n\n/** Whether a CSS value carries a literal color, which belongs to the palette. */\nexport function carriesLiteralColor(value: string): boolean {\n if (LITERAL_COLOR.test(value)) return true\n return (value.toLowerCase().match(/[a-z]+/g) ?? []).some((word) => NAMED_COLORS.has(word))\n}\n\nconst HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i\nconst IDENTIFIER = /^[A-Za-z][A-Za-z0-9]{0,63}$/\nconst PROP_TOKEN = /^[A-Za-z][A-Za-z0-9-]{0,39}$/\n\nconst nullable = (schema: Record<string, unknown>) => ({\n anyOf: [schema, { type: 'null' }],\n})\n\nconst rangeText = (control: ThemeEditorControl) => `from ${control.min} to ${control.max}`\n\nfunction numberProperty(id: ThemeEditorControlId, what: string): Record<string, unknown> {\n const control = themeEditorControl(id)\n return {\n anyOf: [\n { type: 'integer' },\n { type: 'string', enum: [AI_THEME_TOOL_DEFAULT] },\n { type: 'null' },\n ],\n description:\n `${what}, in px, a whole number ${rangeText(control)}. ` +\n `\"${AI_THEME_TOOL_DEFAULT}\" returns it to the theme default; null leaves it as it is.`,\n }\n}\n\nfunction colorValue(scheme: HostThemeScheme): Record<string, unknown> {\n return {\n anyOf: [{ type: 'string' }, { type: 'null' }],\n description:\n `The ${scheme} scheme's value: a hex color #rrggbb, \"${AI_THEME_TOOL_DEFAULT}\" to return ` +\n `it to the theme default, or null to leave the ${scheme} value as it is.`,\n }\n}\n\n/**\n * The tool, built from the catalog. Deterministic for a given catalog, so its\n * bytes are the same on every request and it sits inside the cached prefix.\n */\nexport function aiThemeTool(): AiTool {\n const darkScheme = themeEditorControl('darkScheme')\n const fontFamily = themeEditorControl('fontFamily')\n const properties: Record<string, Record<string, unknown>> = {\n summary: {\n type: 'string',\n description: 'One sentence, in the language of the brief, naming what this proposal changes.',\n },\n colors: {\n type: 'array',\n description:\n 'Color changes, one entry per token. Give the light and the dark value together: a ' +\n 'color changed for one scheme and left unsaid for the other is half a change.',\n items: {\n type: 'object',\n properties: {\n token: {\n type: 'string',\n enum: AI_THEME_COLOR_CONTROLS.map((control) => control.token as ThemeColorToken),\n description:\n 'A palette color (primary, secondary, tertiary, surface, error, warning, info, ' +\n 'success), a background (background.default is the page, background.paper cards ' +\n 'and menus), a text color, a pale accent tint, or the divider.',\n },\n light: colorValue('light'),\n dark: colorValue('dark'),\n },\n required: ['token', 'light', 'dark'],\n additionalProperties: false,\n },\n },\n darkScheme: nullable({\n type: 'string',\n enum: darkScheme.options,\n description:\n '\"auto\" lets visitors in dark mode see the dark scheme; \"off\" keeps every visitor on ' +\n 'light. null leaves it as it is.',\n }),\n fontFamily: nullable({\n type: 'string',\n enum: fontFamily.options,\n description:\n `The site's font, from the curated list; \"${SYSTEM_FONT_VALUE}\" is the theme default. ` +\n 'null leaves it as it is.',\n }),\n borderRadius: numberProperty('borderRadius', 'The corner radius'),\n spacing: numberProperty('spacing', 'The spacing unit every gap and padding is a multiple of'),\n navHeightMobile: numberProperty('navHeight.xs', 'The navigation bar height on phones'),\n navHeightDesktop: numberProperty(\n 'navHeight.sm',\n 'The navigation bar height from the tablet breakpoint up',\n ),\n componentOverrides: {\n type: 'array',\n description:\n 'Component styles beyond the palette and typography, one leaf each. A style names a ' +\n 'slot and a camelCase CSS property; a default names a prop. A style never carries a ' +\n 'literal color: color belongs to the palette.',\n items: {\n type: 'object',\n properties: {\n component: { type: 'string', enum: [...COMPONENT_OVERRIDES_FIELD.components] },\n target: { type: 'string', enum: ['styleOverrides', 'defaultProps'] },\n slot: nullable({\n type: 'string',\n description: 'The style slot (root, contained, h1); null for a default prop.',\n }),\n property: {\n type: 'string',\n description: 'A camelCase CSS property for a style, or the prop for a default.',\n },\n media: nullable({\n type: 'string',\n enum: Object.keys(THEME_EDITOR_MEDIA_QUERIES),\n description: 'Scopes a style to phones or to wider screens; null for every width.',\n }),\n value: { anyOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }] },\n },\n required: ['component', 'target', 'slot', 'property', 'media', 'value'],\n additionalProperties: false,\n },\n },\n resetComponentOverrides: {\n type: 'boolean',\n description:\n \"true drops the site's own component overrides before any above apply, so the theme's \" +\n 'defaults show again.',\n },\n }\n return {\n name: AI_THEME_TOOL_NAME,\n description:\n \"Propose changes to the site's theme. Name only the controls the brief is about; every \" +\n 'control left out keeps its current value. Call this once.',\n strict: true,\n inputSchema: {\n type: 'object',\n properties,\n required: Object.keys(properties),\n additionalProperties: false,\n },\n }\n}\n\n/** What a tool call proposes, held to the editor's constraints. */\nexport interface AiThemeToolParse {\n summary: string\n changes: Array<Omit<AiThemeControlChange, 'before'>>\n components: ThemeComponentOverrideLeaf[]\n resetComponents: boolean\n /** What the call wrote that the editor would not accept, in words. */\n dropped: string[]\n /** What was kept only once it was brought inside the editor's bounds. */\n notes: string[]\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\n\nconst quoted = (value: unknown) => `\"${String(value).slice(0, 40)}\"`\n\n/** `#abc` or `#aabbcc` as the editor's picker writes it: six lowercase digits. */\nexport function normalizeThemeHex(value: string): string | null {\n const trimmed = value.trim()\n if (!HEX.test(trimmed)) return null\n const digits = trimmed.slice(1).toLowerCase()\n return `#${digits.length === 3 ? digits.replace(/./g, (digit) => digit + digit) : digits}`\n}\n\nfunction parseColorValue(raw: unknown, where: string, dropped: string[]): string | null | undefined {\n if (raw === null || raw === undefined) return undefined\n if (raw === AI_THEME_TOOL_DEFAULT) return null\n const hex = typeof raw === 'string' ? normalizeThemeHex(raw) : null\n if (hex) return hex\n dropped.push(`${where}: ${quoted(raw)} is not a hex color`)\n return undefined\n}\n\nfunction parseNumber(\n raw: unknown,\n id: ThemeEditorControlId,\n dropped: string[],\n notes: string[],\n): number | null | undefined {\n if (raw === null || raw === undefined) return undefined\n if (raw === AI_THEME_TOOL_DEFAULT) return null\n const control = themeEditorControl(id)\n if (typeof raw !== 'number' || !Number.isFinite(raw)) {\n dropped.push(`${control.label}: ${quoted(raw)} is not a number`)\n return undefined\n }\n const bounded = Math.min(control.max as number, Math.max(control.min as number, Math.round(raw)))\n if (bounded !== raw) {\n notes.push(`${control.label}: ${raw} is outside ${rangeText(control)}, so ${bounded} is proposed.`)\n }\n return bounded\n}\n\nfunction parseComponentLeaf(\n raw: unknown,\n index: number,\n dropped: string[],\n): ThemeComponentOverrideLeaf | null {\n const where = `componentOverrides[${index}]`\n if (!isRecord(raw)) {\n dropped.push(`${where}: not an object`)\n return null\n }\n const component = String(raw['component'] ?? '')\n if (!(COMPONENT_OVERRIDES_FIELD.components as readonly string[]).includes(component)) {\n dropped.push(`${where}: ${component || 'the component'} is not one a theme may override`)\n return null\n }\n const target =\n raw['target'] === 'defaultProps' || raw['target'] === 'styleOverrides' ? raw['target'] : null\n if (!target) {\n dropped.push(`${where}: target must be styleOverrides or defaultProps`)\n return null\n }\n const property = String(raw['property'] ?? '')\n const value = raw['value']\n const named = `${component}.${property || '?'}`\n if (target === 'defaultProps') {\n if (!AI_THEME_DEFAULT_PROPS.includes(property)) {\n dropped.push(`${named}: not a prop a theme may set a default for`)\n return null\n }\n const valid =\n typeof value === 'boolean' ||\n (typeof value === 'number' && Number.isFinite(value)) ||\n (typeof value === 'string' && PROP_TOKEN.test(value))\n if (!valid) {\n dropped.push(`${named}: ${quoted(value)} is not a value a prop default may take`)\n return null\n }\n return {\n component: component as ThemeComponentOverrideLeaf['component'],\n target,\n slot: null,\n property,\n media: null,\n value: value as string | number | boolean,\n }\n }\n if (!AI_THEME_STYLE_PROPERTIES.includes(property)) {\n dropped.push(`${named}: not a style a theme may set`)\n return null\n }\n const slot = raw['slot'] === null || raw['slot'] === undefined ? 'root' : String(raw['slot'])\n if (!IDENTIFIER.test(slot)) {\n dropped.push(`${named}: ${quoted(slot)} is not a style slot`)\n return null\n }\n const media =\n raw['media'] === null || raw['media'] === undefined\n ? null\n : String(raw['media']) in THEME_EDITOR_MEDIA_QUERIES\n ? (raw['media'] as ThemeEditorMedia)\n : undefined\n if (media === undefined) {\n dropped.push(`${named}: media must be mobile, desktop or null`)\n return null\n }\n if (typeof value === 'number') {\n if (!Number.isFinite(value)) {\n dropped.push(`${named}: not a finite number`)\n return null\n }\n return {\n component: component as ThemeComponentOverrideLeaf['component'],\n target,\n slot,\n property,\n media,\n value,\n }\n }\n if (typeof value !== 'string') {\n dropped.push(`${named}: a style takes a string or a number`)\n return null\n }\n const trimmed = value.trim()\n if (!trimmed || HOSTILE_TEXT.test(trimmed) || !SX_VALUE.test(trimmed)) {\n dropped.push(`${named}: ${quoted(trimmed)} is not a value a style may take`)\n return null\n }\n if (carriesLiteralColor(trimmed)) {\n dropped.push(`${named}: a color belongs to the palette, not to a component style`)\n return null\n }\n return {\n component: component as ThemeComponentOverrideLeaf['component'],\n target,\n slot,\n property,\n media,\n value: trimmed,\n }\n}\n\n/**\n * A tool call's input, held to the editor's constraints: tokens and fonts\n * from the catalog, hex colors as the picker writes them, numbers inside the\n * editor's bounds, and component leaves on the whitelist with safe values\n * and no literal color. What does not hold is dropped and named rather than\n * guessed at; a number out of bounds is brought inside them and named.\n */\nexport function parseAiThemeToolInput(input: Record<string, unknown>): AiThemeToolParse {\n const dropped: string[] = []\n const notes: string[] = []\n const changes: AiThemeToolParse['changes'] = []\n const summary = String(input['summary'] ?? '').trim().slice(0, AI_THEME_SUMMARY_MAX_CHARS)\n\n const colorControls = new Set<string>(AI_THEME_COLOR_CONTROLS.map((control) => control.id))\n const rawColors = Array.isArray(input['colors']) ? input['colors'] : []\n const seen = new Set<string>()\n for (const [index, entry] of rawColors.slice(0, AI_THEME_COLOR_CONTROLS.length * 2).entries()) {\n if (!isRecord(entry)) {\n dropped.push(`colors[${index}]: not an object`)\n continue\n }\n const control = `color.${String(entry['token'] ?? '')}`\n if (!colorControls.has(control)) {\n dropped.push(`colors[${index}]: ${quoted(entry['token'])} is not a theme color`)\n continue\n }\n if (seen.has(control)) {\n dropped.push(`${control}: named twice; the first value is kept`)\n continue\n }\n seen.add(control)\n for (const scheme of ['light', 'dark'] as const) {\n const value = parseColorValue(entry[scheme], `${control} (${scheme})`, dropped)\n if (value === undefined) continue\n changes.push({ control: control as AiThemeValueControl, scheme, value })\n }\n }\n\n const darkScheme = input['darkScheme']\n if (darkScheme === 'auto' || darkScheme === 'off') {\n changes.push({ control: 'darkScheme', scheme: null, value: darkScheme === 'off' ? 'off' : null })\n } else if (darkScheme !== null && darkScheme !== undefined) {\n dropped.push(`darkScheme: ${quoted(darkScheme)} is not auto or off`)\n }\n\n const fontFamily = input['fontFamily']\n if (typeof fontFamily === 'string' && themeEditorControl('fontFamily').options?.includes(fontFamily)) {\n changes.push({\n control: 'fontFamily',\n scheme: null,\n value: fontFamily === SYSTEM_FONT_VALUE ? null : fontFamily,\n })\n } else if (fontFamily !== null && fontFamily !== undefined) {\n dropped.push(`fontFamily: ${quoted(fontFamily)} is not in the font list`)\n }\n\n const numbers: Array<[string, AiThemeValueControl]> = [\n ['borderRadius', 'borderRadius'],\n ['spacing', 'spacing'],\n ['navHeightMobile', 'navHeight.xs'],\n ['navHeightDesktop', 'navHeight.sm'],\n ]\n for (const [property, control] of numbers) {\n const value = parseNumber(input[property], control, dropped, notes)\n if (value !== undefined) changes.push({ control, scheme: null, value })\n }\n\n const rawLeaves = Array.isArray(input['componentOverrides']) ? input['componentOverrides'] : []\n if (rawLeaves.length > AI_THEME_TOOL_MAX_COMPONENT_LEAVES) {\n dropped.push(\n `componentOverrides: ${rawLeaves.length - AI_THEME_TOOL_MAX_COMPONENT_LEAVES} past the ` +\n `${AI_THEME_TOOL_MAX_COMPONENT_LEAVES}-leaf limit`,\n )\n }\n const components = rawLeaves\n .slice(0, AI_THEME_TOOL_MAX_COMPONENT_LEAVES)\n .map((leaf, index) => parseComponentLeaf(leaf, index, dropped))\n .filter((leaf): leaf is ThemeComponentOverrideLeaf => leaf !== null)\n\n return {\n summary,\n changes,\n components,\n resetComponents: input['resetComponentOverrides'] === true,\n dropped,\n notes,\n }\n}\n"],"names":["COMPONENT_OVERRIDES_FIELD","SYSTEM_FONT_VALUE","THEME_EDITOR_CONTROLS","THEME_EDITOR_MEDIA_QUERIES","themeEditorControl","AI_SX_ALLOWED_KEYS","HOSTILE_TEXT","SX_VALUE","AI_THEME_TOOL_NAME","AI_THEME_TOOL_DEFAULT","AI_THEME_COLOR_CONTROLS","filter","control","kind","AI_THEME_TOOL_MAX_COMPONENT_LEAVES","AI_THEME_SUMMARY_MAX_CHARS","AI_THEME_TOOL_PROPERTIES","property","controls","map","id","AI_THEME_TOOL_META_PROPERTIES","aiThemeToolParity","offered","Set","flatMap","entry","catalog","unoffered","has","unknown","SX_SHORTHANDS","AI_THEME_STYLE_PROPERTIES","key","AI_THEME_DEFAULT_PROPS","LITERAL_COLOR","NAMED_COLORS","split","carriesLiteralColor","value","test","toLowerCase","match","some","word","HEX","IDENTIFIER","PROP_TOKEN","nullable","schema","anyOf","type","rangeText","min","max","numberProperty","what","enum","description","colorValue","scheme","aiThemeTool","darkScheme","fontFamily","properties","summary","colors","items","token","light","dark","required","additionalProperties","options","borderRadius","spacing","navHeightMobile","navHeightDesktop","componentOverrides","component","components","target","slot","media","Object","keys","resetComponentOverrides","name","strict","inputSchema","isRecord","Array","isArray","quoted","String","slice","normalizeThemeHex","trimmed","trim","digits","length","replace","digit","parseColorValue","raw","where","dropped","undefined","hex","push","parseNumber","notes","Number","isFinite","label","bounded","Math","round","parseComponentLeaf","index","includes","named","valid","parseAiThemeToolInput","input","changes","colorControls","rawColors","seen","entries","add","numbers","rawLeaves","leaf","resetComponents"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAGD,SACEA,yBAAyB,EACzBC,iBAAiB,EACjBC,qBAAqB,EACrBC,0B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