@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,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { DUPLICABLE_HOST_RESOURCE_KINDS, DUPLICATE_NAME_MAX, isDuplicableHostResourceKind } from "@aglyn/aglyn/app-utils/duplicate-resource";
|
|
17
|
+
import { hostRoleCanWrite } from "@aglyn/aglyn/app-utils/organizations";
|
|
18
|
+
import { orgPermissionLabel } from "@aglyn/aglyn/app-utils/org-permissions";
|
|
19
|
+
import { duplicateResource } from "@aglyn/tenant-data-admin/server/duplicate-resource";
|
|
20
|
+
import { getOrgForUser, memberHasPermissionOnHost } from "@aglyn/tenant-data-admin/server/organizations";
|
|
21
|
+
/**
|
|
22
|
+
* The `duplicate_resource` tool (AGL-2936, AGL-2984): a model that would
|
|
23
|
+
* rebuild something the site already has copies it instead, through core's
|
|
24
|
+
* `duplicateResource` — the same copy the row menus and the console door
|
|
25
|
+
* make, with the same uniqueness rules, the same band arithmetic and the same
|
|
26
|
+
* activity rows.
|
|
27
|
+
*
|
|
28
|
+
* It spends no tokens of its own, so it calls no provider: it runs inside a
|
|
29
|
+
* door or a job step that has already climbed `aiGateLadder`, and takes that
|
|
30
|
+
* ladder's context as its proof — the caller is signed in and verified, the
|
|
31
|
+
* release flag, entitlement and lockdown rungs admitted the request, and the
|
|
32
|
+
* workspace's band and caps admitted a reservation. On top of that it asks
|
|
33
|
+
* what a copy needs whichever door called it: `ai.generate`, because a copy
|
|
34
|
+
* is a generation's output, and a host role that may write the site, because
|
|
35
|
+
* the copy lands there.
|
|
36
|
+
*
|
|
37
|
+
* DRAFTS ONLY, by construction of the copy: a screen copy has no route, a
|
|
38
|
+
* workflow copy no trigger, and nothing places a component, layout or form
|
|
39
|
+
* copy until a person does.
|
|
40
|
+
*/ export const AI_DUPLICATE_RESOURCE_TOOL_NAME = 'duplicate_resource';
|
|
41
|
+
/** The structured-output tool a generation offers the model. */ export const AI_DUPLICATE_RESOURCE_TOOL = {
|
|
42
|
+
name: AI_DUPLICATE_RESOURCE_TOOL_NAME,
|
|
43
|
+
description: 'Copy a resource this site already has — a screen, an email design, a component, a layout, ' + 'a template, a form or a workflow — as a new draft to build from, instead of creating it again. ' + 'The copy is unpublished: it has no address, runs nothing and is placed nowhere until a person does.',
|
|
44
|
+
inputSchema: {
|
|
45
|
+
type: 'object',
|
|
46
|
+
properties: {
|
|
47
|
+
kind: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
enum: [
|
|
50
|
+
...DUPLICABLE_HOST_RESOURCE_KINDS
|
|
51
|
+
],
|
|
52
|
+
description: 'The kind of resource to copy.'
|
|
53
|
+
},
|
|
54
|
+
sourceId: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
description: 'The id of the resource to copy, as the site inventory lists it.'
|
|
57
|
+
},
|
|
58
|
+
name: {
|
|
59
|
+
type: [
|
|
60
|
+
'string',
|
|
61
|
+
'null'
|
|
62
|
+
],
|
|
63
|
+
description: `The copy's name, at most ${DUPLICATE_NAME_MAX} characters, or null for "Copy of" the source's name.`
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
required: [
|
|
67
|
+
'kind',
|
|
68
|
+
'sourceId',
|
|
69
|
+
'name'
|
|
70
|
+
],
|
|
71
|
+
additionalProperties: false
|
|
72
|
+
},
|
|
73
|
+
strict: true
|
|
74
|
+
};
|
|
75
|
+
/** Reads a tool call's input; `null` when it is not one this tool accepts. */ export function parseAiDuplicateResourceInput(input) {
|
|
76
|
+
const kind = input['kind'];
|
|
77
|
+
const sourceId = typeof input['sourceId'] === 'string' ? input['sourceId'].trim() : '';
|
|
78
|
+
const name = input['name'];
|
|
79
|
+
if (!isDuplicableHostResourceKind(kind)) return null;
|
|
80
|
+
if (!sourceId || sourceId.length > 64 || sourceId.includes('/')) return null;
|
|
81
|
+
if (name !== null && typeof name !== 'string') return null;
|
|
82
|
+
const trimmed = typeof name === 'string' ? name.trim().slice(0, DUPLICATE_NAME_MAX) : '';
|
|
83
|
+
return {
|
|
84
|
+
kind,
|
|
85
|
+
sourceId,
|
|
86
|
+
name: trimmed || null
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Makes the copy on `hostId` for the person the gate admitted. Refusals are
|
|
91
|
+
* outcomes, never throws: a model's call that names a missing source or a
|
|
92
|
+
* full band is an answer to relay, not a fault.
|
|
93
|
+
*/ export async function runAiDuplicateResourceTool(context, input) {
|
|
94
|
+
var _context_hostId, _host_get;
|
|
95
|
+
var _gate_reservation;
|
|
96
|
+
const { gate } = context;
|
|
97
|
+
const hostId = String((_context_hostId = context.hostId) != null ? _context_hostId : '').trim();
|
|
98
|
+
const parsed = parseAiDuplicateResourceInput(input);
|
|
99
|
+
if (!parsed) return {
|
|
100
|
+
ok: false,
|
|
101
|
+
status: 400,
|
|
102
|
+
error: 'That is not a resource this site can copy'
|
|
103
|
+
};
|
|
104
|
+
if (!((_gate_reservation = gate.reservation) == null ? void 0 : _gate_reservation.allowed)) {
|
|
105
|
+
return {
|
|
106
|
+
ok: false,
|
|
107
|
+
status: 429,
|
|
108
|
+
error: 'This workspace cannot run AI requests right now'
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
if (!hostId) return {
|
|
112
|
+
ok: false,
|
|
113
|
+
status: 400,
|
|
114
|
+
error: 'Name the site to copy on'
|
|
115
|
+
};
|
|
116
|
+
const host = await gate.firestore.collection('hosts').doc(hostId).get();
|
|
117
|
+
// A site of another workspace is a site this request cannot see.
|
|
118
|
+
if (!host.exists || host.get('orgId') !== gate.orgId) {
|
|
119
|
+
return {
|
|
120
|
+
ok: false,
|
|
121
|
+
status: 404,
|
|
122
|
+
error: 'Unknown site'
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (!gate.staff) {
|
|
126
|
+
const membership = await getOrgForUser(gate.uid, gate.orgId);
|
|
127
|
+
const permitted = (membership == null ? void 0 : membership.orgId) === gate.orgId && await memberHasPermissionOnHost(gate.orgId, hostId, membership.member, 'ai.generate');
|
|
128
|
+
if (!permitted) {
|
|
129
|
+
return {
|
|
130
|
+
ok: false,
|
|
131
|
+
status: 403,
|
|
132
|
+
error: `Your role does not include "${orgPermissionLabel('ai.generate')}" — ask an organization admin`
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const memberRole = ((_host_get = host.get('memberRoles')) != null ? _host_get : {})[gate.uid];
|
|
137
|
+
if (!hostRoleCanWrite(memberRole)) {
|
|
138
|
+
return {
|
|
139
|
+
ok: false,
|
|
140
|
+
status: 403,
|
|
141
|
+
error: 'Editing requires the editor role'
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const result = await duplicateResource(parsed.kind, {
|
|
145
|
+
orgId: gate.orgId,
|
|
146
|
+
hostId,
|
|
147
|
+
sourceId: parsed.sourceId,
|
|
148
|
+
name: parsed.name,
|
|
149
|
+
uid: gate.uid,
|
|
150
|
+
email: gate.decoded.email ? String(gate.decoded.email) : null,
|
|
151
|
+
org: gate.org,
|
|
152
|
+
attemptKey: null
|
|
153
|
+
});
|
|
154
|
+
if (result.ok === false) return result;
|
|
155
|
+
return {
|
|
156
|
+
ok: true,
|
|
157
|
+
kind: parsed.kind,
|
|
158
|
+
id: result.id,
|
|
159
|
+
versionId: result.versionId,
|
|
160
|
+
name: result.name
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
//# sourceMappingURL=ai-duplicate-resource-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/tools/ai-duplicate-resource-tool.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n DUPLICABLE_HOST_RESOURCE_KINDS,\n DUPLICATE_NAME_MAX,\n isDuplicableHostResourceKind,\n type DuplicableHostResourceKind,\n} from '@aglyn/aglyn/app-utils/duplicate-resource'\nimport { hostRoleCanWrite } from '@aglyn/aglyn/app-utils/organizations'\nimport { orgPermissionLabel } from '@aglyn/aglyn/app-utils/org-permissions'\nimport { duplicateResource } from '@aglyn/tenant-data-admin/server/duplicate-resource'\nimport {\n getOrgForUser,\n memberHasPermissionOnHost,\n} from '@aglyn/tenant-data-admin/server/organizations'\nimport type { AiTool } from '../providers/contract'\nimport type { AiGateContext } from '../runtime/ai-gate'\n\n/**\n * The `duplicate_resource` tool (AGL-2936, AGL-2984): a model that would\n * rebuild something the site already has copies it instead, through core's\n * `duplicateResource` — the same copy the row menus and the console door\n * make, with the same uniqueness rules, the same band arithmetic and the same\n * activity rows.\n *\n * It spends no tokens of its own, so it calls no provider: it runs inside a\n * door or a job step that has already climbed `aiGateLadder`, and takes that\n * ladder's context as its proof — the caller is signed in and verified, the\n * release flag, entitlement and lockdown rungs admitted the request, and the\n * workspace's band and caps admitted a reservation. On top of that it asks\n * what a copy needs whichever door called it: `ai.generate`, because a copy\n * is a generation's output, and a host role that may write the site, because\n * the copy lands there.\n *\n * DRAFTS ONLY, by construction of the copy: a screen copy has no route, a\n * workflow copy no trigger, and nothing places a component, layout or form\n * copy until a person does.\n */\n\nexport const AI_DUPLICATE_RESOURCE_TOOL_NAME = 'duplicate_resource'\n\n/** The structured-output tool a generation offers the model. */\nexport const AI_DUPLICATE_RESOURCE_TOOL: AiTool = {\n name: AI_DUPLICATE_RESOURCE_TOOL_NAME,\n description:\n 'Copy a resource this site already has — a screen, an email design, a component, a layout, ' +\n 'a template, a form or a workflow — as a new draft to build from, instead of creating it again. ' +\n 'The copy is unpublished: it has no address, runs nothing and is placed nowhere until a person does.',\n inputSchema: {\n type: 'object',\n properties: {\n kind: {\n type: 'string',\n enum: [...DUPLICABLE_HOST_RESOURCE_KINDS],\n description: 'The kind of resource to copy.',\n },\n sourceId: {\n type: 'string',\n description: 'The id of the resource to copy, as the site inventory lists it.',\n },\n name: {\n type: ['string', 'null'],\n description: `The copy's name, at most ${DUPLICATE_NAME_MAX} characters, or null for \"Copy of\" the source's name.`,\n },\n },\n required: ['kind', 'sourceId', 'name'],\n additionalProperties: false,\n },\n strict: true,\n}\n\n/** A tool call's input, read. */\nexport type AiDuplicateResourceInput = {\n kind: DuplicableHostResourceKind\n sourceId: string\n name: string | null\n}\n\n/** What the tool answers: the copy, or a refusal the caller can relay. */\nexport type AiDuplicateResourceOutcome =\n | { ok: true; kind: DuplicableHostResourceKind; id: string; versionId: string | null; name: string }\n | { ok: false; status: number; error: string }\n\n/** Reads a tool call's input; `null` when it is not one this tool accepts. */\nexport function parseAiDuplicateResourceInput(\n input: Record<string, unknown>,\n): AiDuplicateResourceInput | null {\n const kind = input['kind']\n const sourceId = typeof input['sourceId'] === 'string' ? input['sourceId'].trim() : ''\n const name = input['name']\n if (!isDuplicableHostResourceKind(kind)) return null\n if (!sourceId || sourceId.length > 64 || sourceId.includes('/')) return null\n if (name !== null && typeof name !== 'string') return null\n const trimmed = typeof name === 'string' ? name.trim().slice(0, DUPLICATE_NAME_MAX) : ''\n return { kind, sourceId, name: trimmed || null }\n}\n\n/**\n * Makes the copy on `hostId` for the person the gate admitted. Refusals are\n * outcomes, never throws: a model's call that names a missing source or a\n * full band is an answer to relay, not a fault.\n */\nexport async function runAiDuplicateResourceTool(\n context: { gate: AiGateContext; hostId: string },\n input: Record<string, unknown>,\n): Promise<AiDuplicateResourceOutcome> {\n const { gate } = context\n const hostId = String(context.hostId ?? '').trim()\n const parsed = parseAiDuplicateResourceInput(input)\n if (!parsed) return { ok: false, status: 400, error: 'That is not a resource this site can copy' }\n if (!gate.reservation?.allowed) {\n return { ok: false, status: 429, error: 'This workspace cannot run AI requests right now' }\n }\n if (!hostId) return { ok: false, status: 400, error: 'Name the site to copy on' }\n\n const host = await gate.firestore.collection('hosts').doc(hostId).get()\n // A site of another workspace is a site this request cannot see.\n if (!host.exists || host.get('orgId') !== gate.orgId) {\n return { ok: false, status: 404, error: 'Unknown site' }\n }\n if (!gate.staff) {\n const membership = await getOrgForUser(gate.uid, gate.orgId)\n const permitted =\n membership?.orgId === gate.orgId &&\n (await memberHasPermissionOnHost(gate.orgId, hostId, membership.member, 'ai.generate'))\n if (!permitted) {\n return {\n ok: false,\n status: 403,\n error: `Your role does not include \"${orgPermissionLabel('ai.generate')}\" — ask an organization admin`,\n }\n }\n }\n const memberRole = ((host.get('memberRoles') ?? {}) as Record<string, unknown>)[gate.uid]\n if (!hostRoleCanWrite(memberRole)) {\n return { ok: false, status: 403, error: 'Editing requires the editor role' }\n }\n\n const result = await duplicateResource(parsed.kind, {\n orgId: gate.orgId,\n hostId,\n sourceId: parsed.sourceId,\n name: parsed.name,\n uid: gate.uid,\n email: gate.decoded.email ? String(gate.decoded.email) : null,\n org: gate.org as Record<string, unknown>,\n attemptKey: null,\n })\n if (result.ok === false) return result\n return {\n ok: true,\n kind: parsed.kind,\n id: result.id,\n versionId: result.versionId,\n name: result.name,\n }\n}\n"],"names":["DUPLICABLE_HOST_RESOURCE_KINDS","DUPLICATE_NAME_MAX","isDuplicableHostResourceKind","hostRoleCanWrite","orgPermissionLabel","duplicateResource","getOrgForUser","memberHasPermissionOnHost","AI_DUPLICATE_RESOURCE_TOOL_NAME","AI_DUPLICATE_RESOURCE_TOOL","name","description","inputSchema","type","properties","kind","enum","sourceId","required","additionalProperties","strict","parseAiDuplicateResourceInput","input","trim","length","includes","trimmed","slice","runAiDuplicateResourceTool","context","host","gate","hostId","String","parsed","ok","status","error","reservation","allowed","firestore","collection","doc","get","exists","orgId","staff","membership","uid","permitted","member","memberRole","result","email","decoded","org","attemptKey","id","versionId"],"mappings":"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"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 AiExperimentExplanationAnswer, type AiExperimentTarget, type AiExperimentVariantsProposal } from '../model/ai-experiment';
|
|
18
|
+
import type { AiTool } from '../providers/contract';
|
|
19
|
+
/**
|
|
20
|
+
* The two strict tools an `experiment` job answers through (AGL-2914).
|
|
21
|
+
*
|
|
22
|
+
* `propose_variants` writes copy for the thing under test and nothing else:
|
|
23
|
+
* no weights, no traffic split, no schedule, no winner — those are the A/B
|
|
24
|
+
* testing card's, and a model that could name them could start a test.
|
|
25
|
+
* `explain_result` writes the words for a verdict code already reached, and
|
|
26
|
+
* carries a `winner` field only so an answer that names one can be caught:
|
|
27
|
+
* `checkAiExperimentExplanation` decides what is kept, never this schema.
|
|
28
|
+
*/
|
|
29
|
+
export declare const AI_EXPERIMENT_VARIANTS_TOOL_NAME = "propose_variants";
|
|
30
|
+
export declare const AI_EXPERIMENT_EXPLAIN_TOOL_NAME = "explain_result";
|
|
31
|
+
export declare function aiExperimentVariantsTool(target: AiExperimentTarget): AiTool;
|
|
32
|
+
export declare function aiExperimentExplainTool(): AiTool;
|
|
33
|
+
/**
|
|
34
|
+
* A `propose_variants` call as the check reads it, or `null` when the call is
|
|
35
|
+
* not a proposal at all. Values keep the lengths the model wrote, so the
|
|
36
|
+
* check — not this reader — decides what is too long.
|
|
37
|
+
*/
|
|
38
|
+
export declare function parseAiExperimentVariants(input: unknown): AiExperimentVariantsProposal | null;
|
|
39
|
+
/** An `explain_result` call as the check reads it, or `null` when it is not one. */
|
|
40
|
+
export declare function parseAiExperimentExplanation(input: unknown): AiExperimentExplanationAnswer | null;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { AI_EXPERIMENT_BODY_MAX_CHARS, AI_EXPERIMENT_HEADLINE_MAX_CHARS, AI_EXPERIMENT_LINE_MAX_CHARS, AI_EXPERIMENT_MAX_POINTS, AI_EXPERIMENT_MAX_VARIANTS, AI_EXPERIMENT_MIN_VARIANTS, AI_EXPERIMENT_NAME_MAX_CHARS, AI_EXPERIMENT_NEXT_MAX_CHARS, AI_EXPERIMENT_POINT_MAX_CHARS, AI_EXPERIMENT_RATIONALE_MAX_CHARS, aiExperimentVariantFields } from "../model/ai-experiment.js";
|
|
17
|
+
/**
|
|
18
|
+
* The two strict tools an `experiment` job answers through (AGL-2914).
|
|
19
|
+
*
|
|
20
|
+
* `propose_variants` writes copy for the thing under test and nothing else:
|
|
21
|
+
* no weights, no traffic split, no schedule, no winner — those are the A/B
|
|
22
|
+
* testing card's, and a model that could name them could start a test.
|
|
23
|
+
* `explain_result` writes the words for a verdict code already reached, and
|
|
24
|
+
* carries a `winner` field only so an answer that names one can be caught:
|
|
25
|
+
* `checkAiExperimentExplanation` decides what is kept, never this schema.
|
|
26
|
+
*/ export const AI_EXPERIMENT_VARIANTS_TOOL_NAME = 'propose_variants';
|
|
27
|
+
export const AI_EXPERIMENT_EXPLAIN_TOOL_NAME = 'explain_result';
|
|
28
|
+
/** The copy fields a target's variants fill, as the tool describes them. */ const FIELD_HELP = {
|
|
29
|
+
headline: `The variant's main line of copy; at most ${AI_EXPERIMENT_LINE_MAX_CHARS} characters. Empty string when this variant does not change it.`,
|
|
30
|
+
body: `The variant's supporting copy; at most ${AI_EXPERIMENT_BODY_MAX_CHARS} characters. Empty string when this variant does not change it.`,
|
|
31
|
+
subject: `The variant's subject line; at most ${AI_EXPERIMENT_LINE_MAX_CHARS} characters. Empty string when this variant does not change it.`,
|
|
32
|
+
preheader: `The variant's preheader, the line shown beside the subject; at most ${AI_EXPERIMENT_LINE_MAX_CHARS} characters. Empty string when this variant does not change it.`
|
|
33
|
+
};
|
|
34
|
+
export function aiExperimentVariantsTool(target) {
|
|
35
|
+
const fields = aiExperimentVariantFields(target).filter((field)=>field !== 'name' && field !== 'rationale');
|
|
36
|
+
const properties = {
|
|
37
|
+
name: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
description: `What to call this variant, in a few words; at most ${AI_EXPERIMENT_NAME_MAX_CHARS} characters.`
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
for (const field of fields){
|
|
43
|
+
properties[field] = {
|
|
44
|
+
type: 'string',
|
|
45
|
+
description: FIELD_HELP[field]
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
properties['rationale'] = {
|
|
49
|
+
type: 'string',
|
|
50
|
+
description: `One sentence: what this variant changes and what that is testing; at most ${AI_EXPERIMENT_RATIONALE_MAX_CHARS} characters.`
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
name: AI_EXPERIMENT_VARIANTS_TOOL_NAME,
|
|
54
|
+
description: `Propose between ${AI_EXPERIMENT_MIN_VARIANTS} and ${AI_EXPERIMENT_MAX_VARIANTS} variants for the ` + 'A/B test, the first of them the copy already there. Every field is required.',
|
|
55
|
+
strict: true,
|
|
56
|
+
inputSchema: {
|
|
57
|
+
type: 'object',
|
|
58
|
+
properties: {
|
|
59
|
+
goal: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
description: `What these variants are trying to move, in one short phrase; at most ${AI_EXPERIMENT_RATIONALE_MAX_CHARS} characters.`
|
|
62
|
+
},
|
|
63
|
+
variants: {
|
|
64
|
+
type: 'array',
|
|
65
|
+
description: `The first is the copy under test as it stands; at most ${AI_EXPERIMENT_MAX_VARIANTS} in all. Each varies one idea, and no two say the same thing.`,
|
|
66
|
+
items: {
|
|
67
|
+
type: 'object',
|
|
68
|
+
properties,
|
|
69
|
+
required: [
|
|
70
|
+
'name',
|
|
71
|
+
...fields,
|
|
72
|
+
'rationale'
|
|
73
|
+
],
|
|
74
|
+
additionalProperties: false
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
required: [
|
|
79
|
+
'goal',
|
|
80
|
+
'variants'
|
|
81
|
+
],
|
|
82
|
+
additionalProperties: false
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export function aiExperimentExplainTool() {
|
|
87
|
+
return {
|
|
88
|
+
name: AI_EXPERIMENT_EXPLAIN_TOOL_NAME,
|
|
89
|
+
description: 'Explain what this result means, in the words of the verdict the request states. ' + 'Every field is required.',
|
|
90
|
+
strict: true,
|
|
91
|
+
inputSchema: {
|
|
92
|
+
type: 'object',
|
|
93
|
+
properties: {
|
|
94
|
+
headline: {
|
|
95
|
+
type: 'string',
|
|
96
|
+
description: `One plain sentence saying what happened; at most ${AI_EXPERIMENT_HEADLINE_MAX_CHARS} characters.`
|
|
97
|
+
},
|
|
98
|
+
points: {
|
|
99
|
+
type: 'array',
|
|
100
|
+
description: `What the figures show, most useful first; at most ${AI_EXPERIMENT_MAX_POINTS}. Empty when the headline says it all.`,
|
|
101
|
+
items: {
|
|
102
|
+
type: 'string',
|
|
103
|
+
description: `One plain sentence; at most ${AI_EXPERIMENT_POINT_MAX_CHARS} characters.`
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
winner: {
|
|
107
|
+
type: 'string',
|
|
108
|
+
description: 'The variant the request states won, exactly as the figures name it. Empty string where the request states there is no winner yet.'
|
|
109
|
+
},
|
|
110
|
+
next: {
|
|
111
|
+
type: 'string',
|
|
112
|
+
description: `What to do next; at most ${AI_EXPERIMENT_NEXT_MAX_CHARS} characters. Empty string where the request states there is no winner yet.`
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
required: [
|
|
116
|
+
'headline',
|
|
117
|
+
'points',
|
|
118
|
+
'winner',
|
|
119
|
+
'next'
|
|
120
|
+
],
|
|
121
|
+
additionalProperties: false
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
const isRecord = (value)=>typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
126
|
+
const str = (value)=>typeof value === 'string' ? value : '';
|
|
127
|
+
/**
|
|
128
|
+
* A `propose_variants` call as the check reads it, or `null` when the call is
|
|
129
|
+
* not a proposal at all. Values keep the lengths the model wrote, so the
|
|
130
|
+
* check — not this reader — decides what is too long.
|
|
131
|
+
*/ export function parseAiExperimentVariants(input) {
|
|
132
|
+
if (!isRecord(input) || !Array.isArray(input['variants'])) return null;
|
|
133
|
+
return {
|
|
134
|
+
goal: str(input['goal']),
|
|
135
|
+
variants: input['variants'].filter(isRecord).map((raw)=>({
|
|
136
|
+
name: str(raw['name']),
|
|
137
|
+
headline: str(raw['headline']),
|
|
138
|
+
body: str(raw['body']),
|
|
139
|
+
subject: str(raw['subject']),
|
|
140
|
+
preheader: str(raw['preheader']),
|
|
141
|
+
rationale: str(raw['rationale'])
|
|
142
|
+
}))
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/** An `explain_result` call as the check reads it, or `null` when it is not one. */ export function parseAiExperimentExplanation(input) {
|
|
146
|
+
if (!isRecord(input) || typeof input['headline'] !== 'string') return null;
|
|
147
|
+
return {
|
|
148
|
+
headline: input['headline'],
|
|
149
|
+
points: (Array.isArray(input['points']) ? input['points'] : []).map(str),
|
|
150
|
+
winner: str(input['winner']),
|
|
151
|
+
next: str(input['next'])
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
//# sourceMappingURL=ai-experiment-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/tools/ai-experiment-tool.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AI_EXPERIMENT_BODY_MAX_CHARS,\n AI_EXPERIMENT_HEADLINE_MAX_CHARS,\n AI_EXPERIMENT_LINE_MAX_CHARS,\n AI_EXPERIMENT_MAX_POINTS,\n AI_EXPERIMENT_MAX_VARIANTS,\n AI_EXPERIMENT_MIN_VARIANTS,\n AI_EXPERIMENT_NAME_MAX_CHARS,\n AI_EXPERIMENT_NEXT_MAX_CHARS,\n AI_EXPERIMENT_POINT_MAX_CHARS,\n AI_EXPERIMENT_RATIONALE_MAX_CHARS,\n aiExperimentVariantFields,\n type AiExperimentExplanationAnswer,\n type AiExperimentTarget,\n type AiExperimentVariantsProposal,\n} from '../model/ai-experiment'\nimport type { AiTool } from '../providers/contract'\n\n/**\n * The two strict tools an `experiment` job answers through (AGL-2914).\n *\n * `propose_variants` writes copy for the thing under test and nothing else:\n * no weights, no traffic split, no schedule, no winner — those are the A/B\n * testing card's, and a model that could name them could start a test.\n * `explain_result` writes the words for a verdict code already reached, and\n * carries a `winner` field only so an answer that names one can be caught:\n * `checkAiExperimentExplanation` decides what is kept, never this schema.\n */\n\nexport const AI_EXPERIMENT_VARIANTS_TOOL_NAME = 'propose_variants'\nexport const AI_EXPERIMENT_EXPLAIN_TOOL_NAME = 'explain_result'\n\n/** The copy fields a target's variants fill, as the tool describes them. */\nconst FIELD_HELP: Record<\n 'headline' | 'body' | 'subject' | 'preheader',\n string\n> = {\n headline: `The variant's main line of copy; at most ${AI_EXPERIMENT_LINE_MAX_CHARS} characters. Empty string when this variant does not change it.`,\n body: `The variant's supporting copy; at most ${AI_EXPERIMENT_BODY_MAX_CHARS} characters. Empty string when this variant does not change it.`,\n subject: `The variant's subject line; at most ${AI_EXPERIMENT_LINE_MAX_CHARS} characters. Empty string when this variant does not change it.`,\n preheader: `The variant's preheader, the line shown beside the subject; at most ${AI_EXPERIMENT_LINE_MAX_CHARS} characters. Empty string when this variant does not change it.`,\n}\n\nexport function aiExperimentVariantsTool(target: AiExperimentTarget): AiTool {\n const fields = aiExperimentVariantFields(target).filter(\n (field): field is 'headline' | 'body' | 'subject' | 'preheader' =>\n field !== 'name' && field !== 'rationale',\n )\n const properties: Record<string, unknown> = {\n name: {\n type: 'string',\n description: `What to call this variant, in a few words; at most ${AI_EXPERIMENT_NAME_MAX_CHARS} characters.`,\n },\n }\n for (const field of fields) {\n properties[field] = { type: 'string', description: FIELD_HELP[field] }\n }\n properties['rationale'] = {\n type: 'string',\n description: `One sentence: what this variant changes and what that is testing; at most ${AI_EXPERIMENT_RATIONALE_MAX_CHARS} characters.`,\n }\n return {\n name: AI_EXPERIMENT_VARIANTS_TOOL_NAME,\n description:\n `Propose between ${AI_EXPERIMENT_MIN_VARIANTS} and ${AI_EXPERIMENT_MAX_VARIANTS} variants for the ` +\n 'A/B test, the first of them the copy already there. Every field is required.',\n strict: true,\n inputSchema: {\n type: 'object',\n properties: {\n goal: {\n type: 'string',\n description: `What these variants are trying to move, in one short phrase; at most ${AI_EXPERIMENT_RATIONALE_MAX_CHARS} characters.`,\n },\n variants: {\n type: 'array',\n description: `The first is the copy under test as it stands; at most ${AI_EXPERIMENT_MAX_VARIANTS} in all. Each varies one idea, and no two say the same thing.`,\n items: {\n type: 'object',\n properties,\n required: ['name', ...fields, 'rationale'],\n additionalProperties: false,\n },\n },\n },\n required: ['goal', 'variants'],\n additionalProperties: false,\n },\n }\n}\n\nexport function aiExperimentExplainTool(): AiTool {\n return {\n name: AI_EXPERIMENT_EXPLAIN_TOOL_NAME,\n description:\n 'Explain what this result means, in the words of the verdict the request states. ' +\n 'Every field is required.',\n strict: true,\n inputSchema: {\n type: 'object',\n properties: {\n headline: {\n type: 'string',\n description: `One plain sentence saying what happened; at most ${AI_EXPERIMENT_HEADLINE_MAX_CHARS} characters.`,\n },\n points: {\n type: 'array',\n description: `What the figures show, most useful first; at most ${AI_EXPERIMENT_MAX_POINTS}. Empty when the headline says it all.`,\n items: {\n type: 'string',\n description: `One plain sentence; at most ${AI_EXPERIMENT_POINT_MAX_CHARS} characters.`,\n },\n },\n winner: {\n type: 'string',\n description:\n 'The variant the request states won, exactly as the figures name it. Empty string where the request states there is no winner yet.',\n },\n next: {\n type: 'string',\n description: `What to do next; at most ${AI_EXPERIMENT_NEXT_MAX_CHARS} characters. Empty string where the request states there is no winner yet.`,\n },\n },\n required: ['headline', 'points', 'winner', 'next'],\n additionalProperties: false,\n },\n }\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\n\nconst str = (value: unknown): string => (typeof value === 'string' ? value : '')\n\n/**\n * A `propose_variants` call as the check reads it, or `null` when the call is\n * not a proposal at all. Values keep the lengths the model wrote, so the\n * check — not this reader — decides what is too long.\n */\nexport function parseAiExperimentVariants(\n input: unknown,\n): AiExperimentVariantsProposal | null {\n if (!isRecord(input) || !Array.isArray(input['variants'])) return null\n return {\n goal: str(input['goal']),\n variants: input['variants'].filter(isRecord).map((raw) => ({\n name: str(raw['name']),\n headline: str(raw['headline']),\n body: str(raw['body']),\n subject: str(raw['subject']),\n preheader: str(raw['preheader']),\n rationale: str(raw['rationale']),\n })),\n }\n}\n\n/** An `explain_result` call as the check reads it, or `null` when it is not one. */\nexport function parseAiExperimentExplanation(\n input: unknown,\n): AiExperimentExplanationAnswer | null {\n if (!isRecord(input) || typeof input['headline'] !== 'string') return null\n return {\n headline: input['headline'],\n points: (Array.isArray(input['points']) ? input['points'] : []).map(str),\n winner: str(input['winner']),\n next: str(input['next']),\n }\n}\n"],"names":["AI_EXPERIMENT_BODY_MAX_CHARS","AI_EXPERIMENT_HEADLINE_MAX_CHARS","AI_EXPERIMENT_LINE_MAX_CHARS","AI_EXPERIMENT_MAX_POINTS","AI_EXPERIMENT_MAX_VARIANTS","AI_EXPERIMENT_MIN_VARIANTS","AI_EXPERIMENT_NAME_MAX_CHARS","AI_EXPERIMENT_NEXT_MAX_CHARS","AI_EXPERIMENT_POINT_MAX_CHARS","AI_EXPERIMENT_RATIONALE_MAX_CHARS","aiExperimentVariantFields","AI_EXPERIMENT_VARIANTS_TOOL_NAME","AI_EXPERIMENT_EXPLAIN_TOOL_NAME","FIELD_HELP","headline","body","subject","preheader","aiExperimentVariantsTool","target","fields","filter","field","properties","name","type","description","strict","inputSchema","goal","variants","items","required","additionalProperties","aiExperimentExplainTool","points","winner","next","isRecord","value","Array","isArray","str","parseAiExperimentVariants","input","map","raw","rationale","parseAiExperimentExplanation"],"mappings":"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"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 AiInsightAnswer } from '../model/ai-insight';
|
|
18
|
+
import type { AiTool } from '../providers/contract';
|
|
19
|
+
/**
|
|
20
|
+
* The two strict tools an insight job answers through (AGL-2915).
|
|
21
|
+
*
|
|
22
|
+
* `read_figures` names readers — an id, a window and the reader's own
|
|
23
|
+
* parameters — and nothing else: the model never writes a query, a field
|
|
24
|
+
* path or a filter of its own, only a choice among the readers the request
|
|
25
|
+
* lists. `submit_insights` is the answer, each insight citing the table rows
|
|
26
|
+
* its figures come from. Lengths and counts are stated in the descriptions,
|
|
27
|
+
* as the platform's other strict tools state them; the step holds every one.
|
|
28
|
+
*/
|
|
29
|
+
export declare const AI_INSIGHT_READ_TOOL_NAME = "read_figures";
|
|
30
|
+
export declare const AI_INSIGHT_ANSWER_TOOL_NAME = "submit_insights";
|
|
31
|
+
export declare function aiInsightReadTool(): AiTool;
|
|
32
|
+
export declare function aiInsightAnswerTool(): AiTool;
|
|
33
|
+
/** One reader the model asked for, as it asked. */
|
|
34
|
+
export interface AiInsightReadRequest {
|
|
35
|
+
reader: string;
|
|
36
|
+
days: number;
|
|
37
|
+
params: Record<string, string>;
|
|
38
|
+
}
|
|
39
|
+
/** The reads a `read_figures` call names, shape-checked and bounded; the step decides which are real. */
|
|
40
|
+
export declare function parseAiInsightReads(input: unknown): AiInsightReadRequest[];
|
|
41
|
+
/**
|
|
42
|
+
* A `submit_insights` call as the trace reads it, or `null` when the call is
|
|
43
|
+
* not an answer at all. Values keep the types the model wrote, so the trace
|
|
44
|
+
* — not this reader — decides what an unreadable citation costs.
|
|
45
|
+
*/
|
|
46
|
+
export declare function parseAiInsightAnswer(input: unknown): AiInsightAnswer | null;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ import { AI_INSIGHT_GAP_MAX_CHARS, AI_INSIGHT_MAX_CHARS, AI_INSIGHT_MAX_CITED_ROWS, AI_INSIGHT_MAX_CITES, AI_INSIGHT_MAX_INSIGHTS, AI_INSIGHT_MAX_READS } from "../model/ai-insight.js";
|
|
17
|
+
/**
|
|
18
|
+
* The two strict tools an insight job answers through (AGL-2915).
|
|
19
|
+
*
|
|
20
|
+
* `read_figures` names readers — an id, a window and the reader's own
|
|
21
|
+
* parameters — and nothing else: the model never writes a query, a field
|
|
22
|
+
* path or a filter of its own, only a choice among the readers the request
|
|
23
|
+
* lists. `submit_insights` is the answer, each insight citing the table rows
|
|
24
|
+
* its figures come from. Lengths and counts are stated in the descriptions,
|
|
25
|
+
* as the platform's other strict tools state them; the step holds every one.
|
|
26
|
+
*/ export const AI_INSIGHT_READ_TOOL_NAME = 'read_figures';
|
|
27
|
+
export const AI_INSIGHT_ANSWER_TOOL_NAME = 'submit_insights';
|
|
28
|
+
export function aiInsightReadTool() {
|
|
29
|
+
return {
|
|
30
|
+
name: AI_INSIGHT_READ_TOOL_NAME,
|
|
31
|
+
description: `Choose the readers whose tables answer the question: at most ${AI_INSIGHT_MAX_READS}, ` + 'each from the list the request gives. Every field is required.',
|
|
32
|
+
strict: true,
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: {
|
|
36
|
+
reads: {
|
|
37
|
+
type: 'array',
|
|
38
|
+
description: `The readers to read, most useful first; at most ${AI_INSIGHT_MAX_READS}.`,
|
|
39
|
+
items: {
|
|
40
|
+
type: 'object',
|
|
41
|
+
properties: {
|
|
42
|
+
reader: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
description: 'A reader id from the list, exactly as written.'
|
|
45
|
+
},
|
|
46
|
+
days: {
|
|
47
|
+
type: 'integer',
|
|
48
|
+
description: 'One of the windows that reader lists, in days; 0 for a reader that lists none.'
|
|
49
|
+
},
|
|
50
|
+
params: {
|
|
51
|
+
type: 'array',
|
|
52
|
+
description: 'The parameters that reader lists, by name; empty when it lists none.',
|
|
53
|
+
items: {
|
|
54
|
+
type: 'object',
|
|
55
|
+
properties: {
|
|
56
|
+
name: {
|
|
57
|
+
type: 'string'
|
|
58
|
+
},
|
|
59
|
+
value: {
|
|
60
|
+
type: 'string'
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
required: [
|
|
64
|
+
'name',
|
|
65
|
+
'value'
|
|
66
|
+
],
|
|
67
|
+
additionalProperties: false
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
required: [
|
|
72
|
+
'reader',
|
|
73
|
+
'days',
|
|
74
|
+
'params'
|
|
75
|
+
],
|
|
76
|
+
additionalProperties: false
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
required: [
|
|
81
|
+
'reads'
|
|
82
|
+
],
|
|
83
|
+
additionalProperties: false
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export function aiInsightAnswerTool() {
|
|
88
|
+
return {
|
|
89
|
+
name: AI_INSIGHT_ANSWER_TOOL_NAME,
|
|
90
|
+
description: `Answer with at most ${AI_INSIGHT_MAX_INSIGHTS} insights, each citing the table rows its figures come from. ` + 'Every field is required.',
|
|
91
|
+
strict: true,
|
|
92
|
+
inputSchema: {
|
|
93
|
+
type: 'object',
|
|
94
|
+
properties: {
|
|
95
|
+
insights: {
|
|
96
|
+
type: 'array',
|
|
97
|
+
description: `Most useful first; at most ${AI_INSIGHT_MAX_INSIGHTS}.`,
|
|
98
|
+
items: {
|
|
99
|
+
type: 'object',
|
|
100
|
+
properties: {
|
|
101
|
+
text: {
|
|
102
|
+
type: 'string',
|
|
103
|
+
description: `One or two plain sentences; at most ${AI_INSIGHT_MAX_CHARS} characters.`
|
|
104
|
+
},
|
|
105
|
+
cites: {
|
|
106
|
+
type: 'array',
|
|
107
|
+
description: `The tables and rows its figures come from; at most ${AI_INSIGHT_MAX_CITES} tables.`,
|
|
108
|
+
items: {
|
|
109
|
+
type: 'object',
|
|
110
|
+
properties: {
|
|
111
|
+
table: {
|
|
112
|
+
type: 'string',
|
|
113
|
+
description: 'The table handle: t1, t2, …'
|
|
114
|
+
},
|
|
115
|
+
rows: {
|
|
116
|
+
type: 'array',
|
|
117
|
+
description: `Row numbers as the table numbers them, from 0; at most ${AI_INSIGHT_MAX_CITED_ROWS}.`,
|
|
118
|
+
items: {
|
|
119
|
+
type: 'integer'
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
required: [
|
|
124
|
+
'table',
|
|
125
|
+
'rows'
|
|
126
|
+
],
|
|
127
|
+
additionalProperties: false
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
required: [
|
|
132
|
+
'text',
|
|
133
|
+
'cites'
|
|
134
|
+
],
|
|
135
|
+
additionalProperties: false
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
gap: {
|
|
139
|
+
anyOf: [
|
|
140
|
+
{
|
|
141
|
+
type: 'string'
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
type: 'null'
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
description: `What the tables cannot answer, in one sentence without numbers; at most ${AI_INSIGHT_GAP_MAX_CHARS} characters. null when nothing.`
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
required: [
|
|
151
|
+
'insights',
|
|
152
|
+
'gap'
|
|
153
|
+
],
|
|
154
|
+
additionalProperties: false
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
const isRecord = (value)=>typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
159
|
+
/** The reads a `read_figures` call names, shape-checked and bounded; the step decides which are real. */ export function parseAiInsightReads(input) {
|
|
160
|
+
const reads = isRecord(input) && Array.isArray(input['reads']) ? input['reads'] : [];
|
|
161
|
+
const parsed = [];
|
|
162
|
+
for (const raw of reads){
|
|
163
|
+
if (parsed.length === AI_INSIGHT_MAX_READS) break;
|
|
164
|
+
if (!isRecord(raw) || typeof raw['reader'] !== 'string') continue;
|
|
165
|
+
const params = {};
|
|
166
|
+
for (const pair of Array.isArray(raw['params']) ? raw['params'] : []){
|
|
167
|
+
if (isRecord(pair) && typeof pair['name'] === 'string' && typeof pair['value'] === 'string') {
|
|
168
|
+
params[pair['name']] = pair['value'];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const days = Number(raw['days']);
|
|
172
|
+
parsed.push({
|
|
173
|
+
reader: raw['reader'].trim(),
|
|
174
|
+
days: Number.isInteger(days) && days >= 0 ? days : 0,
|
|
175
|
+
params
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
return parsed;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* A `submit_insights` call as the trace reads it, or `null` when the call is
|
|
182
|
+
* not an answer at all. Values keep the types the model wrote, so the trace
|
|
183
|
+
* — not this reader — decides what an unreadable citation costs.
|
|
184
|
+
*/ export function parseAiInsightAnswer(input) {
|
|
185
|
+
if (!isRecord(input) || !Array.isArray(input['insights'])) return null;
|
|
186
|
+
const insights = input['insights'].filter(isRecord).map((raw)=>({
|
|
187
|
+
text: typeof raw['text'] === 'string' ? raw['text'] : '',
|
|
188
|
+
cites: (Array.isArray(raw['cites']) ? raw['cites'] : []).filter(isRecord).map((cite)=>({
|
|
189
|
+
table: typeof cite['table'] === 'string' ? cite['table'] : '',
|
|
190
|
+
rows: Array.isArray(cite['rows']) ? cite['rows'] : []
|
|
191
|
+
}))
|
|
192
|
+
}));
|
|
193
|
+
const gap = typeof input['gap'] === 'string' ? input['gap'] : null;
|
|
194
|
+
return {
|
|
195
|
+
insights,
|
|
196
|
+
gap
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
//# sourceMappingURL=ai-insight-tool.js.map
|