@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,1099 @@
|
|
|
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
|
+
*/ 'use client';
|
|
17
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
|
+
import { canvas, checkEntitlement, lockdownRefusalText, parseLockdownRefusal } from "@aglyn/aglyn";
|
|
20
|
+
import { editorSessionsRevision, openEditorSession, subscribeEditorSessions } from "@aglyn/aglyn/plugin-manager/editor-sessions";
|
|
21
|
+
import { trackEvent } from "@aglyn/aglyn/app-utils/analytics-events";
|
|
22
|
+
import { mdiChatQuestionOutline, mdiChevronDown, mdiChevronUp, mdiClose, mdiOpenInNew, mdiSend, mdiThumbDownOutline, mdiThumbUpOutline } from "@aglyn/shared-data-mdi";
|
|
23
|
+
import { AppLink, MdiIcon } from "@aglyn/shared-ui-jsx";
|
|
24
|
+
import { useSnackbar } from "@aglyn/shared-ui-snackstack";
|
|
25
|
+
import { Alert, Box, Button, Chip, CircularProgress, Collapse, Drawer, Fab, IconButton, Link, Paper, Stack, TextField, Tooltip, Typography } from "@mui/material";
|
|
26
|
+
import { usePathname } from "next/navigation";
|
|
27
|
+
import { Fragment, useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
28
|
+
import { useUser } from "@aglyn/tenant-feature-instance";
|
|
29
|
+
import { authorizedFetch } from "@aglyn/shared-util-http/authorized-token";
|
|
30
|
+
import { assistEditDocumentOf, isAssistEditProposal } from "../model/assist-edit.js";
|
|
31
|
+
import { applyAssistEdit, describeAssistEditCanvas } from "./assist-edit-canvas.js";
|
|
32
|
+
import { AssistEditCard } from "./assist-edit-card.component.js";
|
|
33
|
+
import { aiInsightSurfaceForPath } from "../model/ai-insight.js";
|
|
34
|
+
import { AssistJobsDrawer } from "./assist-jobs-drawer.component.js";
|
|
35
|
+
import { AiModelSelector } from "./ai-model-selector.component.js";
|
|
36
|
+
import { AiUsageStrip } from "./ai-usage-strip.component.js";
|
|
37
|
+
import { useAiModelChoice } from "./use-ai-model-choice.js";
|
|
38
|
+
import { usePublishAiUsageMeter } from "./use-ai-usage-meter.js";
|
|
39
|
+
import { pluginDocsHelp } from "@aglyn/aglyn/app-utils/docs-help";
|
|
40
|
+
import { HelpTip } from "@aglyn/shared-ui-jsx";
|
|
41
|
+
const HISTORY_TURNS_SENT = 12;
|
|
42
|
+
const storageKey = (orgId)=>`aglyn-assist:${orgId}`;
|
|
43
|
+
function loadThread(orgId) {
|
|
44
|
+
if (!orgId || typeof sessionStorage === 'undefined') return [];
|
|
45
|
+
try {
|
|
46
|
+
const raw = sessionStorage.getItem(storageKey(orgId));
|
|
47
|
+
const parsed = raw ? JSON.parse(raw) : [];
|
|
48
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
49
|
+
} catch (unused) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function saveThread(orgId, messages) {
|
|
54
|
+
if (!orgId || typeof sessionStorage === 'undefined') return;
|
|
55
|
+
try {
|
|
56
|
+
sessionStorage.setItem(storageKey(orgId), JSON.stringify(messages));
|
|
57
|
+
} catch (unused) {
|
|
58
|
+
// Quota/full storage never breaks chat.
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Minimal renderer for assistant text: markdown links and bare URLs become
|
|
63
|
+
* links (internal root-relative paths ride AppLink, external open in a new
|
|
64
|
+
* tab); everything else renders as plain text with line breaks. Phase 1 on
|
|
65
|
+
* purpose — no full markdown surface inside the panel.
|
|
66
|
+
*/ export function renderAssistText(text) {
|
|
67
|
+
const parts = [];
|
|
68
|
+
const pattern = /\[([^\]]+)\]\((\/[^)\s]*|https?:\/\/[^)\s]+)\)|https?:\/\/[^\s)]+/g;
|
|
69
|
+
let cursor = 0;
|
|
70
|
+
for (const match of text.matchAll(pattern)){
|
|
71
|
+
var _match_index;
|
|
72
|
+
const index = (_match_index = match.index) != null ? _match_index : 0;
|
|
73
|
+
if (index > cursor) parts.push(text.slice(cursor, index));
|
|
74
|
+
if (match[1] && match[2]) parts.push({
|
|
75
|
+
label: match[1],
|
|
76
|
+
href: match[2]
|
|
77
|
+
});
|
|
78
|
+
else parts.push({
|
|
79
|
+
label: match[0],
|
|
80
|
+
href: match[0]
|
|
81
|
+
});
|
|
82
|
+
cursor = index + match[0].length;
|
|
83
|
+
}
|
|
84
|
+
if (cursor < text.length) parts.push(text.slice(cursor));
|
|
85
|
+
return /*#__PURE__*/ _jsx(_Fragment, {
|
|
86
|
+
children: parts.map((part, i)=>{
|
|
87
|
+
if (typeof part === 'string') {
|
|
88
|
+
return /*#__PURE__*/ _jsx(Fragment, {
|
|
89
|
+
children: part
|
|
90
|
+
}, i);
|
|
91
|
+
}
|
|
92
|
+
if (part.href.startsWith('/')) {
|
|
93
|
+
return /*#__PURE__*/ _jsx(AppLink, {
|
|
94
|
+
componentVariant: "naked",
|
|
95
|
+
href: part.href,
|
|
96
|
+
children: part.label
|
|
97
|
+
}, i);
|
|
98
|
+
}
|
|
99
|
+
return /*#__PURE__*/ _jsx(Link, {
|
|
100
|
+
href: part.href,
|
|
101
|
+
target: "_blank",
|
|
102
|
+
rel: "noreferrer",
|
|
103
|
+
children: part.label
|
|
104
|
+
}, i);
|
|
105
|
+
})
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Split an answer into its plain layer and its technical tail (AGL-1988).
|
|
110
|
+
*
|
|
111
|
+
* Aglyn's users run from first-time business owners to working developers,
|
|
112
|
+
* and they get the same message. Two modes would be the obvious build and
|
|
113
|
+
* the wrong one — it asks a beginner to label themselves before they have a
|
|
114
|
+
* question, and asks a developer to opt in to being taken seriously. So the
|
|
115
|
+
* model writes one answer with a technical paragraph at the end, and the
|
|
116
|
+
* panel collapses it: the beginner never has to read past the plain steps,
|
|
117
|
+
* the developer never has to ask for the route or the field name.
|
|
118
|
+
*
|
|
119
|
+
* Degrades to "no tail" when the marker is absent, which is the common case
|
|
120
|
+
* and not a failure — plenty of answers have nothing technical to add.
|
|
121
|
+
*/ export function splitAssistDisclosure(text) {
|
|
122
|
+
const match = text.match(/(?:^|\n)[ \t]*Under the hood:[ \t]*/);
|
|
123
|
+
if (!match || match.index === undefined) return {
|
|
124
|
+
plain: text,
|
|
125
|
+
technical: ''
|
|
126
|
+
};
|
|
127
|
+
const plain = text.slice(0, match.index).trimEnd();
|
|
128
|
+
const technical = text.slice(match.index + match[0].length).trim();
|
|
129
|
+
// An answer that is ONLY a technical tail is still the answer. Collapsing
|
|
130
|
+
// the whole thing would show the user an empty bubble with a toggle.
|
|
131
|
+
if (!plain || !technical) return {
|
|
132
|
+
plain: text,
|
|
133
|
+
technical: ''
|
|
134
|
+
};
|
|
135
|
+
return {
|
|
136
|
+
plain,
|
|
137
|
+
technical
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/** The collapsed developer layer. */ function UnderTheHood({ technical }) {
|
|
141
|
+
const [open, setOpen] = useState(false);
|
|
142
|
+
return /*#__PURE__*/ _jsxs(Box, {
|
|
143
|
+
sx: {
|
|
144
|
+
mt: 0.5
|
|
145
|
+
},
|
|
146
|
+
children: [
|
|
147
|
+
/*#__PURE__*/ _jsxs(Link, {
|
|
148
|
+
component: "button",
|
|
149
|
+
type: "button",
|
|
150
|
+
variant: "caption",
|
|
151
|
+
underline: "hover",
|
|
152
|
+
onClick: ()=>setOpen((prior)=>!prior),
|
|
153
|
+
sx: {
|
|
154
|
+
display: 'inline-flex',
|
|
155
|
+
alignItems: 'center',
|
|
156
|
+
gap: 0.25
|
|
157
|
+
},
|
|
158
|
+
children: [
|
|
159
|
+
"Under the hood",
|
|
160
|
+
/*#__PURE__*/ _jsx(MdiIcon, {
|
|
161
|
+
path: open ? mdiChevronUp.path : mdiChevronDown.path,
|
|
162
|
+
sx: {
|
|
163
|
+
fontSize: 14
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
]
|
|
167
|
+
}),
|
|
168
|
+
/*#__PURE__*/ _jsx(Collapse, {
|
|
169
|
+
in: open,
|
|
170
|
+
unmountOnExit: true,
|
|
171
|
+
children: /*#__PURE__*/ _jsx(Typography, {
|
|
172
|
+
variant: "caption",
|
|
173
|
+
component: "div",
|
|
174
|
+
color: "text.secondary",
|
|
175
|
+
sx: {
|
|
176
|
+
mt: 0.5,
|
|
177
|
+
whiteSpace: 'pre-wrap',
|
|
178
|
+
wordBreak: 'break-word'
|
|
179
|
+
},
|
|
180
|
+
children: renderAssistText(technical)
|
|
181
|
+
})
|
|
182
|
+
})
|
|
183
|
+
]
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The source links under an answer (AGL-2486).
|
|
188
|
+
*
|
|
189
|
+
* `docs` is server-resolved retrieval output and has ridden every `done`
|
|
190
|
+
* event since Assist shipped, but NOTHING rendered it: it set the `grounded`
|
|
191
|
+
* analytics flag and stopped there. So every answer carried its citations to
|
|
192
|
+
* a reader who never saw them, and on the MODEL path that array is the only
|
|
193
|
+
* citation there is — the completion is prose, and nothing obliges it to name
|
|
194
|
+
* the page it was grounded in.
|
|
195
|
+
*
|
|
196
|
+
* ## Why this FILTERS rather than rendering the array straight
|
|
197
|
+
*
|
|
198
|
+
* The DEFLECTED path is the opposite case. `composeDocsAnswer` deliberately
|
|
199
|
+
* puts the citation in the answer TEXT as `[label](url)`, because a link is
|
|
200
|
+
* the one markup this panel speaks (`renderAssistText`) — that is a recorded
|
|
201
|
+
* decision, not an oversight, and its own docstring names this array as the
|
|
202
|
+
* tempting-but-wrong home for the citation *because* nothing renders it.
|
|
203
|
+
* Rendering the array underneath would therefore print every heading a second
|
|
204
|
+
* time on exactly the answers that already cite well. Anything whose url is
|
|
205
|
+
* already linked in the text is dropped, which leaves a deflected answer
|
|
206
|
+
* reading precisely as it does today and gives the model answer the sources
|
|
207
|
+
* it has never shown.
|
|
208
|
+
*
|
|
209
|
+
* ## Why the array is not simply suppressed server-side instead
|
|
210
|
+
*
|
|
211
|
+
* That was the other candidate and it is a trap: `docs.length > 0` is what
|
|
212
|
+
* sets the `grounded` analytics flag, so a docs-QUOTING answer would report
|
|
213
|
+
* itself ungrounded. The most grounded turn the product serves would be
|
|
214
|
+
* counted as a documentation gap, which is precisely backwards for the signal
|
|
215
|
+
* `assist-signal-mining` exists to read.
|
|
216
|
+
*/ export function AssistSources({ text, docs }) {
|
|
217
|
+
const unseen = [];
|
|
218
|
+
const shown = new Set();
|
|
219
|
+
for (const doc of docs != null ? docs : []){
|
|
220
|
+
// Already a link in the prose, or already listed here. Both are the same
|
|
221
|
+
// failure to the reader: the same page offered twice.
|
|
222
|
+
if (!(doc == null ? void 0 : doc.url) || text.includes(doc.url) || shown.has(doc.url)) continue;
|
|
223
|
+
shown.add(doc.url);
|
|
224
|
+
unseen.push(doc);
|
|
225
|
+
}
|
|
226
|
+
if (!unseen.length) return null;
|
|
227
|
+
return /*#__PURE__*/ _jsxs(Box, {
|
|
228
|
+
sx: {
|
|
229
|
+
mt: 0.75
|
|
230
|
+
},
|
|
231
|
+
children: [
|
|
232
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
233
|
+
variant: "caption",
|
|
234
|
+
color: "text.secondary",
|
|
235
|
+
component: "div",
|
|
236
|
+
children: unseen.length === 1 ? 'Source' : 'Sources'
|
|
237
|
+
}),
|
|
238
|
+
/*#__PURE__*/ _jsx(Stack, {
|
|
239
|
+
spacing: 0.25,
|
|
240
|
+
sx: {
|
|
241
|
+
mt: 0.25
|
|
242
|
+
},
|
|
243
|
+
children: unseen.map((doc)=>/*#__PURE__*/ _jsx(Typography, {
|
|
244
|
+
variant: "caption",
|
|
245
|
+
component: "div",
|
|
246
|
+
children: doc.url.startsWith('/') ? /*#__PURE__*/ _jsx(AppLink, {
|
|
247
|
+
componentVariant: "naked",
|
|
248
|
+
href: doc.url,
|
|
249
|
+
children: doc.title
|
|
250
|
+
}) : /*#__PURE__*/ _jsx(Link, {
|
|
251
|
+
href: doc.url,
|
|
252
|
+
target: "_blank",
|
|
253
|
+
rel: "noreferrer",
|
|
254
|
+
children: doc.title
|
|
255
|
+
})
|
|
256
|
+
}, doc.url))
|
|
257
|
+
})
|
|
258
|
+
]
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* The confirm card — the whole of "automate current view", and the whole of
|
|
263
|
+
* its boundary.
|
|
264
|
+
*
|
|
265
|
+
* The assistant proposes; this card is the human confirmation; confirming
|
|
266
|
+
* navigates. There is deliberately no submit path anywhere in this
|
|
267
|
+
* component, and no network call: a chat assistant that writes without
|
|
268
|
+
* consent is a far worse launch story than one that only advises, and the
|
|
269
|
+
* cheapest way to be sure it cannot is for the code that could do it not to
|
|
270
|
+
* exist. `assist-panel-proposal.spec.tsx` greps this file for exactly that.
|
|
271
|
+
*
|
|
272
|
+
* The copy is held to the same standard. While `prefill` is false — no
|
|
273
|
+
* console page reads `assist_*` params yet — the card says it will open the
|
|
274
|
+
* page and lists the values to use. It does not say it filled anything in,
|
|
275
|
+
* because a form that comes up empty after that promise is worse than no
|
|
276
|
+
* card at all.
|
|
277
|
+
*/ function ProposalCard({ proposal, onConfirm, onDismiss, brand }) {
|
|
278
|
+
return /*#__PURE__*/ _jsxs(Paper, {
|
|
279
|
+
variant: "outlined",
|
|
280
|
+
sx: {
|
|
281
|
+
mt: 1,
|
|
282
|
+
p: 1.5,
|
|
283
|
+
borderRadius: 2,
|
|
284
|
+
bgcolor: 'background.paper'
|
|
285
|
+
},
|
|
286
|
+
children: [
|
|
287
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
288
|
+
variant: "subtitle2",
|
|
289
|
+
children: proposal.label
|
|
290
|
+
}),
|
|
291
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
292
|
+
variant: "caption",
|
|
293
|
+
color: "text.secondary",
|
|
294
|
+
component: "div",
|
|
295
|
+
children: [
|
|
296
|
+
"Opens ",
|
|
297
|
+
proposal.outcome,
|
|
298
|
+
"."
|
|
299
|
+
]
|
|
300
|
+
}),
|
|
301
|
+
proposal.values.length > 0 && /*#__PURE__*/ _jsxs(Box, {
|
|
302
|
+
sx: {
|
|
303
|
+
mt: 1
|
|
304
|
+
},
|
|
305
|
+
children: [
|
|
306
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
307
|
+
variant: "caption",
|
|
308
|
+
color: "text.secondary",
|
|
309
|
+
component: "div",
|
|
310
|
+
children: proposal.prefill ? 'Filled in for you:' : 'Values to use:'
|
|
311
|
+
}),
|
|
312
|
+
/*#__PURE__*/ _jsx(Stack, {
|
|
313
|
+
component: "ul",
|
|
314
|
+
sx: {
|
|
315
|
+
m: 0,
|
|
316
|
+
pl: 2.5
|
|
317
|
+
},
|
|
318
|
+
children: proposal.values.map(({ name, value })=>/*#__PURE__*/ _jsxs(Typography, {
|
|
319
|
+
component: "li",
|
|
320
|
+
variant: "caption",
|
|
321
|
+
children: [
|
|
322
|
+
name,
|
|
323
|
+
": ",
|
|
324
|
+
/*#__PURE__*/ _jsx("strong", {
|
|
325
|
+
children: value
|
|
326
|
+
})
|
|
327
|
+
]
|
|
328
|
+
}, name))
|
|
329
|
+
})
|
|
330
|
+
]
|
|
331
|
+
}),
|
|
332
|
+
/*#__PURE__*/ _jsxs(Typography, {
|
|
333
|
+
variant: "caption",
|
|
334
|
+
color: "text.secondary",
|
|
335
|
+
component: "div",
|
|
336
|
+
sx: {
|
|
337
|
+
mt: 1
|
|
338
|
+
},
|
|
339
|
+
children: [
|
|
340
|
+
`${brand} Assist only opens the page. Nothing is saved until you `,
|
|
341
|
+
'fill the form in and submit it yourself.'
|
|
342
|
+
]
|
|
343
|
+
}),
|
|
344
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
345
|
+
direction: "row",
|
|
346
|
+
spacing: 1,
|
|
347
|
+
sx: {
|
|
348
|
+
mt: 1.5
|
|
349
|
+
},
|
|
350
|
+
children: [
|
|
351
|
+
/*#__PURE__*/ _jsx(AppLink, {
|
|
352
|
+
componentVariant: "button",
|
|
353
|
+
href: proposal.href,
|
|
354
|
+
variant: "contained",
|
|
355
|
+
size: "small",
|
|
356
|
+
onClick: onConfirm,
|
|
357
|
+
startIcon: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
358
|
+
path: mdiOpenInNew.path
|
|
359
|
+
}),
|
|
360
|
+
children: "Take me there"
|
|
361
|
+
}),
|
|
362
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
363
|
+
size: "small",
|
|
364
|
+
color: "inherit",
|
|
365
|
+
onClick: onDismiss,
|
|
366
|
+
children: "No thanks"
|
|
367
|
+
})
|
|
368
|
+
]
|
|
369
|
+
})
|
|
370
|
+
]
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
export function AssistPanelComponent(props) {
|
|
374
|
+
const { org, orgId, orgReady, scopedOrgId, orgSlug, hostId, productName, assistVisible, assistStaffPreview, generativeVisible, isStaff, aiPermissions: ai } = props;
|
|
375
|
+
const verdict = {
|
|
376
|
+
visible: assistVisible,
|
|
377
|
+
staffPreview: assistStaffPreview
|
|
378
|
+
};
|
|
379
|
+
const branding = {
|
|
380
|
+
productName
|
|
381
|
+
};
|
|
382
|
+
const billingSlug = orgSlug;
|
|
383
|
+
const pathname = usePathname();
|
|
384
|
+
const { data: user } = useUser();
|
|
385
|
+
const { enqueueSnackbar } = useSnackbar();
|
|
386
|
+
const [open, setOpen] = useState(false);
|
|
387
|
+
const [input, setInput] = useState('');
|
|
388
|
+
const [busy, setBusy] = useState(false);
|
|
389
|
+
const [messages, setMessages] = useState([]);
|
|
390
|
+
const [quota, setQuota] = useState(null);
|
|
391
|
+
const scrollRef = useRef(null);
|
|
392
|
+
// The model switch and the usage strip (AGL-2942): the pick rides the
|
|
393
|
+
// chat request, and each answer's `meter` moves every strip for the org.
|
|
394
|
+
const modelChoice = useAiModelChoice({
|
|
395
|
+
orgId: scopedOrgId,
|
|
396
|
+
hostId,
|
|
397
|
+
surface: 'assist',
|
|
398
|
+
kind: 'assist.chat'
|
|
399
|
+
});
|
|
400
|
+
const publishMeter = usePublishAiUsageMeter(scopedOrgId);
|
|
401
|
+
// The open editor, re-read whenever one opens, closes or reports a change —
|
|
402
|
+
// so a card raised on a live version offers Apply once its new version is
|
|
403
|
+
// the one open.
|
|
404
|
+
useSyncExternalStore(subscribeEditorSessions, editorSessionsRevision, editorSessionsRevision);
|
|
405
|
+
const editorSession = openEditorSession();
|
|
406
|
+
// Thread is per-org, session-persisted; switching orgs swaps threads.
|
|
407
|
+
// Keyed on the SCOPED org (AGL-1934): gating only the render would still
|
|
408
|
+
// load — and, on the next keystroke, save — a thread under the fallback
|
|
409
|
+
// org's key on every mount of a page that named no workspace.
|
|
410
|
+
useEffect(()=>{
|
|
411
|
+
setMessages(loadThread(scopedOrgId));
|
|
412
|
+
setQuota(null);
|
|
413
|
+
}, [
|
|
414
|
+
scopedOrgId
|
|
415
|
+
]);
|
|
416
|
+
useEffect(()=>{
|
|
417
|
+
saveThread(scopedOrgId, messages);
|
|
418
|
+
const node = scrollRef.current;
|
|
419
|
+
if (node) node.scrollTop = node.scrollHeight;
|
|
420
|
+
}, [
|
|
421
|
+
scopedOrgId,
|
|
422
|
+
messages
|
|
423
|
+
]);
|
|
424
|
+
const entitled = orgReady && checkEntitlement(org, 'aiAssist');
|
|
425
|
+
// Whether a question asked from a besigner document carries its canvas
|
|
426
|
+
// (AGL-2906). A hint, not a grant: the server decides the edit rung again
|
|
427
|
+
// from its own reads, and drops the outline below it.
|
|
428
|
+
const editRungHint = generativeVisible && ai.loaded && ai.generate && orgReady && checkEntitlement(org, 'aiGenerative');
|
|
429
|
+
const send = useCallback(async ()=>{
|
|
430
|
+
const question = input.trim();
|
|
431
|
+
if (!question || busy || !scopedOrgId || !ai.use) return;
|
|
432
|
+
setBusy(true);
|
|
433
|
+
setInput('');
|
|
434
|
+
const history = messages.slice(-HISTORY_TURNS_SENT).map(({ role, text })=>({
|
|
435
|
+
role,
|
|
436
|
+
text
|
|
437
|
+
}));
|
|
438
|
+
setMessages((prior)=>[
|
|
439
|
+
...prior,
|
|
440
|
+
{
|
|
441
|
+
role: 'user',
|
|
442
|
+
text: question
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
role: 'assistant',
|
|
446
|
+
text: ''
|
|
447
|
+
}
|
|
448
|
+
]);
|
|
449
|
+
const patchAnswer = (patch)=>{
|
|
450
|
+
setMessages((prior)=>{
|
|
451
|
+
const next = [
|
|
452
|
+
...prior
|
|
453
|
+
];
|
|
454
|
+
const last = next[next.length - 1];
|
|
455
|
+
if ((last == null ? void 0 : last.role) === 'assistant') next[next.length - 1] = patch(last);
|
|
456
|
+
return next;
|
|
457
|
+
});
|
|
458
|
+
};
|
|
459
|
+
// A notice must not be swallowed by a partial answer: a refusal or a
|
|
460
|
+
// max_tokens cut arrives AFTER text has streamed, and substituting only
|
|
461
|
+
// when the bubble is empty would leave the user staring at half an
|
|
462
|
+
// answer with nothing saying why it stopped.
|
|
463
|
+
const failAnswer = (notice)=>{
|
|
464
|
+
patchAnswer((message)=>_extends({}, message, {
|
|
465
|
+
text: message.text ? `${message.text}\n\n${notice}` : notice
|
|
466
|
+
}));
|
|
467
|
+
};
|
|
468
|
+
try {
|
|
469
|
+
var _ref;
|
|
470
|
+
// The canvas outline rides along from the besigner document the open
|
|
471
|
+
// editor holds — ids, component ids and short values, never the stored
|
|
472
|
+
// document — and only while that editor is on the version the route
|
|
473
|
+
// names, so the outline and the selection are the ones on screen.
|
|
474
|
+
const editDocument = editRungHint ? assistEditDocumentOf(pathname != null ? pathname : '') : null;
|
|
475
|
+
const session = editDocument ? openEditorSession() : undefined;
|
|
476
|
+
const canvasOutline = editDocument && session && session.documentKind === editDocument.kind && session.documentId === editDocument.documentId && session.versionId === editDocument.versionId ? describeAssistEditCanvas(canvas, (_ref = session.selectedNodeId == null ? void 0 : session.selectedNodeId.call(session)) != null ? _ref : null) : null;
|
|
477
|
+
const response = await authorizedFetch(user, '/api/assist/chat', {
|
|
478
|
+
method: 'POST',
|
|
479
|
+
headers: {
|
|
480
|
+
'Content-Type': 'application/json'
|
|
481
|
+
},
|
|
482
|
+
body: JSON.stringify(_extends({
|
|
483
|
+
orgId: scopedOrgId,
|
|
484
|
+
question,
|
|
485
|
+
history,
|
|
486
|
+
// Page context rides along; the server drops it for free orgs
|
|
487
|
+
// (level 2 is Pro+). Sending it is not a grant — the capability
|
|
488
|
+
// decision is server-side.
|
|
489
|
+
context: {
|
|
490
|
+
route: pathname != null ? pathname : '',
|
|
491
|
+
hostId: hostId != null ? hostId : '',
|
|
492
|
+
orgSlug
|
|
493
|
+
}
|
|
494
|
+
}, modelChoice.model ? {
|
|
495
|
+
model: modelChoice.model
|
|
496
|
+
} : {}, canvasOutline ? {
|
|
497
|
+
canvas: canvasOutline
|
|
498
|
+
} : {}))
|
|
499
|
+
});
|
|
500
|
+
if (!response.ok || !response.body) {
|
|
501
|
+
const payload = await response.json().catch(()=>null);
|
|
502
|
+
const locked = parseLockdownRefusal(response.status, payload);
|
|
503
|
+
if (locked) {
|
|
504
|
+
failAnswer(lockdownRefusalText(locked));
|
|
505
|
+
} else if (response.status === 501) {
|
|
506
|
+
// 501 means the narrow thing it says: no model is available AND
|
|
507
|
+
// the documentation had nothing to offer for this question either
|
|
508
|
+
// — the server hands back the closest pages whenever it has any
|
|
509
|
+
// (AGL-2486), so reaching here means it had none.
|
|
510
|
+
//
|
|
511
|
+
// Written for the person who is actually reading it. "Not
|
|
512
|
+
// configured on this deployment" names a deployment the reader does
|
|
513
|
+
// not administer and a configuration they cannot see, and landing
|
|
514
|
+
// mid-thread after a working answer it reads as a breakage. What a
|
|
515
|
+
// user needs here is what happened, what to try, and who can fix it
|
|
516
|
+
// — in that order, in words that assume no idea what an API key
|
|
517
|
+
// is. The
|
|
518
|
+
// operator's half (the env var) stays in the API error body, where
|
|
519
|
+
// an operator looks and a customer does not.
|
|
520
|
+
failAnswer(`I could not find anything in the documentation about that, and I cannot work it through with you myself yet — ` + `${branding.productName} Assist has not been fully switched on here. ` + `Try asking in different words, or ask whoever set up this workspace to finish enabling the assistant.`);
|
|
521
|
+
} else if ((response.status === 429 || response.status === 402) && (payload == null ? void 0 : payload.reason) === 'quota') {
|
|
522
|
+
var _ref1;
|
|
523
|
+
// 402 is the org's own hard cap (AGL-2653): the band would sell
|
|
524
|
+
// past itself and this workspace switched the sale off. The
|
|
525
|
+
// sentence names the switch, and the credit standing beside it is
|
|
526
|
+
// as real as a 429's, so it lands on the same line.
|
|
527
|
+
if (payload.quota) setQuota(payload.quota);
|
|
528
|
+
publishMeter(payload == null ? void 0 : payload.meter);
|
|
529
|
+
failAnswer(String((_ref1 = payload == null ? void 0 : payload.error) != null ? _ref1 : 'Message limit reached.'));
|
|
530
|
+
} else {
|
|
531
|
+
var _ref2;
|
|
532
|
+
failAnswer(String((_ref2 = payload == null ? void 0 : payload.error) != null ? _ref2 : 'The assistant request failed — try again.'));
|
|
533
|
+
}
|
|
534
|
+
return;
|
|
535
|
+
}
|
|
536
|
+
const reader = response.body.getReader();
|
|
537
|
+
const decoder = new TextDecoder();
|
|
538
|
+
let buffer = '';
|
|
539
|
+
for(;;){
|
|
540
|
+
var _lines_pop;
|
|
541
|
+
const { done, value } = await reader.read();
|
|
542
|
+
if (done) break;
|
|
543
|
+
buffer += decoder.decode(value, {
|
|
544
|
+
stream: true
|
|
545
|
+
});
|
|
546
|
+
const lines = buffer.split('\n');
|
|
547
|
+
buffer = (_lines_pop = lines.pop()) != null ? _lines_pop : '';
|
|
548
|
+
for (const line of lines){
|
|
549
|
+
if (!line.startsWith('data: ')) continue;
|
|
550
|
+
let event;
|
|
551
|
+
try {
|
|
552
|
+
event = JSON.parse(line.slice('data: '.length));
|
|
553
|
+
} catch (unused) {
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
if (event.type === 'delta' && typeof event.text === 'string') {
|
|
557
|
+
const text = event.text;
|
|
558
|
+
patchAnswer((message)=>_extends({}, message, {
|
|
559
|
+
text: message.text + text
|
|
560
|
+
}));
|
|
561
|
+
} else if (event.type === 'done') {
|
|
562
|
+
var _event_docs, _event_proposal;
|
|
563
|
+
const docs = (_event_docs = event.docs) != null ? _event_docs : [];
|
|
564
|
+
// Server-resolved and inert: an id from the closed set attached
|
|
565
|
+
// to the view the question was asked from, plus a destination
|
|
566
|
+
// this client did not choose. Null on every turn that proposed
|
|
567
|
+
// nothing, which is most of them.
|
|
568
|
+
const proposal = (_event_proposal = event.proposal) != null ? _event_proposal : null;
|
|
569
|
+
// The edit proposal (AGL-2906), shape-checked before it can reach
|
|
570
|
+
// a card whose Apply drives the canvas.
|
|
571
|
+
const edit = isAssistEditProposal(event.edit) ? event.edit : null;
|
|
572
|
+
patchAnswer((message)=>{
|
|
573
|
+
var _event_exchangeId;
|
|
574
|
+
return _extends({}, message, {
|
|
575
|
+
exchangeId: (_event_exchangeId = event.exchangeId) != null ? _event_exchangeId : null,
|
|
576
|
+
docs,
|
|
577
|
+
proposal,
|
|
578
|
+
edit
|
|
579
|
+
});
|
|
580
|
+
});
|
|
581
|
+
if (event.quota) setQuota(event.quota);
|
|
582
|
+
publishMeter(event.meter);
|
|
583
|
+
trackEvent('assistant_message_sent', {
|
|
584
|
+
tier: entitled ? 'entitled' : 'free',
|
|
585
|
+
grounded: docs.length > 0
|
|
586
|
+
});
|
|
587
|
+
if (proposal) {
|
|
588
|
+
trackEvent('assistant_proposal_shown', {
|
|
589
|
+
action: proposal.id
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
if (edit) {
|
|
593
|
+
trackEvent('assistant_proposal_shown', {
|
|
594
|
+
action: edit.id
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
} else if (event.type === 'error') {
|
|
598
|
+
var _event_error;
|
|
599
|
+
failAnswer(String((_event_error = event.error) != null ? _event_error : 'The assistant stream failed.'));
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
} catch (error) {
|
|
604
|
+
console.error(error);
|
|
605
|
+
failAnswer('The assistant request failed — check your connection and try again.');
|
|
606
|
+
} finally{
|
|
607
|
+
setBusy(false);
|
|
608
|
+
}
|
|
609
|
+
}, [
|
|
610
|
+
ai.use,
|
|
611
|
+
busy,
|
|
612
|
+
editRungHint,
|
|
613
|
+
entitled,
|
|
614
|
+
hostId,
|
|
615
|
+
input,
|
|
616
|
+
messages,
|
|
617
|
+
modelChoice.model,
|
|
618
|
+
publishMeter,
|
|
619
|
+
scopedOrgId,
|
|
620
|
+
orgSlug,
|
|
621
|
+
pathname,
|
|
622
|
+
user
|
|
623
|
+
]);
|
|
624
|
+
/**
|
|
625
|
+
* Retire a card once it has been acted on or waved away. Local state only
|
|
626
|
+
* — there is nothing to tell the server, because the proposal was never
|
|
627
|
+
* anything the server was waiting on.
|
|
628
|
+
*/ const resolveProposal = useCallback((index)=>{
|
|
629
|
+
setMessages((prior)=>prior.map((entry, i)=>i === index ? _extends({}, entry, {
|
|
630
|
+
proposalResolved: true
|
|
631
|
+
}) : entry));
|
|
632
|
+
}, []);
|
|
633
|
+
/**
|
|
634
|
+
* Land a confirmed edit on the open editor (AGL-2906): through the canvas's
|
|
635
|
+
* own mutators, as one undo step, unsaved. The only request that follows is
|
|
636
|
+
* the activity record, and it carries counts, never content.
|
|
637
|
+
*/ const applyEdit = useCallback((index)=>{
|
|
638
|
+
const message = messages[index];
|
|
639
|
+
const proposal = message == null ? void 0 : message.edit;
|
|
640
|
+
if (!proposal || !scopedOrgId) return;
|
|
641
|
+
const session = openEditorSession();
|
|
642
|
+
const result = applyAssistEdit(canvas, proposal, session);
|
|
643
|
+
if (result.ok === false) {
|
|
644
|
+
setMessages((prior)=>prior.map((entry, i)=>i === index ? _extends({}, entry, {
|
|
645
|
+
editOutcome: {
|
|
646
|
+
kind: 'failed',
|
|
647
|
+
message: result.message
|
|
648
|
+
}
|
|
649
|
+
}) : entry));
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
setMessages((prior)=>prior.map((entry, i)=>i === index ? _extends({}, entry, {
|
|
653
|
+
editOutcome: {
|
|
654
|
+
kind: 'applied'
|
|
655
|
+
}
|
|
656
|
+
}) : entry));
|
|
657
|
+
trackEvent('assistant_proposal_confirmed', {
|
|
658
|
+
action: proposal.id
|
|
659
|
+
});
|
|
660
|
+
enqueueSnackbar('Applied as unsaved changes — undo takes them back', {
|
|
661
|
+
variant: 'success',
|
|
662
|
+
persist: false
|
|
663
|
+
});
|
|
664
|
+
if (!message.exchangeId || !session) return;
|
|
665
|
+
const report = {
|
|
666
|
+
orgId: scopedOrgId,
|
|
667
|
+
hostId: proposal.target.hostId,
|
|
668
|
+
exchangeId: message.exchangeId,
|
|
669
|
+
documentKind: proposal.target.kind,
|
|
670
|
+
documentId: proposal.target.documentId,
|
|
671
|
+
versionId: session.versionId,
|
|
672
|
+
opCounts: result.opCounts
|
|
673
|
+
};
|
|
674
|
+
// Fire and forget: the edit is already on the canvas, and a record that
|
|
675
|
+
// fails to land must not read as an edit that failed.
|
|
676
|
+
void authorizedFetch(user, '/api/assist/edit-applied', {
|
|
677
|
+
method: 'POST',
|
|
678
|
+
headers: {
|
|
679
|
+
'Content-Type': 'application/json'
|
|
680
|
+
},
|
|
681
|
+
body: JSON.stringify(report)
|
|
682
|
+
}).catch(()=>undefined);
|
|
683
|
+
}, [
|
|
684
|
+
enqueueSnackbar,
|
|
685
|
+
messages,
|
|
686
|
+
scopedOrgId,
|
|
687
|
+
user
|
|
688
|
+
]);
|
|
689
|
+
/** Wave an edit card away. Nothing to tell the server: nothing happened. */ const dismissEdit = useCallback((index)=>{
|
|
690
|
+
setMessages((prior)=>prior.map((entry, i)=>i === index ? _extends({}, entry, {
|
|
691
|
+
editOutcome: {
|
|
692
|
+
kind: 'dismissed'
|
|
693
|
+
}
|
|
694
|
+
}) : entry));
|
|
695
|
+
}, []);
|
|
696
|
+
const sendFeedback = useCallback(async (index, feedback)=>{
|
|
697
|
+
const message = messages[index];
|
|
698
|
+
if (!(message == null ? void 0 : message.exchangeId) || !scopedOrgId) return;
|
|
699
|
+
setMessages((prior)=>prior.map((entry, i)=>i === index ? _extends({}, entry, {
|
|
700
|
+
feedback
|
|
701
|
+
}) : entry));
|
|
702
|
+
trackEvent('assistant_feedback', {
|
|
703
|
+
feedback
|
|
704
|
+
});
|
|
705
|
+
try {
|
|
706
|
+
await authorizedFetch(user, '/api/assist/feedback', {
|
|
707
|
+
method: 'POST',
|
|
708
|
+
headers: {
|
|
709
|
+
'Content-Type': 'application/json'
|
|
710
|
+
},
|
|
711
|
+
body: JSON.stringify({
|
|
712
|
+
orgId: scopedOrgId,
|
|
713
|
+
exchangeId: message.exchangeId,
|
|
714
|
+
feedback
|
|
715
|
+
})
|
|
716
|
+
});
|
|
717
|
+
} catch (unused) {
|
|
718
|
+
enqueueSnackbar('Feedback could not be recorded', {
|
|
719
|
+
variant: 'warning',
|
|
720
|
+
persist: false
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
}, [
|
|
724
|
+
enqueueSnackbar,
|
|
725
|
+
messages,
|
|
726
|
+
scopedOrgId,
|
|
727
|
+
user
|
|
728
|
+
]);
|
|
729
|
+
// A released-off feature does not exist (staff preview excepted) — and
|
|
730
|
+
// without an org IN SCOPE there is nothing to meter or record against
|
|
731
|
+
// (AGL-1934). `scopedOrgId`, never `orgId`: the fallback org is always
|
|
732
|
+
// present, which is exactly why gating on it announced and billed the
|
|
733
|
+
// assistant on the workspace picker. Every hook above has already run, so
|
|
734
|
+
// this early return costs no hook-order hazard.
|
|
735
|
+
if (!verdict.visible || !scopedOrgId) return null;
|
|
736
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
737
|
+
children: [
|
|
738
|
+
!open && /*#__PURE__*/ _jsx(Tooltip, {
|
|
739
|
+
title: `${branding.productName} Assist`,
|
|
740
|
+
placement: "left",
|
|
741
|
+
children: /*#__PURE__*/ _jsx(Fab, {
|
|
742
|
+
color: "primary",
|
|
743
|
+
size: "medium",
|
|
744
|
+
"aria-label": `Open ${branding.productName} Assist`,
|
|
745
|
+
onClick: ()=>setOpen(true),
|
|
746
|
+
sx: {
|
|
747
|
+
position: 'fixed',
|
|
748
|
+
// Insets, not constants (AGL-2486). The console chrome leaves
|
|
749
|
+
// the bottom-right corner empty, but the besigner does not:
|
|
750
|
+
// its properties panel is a full-height column on that edge,
|
|
751
|
+
// and a fixed launcher lands on the Styles form and its
|
|
752
|
+
// scrollbar. A surface that owns the corner publishes these
|
|
753
|
+
// variables to move the launcher clear of itself; everywhere
|
|
754
|
+
// else the fallback is the corner it has always used. Read as
|
|
755
|
+
// CSS rather than passed as props so the offset can follow a
|
|
756
|
+
// panel the launcher knows nothing about — one that is
|
|
757
|
+
// resizable and collapsible — without this component growing
|
|
758
|
+
// a dependency on the editor.
|
|
759
|
+
right: 'var(--aglyn-assist-inset-right, 20px)',
|
|
760
|
+
bottom: 'var(--aglyn-assist-inset-bottom, 20px)',
|
|
761
|
+
zIndex: (theme)=>theme.zIndex.drawer - 1
|
|
762
|
+
},
|
|
763
|
+
children: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
764
|
+
path: mdiChatQuestionOutline.path,
|
|
765
|
+
fontSize: "medium"
|
|
766
|
+
})
|
|
767
|
+
})
|
|
768
|
+
}),
|
|
769
|
+
/*#__PURE__*/ _jsx(Drawer, {
|
|
770
|
+
anchor: "right",
|
|
771
|
+
open: open,
|
|
772
|
+
onClose: ()=>setOpen(false),
|
|
773
|
+
slotProps: {
|
|
774
|
+
paper: {
|
|
775
|
+
sx: {
|
|
776
|
+
width: {
|
|
777
|
+
xs: '100%',
|
|
778
|
+
sm: 420
|
|
779
|
+
},
|
|
780
|
+
display: 'flex'
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
},
|
|
784
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
785
|
+
sx: {
|
|
786
|
+
height: '100%'
|
|
787
|
+
},
|
|
788
|
+
children: [
|
|
789
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
790
|
+
direction: "row",
|
|
791
|
+
spacing: 1,
|
|
792
|
+
sx: {
|
|
793
|
+
px: 2,
|
|
794
|
+
py: 1.5,
|
|
795
|
+
borderBottom: 1,
|
|
796
|
+
borderColor: 'divider',
|
|
797
|
+
alignItems: 'center'
|
|
798
|
+
},
|
|
799
|
+
children: [
|
|
800
|
+
/*#__PURE__*/ _jsx(MdiIcon, {
|
|
801
|
+
path: mdiChatQuestionOutline.path,
|
|
802
|
+
fontSize: "medium"
|
|
803
|
+
}),
|
|
804
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
805
|
+
variant: "h6",
|
|
806
|
+
sx: {
|
|
807
|
+
flexGrow: 1
|
|
808
|
+
},
|
|
809
|
+
children: `${branding.productName} Assist`
|
|
810
|
+
}),
|
|
811
|
+
verdict.staffPreview && /*#__PURE__*/ _jsx(Chip, {
|
|
812
|
+
size: "small",
|
|
813
|
+
color: "warning",
|
|
814
|
+
label: "Staff preview"
|
|
815
|
+
}),
|
|
816
|
+
/*#__PURE__*/ _jsx(HelpTip, _extends({}, pluginDocsHelp('aglynAssist', {
|
|
817
|
+
anchor: '#what-it-can-do'
|
|
818
|
+
}), {
|
|
819
|
+
sx: {
|
|
820
|
+
color: 'text.secondary'
|
|
821
|
+
}
|
|
822
|
+
})),
|
|
823
|
+
/*#__PURE__*/ _jsx(Tooltip, {
|
|
824
|
+
title: `Close ${branding.productName} Assist`,
|
|
825
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
826
|
+
"aria-label": `Close ${branding.productName} Assist`,
|
|
827
|
+
onClick: ()=>setOpen(false),
|
|
828
|
+
children: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
829
|
+
path: mdiClose.path,
|
|
830
|
+
fontSize: "medium"
|
|
831
|
+
})
|
|
832
|
+
})
|
|
833
|
+
})
|
|
834
|
+
]
|
|
835
|
+
}),
|
|
836
|
+
/*#__PURE__*/ _jsxs(Box, {
|
|
837
|
+
ref: scrollRef,
|
|
838
|
+
sx: {
|
|
839
|
+
flexGrow: 1,
|
|
840
|
+
overflowY: 'auto',
|
|
841
|
+
p: 2
|
|
842
|
+
},
|
|
843
|
+
children: [
|
|
844
|
+
/*#__PURE__*/ _jsx(AssistJobsDrawer, {
|
|
845
|
+
orgId: scopedOrgId,
|
|
846
|
+
org: org,
|
|
847
|
+
orgReady: orgReady,
|
|
848
|
+
orgSlug: billingSlug,
|
|
849
|
+
user: user,
|
|
850
|
+
visible: generativeVisible,
|
|
851
|
+
isStaff: isStaff,
|
|
852
|
+
hostId: hostId,
|
|
853
|
+
// A question about the figures, where the page reports them
|
|
854
|
+
// (AGL-2915); hidden with the rest of AI jobs, and refused by
|
|
855
|
+
// the jobs door where the member may not generate.
|
|
856
|
+
insight: ai.generate ? aiInsightSurfaceForPath(pathname) : null
|
|
857
|
+
}),
|
|
858
|
+
!messages.length && /*#__PURE__*/ _jsxs(Alert, {
|
|
859
|
+
severity: "info",
|
|
860
|
+
sx: {
|
|
861
|
+
mb: 2
|
|
862
|
+
},
|
|
863
|
+
children: [
|
|
864
|
+
`Ask anything about using ${branding.productName} — building `,
|
|
865
|
+
'your site, publishing, domains, commerce, billing. Answers ',
|
|
866
|
+
'link the docs and the console page to use.',
|
|
867
|
+
orgReady && !entitled && !isStaff && /*#__PURE__*/ _jsxs(_Fragment, {
|
|
868
|
+
children: [
|
|
869
|
+
' ',
|
|
870
|
+
"Free workspaces get a limited number of messages a day; Pro adds page-aware guidance."
|
|
871
|
+
]
|
|
872
|
+
})
|
|
873
|
+
]
|
|
874
|
+
}),
|
|
875
|
+
/*#__PURE__*/ _jsx(Stack, {
|
|
876
|
+
spacing: 1.5,
|
|
877
|
+
children: messages.map((message, index)=>{
|
|
878
|
+
var _message_editOutcome, _message_editOutcome1, _message_editOutcome2, _message_editOutcome3;
|
|
879
|
+
return /*#__PURE__*/ _jsxs(Box, {
|
|
880
|
+
sx: {
|
|
881
|
+
alignSelf: message.role === 'user' ? 'flex-end' : 'flex-start',
|
|
882
|
+
maxWidth: '90%',
|
|
883
|
+
borderRadius: 2,
|
|
884
|
+
px: 1.5,
|
|
885
|
+
py: 1,
|
|
886
|
+
bgcolor: message.role === 'user' ? 'primary.main' : 'action.hover',
|
|
887
|
+
color: message.role === 'user' ? 'primary.contrastText' : 'text.primary'
|
|
888
|
+
},
|
|
889
|
+
children: [
|
|
890
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
891
|
+
variant: "body2",
|
|
892
|
+
component: "div",
|
|
893
|
+
sx: {
|
|
894
|
+
whiteSpace: 'pre-wrap',
|
|
895
|
+
wordBreak: 'break-word'
|
|
896
|
+
},
|
|
897
|
+
children: message.role === 'assistant' ? message.text ? renderAssistText(splitAssistDisclosure(message.text).plain) : /*#__PURE__*/ _jsx(CircularProgress, {
|
|
898
|
+
size: 14
|
|
899
|
+
}) : message.text
|
|
900
|
+
}),
|
|
901
|
+
message.role === 'assistant' && splitAssistDisclosure(message.text).technical && /*#__PURE__*/ _jsx(UnderTheHood, {
|
|
902
|
+
technical: splitAssistDisclosure(message.text).technical
|
|
903
|
+
}),
|
|
904
|
+
message.role === 'assistant' && /*#__PURE__*/ _jsx(AssistSources, {
|
|
905
|
+
text: message.text,
|
|
906
|
+
docs: message.docs
|
|
907
|
+
}),
|
|
908
|
+
message.role === 'assistant' && message.proposal && !message.proposalResolved && /*#__PURE__*/ _jsx(ProposalCard, {
|
|
909
|
+
proposal: message.proposal,
|
|
910
|
+
brand: productName,
|
|
911
|
+
onConfirm: ()=>{
|
|
912
|
+
var _ref;
|
|
913
|
+
var _message_proposal;
|
|
914
|
+
trackEvent('assistant_proposal_confirmed', {
|
|
915
|
+
action: (_ref = (_message_proposal = message.proposal) == null ? void 0 : _message_proposal.id) != null ? _ref : ''
|
|
916
|
+
});
|
|
917
|
+
resolveProposal(index);
|
|
918
|
+
setOpen(false);
|
|
919
|
+
},
|
|
920
|
+
onDismiss: ()=>resolveProposal(index)
|
|
921
|
+
}),
|
|
922
|
+
message.role === 'assistant' && message.edit && ((_message_editOutcome = message.editOutcome) == null ? void 0 : _message_editOutcome.kind) !== 'dismissed' && ((_message_editOutcome1 = message.editOutcome) == null ? void 0 : _message_editOutcome1.kind) !== 'applied' && /*#__PURE__*/ _jsx(AssistEditCard, {
|
|
923
|
+
proposal: message.edit,
|
|
924
|
+
brand: productName,
|
|
925
|
+
session: editorSession,
|
|
926
|
+
failure: ((_message_editOutcome2 = message.editOutcome) == null ? void 0 : _message_editOutcome2.kind) === 'failed' ? message.editOutcome.message : null,
|
|
927
|
+
onApply: ()=>applyEdit(index),
|
|
928
|
+
onCreateVersion: ()=>{
|
|
929
|
+
var _editorSession_createVersion;
|
|
930
|
+
return editorSession == null ? void 0 : (_editorSession_createVersion = editorSession.createVersion) == null ? void 0 : _editorSession_createVersion.call(editorSession);
|
|
931
|
+
},
|
|
932
|
+
onDismiss: ()=>dismissEdit(index)
|
|
933
|
+
}),
|
|
934
|
+
message.role === 'assistant' && ((_message_editOutcome3 = message.editOutcome) == null ? void 0 : _message_editOutcome3.kind) === 'applied' && /*#__PURE__*/ _jsx(Typography, {
|
|
935
|
+
variant: "caption",
|
|
936
|
+
color: "text.secondary",
|
|
937
|
+
component: "div",
|
|
938
|
+
sx: {
|
|
939
|
+
mt: 0.5
|
|
940
|
+
},
|
|
941
|
+
children: "Applied to the canvas as unsaved changes."
|
|
942
|
+
}),
|
|
943
|
+
message.role === 'assistant' && message.exchangeId && /*#__PURE__*/ _jsxs(Stack, {
|
|
944
|
+
direction: "row",
|
|
945
|
+
spacing: 0.5,
|
|
946
|
+
sx: {
|
|
947
|
+
mt: 0.5
|
|
948
|
+
},
|
|
949
|
+
children: [
|
|
950
|
+
/*#__PURE__*/ _jsx(Tooltip, {
|
|
951
|
+
title: message.feedback ? 'Thanks — you already rated this answer' : 'Helpful answer',
|
|
952
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
953
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
954
|
+
size: "small",
|
|
955
|
+
"aria-label": "Helpful answer",
|
|
956
|
+
color: message.feedback === 'up' ? 'primary' : 'default',
|
|
957
|
+
disabled: Boolean(message.feedback),
|
|
958
|
+
onClick: ()=>void sendFeedback(index, 'up'),
|
|
959
|
+
children: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
960
|
+
path: mdiThumbUpOutline.path,
|
|
961
|
+
sx: {
|
|
962
|
+
fontSize: 16
|
|
963
|
+
}
|
|
964
|
+
})
|
|
965
|
+
})
|
|
966
|
+
})
|
|
967
|
+
}),
|
|
968
|
+
/*#__PURE__*/ _jsx(Tooltip, {
|
|
969
|
+
title: message.feedback ? 'Thanks — you already rated this answer' : 'Unhelpful answer',
|
|
970
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
971
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
972
|
+
size: "small",
|
|
973
|
+
"aria-label": "Unhelpful answer",
|
|
974
|
+
color: message.feedback === 'down' ? 'primary' : 'default',
|
|
975
|
+
disabled: Boolean(message.feedback),
|
|
976
|
+
onClick: ()=>void sendFeedback(index, 'down'),
|
|
977
|
+
children: /*#__PURE__*/ _jsx(MdiIcon, {
|
|
978
|
+
path: mdiThumbDownOutline.path,
|
|
979
|
+
sx: {
|
|
980
|
+
fontSize: 16
|
|
981
|
+
}
|
|
982
|
+
})
|
|
983
|
+
})
|
|
984
|
+
})
|
|
985
|
+
})
|
|
986
|
+
]
|
|
987
|
+
})
|
|
988
|
+
]
|
|
989
|
+
}, index);
|
|
990
|
+
})
|
|
991
|
+
})
|
|
992
|
+
]
|
|
993
|
+
}),
|
|
994
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
995
|
+
spacing: 1,
|
|
996
|
+
sx: {
|
|
997
|
+
p: 2,
|
|
998
|
+
borderTop: 1,
|
|
999
|
+
borderColor: 'divider'
|
|
1000
|
+
},
|
|
1001
|
+
children: [
|
|
1002
|
+
ai.loaded && !ai.use ? /*#__PURE__*/ _jsx(Typography, {
|
|
1003
|
+
variant: "caption",
|
|
1004
|
+
color: "text.secondary",
|
|
1005
|
+
children: 'Your role does not include the assistant — ask an ' + 'organization admin to grant "Use AI assistance".'
|
|
1006
|
+
}) : null,
|
|
1007
|
+
/*#__PURE__*/ _jsx(AiUsageStrip, {
|
|
1008
|
+
orgId: scopedOrgId,
|
|
1009
|
+
orgSlug: billingSlug
|
|
1010
|
+
}),
|
|
1011
|
+
quota && quota.period === 'day' && /*#__PURE__*/ _jsxs(Typography, {
|
|
1012
|
+
variant: "caption",
|
|
1013
|
+
color: "text.secondary",
|
|
1014
|
+
children: [
|
|
1015
|
+
quota.remaining,
|
|
1016
|
+
" of ",
|
|
1017
|
+
quota.limit,
|
|
1018
|
+
" free messages left today",
|
|
1019
|
+
billingSlug ? /*#__PURE__*/ _jsxs(_Fragment, {
|
|
1020
|
+
children: [
|
|
1021
|
+
' — ',
|
|
1022
|
+
/*#__PURE__*/ _jsx(AppLink, {
|
|
1023
|
+
componentVariant: "naked",
|
|
1024
|
+
href: `/${billingSlug}/billing`,
|
|
1025
|
+
children: "upgrade for more"
|
|
1026
|
+
})
|
|
1027
|
+
]
|
|
1028
|
+
}) : null
|
|
1029
|
+
]
|
|
1030
|
+
}),
|
|
1031
|
+
entitled ? /*#__PURE__*/ _jsx(Stack, {
|
|
1032
|
+
direction: "row",
|
|
1033
|
+
sx: {
|
|
1034
|
+
justifyContent: 'flex-end',
|
|
1035
|
+
mb: -0.5
|
|
1036
|
+
},
|
|
1037
|
+
children: /*#__PURE__*/ _jsx(AiModelSelector, {
|
|
1038
|
+
choice: modelChoice,
|
|
1039
|
+
disabled: busy || !ai.loaded || !ai.use
|
|
1040
|
+
})
|
|
1041
|
+
}) : null,
|
|
1042
|
+
/*#__PURE__*/ _jsxs(Stack, {
|
|
1043
|
+
direction: "row",
|
|
1044
|
+
spacing: 1,
|
|
1045
|
+
sx: {
|
|
1046
|
+
alignItems: 'flex-end'
|
|
1047
|
+
},
|
|
1048
|
+
children: [
|
|
1049
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
1050
|
+
fullWidth: true,
|
|
1051
|
+
multiline: true,
|
|
1052
|
+
maxRows: 4,
|
|
1053
|
+
size: "small",
|
|
1054
|
+
placeholder: "How do I…",
|
|
1055
|
+
value: input,
|
|
1056
|
+
disabled: busy || !ai.loaded || !ai.use,
|
|
1057
|
+
onChange: (event)=>setInput(event.target.value),
|
|
1058
|
+
onKeyDown: (event)=>{
|
|
1059
|
+
if (event.key === 'Enter' && !event.shiftKey) {
|
|
1060
|
+
event.preventDefault();
|
|
1061
|
+
void send();
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}),
|
|
1065
|
+
/*#__PURE__*/ _jsx(Tooltip, {
|
|
1066
|
+
title: busy ? 'Waiting for an answer…' : !ai.loaded ? 'Checking your permissions…' : !ai.use ? 'Your role does not include the assistant' : 'Send message',
|
|
1067
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
1068
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
1069
|
+
color: "primary",
|
|
1070
|
+
"aria-label": "Send message",
|
|
1071
|
+
disabled: busy || !input.trim() || !ai.loaded || !ai.use,
|
|
1072
|
+
onClick: ()=>void send(),
|
|
1073
|
+
children: busy ? /*#__PURE__*/ _jsx(CircularProgress, {
|
|
1074
|
+
size: 20
|
|
1075
|
+
}) : // 20px to match the CircularProgress it swaps with
|
|
1076
|
+
// on the line above — at the inherited 14px the
|
|
1077
|
+
// button visibly grew its contents while busy.
|
|
1078
|
+
/*#__PURE__*/ _jsx(MdiIcon, {
|
|
1079
|
+
path: mdiSend.path,
|
|
1080
|
+
sx: {
|
|
1081
|
+
fontSize: 20
|
|
1082
|
+
}
|
|
1083
|
+
})
|
|
1084
|
+
})
|
|
1085
|
+
})
|
|
1086
|
+
})
|
|
1087
|
+
]
|
|
1088
|
+
})
|
|
1089
|
+
]
|
|
1090
|
+
})
|
|
1091
|
+
]
|
|
1092
|
+
})
|
|
1093
|
+
})
|
|
1094
|
+
]
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
export default AssistPanelComponent;
|
|
1098
|
+
|
|
1099
|
+
//# sourceMappingURL=assist-panel.component.js.map
|