@aglyn/plugins-ai 1.0.0-beta.229 → 1.0.0-beta.231
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/README.md +3 -3
- package/package.json +17 -17
- package/src/lib/activity/ai-activity-actions.js +7 -1
- package/src/lib/activity/ai-activity-actions.js.map +1 -1
- package/src/lib/components/ai-assist-provider-on-host.component.d.ts +66 -0
- package/src/lib/components/ai-assist-provider-on-host.component.js +78 -0
- package/src/lib/components/ai-assist-provider-on-host.component.js.map +1 -0
- package/src/lib/components/ai-assist-provider.component.js +9 -10
- package/src/lib/components/ai-assist-provider.component.js.map +1 -1
- package/src/lib/components/ai-automation-zones.d.ts +38 -0
- package/src/lib/components/ai-automation-zones.js +5 -1
- package/src/lib/components/ai-automation-zones.js.map +1 -1
- package/src/lib/components/ai-brief-dialog.component.d.ts +20 -2
- package/src/lib/components/ai-brief-dialog.component.js +87 -8
- package/src/lib/components/ai-brief-dialog.component.js.map +1 -1
- package/src/lib/components/ai-campaign-create.component.d.ts +54 -0
- package/src/lib/components/ai-campaign-create.component.js +270 -0
- package/src/lib/components/ai-campaign-create.component.js.map +1 -0
- package/src/lib/components/ai-describe-automation.component.d.ts +8 -3
- package/src/lib/components/ai-describe-automation.component.js +15 -6
- package/src/lib/components/ai-describe-automation.component.js.map +1 -1
- package/src/lib/components/ai-describe-button.component.d.ts +20 -8
- package/src/lib/components/ai-describe-button.component.js +19 -36
- package/src/lib/components/ai-describe-button.component.js.map +1 -1
- package/src/lib/components/ai-describe-email.component.d.ts +31 -0
- package/src/lib/components/ai-describe-email.component.js +22 -0
- package/src/lib/components/ai-describe-email.component.js.map +1 -0
- package/src/lib/components/ai-describe-org-automation.component.d.ts +36 -0
- package/src/lib/components/ai-describe-org-automation.component.js +238 -0
- package/src/lib/components/ai-describe-org-automation.component.js.map +1 -0
- package/src/lib/components/ai-experiment-cards.component.d.ts +9 -1
- package/src/lib/components/ai-experiment-cards.component.js +104 -18
- package/src/lib/components/ai-experiment-cards.component.js.map +1 -1
- package/src/lib/components/ai-explain-automation.component.js +1 -5
- package/src/lib/components/ai-explain-automation.component.js.map +1 -1
- package/src/lib/components/ai-funnel-zones.component.d.ts +61 -0
- package/src/lib/components/ai-funnel-zones.component.js +178 -0
- package/src/lib/components/ai-funnel-zones.component.js.map +1 -0
- package/src/lib/components/ai-insight-card.component.d.ts +42 -0
- package/src/lib/components/ai-insight-card.component.js +137 -0
- package/src/lib/components/ai-insight-card.component.js.map +1 -0
- package/src/lib/components/ai-insight-dialog.component.d.ts +6 -0
- package/src/lib/components/ai-insight-dialog.component.js +9 -3
- package/src/lib/components/ai-insight-dialog.component.js.map +1 -1
- package/src/lib/components/ai-job-plan.component.d.ts +7 -2
- package/src/lib/components/ai-job-plan.component.js +38 -6
- package/src/lib/components/ai-job-plan.component.js.map +1 -1
- package/src/lib/components/ai-job-requests.d.ts +17 -1
- package/src/lib/components/ai-job-requests.js +39 -3
- package/src/lib/components/ai-job-requests.js.map +1 -1
- package/src/lib/components/ai-logic-zones.d.ts +64 -0
- package/src/lib/components/ai-logic-zones.js +18 -0
- package/src/lib/components/ai-logic-zones.js.map +1 -0
- package/src/lib/components/ai-logic.component.d.ts +77 -0
- package/src/lib/components/ai-logic.component.js +553 -0
- package/src/lib/components/ai-logic.component.js.map +1 -0
- package/src/lib/components/ai-marketing-insight.component.d.ts +30 -0
- package/src/lib/components/ai-marketing-insight.component.js +80 -0
- package/src/lib/components/ai-marketing-insight.component.js.map +1 -0
- package/src/lib/components/ai-media-create.component.d.ts +55 -0
- package/src/lib/components/ai-media-create.component.js +433 -0
- package/src/lib/components/ai-media-create.component.js.map +1 -0
- package/src/lib/components/ai-overlay-cards.component.d.ts +83 -0
- package/src/lib/components/ai-overlay-cards.component.js +505 -0
- package/src/lib/components/ai-overlay-cards.component.js.map +1 -0
- package/src/lib/components/ai-permissions-on-host.component.d.ts +3 -46
- package/src/lib/components/ai-permissions-on-host.component.js +5 -53
- package/src/lib/components/ai-permissions-on-host.component.js.map +1 -1
- package/src/lib/components/ai-product-zones.d.ts +5 -0
- package/src/lib/components/ai-product-zones.js +1 -1
- package/src/lib/components/ai-product-zones.js.map +1 -1
- package/src/lib/components/ai-products-create-button.component.d.ts +42 -0
- package/src/lib/components/ai-products-create-button.component.js +67 -0
- package/src/lib/components/ai-products-create-button.component.js.map +1 -0
- package/src/lib/components/ai-products-hub-card.component.js +100 -81
- package/src/lib/components/ai-products-hub-card.component.js.map +1 -1
- package/src/lib/components/ai-revise-automation.component.d.ts +16 -0
- package/src/lib/components/ai-revise-automation.component.js +207 -0
- package/src/lib/components/ai-revise-automation.component.js.map +1 -0
- package/src/lib/components/ai-site-build-page.component.js +160 -24
- package/src/lib/components/ai-site-build-page.component.js.map +1 -1
- package/src/lib/components/ai-upsell-dialog.component.d.ts +53 -0
- package/src/lib/components/ai-upsell-dialog.component.js +177 -0
- package/src/lib/components/ai-upsell-dialog.component.js.map +1 -0
- package/src/lib/components/assist-build-card.component.d.ts +42 -0
- package/src/lib/components/assist-build-card.component.js +183 -0
- package/src/lib/components/assist-build-card.component.js.map +1 -0
- package/src/lib/components/assist-edit-canvas.d.ts +2 -0
- package/src/lib/components/assist-edit-canvas.js +56 -1
- package/src/lib/components/assist-edit-canvas.js.map +1 -1
- package/src/lib/components/assist-jobs-drawer.component.js +48 -3
- package/src/lib/components/assist-jobs-drawer.component.js.map +1 -1
- package/src/lib/components/assist-panel.component.js +51 -2
- package/src/lib/components/assist-panel.component.js.map +1 -1
- package/src/lib/components/use-ai-job-run.d.ts +3 -14
- package/src/lib/components/use-ai-job-run.js +0 -50
- package/src/lib/components/use-ai-job-run.js.map +1 -1
- package/src/lib/jobs/ai-build-capabilities.d.ts +58 -0
- package/src/lib/jobs/ai-build-capabilities.js +256 -0
- package/src/lib/jobs/ai-build-capabilities.js.map +1 -0
- package/src/lib/jobs/ai-build-unit-outcome.d.ts +52 -0
- package/src/lib/jobs/ai-build-unit-outcome.js +140 -0
- package/src/lib/jobs/ai-build-unit-outcome.js.map +1 -0
- package/src/lib/jobs/ai-job-auto-confirm.d.ts +8 -0
- package/src/lib/jobs/ai-job-auto-confirm.js +30 -6
- package/src/lib/jobs/ai-job-auto-confirm.js.map +1 -1
- package/src/lib/jobs/ai-job-build-step.d.ts +144 -0
- package/src/lib/jobs/ai-job-build-step.js +668 -0
- package/src/lib/jobs/ai-job-build-step.js.map +1 -0
- package/src/lib/jobs/ai-job-draft-ids.js +9 -1
- package/src/lib/jobs/ai-job-draft-ids.js.map +1 -1
- package/src/lib/jobs/ai-job-drafts.d.ts +14 -4
- package/src/lib/jobs/ai-job-drafts.js +25 -4
- package/src/lib/jobs/ai-job-drafts.js.map +1 -1
- package/src/lib/jobs/ai-job-generation.d.ts +8 -0
- package/src/lib/jobs/ai-job-generation.js +13 -2
- package/src/lib/jobs/ai-job-generation.js.map +1 -1
- package/src/lib/jobs/ai-job-insight-step.js +8 -1
- package/src/lib/jobs/ai-job-insight-step.js.map +1 -1
- package/src/lib/jobs/ai-job-layout-language.d.ts +73 -0
- package/src/lib/jobs/ai-job-layout-language.js +194 -0
- package/src/lib/jobs/ai-job-layout-language.js.map +1 -0
- package/src/lib/jobs/ai-job-layout-site-pages.d.ts +13 -2
- package/src/lib/jobs/ai-job-layout-site-pages.js +18 -2
- package/src/lib/jobs/ai-job-layout-site-pages.js.map +1 -1
- package/src/lib/jobs/ai-job-layout-step.d.ts +5 -0
- package/src/lib/jobs/ai-job-layout-step.js +105 -5
- package/src/lib/jobs/ai-job-layout-step.js.map +1 -1
- package/src/lib/jobs/ai-job-logic-step.d.ts +107 -0
- package/src/lib/jobs/ai-job-logic-step.js +395 -0
- package/src/lib/jobs/ai-job-logic-step.js.map +1 -0
- package/src/lib/jobs/ai-job-overlay-copy.d.ts +70 -0
- package/src/lib/jobs/ai-job-overlay-copy.js +178 -0
- package/src/lib/jobs/ai-job-overlay-copy.js.map +1 -0
- package/src/lib/jobs/ai-job-page-language.d.ts +149 -0
- package/src/lib/jobs/ai-job-page-language.js +355 -0
- package/src/lib/jobs/ai-job-page-language.js.map +1 -0
- package/src/lib/jobs/ai-job-page-sections.d.ts +37 -1
- package/src/lib/jobs/ai-job-page-sections.js +93 -11
- package/src/lib/jobs/ai-job-page-sections.js.map +1 -1
- package/src/lib/jobs/ai-job-page-step.d.ts +4 -4
- package/src/lib/jobs/ai-job-page-step.js +111 -20
- package/src/lib/jobs/ai-job-page-step.js.map +1 -1
- package/src/lib/jobs/ai-job-plan-step.d.ts +27 -2
- package/src/lib/jobs/ai-job-plan-step.js +87 -13
- package/src/lib/jobs/ai-job-plan-step.js.map +1 -1
- package/src/lib/jobs/ai-job-site-step.d.ts +19 -1
- package/src/lib/jobs/ai-job-site-step.js +220 -61
- package/src/lib/jobs/ai-job-site-step.js.map +1 -1
- package/src/lib/jobs/ai-job-text-step.d.ts +22 -1
- package/src/lib/jobs/ai-job-text-step.js +12 -0
- package/src/lib/jobs/ai-job-text-step.js.map +1 -1
- package/src/lib/jobs/ai-job-workflow-step.d.ts +54 -4
- package/src/lib/jobs/ai-job-workflow-step.js +320 -15
- package/src/lib/jobs/ai-job-workflow-step.js.map +1 -1
- package/src/lib/jobs/ai-jobs.d.ts +80 -2
- package/src/lib/jobs/ai-jobs.js +391 -18
- package/src/lib/jobs/ai-jobs.js.map +1 -1
- package/src/lib/jobs/ai-layout-full-height.d.ts +40 -0
- package/src/lib/jobs/ai-layout-full-height.js +82 -0
- package/src/lib/jobs/ai-layout-full-height.js.map +1 -0
- package/src/lib/jobs/ai-layout-site-facts.d.ts +54 -0
- package/src/lib/jobs/ai-layout-site-facts.js +153 -0
- package/src/lib/jobs/ai-layout-site-facts.js.map +1 -0
- package/src/lib/jobs/ai-logic-records.d.ts +40 -0
- package/src/lib/jobs/ai-logic-records.js +55 -0
- package/src/lib/jobs/ai-logic-records.js.map +1 -0
- package/src/lib/jobs/ai-site-publish.d.ts +7 -0
- package/src/lib/jobs/ai-site-publish.js +9 -0
- package/src/lib/jobs/ai-site-publish.js.map +1 -1
- package/src/lib/jobs/ai-workflow-records.d.ts +4 -0
- package/src/lib/jobs/ai-workflow-records.js +40 -1
- package/src/lib/jobs/ai-workflow-records.js.map +1 -1
- package/src/lib/layout-language/ai-layout-compiler.d.ts +145 -0
- package/src/lib/layout-language/ai-layout-compiler.js +1148 -0
- package/src/lib/layout-language/ai-layout-compiler.js.map +1 -0
- package/src/lib/layout-language/ai-layout-copy.d.ts +73 -0
- package/src/lib/layout-language/ai-layout-copy.js +137 -0
- package/src/lib/layout-language/ai-layout-copy.js.map +1 -0
- package/src/lib/layout-language/ai-layout-frame.d.ts +52 -0
- package/src/lib/layout-language/ai-layout-frame.js +457 -0
- package/src/lib/layout-language/ai-layout-frame.js.map +1 -0
- package/src/lib/layout-language/ai-layout-gaps.d.ts +63 -0
- package/src/lib/layout-language/ai-layout-gaps.js +345 -0
- package/src/lib/layout-language/ai-layout-gaps.js.map +1 -0
- package/src/lib/layout-language/ai-layout-language.d.ts +161 -0
- package/src/lib/layout-language/ai-layout-language.js +446 -0
- package/src/lib/layout-language/ai-layout-language.js.map +1 -0
- package/src/lib/layout-language/ai-layout-links.d.ts +80 -0
- package/src/lib/layout-language/ai-layout-links.js +109 -0
- package/src/lib/layout-language/ai-layout-links.js.map +1 -0
- package/src/lib/layout-language/ai-layout-store.d.ts +39 -0
- package/src/lib/layout-language/ai-layout-store.js +69 -0
- package/src/lib/layout-language/ai-layout-store.js.map +1 -0
- package/src/lib/layout-language/ai-layout-tree.d.ts +59 -0
- package/src/lib/layout-language/ai-layout-tree.js +84 -0
- package/src/lib/layout-language/ai-layout-tree.js.map +1 -0
- package/src/lib/lazy-widget.d.ts +45 -0
- package/src/lib/lazy-widget.js +53 -0
- package/src/lib/lazy-widget.js.map +1 -0
- package/src/lib/model/ai-automation-draft.d.ts +18 -0
- package/src/lib/model/ai-automation-draft.js +86 -0
- package/src/lib/model/ai-automation-draft.js.map +1 -1
- package/src/lib/model/ai-build-job.d.ts +201 -0
- package/src/lib/model/ai-build-job.js +472 -0
- package/src/lib/model/ai-build-job.js.map +1 -0
- package/src/lib/model/ai-build-plan.d.ts +61 -0
- package/src/lib/model/ai-build-plan.js +154 -9
- package/src/lib/model/ai-build-plan.js.map +1 -1
- package/src/lib/model/ai-build-progress.d.ts +73 -0
- package/src/lib/model/ai-build-progress.js +170 -0
- package/src/lib/model/ai-build-progress.js.map +1 -0
- package/src/lib/model/ai-host-publish-context.d.ts +51 -0
- package/src/lib/model/ai-host-publish-context.js +104 -0
- package/src/lib/model/ai-host-publish-context.js.map +1 -0
- package/src/lib/model/ai-insight.d.ts +20 -10
- package/src/lib/model/ai-insight.js +72 -9
- package/src/lib/model/ai-insight.js.map +1 -1
- package/src/lib/model/ai-job-activity.d.ts +22 -0
- package/src/lib/model/ai-job-activity.js +25 -2
- package/src/lib/model/ai-job-activity.js.map +1 -1
- package/src/lib/model/ai-job-failure-copy.d.ts +38 -1
- package/src/lib/model/ai-job-failure-copy.js +56 -1
- package/src/lib/model/ai-job-failure-copy.js.map +1 -1
- package/src/lib/model/ai-job-notice.d.ts +3 -1
- package/src/lib/model/ai-job-notice.js +31 -9
- package/src/lib/model/ai-job-notice.js.map +1 -1
- package/src/lib/model/ai-jobs.types.d.ts +99 -2
- package/src/lib/model/ai-jobs.types.js +3 -1
- package/src/lib/model/ai-jobs.types.js.map +1 -1
- package/src/lib/model/ai-logic-job.d.ts +108 -0
- package/src/lib/model/ai-logic-job.js +327 -0
- package/src/lib/model/ai-logic-job.js.map +1 -0
- package/src/lib/model/ai-media-credits.d.ts +52 -0
- package/src/lib/model/ai-media-credits.js +61 -0
- package/src/lib/model/ai-media-credits.js.map +1 -0
- package/src/lib/model/ai-overlay-copy.d.ts +114 -0
- package/src/lib/model/ai-overlay-copy.js +175 -0
- package/src/lib/model/ai-overlay-copy.js.map +1 -0
- package/src/lib/model/ai-site-build-progress.d.ts +25 -4
- package/src/lib/model/ai-site-build-progress.js +194 -11
- package/src/lib/model/ai-site-build-progress.js.map +1 -1
- package/src/lib/model/ai-site-job.d.ts +8 -0
- package/src/lib/model/ai-site-job.js +9 -0
- package/src/lib/model/ai-site-job.js.map +1 -1
- package/src/lib/model/ai-site-start-seo.d.ts +1 -1
- package/src/lib/model/ai-site-start.d.ts +5 -2
- package/src/lib/model/ai-site-start.js +5 -2
- package/src/lib/model/ai-site-start.js.map +1 -1
- package/src/lib/model/ai-svg.d.ts +69 -0
- package/src/lib/model/ai-svg.js +265 -0
- package/src/lib/model/ai-svg.js.map +1 -0
- package/src/lib/model/ai-usage-by-user.d.ts +3 -2
- package/src/lib/model/ai-usage-by-user.js.map +1 -1
- package/src/lib/model/ai-workflow-job.d.ts +92 -4
- package/src/lib/model/ai-workflow-job.js +124 -7
- package/src/lib/model/ai-workflow-job.js.map +1 -1
- package/src/lib/model/assist-build.d.ts +58 -0
- package/src/lib/model/assist-build.js +52 -0
- package/src/lib/model/assist-build.js.map +1 -0
- package/src/lib/model/assist-edit.d.ts +48 -3
- package/src/lib/model/assist-edit.js +48 -4
- package/src/lib/model/assist-edit.js.map +1 -1
- package/src/lib/plugin-config.js +2 -0
- package/src/lib/plugin-config.js.map +1 -1
- package/src/lib/plugin.js +308 -47
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/providers/catalog.d.ts +82 -5
- package/src/lib/providers/catalog.js +83 -12
- package/src/lib/providers/catalog.js.map +1 -1
- package/src/lib/providers/image-contract.d.ts +116 -0
- package/src/lib/providers/image-contract.js +74 -0
- package/src/lib/providers/image-contract.js.map +1 -0
- package/src/lib/providers/model-choice.js +11 -0
- package/src/lib/providers/model-choice.js.map +1 -1
- package/src/lib/providers/routing.js +18 -0
- package/src/lib/providers/routing.js.map +1 -1
- package/src/lib/providers/vertex-image.d.ts +121 -0
- package/src/lib/providers/vertex-image.js +312 -0
- package/src/lib/providers/vertex-image.js.map +1 -0
- package/src/lib/runtime/ai-doctrine-validators.d.ts +101 -0
- package/src/lib/runtime/ai-doctrine-validators.js +525 -4
- package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
- package/src/lib/runtime/ai-doctrine.js +21 -6
- package/src/lib/runtime/ai-doctrine.js.map +1 -1
- package/src/lib/runtime/ai-eval-live.js +4 -0
- package/src/lib/runtime/ai-eval-live.js.map +1 -1
- package/src/lib/runtime/ai-eval.d.ts +15 -1
- package/src/lib/runtime/ai-eval.js +52 -1
- package/src/lib/runtime/ai-eval.js.map +1 -1
- package/src/lib/runtime/ai-icon-library.d.ts +257 -0
- package/src/lib/runtime/ai-icon-library.js +254 -0
- package/src/lib/runtime/ai-icon-library.js.map +1 -0
- package/src/lib/runtime/ai-node-tree.d.ts +9 -0
- package/src/lib/runtime/ai-node-tree.js +30 -4
- package/src/lib/runtime/ai-node-tree.js.map +1 -1
- package/src/lib/runtime/ai-palette.d.ts +6 -0
- package/src/lib/runtime/ai-palette.generated.js +70 -0
- package/src/lib/runtime/ai-palette.generated.js.map +1 -1
- package/src/lib/runtime/ai-palette.js.map +1 -1
- package/src/lib/runtime/experiment-variant-copy.d.ts +34 -0
- package/src/lib/runtime/experiment-variant-copy.js +102 -0
- package/src/lib/runtime/experiment-variant-copy.js.map +1 -0
- package/src/lib/server/ai-experiment-versions.d.ts +51 -0
- package/src/lib/server/ai-experiment-versions.js +270 -0
- package/src/lib/server/ai-experiment-versions.js.map +1 -0
- package/src/lib/server/ai-jobs-resume.js +74 -4
- package/src/lib/server/ai-jobs-resume.js.map +1 -1
- package/src/lib/server/ai-media-image.d.ts +66 -0
- package/src/lib/server/ai-media-image.js +521 -0
- package/src/lib/server/ai-media-image.js.map +1 -0
- package/src/lib/server/ai-media-svg.d.ts +91 -0
- package/src/lib/server/ai-media-svg.js +186 -0
- package/src/lib/server/ai-media-svg.js.map +1 -0
- package/src/lib/server/assist-build.d.ts +54 -0
- package/src/lib/server/assist-build.js +121 -0
- package/src/lib/server/assist-build.js.map +1 -0
- package/src/lib/server/assist-chat.js +108 -12
- package/src/lib/server/assist-chat.js.map +1 -1
- package/src/lib/server/assist-edit.js +213 -3
- package/src/lib/server/assist-edit.js.map +1 -1
- package/src/lib/server/assist-view-context.js +242 -4
- package/src/lib/server/assist-view-context.js.map +1 -1
- package/src/lib/server.js +26 -0
- package/src/lib/server.js.map +1 -1
- package/src/lib/tools/ai-logic-tool.d.ts +27 -0
- package/src/lib/tools/ai-logic-tool.js +207 -0
- package/src/lib/tools/ai-logic-tool.js.map +1 -0
- package/src/lib/tools/ai-overlay-tool.d.ts +35 -0
- package/src/lib/tools/ai-overlay-tool.js +107 -0
- package/src/lib/tools/ai-overlay-tool.js.map +1 -0
- package/src/lib/tools/ai-workflow-tool.d.ts +17 -2
- package/src/lib/tools/ai-workflow-tool.js +47 -14
- package/src/lib/tools/ai-workflow-tool.js.map +1 -1
- package/src/lib/usage/assist-job-refund.d.ts +28 -1
- package/src/lib/usage/assist-job-refund.js +44 -9
- package/src/lib/usage/assist-job-refund.js.map +1 -1
- package/src/lib/usage/assist-usage.d.ts +5 -0
- package/src/lib/usage/assist-usage.js +2 -0
- package/src/lib/usage/assist-usage.js.map +1 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2026 Aglyn LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/ import { AI_OVERLAY_COPY_TASK, AI_OVERLAY_CURRENT_MAX_CHARS, aiOverlayCopyText, aiOverlayKind, aiOverlayLimits, aiOverlayTriggerRanges, checkAiOverlayCopy } from "../model/ai-overlay-copy.js";
|
|
18
|
+
import { AI_ROUTING_TABLE } from "../providers/routing.js";
|
|
19
|
+
import { AI_ACCEPTABLE_USE_BLOCK, runAiRequest } from "../runtime/ai-runtime.js";
|
|
20
|
+
import { AI_OVERLAY_TOOL_NAME, aiOverlayTool, parseAiOverlayCopy } from "../tools/ai-overlay-tool.js";
|
|
21
|
+
/**
|
|
22
|
+
* Overlay copy (AGL-3603): the `text` step asked, by `inputs.task: 'overlay'`,
|
|
23
|
+
* for an announcement bar's or a popup's copy as fields rather than prose.
|
|
24
|
+
*
|
|
25
|
+
* A text job rather than a kind of its own because it IS a text job — a brief
|
|
26
|
+
* in, a short piece of copy out, one request at the `job.text` route's model
|
|
27
|
+
* and ceiling — so it runs inline in the create door, is metered as any text
|
|
28
|
+
* job is and needs no plan. Only the answer's shape differs: one strict tool
|
|
29
|
+
* call, held by `checkAiOverlayCopy` to the limits and the triggers the
|
|
30
|
+
* request named.
|
|
31
|
+
*
|
|
32
|
+
* ## Nothing is written
|
|
33
|
+
*
|
|
34
|
+
* The answer is a proposal on the job's output. The overlay is the marketing
|
|
35
|
+
* plugin's; its editor fills its fields from the proposal unsaved, or its list
|
|
36
|
+
* writes a new overlay switched off, and in both a person decides what goes
|
|
37
|
+
* live. No link, schedule, page targeting or on-switch is ever proposed.
|
|
38
|
+
*
|
|
39
|
+
* ## What reaches the model
|
|
40
|
+
*
|
|
41
|
+
* The brief, what the overlay is (a bar or a popup), the triggers the site
|
|
42
|
+
* offers, and — when a person asked from an overlay that has copy — that copy
|
|
43
|
+
* as the editor holds it. Nothing about the site's visitors or its figures.
|
|
44
|
+
*/ /** The job's failure when the answer could not be used. */ export const AI_OVERLAY_NO_COPY_COPY = 'The AI did not write copy that fits this overlay. Try the brief in different words.';
|
|
45
|
+
/** The job's failure when the inputs name no overlay kind. */ export const AI_OVERLAY_NO_KIND_COPY = 'Say whether the copy is for an announcement bar or a popup.';
|
|
46
|
+
/** The rules, static and byte-identical for every workspace, so they cache. */ export const AI_OVERLAY_RULES = [
|
|
47
|
+
'You write copy for the announcement bars and popups on a small business’s website. A bar is one short line across the top of every page; a popup is a headline, a short body and an optional button, shown once as the visitor reads.',
|
|
48
|
+
`Call ${AI_OVERLAY_TOOL_NAME} once.`,
|
|
49
|
+
'- Lead with what the visitor gets: the offer, the news or the reason to act. One idea per overlay.',
|
|
50
|
+
'- Keep inside every length the tool states. Shorter is better: a bar is read in a glance.',
|
|
51
|
+
'- A button label is a few words that start with a verb.',
|
|
52
|
+
'- For a popup, choose when it opens only from the triggers the request lists, and a value inside the range it gives: a short delay for an announcement, a scroll depth for something a reader earns, exit intent for a last offer. Answer `none` to leave it as it is.',
|
|
53
|
+
'- Write plain text: no HTML, no markdown, no links, no emoji, no fences.',
|
|
54
|
+
'- Never invent a fact, a price, a discount, a deadline, a name or a guarantee the brief or the current copy did not give you; where one is missing, leave a clearly marked placeholder in square brackets.',
|
|
55
|
+
'- Write in the language of the brief.'
|
|
56
|
+
].join('\n');
|
|
57
|
+
export const AI_OVERLAY_SYSTEM = [
|
|
58
|
+
{
|
|
59
|
+
text: `${AI_OVERLAY_RULES}\n\n${AI_ACCEPTABLE_USE_BLOCK}`,
|
|
60
|
+
cacheBreakpoint: true
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
const str = (value)=>typeof value === 'string' ? value.trim() : '';
|
|
64
|
+
const TRIGGER_WORDS = {
|
|
65
|
+
delay: (range)=>`delay (seconds after the page loads${range ? `, ${range.min} to ${range.max}` : ''})`,
|
|
66
|
+
scroll: (range)=>`scroll (percent of the page scrolled${range ? `, ${range.min} to ${range.max}` : ''})`,
|
|
67
|
+
exit: ()=>'exit (as the visitor moves to leave)'
|
|
68
|
+
};
|
|
69
|
+
/** The user turn: the brief, the overlay, its triggers and its copy as it stands. */ export function aiOverlayCopyPrompt(input) {
|
|
70
|
+
const lines = [
|
|
71
|
+
`Brief: ${input.brief}`,
|
|
72
|
+
`Write the copy for ${input.kind === 'bar' ? 'an announcement bar' : 'a popup'}.`
|
|
73
|
+
];
|
|
74
|
+
if (input.kind === 'popup') {
|
|
75
|
+
lines.push(input.triggers.size ? `Triggers the site offers: ${[
|
|
76
|
+
...input.triggers
|
|
77
|
+
].map(([id, range])=>TRIGGER_WORDS[id](range)).join('; ')}.` : 'Leave when it opens as it is: answer `none`.');
|
|
78
|
+
}
|
|
79
|
+
if (input.current) lines.push('', 'The copy as it stands:', input.current);
|
|
80
|
+
return lines.join('\n');
|
|
81
|
+
}
|
|
82
|
+
/** A checked proposal as the job's output: shown as text, carried as fields. */ export function aiOverlayCopyOutput(job, proposal) {
|
|
83
|
+
var _job_hostId;
|
|
84
|
+
var _job_inputs;
|
|
85
|
+
return {
|
|
86
|
+
resource: 'text',
|
|
87
|
+
id: 'draft',
|
|
88
|
+
hostId: (_job_hostId = job.hostId) != null ? _job_hostId : null,
|
|
89
|
+
hostSubdomain: str((_job_inputs = job.inputs) == null ? void 0 : _job_inputs['hostSubdomain']) || null,
|
|
90
|
+
label: proposal.kind === 'bar' ? 'Announcement bar copy' : 'Popup copy',
|
|
91
|
+
text: aiOverlayCopyText(proposal),
|
|
92
|
+
proposal: _extends({
|
|
93
|
+
task: AI_OVERLAY_COPY_TASK
|
|
94
|
+
}, proposal),
|
|
95
|
+
note: 'Put this into the overlay editor to use it; nothing has been changed on the site.'
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/** The overlay task of the text step: one strict tool call, checked, never written. */ export async function runAiOverlayCopy(input) {
|
|
99
|
+
var _job_inputs, _result_toolUse_find;
|
|
100
|
+
const { job, model } = input;
|
|
101
|
+
const kind = aiOverlayKind(job.inputs);
|
|
102
|
+
if (!kind) {
|
|
103
|
+
return {
|
|
104
|
+
outputs: [],
|
|
105
|
+
usage: {
|
|
106
|
+
inputTokens: 0,
|
|
107
|
+
outputTokens: 0,
|
|
108
|
+
cacheReadTokens: 0,
|
|
109
|
+
cacheWriteTokens: 0
|
|
110
|
+
},
|
|
111
|
+
estCostUsd: 0,
|
|
112
|
+
model,
|
|
113
|
+
stopReason: null,
|
|
114
|
+
failure: AI_OVERLAY_NO_KIND_COPY
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const limits = aiOverlayLimits(job.inputs);
|
|
118
|
+
const triggers = aiOverlayTriggerRanges(job.inputs);
|
|
119
|
+
const result = await runAiRequest(_extends({
|
|
120
|
+
model,
|
|
121
|
+
system: AI_OVERLAY_SYSTEM,
|
|
122
|
+
messages: [
|
|
123
|
+
{
|
|
124
|
+
role: 'user',
|
|
125
|
+
content: aiOverlayCopyPrompt({
|
|
126
|
+
brief: job.brief,
|
|
127
|
+
kind,
|
|
128
|
+
triggers,
|
|
129
|
+
current: str((_job_inputs = job.inputs) == null ? void 0 : _job_inputs['current']).slice(0, AI_OVERLAY_CURRENT_MAX_CHARS)
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
tools: [
|
|
134
|
+
aiOverlayTool(kind, limits, [
|
|
135
|
+
...triggers.keys()
|
|
136
|
+
])
|
|
137
|
+
],
|
|
138
|
+
maxTokens: input.maxTokens
|
|
139
|
+
}, AI_ROUTING_TABLE['job.text'].thinking ? {
|
|
140
|
+
thinking: AI_ROUTING_TABLE['job.text'].thinking
|
|
141
|
+
} : {}, AI_ROUTING_TABLE['job.text'].effort ? {
|
|
142
|
+
effort: AI_ROUTING_TABLE['job.text'].effort
|
|
143
|
+
} : {}, {
|
|
144
|
+
stream: false
|
|
145
|
+
}, input.signal ? {
|
|
146
|
+
signal: input.signal
|
|
147
|
+
} : {}));
|
|
148
|
+
const spent = {
|
|
149
|
+
usage: result.usage,
|
|
150
|
+
estCostUsd: result.estCostUsd,
|
|
151
|
+
model,
|
|
152
|
+
stopReason: result.stopReason
|
|
153
|
+
};
|
|
154
|
+
if (result.kind === 'refusal') return _extends({
|
|
155
|
+
outputs: []
|
|
156
|
+
}, spent, {
|
|
157
|
+
refused: true
|
|
158
|
+
});
|
|
159
|
+
const checked = checkAiOverlayCopy(parseAiOverlayCopy((_result_toolUse_find = result.toolUse.find((use)=>use.name === AI_OVERLAY_TOOL_NAME)) == null ? void 0 : _result_toolUse_find.input), kind, limits, triggers);
|
|
160
|
+
if (!checked) return _extends({
|
|
161
|
+
outputs: []
|
|
162
|
+
}, spent, {
|
|
163
|
+
failure: AI_OVERLAY_NO_COPY_COPY
|
|
164
|
+
});
|
|
165
|
+
if (checked.findings.length) {
|
|
166
|
+
console.info('ai overlay copy held to its limits', {
|
|
167
|
+
jobId: job.$id,
|
|
168
|
+
findings: checked.findings
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return _extends({
|
|
172
|
+
outputs: [
|
|
173
|
+
aiOverlayCopyOutput(job, checked.proposal)
|
|
174
|
+
]
|
|
175
|
+
}, spent);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
//# sourceMappingURL=ai-job-overlay-copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-job-overlay-copy.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_OVERLAY_COPY_TASK,\n AI_OVERLAY_CURRENT_MAX_CHARS,\n aiOverlayCopyText,\n aiOverlayKind,\n aiOverlayLimits,\n aiOverlayTriggerRanges,\n checkAiOverlayCopy,\n type AiOverlayCopyProposal,\n type AiOverlayKind,\n type AiOverlayTrigger,\n} from '../model/ai-overlay-copy'\nimport type { AiJob, AiJobOutput } from '../model/ai-jobs.types'\nimport { AI_ROUTING_TABLE } from '../providers/routing'\nimport {\n AI_ACCEPTABLE_USE_BLOCK,\n runAiRequest,\n type AiSystemBlock,\n} from '../runtime/ai-runtime'\nimport { AI_OVERLAY_TOOL_NAME, aiOverlayTool, parseAiOverlayCopy } from '../tools/ai-overlay-tool'\nimport type { AiJobStepOutcome } from './ai-job-text-step'\n\n/**\n * Overlay copy (AGL-3603): the `text` step asked, by `inputs.task: 'overlay'`,\n * for an announcement bar's or a popup's copy as fields rather than prose.\n *\n * A text job rather than a kind of its own because it IS a text job — a brief\n * in, a short piece of copy out, one request at the `job.text` route's model\n * and ceiling — so it runs inline in the create door, is metered as any text\n * job is and needs no plan. Only the answer's shape differs: one strict tool\n * call, held by `checkAiOverlayCopy` to the limits and the triggers the\n * request named.\n *\n * ## Nothing is written\n *\n * The answer is a proposal on the job's output. The overlay is the marketing\n * plugin's; its editor fills its fields from the proposal unsaved, or its list\n * writes a new overlay switched off, and in both a person decides what goes\n * live. No link, schedule, page targeting or on-switch is ever proposed.\n *\n * ## What reaches the model\n *\n * The brief, what the overlay is (a bar or a popup), the triggers the site\n * offers, and — when a person asked from an overlay that has copy — that copy\n * as the editor holds it. Nothing about the site's visitors or its figures.\n */\n\n/** The job's failure when the answer could not be used. */\nexport const AI_OVERLAY_NO_COPY_COPY =\n 'The AI did not write copy that fits this overlay. Try the brief in different words.'\n\n/** The job's failure when the inputs name no overlay kind. */\nexport const AI_OVERLAY_NO_KIND_COPY = 'Say whether the copy is for an announcement bar or a popup.'\n\n/** The rules, static and byte-identical for every workspace, so they cache. */\nexport const AI_OVERLAY_RULES = [\n 'You write copy for the announcement bars and popups on a small business’s website. A bar is one short line across the top of every page; a popup is a headline, a short body and an optional button, shown once as the visitor reads.',\n `Call ${AI_OVERLAY_TOOL_NAME} once.`,\n '- Lead with what the visitor gets: the offer, the news or the reason to act. One idea per overlay.',\n '- Keep inside every length the tool states. Shorter is better: a bar is read in a glance.',\n '- A button label is a few words that start with a verb.',\n '- For a popup, choose when it opens only from the triggers the request lists, and a value inside the range it gives: a short delay for an announcement, a scroll depth for something a reader earns, exit intent for a last offer. Answer `none` to leave it as it is.',\n '- Write plain text: no HTML, no markdown, no links, no emoji, no fences.',\n '- Never invent a fact, a price, a discount, a deadline, a name or a guarantee the brief or the current copy did not give you; where one is missing, leave a clearly marked placeholder in square brackets.',\n '- Write in the language of the brief.',\n].join('\\n')\n\nexport const AI_OVERLAY_SYSTEM: AiSystemBlock[] = [\n { text: `${AI_OVERLAY_RULES}\\n\\n${AI_ACCEPTABLE_USE_BLOCK}`, cacheBreakpoint: true },\n]\n\nconst str = (value: unknown): string => (typeof value === 'string' ? value.trim() : '')\n\nconst TRIGGER_WORDS: Record<AiOverlayTrigger, (range: { min: number; max: number } | null) => string> = {\n delay: (range) => `delay (seconds after the page loads${range ? `, ${range.min} to ${range.max}` : ''})`,\n scroll: (range) => `scroll (percent of the page scrolled${range ? `, ${range.min} to ${range.max}` : ''})`,\n exit: () => 'exit (as the visitor moves to leave)',\n}\n\n/** The user turn: the brief, the overlay, its triggers and its copy as it stands. */\nexport function aiOverlayCopyPrompt(input: {\n brief: string\n kind: AiOverlayKind\n triggers: ReadonlyMap<AiOverlayTrigger, { min: number; max: number } | null>\n current: string\n}): string {\n const lines = [`Brief: ${input.brief}`, `Write the copy for ${input.kind === 'bar' ? 'an announcement bar' : 'a popup'}.`]\n if (input.kind === 'popup') {\n lines.push(\n input.triggers.size\n ? `Triggers the site offers: ${[...input.triggers].map(([id, range]) => TRIGGER_WORDS[id](range)).join('; ')}.`\n : 'Leave when it opens as it is: answer `none`.',\n )\n }\n if (input.current) lines.push('', 'The copy as it stands:', input.current)\n return lines.join('\\n')\n}\n\n/** A checked proposal as the job's output: shown as text, carried as fields. */\nexport function aiOverlayCopyOutput(\n job: Pick<AiJob, 'hostId' | 'inputs'>,\n proposal: AiOverlayCopyProposal,\n): AiJobOutput {\n return {\n resource: 'text',\n id: 'draft',\n hostId: job.hostId ?? null,\n hostSubdomain: str(job.inputs?.['hostSubdomain']) || null,\n label: proposal.kind === 'bar' ? 'Announcement bar copy' : 'Popup copy',\n text: aiOverlayCopyText(proposal),\n proposal: { task: AI_OVERLAY_COPY_TASK, ...proposal },\n note: 'Put this into the overlay editor to use it; nothing has been changed on the site.',\n }\n}\n\n/** The overlay task of the text step: one strict tool call, checked, never written. */\nexport async function runAiOverlayCopy(input: {\n job: Pick<AiJob, '$id' | 'brief' | 'hostId' | 'inputs'>\n model: string\n maxTokens: number\n signal?: AbortSignal\n}): Promise<AiJobStepOutcome> {\n const { job, model } = input\n const kind = aiOverlayKind(job.inputs)\n if (!kind) {\n return {\n outputs: [],\n usage: { inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0 },\n estCostUsd: 0,\n model,\n stopReason: null,\n failure: AI_OVERLAY_NO_KIND_COPY,\n }\n }\n const limits = aiOverlayLimits(job.inputs)\n const triggers = aiOverlayTriggerRanges(job.inputs)\n const result = await runAiRequest({\n model,\n system: AI_OVERLAY_SYSTEM,\n messages: [\n {\n role: 'user',\n content: aiOverlayCopyPrompt({\n brief: job.brief,\n kind,\n triggers,\n current: str(job.inputs?.['current']).slice(0, AI_OVERLAY_CURRENT_MAX_CHARS),\n }),\n },\n ],\n tools: [aiOverlayTool(kind, limits, [...triggers.keys()])],\n maxTokens: input.maxTokens,\n ...(AI_ROUTING_TABLE['job.text'].thinking ? { thinking: AI_ROUTING_TABLE['job.text'].thinking } : {}),\n ...(AI_ROUTING_TABLE['job.text'].effort ? { effort: AI_ROUTING_TABLE['job.text'].effort } : {}),\n stream: false,\n ...(input.signal ? { signal: input.signal } : {}),\n })\n const spent = {\n usage: result.usage,\n estCostUsd: result.estCostUsd,\n model,\n stopReason: result.stopReason,\n }\n if (result.kind === 'refusal') return { outputs: [], ...spent, refused: true }\n const checked = checkAiOverlayCopy(\n parseAiOverlayCopy(result.toolUse.find((use) => use.name === AI_OVERLAY_TOOL_NAME)?.input),\n kind,\n limits,\n triggers,\n )\n if (!checked) return { outputs: [], ...spent, failure: AI_OVERLAY_NO_COPY_COPY }\n if (checked.findings.length) {\n console.info('ai overlay copy held to its limits', { jobId: job.$id, findings: checked.findings })\n }\n return { outputs: [aiOverlayCopyOutput(job, checked.proposal)], ...spent }\n}\n"],"names":["AI_OVERLAY_COPY_TASK","AI_OVERLAY_CURRENT_MAX_CHARS","aiOverlayCopyText","aiOverlayKind","aiOverlayLimits","aiOverlayTriggerRanges","checkAiOverlayCopy","AI_ROUTING_TABLE","AI_ACCEPTABLE_USE_BLOCK","runAiRequest","AI_OVERLAY_TOOL_NAME","aiOverlayTool","parseAiOverlayCopy","AI_OVERLAY_NO_COPY_COPY","AI_OVERLAY_NO_KIND_COPY","AI_OVERLAY_RULES","join","AI_OVERLAY_SYSTEM","text","cacheBreakpoint","str","value","trim","TRIGGER_WORDS","delay","range","min","max","scroll","exit","aiOverlayCopyPrompt","input","lines","brief","kind","push","triggers","size","map","id","current","aiOverlayCopyOutput","job","proposal","resource","hostId","hostSubdomain","inputs","label","task","note","runAiOverlayCopy","result","model","outputs","usage","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","estCostUsd","stopReason","failure","limits","system","messages","role","content","slice","tools","keys","maxTokens","thinking","effort","stream","signal","spent","refused","checked","toolUse","find","use","name","findings","length","console","info","jobId","$id"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,oBAAoB,EACpBC,4BAA4B,EAC5BC,iBAAiB,EACjBC,aAAa,EACbC,eAAe,EACfC,sBAAsB,EACtBC,kBAAkB,QAIb,8BAA0B;AAEjC,SAASC,gBAAgB,QAAQ,0BAAsB;AACvD,SACEC,uBAAuB,EACvBC,YAAY,QAEP,2BAAuB;AAC9B,SAASC,oBAAoB,EAAEC,aAAa,EAAEC,kBAAkB,QAAQ,8BAA0B;AAGlG;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GAED,y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026 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 { NodesMap } from '@aglyn/aglyn/types/nodes';
|
|
18
|
+
import { type AiBuildPlanScreen } from '../model/ai-build-plan';
|
|
19
|
+
import type { AiJob, AiJobPlan } from '../model/ai-jobs.types';
|
|
20
|
+
import { type AiSiteInventory } from '../model/ai-site-inventory';
|
|
21
|
+
import { type AiLayoutSection, type AiLayoutSettlement } from '../layout-language/ai-layout-language';
|
|
22
|
+
import type { AiLayoutTargets } from '../layout-language/ai-layout-links';
|
|
23
|
+
import { type AiGenerationCheck, type AiValidatedGeneration } from '../runtime/ai-doctrine';
|
|
24
|
+
import { type AiDoctrineTreeContext } from '../runtime/ai-doctrine-validators';
|
|
25
|
+
import type { AiLoadEstimate } from '../runtime/ai-palette';
|
|
26
|
+
import type { AiSystemBlock } from '../runtime/ai-runtime';
|
|
27
|
+
/**
|
|
28
|
+
* A page built in the compact layout language (AGL-3660): the page step's
|
|
29
|
+
* pass for a site's page units — a guided start's and a build's — in place of
|
|
30
|
+
* the raw-tree section passes.
|
|
31
|
+
*
|
|
32
|
+
* ONE answer a page: every planned section, in the language, through
|
|
33
|
+
* `submit_page`. The compiler writes the tree, the palette validator stores
|
|
34
|
+
* it as it stores any generated tree, and the doctrine checks the whole page.
|
|
35
|
+
* A section the answer left out or left empty is the one thing a re-ask asks
|
|
36
|
+
* for: the sections that read are kept, and the second answer fills only
|
|
37
|
+
* what is still missing. Then the page step's last pass runs as it always
|
|
38
|
+
* has — the whole page held to the doctrine again, its listing written, the
|
|
39
|
+
* draft reported — so the item ledger, the credits and Try again work exactly
|
|
40
|
+
* as they did.
|
|
41
|
+
*/
|
|
42
|
+
/** The unit input that says a page or a layout is built in the layout language. */
|
|
43
|
+
export declare const AI_LAYOUT_LANGUAGE_INPUT = "layoutLanguage";
|
|
44
|
+
/** The unit input naming the page of the site that places its form, where it is another page. */
|
|
45
|
+
export declare const AI_LAYOUT_FORM_PAGE_INPUT = "layoutFormPage";
|
|
46
|
+
/** Whether this job builds its page or its layout in the layout language. */
|
|
47
|
+
export declare function aiJobUsesLayoutLanguage(job: Pick<AiJob, 'inputs'>): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The most one page's answer asks for. A section in the language is about
|
|
50
|
+
* 120 to 250 tokens with its copy, so the largest page a plan admits — eight
|
|
51
|
+
* sections — fits with room; the compiler, not the ceiling, keeps a page small.
|
|
52
|
+
*/
|
|
53
|
+
export declare const AI_JOB_PAGE_LANGUAGE_TOKENS = 3000;
|
|
54
|
+
/**
|
|
55
|
+
* The time a language page pass needs: its lookup rounds, its answer and its
|
|
56
|
+
* re-ask at `AI_JOB_PAGE_LANGUAGE_TOKENS` on the tier the page step is served
|
|
57
|
+
* from, with the step's reads and writes.
|
|
58
|
+
*/
|
|
59
|
+
/** The most the follow-up asking only for the sections an answer left out may run to. */
|
|
60
|
+
export declare const AI_JOB_PAGE_LANGUAGE_FOLLOW_UP_TOKENS = 1500;
|
|
61
|
+
export declare const AI_JOB_PAGE_LANGUAGE_BUDGET: import("./ai-job-budget").AiJobStepBudget;
|
|
62
|
+
/** The doctrine scope the language doors are told: values the compiler checks itself. */
|
|
63
|
+
export declare const AI_LAYOUT_PAGE_KIND = "layout-page";
|
|
64
|
+
/** The language, as the page door's cached instructions. */
|
|
65
|
+
export declare const AI_JOB_PAGE_LANGUAGE_INSTRUCTIONS: readonly AiSystemBlock[];
|
|
66
|
+
/** The page of a site plan that places its form: the form the plan creates, or one the site has. */
|
|
67
|
+
export declare function aiLayoutFormPageOfPlan(plan: Pick<AiJobPlan, 'create' | 'screens'>, formIds?: readonly string[]): string | null;
|
|
68
|
+
/** Every word the job was given, which a page's contact details are held to. */
|
|
69
|
+
export declare function aiLayoutFacts(job: Pick<AiJob, 'brief' | 'inputs'>): string;
|
|
70
|
+
/** What a page's links resolve against: the site's pages, built and planned, its forms and components. */
|
|
71
|
+
export declare function aiLayoutPageTargets(input: {
|
|
72
|
+
job: Pick<AiJob, 'brief' | 'inputs'>;
|
|
73
|
+
inventory: AiSiteInventory | null;
|
|
74
|
+
own: ReadonlyArray<string | null | undefined>;
|
|
75
|
+
}): AiLayoutTargets;
|
|
76
|
+
/** The page's user turn: the page, the brief, the plan, its sections and where its links may go. */
|
|
77
|
+
export declare function aiLayoutPagePrompt(input: {
|
|
78
|
+
job: Pick<AiJob, 'brief' | 'inputs' | '$id'>;
|
|
79
|
+
plan: AiJobPlan;
|
|
80
|
+
screen: AiBuildPlanScreen;
|
|
81
|
+
targets: AiLayoutTargets;
|
|
82
|
+
reusableComponents: boolean;
|
|
83
|
+
/** The sections a re-ask still needs, by plan index; absent on the first ask. */
|
|
84
|
+
missing?: readonly number[];
|
|
85
|
+
}): string;
|
|
86
|
+
/** A validated language page, stored as the page keeps it. */
|
|
87
|
+
export interface AiLayoutPageBuilt {
|
|
88
|
+
nodes: NodesMap;
|
|
89
|
+
load: AiLoadEstimate | null;
|
|
90
|
+
settled: AiLayoutSettlement[];
|
|
91
|
+
/** What the last answer's gaps took out of the page (`ai-layout-gaps.ts`). */
|
|
92
|
+
dropped: string[];
|
|
93
|
+
}
|
|
94
|
+
export interface AiLayoutPageCheckInput {
|
|
95
|
+
screen: AiBuildPlanScreen;
|
|
96
|
+
sectionIds: readonly string[];
|
|
97
|
+
targets: AiLayoutTargets;
|
|
98
|
+
context: AiDoctrineTreeContext;
|
|
99
|
+
reusableComponents: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* What earlier answers gave, by plan index, shared between the page's
|
|
102
|
+
* generations: a follow-up asking only for missing sections fills the rest.
|
|
103
|
+
*/
|
|
104
|
+
kept?: Array<AiLayoutSection | null>;
|
|
105
|
+
/** The plan indices this answer's sections fill, in order; absent, every section. */
|
|
106
|
+
only?: readonly number[];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The follow-up turn for the sections a page's answer left out (AGL-3660):
|
|
110
|
+
* the page as before, told which sections it already has, and asked for only
|
|
111
|
+
* the missing ones, in order — the one part of a page asked for again.
|
|
112
|
+
*/
|
|
113
|
+
export declare function aiLayoutMissingSectionsPrompt(input: {
|
|
114
|
+
base: string;
|
|
115
|
+
screen: AiBuildPlanScreen;
|
|
116
|
+
missing: readonly number[];
|
|
117
|
+
}): string;
|
|
118
|
+
/** The plan indices a page still lacks, after the answers so far. */
|
|
119
|
+
export declare function aiLayoutMissingSections(kept: ReadonlyArray<AiLayoutSection | null>): number[];
|
|
120
|
+
/** The violation a planned section the answer gave nothing usable for is named by. */
|
|
121
|
+
export declare const AI_LAYOUT_SECTION_MISSING_CODE = "layout-section-missing";
|
|
122
|
+
/**
|
|
123
|
+
* The check a language page answer is held to: each planned section read,
|
|
124
|
+
* the page compiled, stored and checked whole. Sections that read are kept
|
|
125
|
+
* across the re-ask, so the second answer is asked only for what was missing,
|
|
126
|
+
* and a section it sends again that already read is not taken twice.
|
|
127
|
+
*/
|
|
128
|
+
export declare function aiLayoutPageCheck(input: AiLayoutPageCheckInput): AiGenerationCheck<AiLayoutPageBuilt>;
|
|
129
|
+
export interface AiLayoutPageRunInput {
|
|
130
|
+
job: Pick<AiJob, 'brief' | 'inputs' | '$id'>;
|
|
131
|
+
plan: AiJobPlan;
|
|
132
|
+
screen: AiBuildPlanScreen;
|
|
133
|
+
sectionIds: readonly string[];
|
|
134
|
+
targets: AiLayoutTargets;
|
|
135
|
+
context: AiDoctrineTreeContext;
|
|
136
|
+
reusableComponents: boolean;
|
|
137
|
+
inventory: AiSiteInventory | null;
|
|
138
|
+
model: string;
|
|
139
|
+
signal?: AbortSignal;
|
|
140
|
+
/** Wraps the check, for an eval that records each answer it reads. */
|
|
141
|
+
observe?: (check: AiGenerationCheck<AiLayoutPageBuilt>) => AiGenerationCheck<AiLayoutPageBuilt>;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A whole page in the layout language: one answer for every section, and,
|
|
145
|
+
* where that answer and its re-ask still left a section out, one follow-up
|
|
146
|
+
* asking for only those (AGL-3660). The sections that read are kept between
|
|
147
|
+
* them, so the page is compiled whole once every section is designed.
|
|
148
|
+
*/
|
|
149
|
+
export declare function aiRunLayoutPage(input: AiLayoutPageRunInput): Promise<AiValidatedGeneration<AiLayoutPageBuilt>>;
|