@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,558 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { type AiJob, type AiJobApplied, type AiJobKind, type AiJobOutput, type AiJobPlan, type AiJobReview, type AiJobStatus, type AiJobStepTokens, type AiJobSummary } from '../model/ai-jobs.types';
|
|
18
|
+
import type { AglynOrgBilling } from '@aglyn/aglyn/foundation/definitions/org-billing.types';
|
|
19
|
+
import { type AiActivityActor } from '../activity/ai-activity';
|
|
20
|
+
import { type AiEffort, type AiUsage } from '../runtime/ai-runtime';
|
|
21
|
+
import { AI_JOB_INLINE_BUDGET_MS, AI_JOB_SWEEP_BUDGET_MS } from './ai-job-budget';
|
|
22
|
+
import { type AiJobStepOutcome, type AiJobStepRunner } from './ai-job-text-step';
|
|
23
|
+
import { type AssistReservation } from '../usage/assist-usage';
|
|
24
|
+
/**
|
|
25
|
+
* AI generation jobs — the Firestore state machine (AGL-2904).
|
|
26
|
+
*
|
|
27
|
+
* One document per job under the org, written only by this module through
|
|
28
|
+
* the Admin SDK; the rules let a member READ their org's jobs and nobody
|
|
29
|
+
* write them. The console route creates a job and runs its first step
|
|
30
|
+
* inline when it can; the AI jobs beat, a console route of its own, claims
|
|
31
|
+
* and runs whatever is queued, across every org, inside a wall-clock budget
|
|
32
|
+
* (`ai-jobs-beat.ts`). Both go through
|
|
33
|
+
* `runAiJobStep`, so there is exactly one place a step is claimed, metered,
|
|
34
|
+
* run and recorded.
|
|
35
|
+
*
|
|
36
|
+
* ── Credits, per step ────────────────────────────────────────────────────
|
|
37
|
+
*
|
|
38
|
+
* Every step is an assist message to the meter: `reserveAssistMessage`
|
|
39
|
+
* BEFORE the provider is called — the same read-and-increment transaction
|
|
40
|
+
* the chat route takes, so a job cannot slip past the org's monthly ceiling
|
|
41
|
+
* by being asynchronous — and `recordAssistCost` after, at the serving
|
|
42
|
+
* model's rates, so the usage rollup and the invoice see a job's tokens
|
|
43
|
+
* exactly as they see a chat turn's. The credit figure on the job is that
|
|
44
|
+
* cost at the plan's credit rate, rounded up like every other credit.
|
|
45
|
+
*
|
|
46
|
+
* A refused reservation is NOT a failure. The org is out of credits, over
|
|
47
|
+
* its cap, or has switched overage off — all things a member can change —
|
|
48
|
+
* so the job parks as `needs_input` with the refusal in customer-safe words
|
|
49
|
+
* and the beat tries it again once it has rested. `failed` is reserved for
|
|
50
|
+
* a step that cannot succeed by waiting.
|
|
51
|
+
*
|
|
52
|
+
* ── What a step may not do ───────────────────────────────────────────────
|
|
53
|
+
*
|
|
54
|
+
* A step runner writes drafts and returns. It does not touch the job
|
|
55
|
+
* document, the meter or the lease: the machine owns those, so a runner
|
|
56
|
+
* written next month cannot forget the reservation or record itself done
|
|
57
|
+
* while the provider is still generating.
|
|
58
|
+
*/
|
|
59
|
+
export declare const AI_JOBS_COLLECTION = "aiJobs";
|
|
60
|
+
/**
|
|
61
|
+
* How long a claim holds the step: longer than the longest any holder can
|
|
62
|
+
* still be running it, which is the beat route's 300 s function ceiling
|
|
63
|
+
* (AGL-3026). A lease that ran out under a live holder would let the next
|
|
64
|
+
* beat claim the same step and call the provider for it a second time, and
|
|
65
|
+
* the beat fires every minute while a sweep may run for most of five, so
|
|
66
|
+
* this is what keeps overlapping beats apart. A step abandoned by a process
|
|
67
|
+
* that died is recovered once it runs out, by the first beat after that.
|
|
68
|
+
*/
|
|
69
|
+
export declare const AI_JOB_LEASE_MS = 330000;
|
|
70
|
+
/** A step handed back by a retryable provider failure this many times fails. */
|
|
71
|
+
export declare const AI_JOB_STEP_MAX_ATTEMPTS = 3;
|
|
72
|
+
/**
|
|
73
|
+
* The most passes one step may take by asking to continue (AGL-2910), for a
|
|
74
|
+
* kind that registers no bound of its own. A site audit's passes are its
|
|
75
|
+
* units of generated work; this bounds a runner that never finishes, not a
|
|
76
|
+
* real site.
|
|
77
|
+
*/
|
|
78
|
+
export declare const AI_JOB_STEP_MAX_PASSES = 40;
|
|
79
|
+
/**
|
|
80
|
+
* The nominal credit figure shown as held per outstanding step. Not a
|
|
81
|
+
* bound — the reservation and the monthly ceiling are — but the console
|
|
82
|
+
* must show a running job as costing something before its bill is known.
|
|
83
|
+
*
|
|
84
|
+
* NOMINAL, and nothing reads it as more (AGL-3030): the band, the Free
|
|
85
|
+
* taste's account allowance and every refusal are measured on recorded
|
|
86
|
+
* spend, and the one real reservation a step takes is a message, counted
|
|
87
|
+
* when the step is claimed and settled — metered or handed back — before the
|
|
88
|
+
* step is recorded. So a job holds nothing real between steps, and a job
|
|
89
|
+
* parked for a person shows nothing held either: `recordStep` releases the
|
|
90
|
+
* figure when a step parks for review, and `resumeAiJob` holds it again for
|
|
91
|
+
* the steps a person's resume queues.
|
|
92
|
+
*/
|
|
93
|
+
export declare const AI_JOB_STEP_RESERVE_CREDITS = 50;
|
|
94
|
+
/**
|
|
95
|
+
* The inline doors' budget and the beat's, declared beside the time a step is
|
|
96
|
+
* planned against (`ai-job-budget.ts`, AGL-3036) so a step's least time and
|
|
97
|
+
* the budgets it has to fit are read in one place.
|
|
98
|
+
*/
|
|
99
|
+
export { AI_JOB_INLINE_BUDGET_MS, AI_JOB_SWEEP_BUDGET_MS };
|
|
100
|
+
/** Jobs one beat reads as candidates; the budget usually stops it first. */
|
|
101
|
+
export declare const AI_JOB_SWEEP_MAX_JOBS = 25;
|
|
102
|
+
/** Parked jobs one beat re-queues, on top of the active candidates. */
|
|
103
|
+
export declare const AI_JOB_SWEEP_MAX_PARKED = 5;
|
|
104
|
+
/** How long a `needs_input` job rests before the beat tries its reservation again. */
|
|
105
|
+
export declare const AI_JOB_NEEDS_INPUT_RETRY_MS: number;
|
|
106
|
+
export declare const AI_JOB_NOT_AVAILABLE_COPY = "This kind of AI job is not available yet.";
|
|
107
|
+
export declare const AI_JOB_REFUSED_COPY = "The model declined this brief. Try rephrasing it.";
|
|
108
|
+
type Firestore = FirebaseFirestore.Firestore;
|
|
109
|
+
export declare function isAiJobTerminal(status: AiJobStatus): boolean;
|
|
110
|
+
/** The step a planned kind runs first (AGL-2935). */
|
|
111
|
+
export declare const AI_JOB_PLAN_STEP = "plan";
|
|
112
|
+
/**
|
|
113
|
+
* The kinds that build site structure, and so plan before they generate
|
|
114
|
+
* (AGL-2935): the plan their first step proposes is what their generation
|
|
115
|
+
* step executes, once a person has confirmed it.
|
|
116
|
+
*/
|
|
117
|
+
export declare const AI_PLANNED_JOB_KINDS: readonly AiJobKind[];
|
|
118
|
+
export interface AiJobStepRegistration {
|
|
119
|
+
/**
|
|
120
|
+
* The least time, in milliseconds, one run of the kind's step needs before
|
|
121
|
+
* it starts (AGL-2907): its generation's worst case at the rates
|
|
122
|
+
* `ai-job-budget.ts` assumes — every model call it may make, with the step's
|
|
123
|
+
* own reads and writes (AGL-3036). The beat leaves the step queued rather
|
|
124
|
+
* than start it with less time left, and an inline door leaves it for the
|
|
125
|
+
* beat, because a provider call the caller's budget cuts off is still
|
|
126
|
+
* generated and billed upstream while the meter records nothing.
|
|
127
|
+
*
|
|
128
|
+
* Every generation step the plugin registers declares one (AGL-3035), and a
|
|
129
|
+
* spec over the console surface's registrations fails on a step that does
|
|
130
|
+
* not. Absent, the step starts whenever it is claimed.
|
|
131
|
+
*/
|
|
132
|
+
minimumMs?: number;
|
|
133
|
+
/**
|
|
134
|
+
* For a step whose runs need different times, the least time the run this
|
|
135
|
+
* job would make next needs (AGL-3035): a page job's pass that builds a
|
|
136
|
+
* layout needs a layout's time, where its section passes need a section's,
|
|
137
|
+
* and a scaffold's pass needs what the unit it hands on needs. Never read as
|
|
138
|
+
* less than `minimumMs`, which is then the least any run of the step needs.
|
|
139
|
+
*/
|
|
140
|
+
minimumMsFor?: (job: AiJob) => number;
|
|
141
|
+
}
|
|
142
|
+
/** Idempotent per kind; last registration wins. */
|
|
143
|
+
export declare function registerAiJobStep(kind: AiJobKind, runner: AiJobStepRunner, registration?: AiJobStepRegistration): void;
|
|
144
|
+
/**
|
|
145
|
+
* The least time a step needs before it starts: the plan step's own minimum
|
|
146
|
+
* for the plan step of any kind (AGL-3026), and the kind's registered
|
|
147
|
+
* minimum for the kind's own step — the least any run of it needs.
|
|
148
|
+
*/
|
|
149
|
+
export declare function aiJobStepMinimumMs(kind: AiJobKind, stepName: string): number;
|
|
150
|
+
/**
|
|
151
|
+
* The least time the next run of a job's own step needs (AGL-3035): what the
|
|
152
|
+
* kind registered, or more where the kind says this job's next run needs
|
|
153
|
+
* more. A step that delegates a unit to another kind — a page job's creation,
|
|
154
|
+
* a scaffold's page — asks this of the job it derives for the unit.
|
|
155
|
+
*/
|
|
156
|
+
export declare function aiJobStepRunMinimumMs(job: AiJob): number;
|
|
157
|
+
/** The least time the job's next step needs; 0 when no step is left to run. */
|
|
158
|
+
export declare function aiJobNextStepMinimumMs(job: AiJob): number;
|
|
159
|
+
export declare function aiJobStepRunnerFor(kind: AiJobKind): AiJobStepRunner | null;
|
|
160
|
+
/**
|
|
161
|
+
* A kind whose step works through more units than the default bounds
|
|
162
|
+
* (AGL-2911). A scaffold's unit is a whole page and its site is eight of
|
|
163
|
+
* them, where an audit's is one page's listing, so the runaway bound the
|
|
164
|
+
* default gives an audit would cut a real site short. The kind registers its
|
|
165
|
+
* own beside its runner, so the machine keeps no list of kinds and the bound
|
|
166
|
+
* sits with the plan that explains it.
|
|
167
|
+
*/
|
|
168
|
+
export declare function registerAiJobStepPasses(kind: AiJobKind, maxPasses: number): void;
|
|
169
|
+
/** The passes a kind's step may take; the default where it registered none. */
|
|
170
|
+
export declare function aiJobStepMaxPasses(kind: AiJobKind): number;
|
|
171
|
+
/**
|
|
172
|
+
* The plan step every planned kind runs first. Registered by its own module
|
|
173
|
+
* (`ai-job-plan-step.ts`), which the plugin's server surface loads, so this
|
|
174
|
+
* machine — and every spec that drives it — never loads the inventory
|
|
175
|
+
* reader and the Admin SDK behind it. `null` unregisters it, minimum and all.
|
|
176
|
+
*
|
|
177
|
+
* `minimumMs` means for the plan step what it means for a kind's step
|
|
178
|
+
* (AGL-3026): a plan answered at its ceiling takes longer than an inline
|
|
179
|
+
* door's budget, so the step says so, and both doors leave it for the beat.
|
|
180
|
+
*/
|
|
181
|
+
export declare function registerAiJobPlanStep(runner: AiJobStepRunner | null, registration?: AiJobStepRegistration): void;
|
|
182
|
+
/**
|
|
183
|
+
* Whether AI generation is paused for a workspace, as the jobs doors read it
|
|
184
|
+
* (AGL-3037). `staff` is a verified staff caller on an inline door; the beat
|
|
185
|
+
* has none.
|
|
186
|
+
*/
|
|
187
|
+
export type AiJobPauseReader = (input: {
|
|
188
|
+
orgId: string;
|
|
189
|
+
staff: boolean;
|
|
190
|
+
}) => Promise<boolean>;
|
|
191
|
+
/**
|
|
192
|
+
* The reader `runAiJobStep` asks before it claims a step. Registered by its
|
|
193
|
+
* own module (`ai-jobs-pause.ts`), which the plugin's console surface calls,
|
|
194
|
+
* so this machine — and every spec that drives it — never loads the Admin SDK
|
|
195
|
+
* the lockdown reads run on. `null` unregisters it; a machine with no reader
|
|
196
|
+
* runs every job, as a process with no lockdown carrier would.
|
|
197
|
+
*/
|
|
198
|
+
export declare function registerAiJobPauseReader(reader: AiJobPauseReader | null): void;
|
|
199
|
+
/** Whether a pause reader is registered: what a surface that runs jobs must have. */
|
|
200
|
+
export declare function aiJobPauseReaderRegistered(): boolean;
|
|
201
|
+
/** The runner for one step of one job: the plan step by its name, else the kind's own. */
|
|
202
|
+
export declare function aiJobRunnerForStep(kind: AiJobKind, stepName: string): AiJobStepRunner | null;
|
|
203
|
+
/**
|
|
204
|
+
* The step names a job of this kind carries, in order. A planned kind plans
|
|
205
|
+
* only once something can build the plan: until its generation runner is
|
|
206
|
+
* registered, its job fails fast and free, rather than spending on a plan
|
|
207
|
+
* nothing will execute.
|
|
208
|
+
*/
|
|
209
|
+
export declare function aiJobStepNames(kind: AiJobKind): string[];
|
|
210
|
+
export interface CreateAiJobInput {
|
|
211
|
+
orgId: string;
|
|
212
|
+
hostId?: string | null;
|
|
213
|
+
kind: AiJobKind;
|
|
214
|
+
brief: string;
|
|
215
|
+
inputs?: Record<string, unknown>;
|
|
216
|
+
/** The model the creator picked (AGL-2942); absent or `null` for Auto. */
|
|
217
|
+
model?: string | null;
|
|
218
|
+
createdBy: string;
|
|
219
|
+
/** The creator's address, for the activity row; the document stores the uid only. */
|
|
220
|
+
createdByEmail?: string | null;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* A new job, `queued`, with its step plan laid out and nothing run.
|
|
224
|
+
*
|
|
225
|
+
* The activity row is written once the document is, so the feed never names
|
|
226
|
+
* a job that does not exist. The brief's length stands in for the brief,
|
|
227
|
+
* which is the customer's own text and is not logged (AGL-2929).
|
|
228
|
+
*/
|
|
229
|
+
export declare function createAiJob(firestore: Firestore, input: CreateAiJobInput, now?: Date): Promise<AiJob>;
|
|
230
|
+
export declare function getAiJob(firestore: Firestore, orgId: string, jobId: string): Promise<AiJob | null>;
|
|
231
|
+
export interface ListAiJobsOptions {
|
|
232
|
+
status?: AiJobStatus;
|
|
233
|
+
limit?: number;
|
|
234
|
+
}
|
|
235
|
+
/** Newest first. Needs the (status, createdAt) index when filtered. */
|
|
236
|
+
export declare function listAiJobs(firestore: Firestore, orgId: string, options?: ListAiJobsOptions): Promise<AiJob[]>;
|
|
237
|
+
/** The wire form. `running` is the lease, read against `now`. */
|
|
238
|
+
export declare function aiJobSummary(job: AiJob, now?: Date): AiJobSummary;
|
|
239
|
+
export interface ClaimedAiJobStep {
|
|
240
|
+
job: AiJob;
|
|
241
|
+
stepIndex: number;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Take the lease on the job's next step, in one transaction.
|
|
245
|
+
*
|
|
246
|
+
* Refuses — `null` — when the job is terminal or parked, when it has no
|
|
247
|
+
* step left, or when ANOTHER owner's lease has not yet expired. That last
|
|
248
|
+
* clause is the whole point: the console route and two overlapping beats
|
|
249
|
+
* can all look at one job inside the same minute, and only one of them may
|
|
250
|
+
* spend the reservation for its step. An expired lease is claimable, which
|
|
251
|
+
* is how a step abandoned mid-flight by a frozen process is recovered — the
|
|
252
|
+
* stale lease is released by being taken, not by a sweep of its own.
|
|
253
|
+
*/
|
|
254
|
+
export declare function claimNextStep(firestore: Firestore, orgId: string, jobId: string, owner: string, now?: Date): Promise<ClaimedAiJobStep | null>;
|
|
255
|
+
/**
|
|
256
|
+
* Extend the lease while a long step is still running. `false` when the
|
|
257
|
+
* caller no longer holds it — the step was recovered by someone else, and
|
|
258
|
+
* the caller's result must not overwrite theirs.
|
|
259
|
+
*/
|
|
260
|
+
export declare function heartbeatStep(firestore: Firestore, orgId: string, jobId: string, owner: string, now?: Date): Promise<boolean>;
|
|
261
|
+
/**
|
|
262
|
+
* Leave a job whose workspace's AI is paused where it is (AGL-3037), moved to
|
|
263
|
+
* the back of the beat's queue. Nothing is claimed: its steps, their attempts
|
|
264
|
+
* and its lease stay exactly as they were, so resuming AI runs the job from
|
|
265
|
+
* where it stopped. Only `updatedAt` moves — the beat's queue is ordered by it,
|
|
266
|
+
* and a paused workspace's jobs left at the front would fill every beat's
|
|
267
|
+
* candidates and starve every other workspace's.
|
|
268
|
+
*
|
|
269
|
+
* `null`, writing nothing, for a job a claim would not take either: terminal,
|
|
270
|
+
* parked, no step left, or another owner's live lease.
|
|
271
|
+
*/
|
|
272
|
+
export declare function holdPausedAiJob(firestore: Firestore, orgId: string, jobId: string, owner: string, now?: Date): Promise<AiJob | null>;
|
|
273
|
+
export interface RecordStepInput {
|
|
274
|
+
/** `pending` hands the step back for another attempt. */
|
|
275
|
+
status: 'done' | 'failed' | 'pending';
|
|
276
|
+
creditsSpent: number;
|
|
277
|
+
error?: string | null;
|
|
278
|
+
outputs?: AiJobOutput[];
|
|
279
|
+
/** The plan the step proposed, kept on the job (AGL-2935). */
|
|
280
|
+
plan?: AiJobPlan;
|
|
281
|
+
/** The step stopped for a person: the job parks `needs_review` in this same write. */
|
|
282
|
+
review?: AiJobReview;
|
|
283
|
+
/**
|
|
284
|
+
* With `pending`: the step is handed back because it made progress and
|
|
285
|
+
* asked to continue (AGL-2910), not because an attempt failed. Its
|
|
286
|
+
* attempts count again from zero and its passes by one.
|
|
287
|
+
*/
|
|
288
|
+
continued?: boolean;
|
|
289
|
+
/** What the run cost in tokens and time (AGL-2937), added to the step's totals. */
|
|
290
|
+
tokens?: AiJobStepTokenRun;
|
|
291
|
+
}
|
|
292
|
+
/** One run of a step's runner, as the machine measured it (AGL-2937). */
|
|
293
|
+
export interface AiJobStepTokenRun {
|
|
294
|
+
usage: AiUsage;
|
|
295
|
+
model: string;
|
|
296
|
+
effort: AiEffort | null;
|
|
297
|
+
latencyMs: number;
|
|
298
|
+
/** Why the run's last model call stopped (AGL-3042). */
|
|
299
|
+
stopReason: string | null;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* The runs whose stop reasons a step's record keeps (AGL-3042), newest last.
|
|
303
|
+
* A page job that builds a layout, a form and a component, then five sections
|
|
304
|
+
* and its last pass, runs its generation step nine times: twelve keep such a
|
|
305
|
+
* page whole with room for three retries.
|
|
306
|
+
*
|
|
307
|
+
* What it costs the document: an entry is at most 67 bytes as Firestore sizes
|
|
308
|
+
* it (the two field names, 11 and 7; a stop reason, a provider's ASCII word of
|
|
309
|
+
* at most `AI_JOB_STEP_STOP_REASON_MAX_CHARS` characters, 41; an integer, 8),
|
|
310
|
+
* so a step's list is at most 813 bytes with its field name, and a job's two
|
|
311
|
+
* steps at most 1,626 of the 1,048,576 bytes a document may hold.
|
|
312
|
+
*/
|
|
313
|
+
export declare const AI_JOB_STEP_LAST_RUNS = 12;
|
|
314
|
+
/** The longest stop reason a run's entry keeps; every one a provider names today is shorter. */
|
|
315
|
+
export declare const AI_JOB_STEP_STOP_REASON_MAX_CHARS = 40;
|
|
316
|
+
/**
|
|
317
|
+
* A step's measure with one more run added: the four counts and the time
|
|
318
|
+
* summed, the model and effort taken from the run, and why it stopped
|
|
319
|
+
* appended to the latest runs (AGL-3042).
|
|
320
|
+
*/
|
|
321
|
+
export declare function addAiJobStepTokens(current: AiJobStepTokens | null | undefined, run: AiJobStepTokenRun): AiJobStepTokens;
|
|
322
|
+
export interface RecordedStep {
|
|
323
|
+
job: AiJob;
|
|
324
|
+
/** Steps still to run after this one. */
|
|
325
|
+
remaining: number;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Record what a step cost and produced, and hand the lease back.
|
|
329
|
+
*
|
|
330
|
+
* Credits and outputs are recorded whatever the job's status is by now —
|
|
331
|
+
* a job canceled while its provider call was in flight still spent the
|
|
332
|
+
* tokens, and hiding that would make the bill disagree with the document.
|
|
333
|
+
* The status transition is the caller's next call (`completeAiJob`,
|
|
334
|
+
* `failAiJob`), except that a step handed back or a step with more steps
|
|
335
|
+
* behind it re-queues here, so the beat sees it without another write —
|
|
336
|
+
* and a step that stopped for a person parks the job `needs_review` here,
|
|
337
|
+
* in the same transaction, so no beat can claim the next step in between.
|
|
338
|
+
*/
|
|
339
|
+
export declare function recordStep(firestore: Firestore, orgId: string, jobId: string, owner: string, stepIndex: number, input: RecordStepInput, now?: Date): Promise<RecordedStep>;
|
|
340
|
+
/** Every step done: the job is `done` and holds nothing. */
|
|
341
|
+
export declare function completeAiJob(firestore: Firestore, orgId: string, jobId: string, now?: Date): Promise<AiJob>;
|
|
342
|
+
/**
|
|
343
|
+
* Terminal failure. `message` is the only thing a customer reads, so it is
|
|
344
|
+
* a fixed sentence; whatever the provider or the runner actually said goes
|
|
345
|
+
* to the log beside the ids an operator would search for.
|
|
346
|
+
*/
|
|
347
|
+
export declare function failAiJob(firestore: Firestore, orgId: string, jobId: string, message: string, detail?: {
|
|
348
|
+
stepIndex?: number;
|
|
349
|
+
error?: unknown;
|
|
350
|
+
}, now?: Date): Promise<AiJob>;
|
|
351
|
+
/**
|
|
352
|
+
* Park the job for something only the workspace can change. The running
|
|
353
|
+
* step goes back to `pending` so the same step is what runs when the beat
|
|
354
|
+
* tries again; its attempt is not counted, because nothing was attempted.
|
|
355
|
+
*/
|
|
356
|
+
export declare function markAiJobNeedsInput(firestore: Firestore, orgId: string, jobId: string, reason: string, now?: Date): Promise<AiJob>;
|
|
357
|
+
/**
|
|
358
|
+
* Cancel. Idempotent — a terminal job is returned unchanged — and it does
|
|
359
|
+
* not wait for a step in flight: the runner holding the lease finishes its
|
|
360
|
+
* provider call, records what it cost, and finds the job canceled when it
|
|
361
|
+
* goes to complete it.
|
|
362
|
+
*
|
|
363
|
+
* The activity row is written only when the cancel changed something: a
|
|
364
|
+
* second cancel of the same job is not a second act. `actor` is the member
|
|
365
|
+
* who canceled; a cancel with nobody named is recorded as nobody's rather
|
|
366
|
+
* than as the creator's.
|
|
367
|
+
*/
|
|
368
|
+
export declare function cancelAiJob(firestore: Firestore, orgId: string, jobId: string, now?: Date, actor?: AiActivityActor | null): Promise<{
|
|
369
|
+
job: AiJob;
|
|
370
|
+
changed: boolean;
|
|
371
|
+
}>;
|
|
372
|
+
/**
|
|
373
|
+
* Resume a job that stopped for a person (AGL-2935): confirm its plan, or
|
|
374
|
+
* try again the step whose answer broke a building rule. One transaction,
|
|
375
|
+
* so two confirmations land once; anything but a `needs_review` job comes
|
|
376
|
+
* back unchanged. The pending step's attempts start over — a person asking
|
|
377
|
+
* again is not a provider failing again — and a confirmed plan with no step
|
|
378
|
+
* left behind it completes the job rather than queueing nothing. The steps
|
|
379
|
+
* it queues are held at the nominal figure again, which the park released —
|
|
380
|
+
* and a confirmed plan is held at what the whole job is estimated to cost
|
|
381
|
+
* (AGL-3031), creations included, where that is more.
|
|
382
|
+
*/
|
|
383
|
+
export declare function resumeAiJob(firestore: Firestore, orgId: string, jobId: string, actor: {
|
|
384
|
+
uid: string;
|
|
385
|
+
}, now?: Date): Promise<{
|
|
386
|
+
job: AiJob;
|
|
387
|
+
changed: boolean;
|
|
388
|
+
}>;
|
|
389
|
+
/**
|
|
390
|
+
* Record what a person applied from a finished job's outputs (AGL-2910): the
|
|
391
|
+
* versions an apply opened and the listings it staged. The apply door calls
|
|
392
|
+
* this after its own writes, so the record names only what exists. It never
|
|
393
|
+
* changes the job's status, its steps or its spend.
|
|
394
|
+
*/
|
|
395
|
+
export declare function recordAiJobApplied(firestore: Firestore, orgId: string, jobId: string, applied: AiJobApplied, now?: Date): Promise<AiJob>;
|
|
396
|
+
export type AiJobAuditAction = 'ai.job.output' | 'ai.job.cancel' | 'ai.job.resume' | 'ai.job.apply';
|
|
397
|
+
export interface AiJobAuditEntry {
|
|
398
|
+
action: AiJobAuditAction;
|
|
399
|
+
actorUid: string;
|
|
400
|
+
actorEmail?: string | null;
|
|
401
|
+
orgId: string;
|
|
402
|
+
jobId: string;
|
|
403
|
+
after: Record<string, unknown>;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* One `adminAudit` row, the same writer shape the billing routes use. Never
|
|
407
|
+
* throws: an audit row that fails to land is logged, not turned into a
|
|
408
|
+
* failed job the customer paid for.
|
|
409
|
+
*/
|
|
410
|
+
export declare function writeAiJobAudit(firestore: Firestore, entry: AiJobAuditEntry): Promise<void>;
|
|
411
|
+
/**
|
|
412
|
+
* The refusal in customer-safe words. The org's own wall names the switch
|
|
413
|
+
* (AGL-2653); a cap, a band and a budget are told apart because one is a
|
|
414
|
+
* figure the org set, one is what its plan sold, and one is the operator's
|
|
415
|
+
* backstop; the message cap resets on a clock the others do not.
|
|
416
|
+
*/
|
|
417
|
+
export declare function aiJobRefusalText(org: Partial<AglynOrgBilling> | null, reservation: Pick<AssistReservation, 'refusedBy' | 'budgetUsd' | 'allotment' | 'capReason' | 'overageLimitUsd' | 'overageUnpaidUsd'>): string;
|
|
418
|
+
export interface RunAiJobStepOptions {
|
|
419
|
+
/** Who is claiming: a request id or a beat id. */
|
|
420
|
+
owner: string;
|
|
421
|
+
now?: Date;
|
|
422
|
+
/**
|
|
423
|
+
* A reservation the caller already holds for THIS step — the console
|
|
424
|
+
* route's gate ladder takes one before the job exists. Every later step
|
|
425
|
+
* reserves for itself.
|
|
426
|
+
*/
|
|
427
|
+
reservation?: AssistReservation;
|
|
428
|
+
/** The org billing document when the caller has it; read otherwise. */
|
|
429
|
+
org?: Partial<AglynOrgBilling> | null;
|
|
430
|
+
/** Ends the provider call when the caller's budget does. */
|
|
431
|
+
signal?: AbortSignal;
|
|
432
|
+
/**
|
|
433
|
+
* The person on the request when a route runs the step inline. The beat
|
|
434
|
+
* has none: what a step produces is then credited to the job's creator,
|
|
435
|
+
* whose brief it is, never to nobody (AGL-2929).
|
|
436
|
+
*/
|
|
437
|
+
actor?: AiActivityActor;
|
|
438
|
+
/**
|
|
439
|
+
* A verified staff claim on the request when a route runs the step inline.
|
|
440
|
+
* The workspace's AI pause lets staff through here as the gate ladder does,
|
|
441
|
+
* so staff can verify a pause with one generation (AGL-3037). The beat has
|
|
442
|
+
* no caller and never passes it.
|
|
443
|
+
*/
|
|
444
|
+
staff?: boolean;
|
|
445
|
+
}
|
|
446
|
+
export type AiJobStepRun =
|
|
447
|
+
/** Nothing to do: terminal, parked, no step left, or another owner's lease. */
|
|
448
|
+
{
|
|
449
|
+
outcome: 'not-claimable';
|
|
450
|
+
}
|
|
451
|
+
/** The reservation was refused; the job is parked with the reason. */
|
|
452
|
+
| {
|
|
453
|
+
outcome: 'needs_input';
|
|
454
|
+
job: AiJob;
|
|
455
|
+
}
|
|
456
|
+
/** The step stopped for a person (AGL-2935): its plan waits, or its answer broke a rule twice. */
|
|
457
|
+
| {
|
|
458
|
+
outcome: 'needs_review';
|
|
459
|
+
job: AiJob;
|
|
460
|
+
}
|
|
461
|
+
/** The step ran and was recorded; `job.status` says whether more remain. */
|
|
462
|
+
| {
|
|
463
|
+
outcome: 'done';
|
|
464
|
+
job: AiJob;
|
|
465
|
+
} | {
|
|
466
|
+
outcome: 'failed';
|
|
467
|
+
job: AiJob;
|
|
468
|
+
}
|
|
469
|
+
/** A retryable provider failure; the step is pending again. */
|
|
470
|
+
| {
|
|
471
|
+
outcome: 'requeued';
|
|
472
|
+
job: AiJob;
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* AI is paused for the job's workspace (AGL-3037): nothing was claimed,
|
|
476
|
+
* reserved or run, and the job waits where it stopped, at the back of the
|
|
477
|
+
* beat's queue, until staff resume AI.
|
|
478
|
+
*/
|
|
479
|
+
| {
|
|
480
|
+
outcome: 'paused';
|
|
481
|
+
job: AiJob;
|
|
482
|
+
};
|
|
483
|
+
/** A step outcome that carries no tokens and no cost: the provider was never reached. */
|
|
484
|
+
export declare function aiJobStepSpentNothing(outcome: Pick<AiJobStepOutcome, 'usage' | 'estCostUsd'>): boolean;
|
|
485
|
+
/**
|
|
486
|
+
* Pause, claim, reserve, run, meter, record — one step of one job.
|
|
487
|
+
*
|
|
488
|
+
* The order is the invariant. The workspace's AI pause is asked BEFORE the
|
|
489
|
+
* claim, so a paused workspace's job is neither claimed nor reserved for.
|
|
490
|
+
* The reservation is taken AFTER the claim so a refused claim costs nothing,
|
|
491
|
+
* and BEFORE the runner so the org's ceiling binds before a token is spent.
|
|
492
|
+
* The cost is recorded before the step is, so a process cut off between the
|
|
493
|
+
* two leaves the bill right and the step recoverable, never the other way
|
|
494
|
+
* round.
|
|
495
|
+
*/
|
|
496
|
+
export declare function runAiJobStep(firestore: Firestore, orgId: string, jobId: string, options: RunAiJobStepOptions): Promise<AiJobStepRun>;
|
|
497
|
+
export interface DueAiJob {
|
|
498
|
+
orgId: string;
|
|
499
|
+
jobId: string;
|
|
500
|
+
}
|
|
501
|
+
export interface SweepAiJobsOptions {
|
|
502
|
+
firestore: Firestore;
|
|
503
|
+
/** The beat's identity for its leases. */
|
|
504
|
+
owner: string;
|
|
505
|
+
now?: () => number;
|
|
506
|
+
budgetMs?: number;
|
|
507
|
+
maxJobs?: number;
|
|
508
|
+
/** Test seams; the defaults query Firestore and run the real step. */
|
|
509
|
+
listDue?: () => Promise<DueAiJob[]>;
|
|
510
|
+
runStep?: (orgId: string, jobId: string, options: RunAiJobStepOptions) => Promise<AiJobStepRun>;
|
|
511
|
+
}
|
|
512
|
+
export interface SweepAiJobsResult {
|
|
513
|
+
/** Candidates the queries returned. */
|
|
514
|
+
due: number;
|
|
515
|
+
/** Steps this sweep actually ran to a recorded result. */
|
|
516
|
+
ran: number;
|
|
517
|
+
/** Claims another owner held, or jobs with nothing left. */
|
|
518
|
+
skipped: number;
|
|
519
|
+
/**
|
|
520
|
+
* Jobs whose workspace's AI staff have paused (AGL-3037): held where they
|
|
521
|
+
* stopped and moved to the back of the queue, to run once AI is resumed.
|
|
522
|
+
*/
|
|
523
|
+
paused: number;
|
|
524
|
+
/** Candidates left untouched because the wall clock ran out. */
|
|
525
|
+
remaining: number;
|
|
526
|
+
budgetExhausted: boolean;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Every job the beat should look at, oldest first: queued and running
|
|
530
|
+
* across every org, then `needs_input` jobs that have rested long enough
|
|
531
|
+
* for the org's standing to have changed. Two queries rather than one, so
|
|
532
|
+
* a workspace with many parked jobs cannot fill the candidate list and
|
|
533
|
+
* starve the queue behind it. Both use the collection-group index on
|
|
534
|
+
* (status, updatedAt).
|
|
535
|
+
*
|
|
536
|
+
* The ordering is the cursor. A job this sweep touches has its `updatedAt`
|
|
537
|
+
* moved and goes to the back of the next query; one it did not reach keeps
|
|
538
|
+
* its place at the front. So there is no stored position to fall behind
|
|
539
|
+
* or skip past — the same shape `media-move.ts` gives its budgeted loop,
|
|
540
|
+
* where what was not done is simply what is asked for next.
|
|
541
|
+
*/
|
|
542
|
+
export declare function listDueAiJobs(firestore: Firestore, nowMs: number, maxJobs?: number, maxParked?: number): Promise<DueAiJob[]>;
|
|
543
|
+
/**
|
|
544
|
+
* Run due steps until the budget is spent, and account for every candidate.
|
|
545
|
+
*
|
|
546
|
+
* The bound is wall clock, not a count, for the reason `media-move.ts`
|
|
547
|
+
* gives: one step is one provider round trip of unknown length, so any
|
|
548
|
+
* fixed number would be wrong for some brief. The budget is checked BETWEEN
|
|
549
|
+
* jobs, and the step in flight gets the time that is left as its abort
|
|
550
|
+
* signal, so the sweep still finishes whichever step it has started. At
|
|
551
|
+
* least one candidate is always attempted, so a beat that yields having
|
|
552
|
+
* done nothing cannot starve a queue behind a slow clock.
|
|
553
|
+
*
|
|
554
|
+
* A `needs_input` job is re-queued before its step is claimed, because the
|
|
555
|
+
* claim admits only queued and running jobs; the reservation inside the
|
|
556
|
+
* step is what decides whether the org's standing has changed.
|
|
557
|
+
*/
|
|
558
|
+
export declare function sweepAiJobs(options: SweepAiJobsOptions): Promise<SweepAiJobsResult>;
|