@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.
Files changed (340) hide show
  1. package/README.md +3 -3
  2. package/package.json +17 -17
  3. package/src/lib/activity/ai-activity-actions.js +7 -1
  4. package/src/lib/activity/ai-activity-actions.js.map +1 -1
  5. package/src/lib/components/ai-assist-provider-on-host.component.d.ts +66 -0
  6. package/src/lib/components/ai-assist-provider-on-host.component.js +78 -0
  7. package/src/lib/components/ai-assist-provider-on-host.component.js.map +1 -0
  8. package/src/lib/components/ai-assist-provider.component.js +9 -10
  9. package/src/lib/components/ai-assist-provider.component.js.map +1 -1
  10. package/src/lib/components/ai-automation-zones.d.ts +38 -0
  11. package/src/lib/components/ai-automation-zones.js +5 -1
  12. package/src/lib/components/ai-automation-zones.js.map +1 -1
  13. package/src/lib/components/ai-brief-dialog.component.d.ts +20 -2
  14. package/src/lib/components/ai-brief-dialog.component.js +87 -8
  15. package/src/lib/components/ai-brief-dialog.component.js.map +1 -1
  16. package/src/lib/components/ai-campaign-create.component.d.ts +54 -0
  17. package/src/lib/components/ai-campaign-create.component.js +270 -0
  18. package/src/lib/components/ai-campaign-create.component.js.map +1 -0
  19. package/src/lib/components/ai-describe-automation.component.d.ts +8 -3
  20. package/src/lib/components/ai-describe-automation.component.js +15 -6
  21. package/src/lib/components/ai-describe-automation.component.js.map +1 -1
  22. package/src/lib/components/ai-describe-button.component.d.ts +20 -8
  23. package/src/lib/components/ai-describe-button.component.js +19 -36
  24. package/src/lib/components/ai-describe-button.component.js.map +1 -1
  25. package/src/lib/components/ai-describe-email.component.d.ts +31 -0
  26. package/src/lib/components/ai-describe-email.component.js +22 -0
  27. package/src/lib/components/ai-describe-email.component.js.map +1 -0
  28. package/src/lib/components/ai-describe-org-automation.component.d.ts +36 -0
  29. package/src/lib/components/ai-describe-org-automation.component.js +238 -0
  30. package/src/lib/components/ai-describe-org-automation.component.js.map +1 -0
  31. package/src/lib/components/ai-experiment-cards.component.d.ts +9 -1
  32. package/src/lib/components/ai-experiment-cards.component.js +104 -18
  33. package/src/lib/components/ai-experiment-cards.component.js.map +1 -1
  34. package/src/lib/components/ai-explain-automation.component.js +1 -5
  35. package/src/lib/components/ai-explain-automation.component.js.map +1 -1
  36. package/src/lib/components/ai-funnel-zones.component.d.ts +61 -0
  37. package/src/lib/components/ai-funnel-zones.component.js +178 -0
  38. package/src/lib/components/ai-funnel-zones.component.js.map +1 -0
  39. package/src/lib/components/ai-insight-card.component.d.ts +42 -0
  40. package/src/lib/components/ai-insight-card.component.js +137 -0
  41. package/src/lib/components/ai-insight-card.component.js.map +1 -0
  42. package/src/lib/components/ai-insight-dialog.component.d.ts +6 -0
  43. package/src/lib/components/ai-insight-dialog.component.js +9 -3
  44. package/src/lib/components/ai-insight-dialog.component.js.map +1 -1
  45. package/src/lib/components/ai-job-plan.component.d.ts +7 -2
  46. package/src/lib/components/ai-job-plan.component.js +38 -6
  47. package/src/lib/components/ai-job-plan.component.js.map +1 -1
  48. package/src/lib/components/ai-job-requests.d.ts +17 -1
  49. package/src/lib/components/ai-job-requests.js +39 -3
  50. package/src/lib/components/ai-job-requests.js.map +1 -1
  51. package/src/lib/components/ai-logic-zones.d.ts +64 -0
  52. package/src/lib/components/ai-logic-zones.js +18 -0
  53. package/src/lib/components/ai-logic-zones.js.map +1 -0
  54. package/src/lib/components/ai-logic.component.d.ts +77 -0
  55. package/src/lib/components/ai-logic.component.js +553 -0
  56. package/src/lib/components/ai-logic.component.js.map +1 -0
  57. package/src/lib/components/ai-marketing-insight.component.d.ts +30 -0
  58. package/src/lib/components/ai-marketing-insight.component.js +80 -0
  59. package/src/lib/components/ai-marketing-insight.component.js.map +1 -0
  60. package/src/lib/components/ai-media-create.component.d.ts +55 -0
  61. package/src/lib/components/ai-media-create.component.js +433 -0
  62. package/src/lib/components/ai-media-create.component.js.map +1 -0
  63. package/src/lib/components/ai-overlay-cards.component.d.ts +83 -0
  64. package/src/lib/components/ai-overlay-cards.component.js +505 -0
  65. package/src/lib/components/ai-overlay-cards.component.js.map +1 -0
  66. package/src/lib/components/ai-permissions-on-host.component.d.ts +3 -46
  67. package/src/lib/components/ai-permissions-on-host.component.js +5 -53
  68. package/src/lib/components/ai-permissions-on-host.component.js.map +1 -1
  69. package/src/lib/components/ai-product-zones.d.ts +5 -0
  70. package/src/lib/components/ai-product-zones.js +1 -1
  71. package/src/lib/components/ai-product-zones.js.map +1 -1
  72. package/src/lib/components/ai-products-create-button.component.d.ts +42 -0
  73. package/src/lib/components/ai-products-create-button.component.js +67 -0
  74. package/src/lib/components/ai-products-create-button.component.js.map +1 -0
  75. package/src/lib/components/ai-products-hub-card.component.js +100 -81
  76. package/src/lib/components/ai-products-hub-card.component.js.map +1 -1
  77. package/src/lib/components/ai-revise-automation.component.d.ts +16 -0
  78. package/src/lib/components/ai-revise-automation.component.js +207 -0
  79. package/src/lib/components/ai-revise-automation.component.js.map +1 -0
  80. package/src/lib/components/ai-site-build-page.component.js +160 -24
  81. package/src/lib/components/ai-site-build-page.component.js.map +1 -1
  82. package/src/lib/components/ai-upsell-dialog.component.d.ts +53 -0
  83. package/src/lib/components/ai-upsell-dialog.component.js +177 -0
  84. package/src/lib/components/ai-upsell-dialog.component.js.map +1 -0
  85. package/src/lib/components/assist-build-card.component.d.ts +42 -0
  86. package/src/lib/components/assist-build-card.component.js +183 -0
  87. package/src/lib/components/assist-build-card.component.js.map +1 -0
  88. package/src/lib/components/assist-edit-canvas.d.ts +2 -0
  89. package/src/lib/components/assist-edit-canvas.js +56 -1
  90. package/src/lib/components/assist-edit-canvas.js.map +1 -1
  91. package/src/lib/components/assist-jobs-drawer.component.js +48 -3
  92. package/src/lib/components/assist-jobs-drawer.component.js.map +1 -1
  93. package/src/lib/components/assist-panel.component.js +51 -2
  94. package/src/lib/components/assist-panel.component.js.map +1 -1
  95. package/src/lib/components/use-ai-job-run.d.ts +3 -14
  96. package/src/lib/components/use-ai-job-run.js +0 -50
  97. package/src/lib/components/use-ai-job-run.js.map +1 -1
  98. package/src/lib/jobs/ai-build-capabilities.d.ts +58 -0
  99. package/src/lib/jobs/ai-build-capabilities.js +256 -0
  100. package/src/lib/jobs/ai-build-capabilities.js.map +1 -0
  101. package/src/lib/jobs/ai-build-unit-outcome.d.ts +52 -0
  102. package/src/lib/jobs/ai-build-unit-outcome.js +140 -0
  103. package/src/lib/jobs/ai-build-unit-outcome.js.map +1 -0
  104. package/src/lib/jobs/ai-job-auto-confirm.d.ts +8 -0
  105. package/src/lib/jobs/ai-job-auto-confirm.js +30 -6
  106. package/src/lib/jobs/ai-job-auto-confirm.js.map +1 -1
  107. package/src/lib/jobs/ai-job-build-step.d.ts +144 -0
  108. package/src/lib/jobs/ai-job-build-step.js +668 -0
  109. package/src/lib/jobs/ai-job-build-step.js.map +1 -0
  110. package/src/lib/jobs/ai-job-draft-ids.js +9 -1
  111. package/src/lib/jobs/ai-job-draft-ids.js.map +1 -1
  112. package/src/lib/jobs/ai-job-drafts.d.ts +14 -4
  113. package/src/lib/jobs/ai-job-drafts.js +25 -4
  114. package/src/lib/jobs/ai-job-drafts.js.map +1 -1
  115. package/src/lib/jobs/ai-job-generation.d.ts +8 -0
  116. package/src/lib/jobs/ai-job-generation.js +13 -2
  117. package/src/lib/jobs/ai-job-generation.js.map +1 -1
  118. package/src/lib/jobs/ai-job-insight-step.js +8 -1
  119. package/src/lib/jobs/ai-job-insight-step.js.map +1 -1
  120. package/src/lib/jobs/ai-job-layout-language.d.ts +73 -0
  121. package/src/lib/jobs/ai-job-layout-language.js +194 -0
  122. package/src/lib/jobs/ai-job-layout-language.js.map +1 -0
  123. package/src/lib/jobs/ai-job-layout-site-pages.d.ts +13 -2
  124. package/src/lib/jobs/ai-job-layout-site-pages.js +18 -2
  125. package/src/lib/jobs/ai-job-layout-site-pages.js.map +1 -1
  126. package/src/lib/jobs/ai-job-layout-step.d.ts +5 -0
  127. package/src/lib/jobs/ai-job-layout-step.js +105 -5
  128. package/src/lib/jobs/ai-job-layout-step.js.map +1 -1
  129. package/src/lib/jobs/ai-job-logic-step.d.ts +107 -0
  130. package/src/lib/jobs/ai-job-logic-step.js +395 -0
  131. package/src/lib/jobs/ai-job-logic-step.js.map +1 -0
  132. package/src/lib/jobs/ai-job-overlay-copy.d.ts +70 -0
  133. package/src/lib/jobs/ai-job-overlay-copy.js +178 -0
  134. package/src/lib/jobs/ai-job-overlay-copy.js.map +1 -0
  135. package/src/lib/jobs/ai-job-page-language.d.ts +149 -0
  136. package/src/lib/jobs/ai-job-page-language.js +355 -0
  137. package/src/lib/jobs/ai-job-page-language.js.map +1 -0
  138. package/src/lib/jobs/ai-job-page-sections.d.ts +37 -1
  139. package/src/lib/jobs/ai-job-page-sections.js +93 -11
  140. package/src/lib/jobs/ai-job-page-sections.js.map +1 -1
  141. package/src/lib/jobs/ai-job-page-step.d.ts +4 -4
  142. package/src/lib/jobs/ai-job-page-step.js +111 -20
  143. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  144. package/src/lib/jobs/ai-job-plan-step.d.ts +27 -2
  145. package/src/lib/jobs/ai-job-plan-step.js +87 -13
  146. package/src/lib/jobs/ai-job-plan-step.js.map +1 -1
  147. package/src/lib/jobs/ai-job-site-step.d.ts +19 -1
  148. package/src/lib/jobs/ai-job-site-step.js +220 -61
  149. package/src/lib/jobs/ai-job-site-step.js.map +1 -1
  150. package/src/lib/jobs/ai-job-text-step.d.ts +22 -1
  151. package/src/lib/jobs/ai-job-text-step.js +12 -0
  152. package/src/lib/jobs/ai-job-text-step.js.map +1 -1
  153. package/src/lib/jobs/ai-job-workflow-step.d.ts +54 -4
  154. package/src/lib/jobs/ai-job-workflow-step.js +320 -15
  155. package/src/lib/jobs/ai-job-workflow-step.js.map +1 -1
  156. package/src/lib/jobs/ai-jobs.d.ts +80 -2
  157. package/src/lib/jobs/ai-jobs.js +391 -18
  158. package/src/lib/jobs/ai-jobs.js.map +1 -1
  159. package/src/lib/jobs/ai-layout-full-height.d.ts +40 -0
  160. package/src/lib/jobs/ai-layout-full-height.js +82 -0
  161. package/src/lib/jobs/ai-layout-full-height.js.map +1 -0
  162. package/src/lib/jobs/ai-layout-site-facts.d.ts +54 -0
  163. package/src/lib/jobs/ai-layout-site-facts.js +153 -0
  164. package/src/lib/jobs/ai-layout-site-facts.js.map +1 -0
  165. package/src/lib/jobs/ai-logic-records.d.ts +40 -0
  166. package/src/lib/jobs/ai-logic-records.js +55 -0
  167. package/src/lib/jobs/ai-logic-records.js.map +1 -0
  168. package/src/lib/jobs/ai-site-publish.d.ts +7 -0
  169. package/src/lib/jobs/ai-site-publish.js +9 -0
  170. package/src/lib/jobs/ai-site-publish.js.map +1 -1
  171. package/src/lib/jobs/ai-workflow-records.d.ts +4 -0
  172. package/src/lib/jobs/ai-workflow-records.js +40 -1
  173. package/src/lib/jobs/ai-workflow-records.js.map +1 -1
  174. package/src/lib/layout-language/ai-layout-compiler.d.ts +145 -0
  175. package/src/lib/layout-language/ai-layout-compiler.js +1148 -0
  176. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -0
  177. package/src/lib/layout-language/ai-layout-copy.d.ts +73 -0
  178. package/src/lib/layout-language/ai-layout-copy.js +137 -0
  179. package/src/lib/layout-language/ai-layout-copy.js.map +1 -0
  180. package/src/lib/layout-language/ai-layout-frame.d.ts +52 -0
  181. package/src/lib/layout-language/ai-layout-frame.js +457 -0
  182. package/src/lib/layout-language/ai-layout-frame.js.map +1 -0
  183. package/src/lib/layout-language/ai-layout-gaps.d.ts +63 -0
  184. package/src/lib/layout-language/ai-layout-gaps.js +345 -0
  185. package/src/lib/layout-language/ai-layout-gaps.js.map +1 -0
  186. package/src/lib/layout-language/ai-layout-language.d.ts +161 -0
  187. package/src/lib/layout-language/ai-layout-language.js +446 -0
  188. package/src/lib/layout-language/ai-layout-language.js.map +1 -0
  189. package/src/lib/layout-language/ai-layout-links.d.ts +80 -0
  190. package/src/lib/layout-language/ai-layout-links.js +109 -0
  191. package/src/lib/layout-language/ai-layout-links.js.map +1 -0
  192. package/src/lib/layout-language/ai-layout-store.d.ts +39 -0
  193. package/src/lib/layout-language/ai-layout-store.js +69 -0
  194. package/src/lib/layout-language/ai-layout-store.js.map +1 -0
  195. package/src/lib/layout-language/ai-layout-tree.d.ts +59 -0
  196. package/src/lib/layout-language/ai-layout-tree.js +84 -0
  197. package/src/lib/layout-language/ai-layout-tree.js.map +1 -0
  198. package/src/lib/lazy-widget.d.ts +45 -0
  199. package/src/lib/lazy-widget.js +53 -0
  200. package/src/lib/lazy-widget.js.map +1 -0
  201. package/src/lib/model/ai-automation-draft.d.ts +18 -0
  202. package/src/lib/model/ai-automation-draft.js +86 -0
  203. package/src/lib/model/ai-automation-draft.js.map +1 -1
  204. package/src/lib/model/ai-build-job.d.ts +201 -0
  205. package/src/lib/model/ai-build-job.js +472 -0
  206. package/src/lib/model/ai-build-job.js.map +1 -0
  207. package/src/lib/model/ai-build-plan.d.ts +61 -0
  208. package/src/lib/model/ai-build-plan.js +154 -9
  209. package/src/lib/model/ai-build-plan.js.map +1 -1
  210. package/src/lib/model/ai-build-progress.d.ts +73 -0
  211. package/src/lib/model/ai-build-progress.js +170 -0
  212. package/src/lib/model/ai-build-progress.js.map +1 -0
  213. package/src/lib/model/ai-host-publish-context.d.ts +51 -0
  214. package/src/lib/model/ai-host-publish-context.js +104 -0
  215. package/src/lib/model/ai-host-publish-context.js.map +1 -0
  216. package/src/lib/model/ai-insight.d.ts +20 -10
  217. package/src/lib/model/ai-insight.js +72 -9
  218. package/src/lib/model/ai-insight.js.map +1 -1
  219. package/src/lib/model/ai-job-activity.d.ts +22 -0
  220. package/src/lib/model/ai-job-activity.js +25 -2
  221. package/src/lib/model/ai-job-activity.js.map +1 -1
  222. package/src/lib/model/ai-job-failure-copy.d.ts +38 -1
  223. package/src/lib/model/ai-job-failure-copy.js +56 -1
  224. package/src/lib/model/ai-job-failure-copy.js.map +1 -1
  225. package/src/lib/model/ai-job-notice.d.ts +3 -1
  226. package/src/lib/model/ai-job-notice.js +31 -9
  227. package/src/lib/model/ai-job-notice.js.map +1 -1
  228. package/src/lib/model/ai-jobs.types.d.ts +99 -2
  229. package/src/lib/model/ai-jobs.types.js +3 -1
  230. package/src/lib/model/ai-jobs.types.js.map +1 -1
  231. package/src/lib/model/ai-logic-job.d.ts +108 -0
  232. package/src/lib/model/ai-logic-job.js +327 -0
  233. package/src/lib/model/ai-logic-job.js.map +1 -0
  234. package/src/lib/model/ai-media-credits.d.ts +52 -0
  235. package/src/lib/model/ai-media-credits.js +61 -0
  236. package/src/lib/model/ai-media-credits.js.map +1 -0
  237. package/src/lib/model/ai-overlay-copy.d.ts +114 -0
  238. package/src/lib/model/ai-overlay-copy.js +175 -0
  239. package/src/lib/model/ai-overlay-copy.js.map +1 -0
  240. package/src/lib/model/ai-site-build-progress.d.ts +25 -4
  241. package/src/lib/model/ai-site-build-progress.js +194 -11
  242. package/src/lib/model/ai-site-build-progress.js.map +1 -1
  243. package/src/lib/model/ai-site-job.d.ts +8 -0
  244. package/src/lib/model/ai-site-job.js +9 -0
  245. package/src/lib/model/ai-site-job.js.map +1 -1
  246. package/src/lib/model/ai-site-start-seo.d.ts +1 -1
  247. package/src/lib/model/ai-site-start.d.ts +5 -2
  248. package/src/lib/model/ai-site-start.js +5 -2
  249. package/src/lib/model/ai-site-start.js.map +1 -1
  250. package/src/lib/model/ai-svg.d.ts +69 -0
  251. package/src/lib/model/ai-svg.js +265 -0
  252. package/src/lib/model/ai-svg.js.map +1 -0
  253. package/src/lib/model/ai-usage-by-user.d.ts +3 -2
  254. package/src/lib/model/ai-usage-by-user.js.map +1 -1
  255. package/src/lib/model/ai-workflow-job.d.ts +92 -4
  256. package/src/lib/model/ai-workflow-job.js +124 -7
  257. package/src/lib/model/ai-workflow-job.js.map +1 -1
  258. package/src/lib/model/assist-build.d.ts +58 -0
  259. package/src/lib/model/assist-build.js +52 -0
  260. package/src/lib/model/assist-build.js.map +1 -0
  261. package/src/lib/model/assist-edit.d.ts +48 -3
  262. package/src/lib/model/assist-edit.js +48 -4
  263. package/src/lib/model/assist-edit.js.map +1 -1
  264. package/src/lib/plugin-config.js +2 -0
  265. package/src/lib/plugin-config.js.map +1 -1
  266. package/src/lib/plugin.js +308 -47
  267. package/src/lib/plugin.js.map +1 -1
  268. package/src/lib/providers/catalog.d.ts +82 -5
  269. package/src/lib/providers/catalog.js +83 -12
  270. package/src/lib/providers/catalog.js.map +1 -1
  271. package/src/lib/providers/image-contract.d.ts +116 -0
  272. package/src/lib/providers/image-contract.js +74 -0
  273. package/src/lib/providers/image-contract.js.map +1 -0
  274. package/src/lib/providers/model-choice.js +11 -0
  275. package/src/lib/providers/model-choice.js.map +1 -1
  276. package/src/lib/providers/routing.js +18 -0
  277. package/src/lib/providers/routing.js.map +1 -1
  278. package/src/lib/providers/vertex-image.d.ts +121 -0
  279. package/src/lib/providers/vertex-image.js +312 -0
  280. package/src/lib/providers/vertex-image.js.map +1 -0
  281. package/src/lib/runtime/ai-doctrine-validators.d.ts +101 -0
  282. package/src/lib/runtime/ai-doctrine-validators.js +525 -4
  283. package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
  284. package/src/lib/runtime/ai-doctrine.js +21 -6
  285. package/src/lib/runtime/ai-doctrine.js.map +1 -1
  286. package/src/lib/runtime/ai-eval-live.js +4 -0
  287. package/src/lib/runtime/ai-eval-live.js.map +1 -1
  288. package/src/lib/runtime/ai-eval.d.ts +15 -1
  289. package/src/lib/runtime/ai-eval.js +52 -1
  290. package/src/lib/runtime/ai-eval.js.map +1 -1
  291. package/src/lib/runtime/ai-icon-library.d.ts +257 -0
  292. package/src/lib/runtime/ai-icon-library.js +254 -0
  293. package/src/lib/runtime/ai-icon-library.js.map +1 -0
  294. package/src/lib/runtime/ai-node-tree.d.ts +9 -0
  295. package/src/lib/runtime/ai-node-tree.js +30 -4
  296. package/src/lib/runtime/ai-node-tree.js.map +1 -1
  297. package/src/lib/runtime/ai-palette.d.ts +6 -0
  298. package/src/lib/runtime/ai-palette.generated.js +70 -0
  299. package/src/lib/runtime/ai-palette.generated.js.map +1 -1
  300. package/src/lib/runtime/ai-palette.js.map +1 -1
  301. package/src/lib/runtime/experiment-variant-copy.d.ts +34 -0
  302. package/src/lib/runtime/experiment-variant-copy.js +102 -0
  303. package/src/lib/runtime/experiment-variant-copy.js.map +1 -0
  304. package/src/lib/server/ai-experiment-versions.d.ts +51 -0
  305. package/src/lib/server/ai-experiment-versions.js +270 -0
  306. package/src/lib/server/ai-experiment-versions.js.map +1 -0
  307. package/src/lib/server/ai-jobs-resume.js +74 -4
  308. package/src/lib/server/ai-jobs-resume.js.map +1 -1
  309. package/src/lib/server/ai-media-image.d.ts +66 -0
  310. package/src/lib/server/ai-media-image.js +521 -0
  311. package/src/lib/server/ai-media-image.js.map +1 -0
  312. package/src/lib/server/ai-media-svg.d.ts +91 -0
  313. package/src/lib/server/ai-media-svg.js +186 -0
  314. package/src/lib/server/ai-media-svg.js.map +1 -0
  315. package/src/lib/server/assist-build.d.ts +54 -0
  316. package/src/lib/server/assist-build.js +121 -0
  317. package/src/lib/server/assist-build.js.map +1 -0
  318. package/src/lib/server/assist-chat.js +108 -12
  319. package/src/lib/server/assist-chat.js.map +1 -1
  320. package/src/lib/server/assist-edit.js +213 -3
  321. package/src/lib/server/assist-edit.js.map +1 -1
  322. package/src/lib/server/assist-view-context.js +242 -4
  323. package/src/lib/server/assist-view-context.js.map +1 -1
  324. package/src/lib/server.js +26 -0
  325. package/src/lib/server.js.map +1 -1
  326. package/src/lib/tools/ai-logic-tool.d.ts +27 -0
  327. package/src/lib/tools/ai-logic-tool.js +207 -0
  328. package/src/lib/tools/ai-logic-tool.js.map +1 -0
  329. package/src/lib/tools/ai-overlay-tool.d.ts +35 -0
  330. package/src/lib/tools/ai-overlay-tool.js +107 -0
  331. package/src/lib/tools/ai-overlay-tool.js.map +1 -0
  332. package/src/lib/tools/ai-workflow-tool.d.ts +17 -2
  333. package/src/lib/tools/ai-workflow-tool.js +47 -14
  334. package/src/lib/tools/ai-workflow-tool.js.map +1 -1
  335. package/src/lib/usage/assist-job-refund.d.ts +28 -1
  336. package/src/lib/usage/assist-job-refund.js +44 -9
  337. package/src/lib/usage/assist-job-refund.js.map +1 -1
  338. package/src/lib/usage/assist-usage.d.ts +5 -0
  339. package/src/lib/usage/assist-usage.js +2 -0
  340. package/src/lib/usage/assist-usage.js.map +1 -1
@@ -0,0 +1,175 @@
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
+ */ /**
18
+ * Overlay copy by AI (AGL-3603): what a `text` job asked for an announcement
19
+ * bar's or a popup's copy answers, in the shape the step writes and the
20
+ * console reads. Pure data, so the widgets and the step share one reading.
21
+ *
22
+ * The overlay is the marketing plugin's, and neither plugin imports the other:
23
+ * the limits and the trigger catalog are handed to the widget by the zone,
24
+ * and the widget passes them on as the job's inputs. The step then holds the
25
+ * answer to the TIGHTER of those and its own ceilings below, so a job started
26
+ * by anything else is still bounded, and drops a trigger the caller did not
27
+ * name rather than inventing one.
28
+ */ /** The `text` job's `inputs.task` that asks for overlay copy. */ export const AI_OVERLAY_COPY_TASK = 'overlay';
29
+ /** The step's own ceilings: no zone may widen a field past these. */ export const AI_OVERLAY_COPY_CEILINGS = {
30
+ name: 80,
31
+ text: 200,
32
+ headline: 120,
33
+ body: 600,
34
+ ctaLabel: 60
35
+ };
36
+ /** The triggers a popup may be proposed to open on, as the site runtime names them. */ export const AI_OVERLAY_TRIGGERS = [
37
+ 'delay',
38
+ 'scroll',
39
+ 'exit'
40
+ ];
41
+ /** The longest description of the current copy a job sends. */ export const AI_OVERLAY_CURRENT_MAX_CHARS = 1200;
42
+ const str = (value)=>typeof value === 'string' ? value.trim() : '';
43
+ /** The kind a job's inputs name, or `null`. */ export function aiOverlayKind(inputs) {
44
+ const kind = inputs == null ? void 0 : inputs['overlayKind'];
45
+ return kind === 'bar' || kind === 'popup' ? kind : null;
46
+ }
47
+ /** Whether a `text` job's inputs ask for overlay copy. */ export function aiOverlayCopyRequested(inputs) {
48
+ return (inputs == null ? void 0 : inputs['task']) === AI_OVERLAY_COPY_TASK;
49
+ }
50
+ /**
51
+ * The limit each field is held to: the caller's, where it named one, never
52
+ * past the step's ceiling. Inputs carry them as `limit_<field>`.
53
+ */ export function aiOverlayLimits(inputs) {
54
+ const limits = _extends({}, AI_OVERLAY_COPY_CEILINGS);
55
+ for (const field of Object.keys(limits)){
56
+ const asked = Number(inputs == null ? void 0 : inputs[`limit_${field}`]);
57
+ if (Number.isFinite(asked) && asked > 0) limits[field] = Math.min(limits[field], Math.floor(asked));
58
+ }
59
+ return limits;
60
+ }
61
+ /**
62
+ * The triggers the caller allows, with their ranges. Inputs carry them as
63
+ * `triggers` (`delay:0-120,scroll:1-100,exit`); an id the runtime does not
64
+ * know is dropped, and with no list a popup is proposed no trigger at all.
65
+ */ export function aiOverlayTriggerRanges(inputs) {
66
+ const ranges = new Map();
67
+ for (const part of str(inputs == null ? void 0 : inputs['triggers']).split(',')){
68
+ const [id, range] = part.trim().split(':');
69
+ if (!AI_OVERLAY_TRIGGERS.includes(id)) continue;
70
+ const [min, max] = String(range != null ? range : '').split('-').map(Number);
71
+ ranges.set(id, Number.isFinite(min) && Number.isFinite(max) && max >= min ? {
72
+ min,
73
+ max
74
+ } : null);
75
+ }
76
+ return ranges;
77
+ }
78
+ /** The zone's trigger catalog as the job's `triggers` input. */ export function aiOverlayTriggersInput(rules) {
79
+ return rules.filter((rule)=>AI_OVERLAY_TRIGGERS.includes(rule.id)).map((rule)=>rule.unit ? `${rule.id}:${rule.min}-${rule.max}` : rule.id).join(',');
80
+ }
81
+ /** The zone's limits as the job's `limit_<field>` inputs. */ export function aiOverlayLimitInputs(limits) {
82
+ const inputs = {};
83
+ for (const field of Object.keys(AI_OVERLAY_COPY_CEILINGS)){
84
+ const limit = limits[field];
85
+ if (typeof limit === 'number' && limit > 0) inputs[`limit_${field}`] = limit;
86
+ }
87
+ return inputs;
88
+ }
89
+ /** One field on one line, or a body with its paragraphs, cut to its limit. */ function fit(value, limit, multiline = false) {
90
+ const folded = multiline ? value.replace(/\r\n?/g, '\n').replace(/[^\S\n]+/g, ' ').replace(/\n{3,}/g, '\n\n') : value.replace(/\s+/g, ' ');
91
+ return folded.trim().slice(0, limit).trim();
92
+ }
93
+ /** Markup, a fence or a link: things a bar or a popup shows as typed. */ const MARKUP = /<\/?[a-z][^>]*>|```|\[[^\]]*\]\([^)]*\)|https?:\/\//i;
94
+ /**
95
+ * An answer held to the overlay's rules, or `null` when nothing usable is
96
+ * left: a bar with no text, a popup with no body, or copy carrying markup or
97
+ * a link. A field over its limit is cut rather than refused, and a trigger
98
+ * outside the caller's catalog is dropped, with each recorded as a finding.
99
+ */ export function checkAiOverlayCopy(answer, kind, limits, triggers) {
100
+ if (!answer) return null;
101
+ const findings = [];
102
+ const field = (name, multiline = false)=>{
103
+ const raw = answer[name];
104
+ const value = fit(raw, limits[name], multiline);
105
+ if (fit(raw, Number.MAX_SAFE_INTEGER, multiline).length > limits[name]) {
106
+ findings.push(`${name} cut to ${limits[name]} characters`);
107
+ }
108
+ return value;
109
+ };
110
+ const proposal = {
111
+ kind,
112
+ name: field('name'),
113
+ text: kind === 'bar' ? field('text') : '',
114
+ headline: kind === 'popup' ? field('headline') : '',
115
+ body: kind === 'popup' ? field('body', true) : '',
116
+ ctaLabel: kind === 'popup' ? field('ctaLabel') : '',
117
+ trigger: null,
118
+ triggerValue: null,
119
+ rationale: fit(answer.rationale, 200)
120
+ };
121
+ if ([
122
+ proposal.text,
123
+ proposal.headline,
124
+ proposal.body,
125
+ proposal.ctaLabel
126
+ ].some((value)=>MARKUP.test(value))) {
127
+ return null;
128
+ }
129
+ if (kind === 'bar' ? !proposal.text : !proposal.body) return null;
130
+ if (kind === 'popup' && answer.trigger) {
131
+ const trigger = answer.trigger;
132
+ if (triggers.has(trigger)) {
133
+ var _triggers_get;
134
+ proposal.trigger = trigger;
135
+ const range = (_triggers_get = triggers.get(trigger)) != null ? _triggers_get : null;
136
+ if (range && answer.triggerValue !== null && Number.isFinite(answer.triggerValue)) {
137
+ proposal.triggerValue = Math.min(range.max, Math.max(range.min, Math.round(answer.triggerValue)));
138
+ }
139
+ } else if (answer.trigger !== 'none') {
140
+ findings.push(`trigger "${answer.trigger}" is not one the site offers`);
141
+ }
142
+ }
143
+ return {
144
+ proposal,
145
+ findings
146
+ };
147
+ }
148
+ /** The proposal a finished overlay job's output carries, or `null` for anything else. */ export function readAiOverlayCopy(proposal) {
149
+ if (!proposal || proposal['task'] !== AI_OVERLAY_COPY_TASK) return null;
150
+ const kind = proposal['kind'];
151
+ if (kind !== 'bar' && kind !== 'popup') return null;
152
+ const trigger = proposal['trigger'];
153
+ const value = proposal['triggerValue'];
154
+ return {
155
+ kind,
156
+ name: str(proposal['name']),
157
+ text: str(proposal['text']),
158
+ headline: str(proposal['headline']),
159
+ body: str(proposal['body']),
160
+ ctaLabel: str(proposal['ctaLabel']),
161
+ trigger: AI_OVERLAY_TRIGGERS.includes(trigger) ? trigger : null,
162
+ triggerValue: typeof value === 'number' && Number.isFinite(value) ? value : null,
163
+ rationale: str(proposal['rationale'])
164
+ };
165
+ }
166
+ /** A proposal as the plain text a `text` output shows on the AI jobs page. */ export function aiOverlayCopyText(proposal) {
167
+ if (proposal.kind === 'bar') return proposal.text;
168
+ return [
169
+ proposal.headline,
170
+ proposal.body,
171
+ proposal.ctaLabel ? `Button: ${proposal.ctaLabel}` : ''
172
+ ].filter(Boolean).join('\n\n');
173
+ }
174
+
175
+ //# sourceMappingURL=ai-overlay-copy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-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\n/**\n * Overlay copy by AI (AGL-3603): what a `text` job asked for an announcement\n * bar's or a popup's copy answers, in the shape the step writes and the\n * console reads. Pure data, so the widgets and the step share one reading.\n *\n * The overlay is the marketing plugin's, and neither plugin imports the other:\n * the limits and the trigger catalog are handed to the widget by the zone,\n * and the widget passes them on as the job's inputs. The step then holds the\n * answer to the TIGHTER of those and its own ceilings below, so a job started\n * by anything else is still bounded, and drops a trigger the caller did not\n * name rather than inventing one.\n */\n\n/** The `text` job's `inputs.task` that asks for overlay copy. */\nexport const AI_OVERLAY_COPY_TASK = 'overlay'\n\n/** What the copy is for. */\nexport type AiOverlayKind = 'bar' | 'popup'\n\n/** The fields an answer fills. */\nexport type AiOverlayCopyField = 'name' | 'text' | 'headline' | 'body' | 'ctaLabel'\n\n/** The step's own ceilings: no zone may widen a field past these. */\nexport const AI_OVERLAY_COPY_CEILINGS: Readonly<Record<AiOverlayCopyField, number>> = {\n name: 80,\n text: 200,\n headline: 120,\n body: 600,\n ctaLabel: 60,\n}\n\n/** The triggers a popup may be proposed to open on, as the site runtime names them. */\nexport const AI_OVERLAY_TRIGGERS = ['delay', 'scroll', 'exit'] as const\nexport type AiOverlayTrigger = (typeof AI_OVERLAY_TRIGGERS)[number]\n\n/** One trigger as the zone hands it over: its id and the range of its value. */\nexport interface AiOverlayTriggerRule {\n id: string\n label: string\n unit: 'seconds' | 'percent' | null\n min: number\n max: number\n}\n\n/** The longest description of the current copy a job sends. */\nexport const AI_OVERLAY_CURRENT_MAX_CHARS = 1_200\n\n/** What a checked answer proposes. Absent fields propose nothing. */\nexport interface AiOverlayCopyProposal {\n kind: AiOverlayKind\n name: string\n text: string\n headline: string\n body: string\n ctaLabel: string\n trigger: AiOverlayTrigger | null\n triggerValue: number | null\n /** One sentence on what the copy leans on; shown, never written. */\n rationale: string\n}\n\n/** What the model answered, before the check. */\nexport interface AiOverlayCopyAnswer {\n name: string\n text: string\n headline: string\n body: string\n ctaLabel: string\n trigger: string\n triggerValue: number | null\n rationale: string\n}\n\nconst str = (value: unknown): string => (typeof value === 'string' ? value.trim() : '')\n\n/** The kind a job's inputs name, or `null`. */\nexport function aiOverlayKind(inputs: Readonly<Record<string, unknown>> | null | undefined): AiOverlayKind | null {\n const kind = inputs?.['overlayKind']\n return kind === 'bar' || kind === 'popup' ? kind : null\n}\n\n/** Whether a `text` job's inputs ask for overlay copy. */\nexport function aiOverlayCopyRequested(inputs: Readonly<Record<string, unknown>> | null | undefined): boolean {\n return inputs?.['task'] === AI_OVERLAY_COPY_TASK\n}\n\n/**\n * The limit each field is held to: the caller's, where it named one, never\n * past the step's ceiling. Inputs carry them as `limit_<field>`.\n */\nexport function aiOverlayLimits(\n inputs: Readonly<Record<string, unknown>> | null | undefined,\n): Record<AiOverlayCopyField, number> {\n const limits = { ...AI_OVERLAY_COPY_CEILINGS }\n for (const field of Object.keys(limits) as AiOverlayCopyField[]) {\n const asked = Number(inputs?.[`limit_${field}`])\n if (Number.isFinite(asked) && asked > 0) limits[field] = Math.min(limits[field], Math.floor(asked))\n }\n return limits\n}\n\n/**\n * The triggers the caller allows, with their ranges. Inputs carry them as\n * `triggers` (`delay:0-120,scroll:1-100,exit`); an id the runtime does not\n * know is dropped, and with no list a popup is proposed no trigger at all.\n */\nexport function aiOverlayTriggerRanges(\n inputs: Readonly<Record<string, unknown>> | null | undefined,\n): Map<AiOverlayTrigger, { min: number; max: number } | null> {\n const ranges = new Map<AiOverlayTrigger, { min: number; max: number } | null>()\n for (const part of str(inputs?.['triggers']).split(',')) {\n const [id, range] = part.trim().split(':')\n if (!(AI_OVERLAY_TRIGGERS as readonly string[]).includes(id)) continue\n const [min, max] = String(range ?? '').split('-').map(Number)\n ranges.set(\n id as AiOverlayTrigger,\n Number.isFinite(min) && Number.isFinite(max) && max >= min ? { min, max } : null,\n )\n }\n return ranges\n}\n\n/** The zone's trigger catalog as the job's `triggers` input. */\nexport function aiOverlayTriggersInput(rules: readonly AiOverlayTriggerRule[]): string {\n return rules\n .filter((rule) => (AI_OVERLAY_TRIGGERS as readonly string[]).includes(rule.id))\n .map((rule) => (rule.unit ? `${rule.id}:${rule.min}-${rule.max}` : rule.id))\n .join(',')\n}\n\n/** The zone's limits as the job's `limit_<field>` inputs. */\nexport function aiOverlayLimitInputs(\n limits: Readonly<Partial<Record<AiOverlayCopyField, number>>>,\n): Record<string, number> {\n const inputs: Record<string, number> = {}\n for (const field of Object.keys(AI_OVERLAY_COPY_CEILINGS) as AiOverlayCopyField[]) {\n const limit = limits[field]\n if (typeof limit === 'number' && limit > 0) inputs[`limit_${field}`] = limit\n }\n return inputs\n}\n\n/** One field on one line, or a body with its paragraphs, cut to its limit. */\nfunction fit(value: string, limit: number, multiline = false): string {\n const folded = multiline\n ? value.replace(/\\r\\n?/g, '\\n').replace(/[^\\S\\n]+/g, ' ').replace(/\\n{3,}/g, '\\n\\n')\n : value.replace(/\\s+/g, ' ')\n return folded.trim().slice(0, limit).trim()\n}\n\n/** Markup, a fence or a link: things a bar or a popup shows as typed. */\nconst MARKUP = /<\\/?[a-z][^>]*>|```|\\[[^\\]]*\\]\\([^)]*\\)|https?:\\/\\//i\n\nexport interface AiOverlayCopyCheck {\n proposal: AiOverlayCopyProposal\n /** What was cut or dropped, for the log. */\n findings: string[]\n}\n\n/**\n * An answer held to the overlay's rules, or `null` when nothing usable is\n * left: a bar with no text, a popup with no body, or copy carrying markup or\n * a link. A field over its limit is cut rather than refused, and a trigger\n * outside the caller's catalog is dropped, with each recorded as a finding.\n */\nexport function checkAiOverlayCopy(\n answer: AiOverlayCopyAnswer | null,\n kind: AiOverlayKind,\n limits: Readonly<Record<AiOverlayCopyField, number>>,\n triggers: ReadonlyMap<AiOverlayTrigger, { min: number; max: number } | null>,\n): AiOverlayCopyCheck | null {\n if (!answer) return null\n const findings: string[] = []\n const field = (name: AiOverlayCopyField, multiline = false): string => {\n const raw = answer[name]\n const value = fit(raw, limits[name], multiline)\n if (fit(raw, Number.MAX_SAFE_INTEGER, multiline).length > limits[name]) {\n findings.push(`${name} cut to ${limits[name]} characters`)\n }\n return value\n }\n const proposal: AiOverlayCopyProposal = {\n kind,\n name: field('name'),\n text: kind === 'bar' ? field('text') : '',\n headline: kind === 'popup' ? field('headline') : '',\n body: kind === 'popup' ? field('body', true) : '',\n ctaLabel: kind === 'popup' ? field('ctaLabel') : '',\n trigger: null,\n triggerValue: null,\n rationale: fit(answer.rationale, 200),\n }\n if ([proposal.text, proposal.headline, proposal.body, proposal.ctaLabel].some((value) => MARKUP.test(value))) {\n return null\n }\n if (kind === 'bar' ? !proposal.text : !proposal.body) return null\n if (kind === 'popup' && answer.trigger) {\n const trigger = answer.trigger as AiOverlayTrigger\n if (triggers.has(trigger)) {\n proposal.trigger = trigger\n const range = triggers.get(trigger) ?? null\n if (range && answer.triggerValue !== null && Number.isFinite(answer.triggerValue)) {\n proposal.triggerValue = Math.min(range.max, Math.max(range.min, Math.round(answer.triggerValue)))\n }\n } else if (answer.trigger !== 'none') {\n findings.push(`trigger \"${answer.trigger}\" is not one the site offers`)\n }\n }\n return { proposal, findings }\n}\n\n/** The proposal a finished overlay job's output carries, or `null` for anything else. */\nexport function readAiOverlayCopy(proposal: Record<string, unknown> | null | undefined): AiOverlayCopyProposal | null {\n if (!proposal || proposal['task'] !== AI_OVERLAY_COPY_TASK) return null\n const kind = proposal['kind']\n if (kind !== 'bar' && kind !== 'popup') return null\n const trigger = proposal['trigger']\n const value = proposal['triggerValue']\n return {\n kind,\n name: str(proposal['name']),\n text: str(proposal['text']),\n headline: str(proposal['headline']),\n body: str(proposal['body']),\n ctaLabel: str(proposal['ctaLabel']),\n trigger: (AI_OVERLAY_TRIGGERS as readonly unknown[]).includes(trigger) ? (trigger as AiOverlayTrigger) : null,\n triggerValue: typeof value === 'number' && Number.isFinite(value) ? value : null,\n rationale: str(proposal['rationale']),\n }\n}\n\n/** A proposal as the plain text a `text` output shows on the AI jobs page. */\nexport function aiOverlayCopyText(proposal: AiOverlayCopyProposal): string {\n if (proposal.kind === 'bar') return proposal.text\n return [\n proposal.headline,\n proposal.body,\n proposal.ctaLabel ? `Button: ${proposal.ctaLabel}` : '',\n ]\n .filter(Boolean)\n .join('\\n\\n')\n}\n"],"names":["AI_OVERLAY_COPY_TASK","AI_OVERLAY_COPY_CEILINGS","name","text","headline","body","ctaLabel","AI_OVERLAY_TRIGGERS","AI_OVERLAY_CURRENT_MAX_CHARS","str","value","trim","aiOverlayKind","inputs","kind","aiOverlayCopyRequested","aiOverlayLimits","limits","field","Object","keys","asked","Number","isFinite","Math","min","floor","aiOverlayTriggerRanges","ranges","Map","part","split","id","range","includes","max","String","map","set","aiOverlayTriggersInput","rules","filter","rule","unit","join","aiOverlayLimitInputs","limit","fit","multiline","folded","replace","slice","MARKUP","checkAiOverlayCopy","answer","triggers","findings","raw","MAX_SAFE_INTEGER","length","push","proposal","trigger","triggerValue","rationale","some","test","has","get","round","readAiOverlayCopy","aiOverlayCopyText","Boolean"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;CAWC,GAED,+DAA+D,GAC/D,OAAO,MAAMA,uBAAuB,UAAS;AAQ7C,mEAAmE,GACnE,OAAO,MAAMC,2BAAyE;IACpFC,MAAM;IACNC,MAAM;IACNC,UAAU;IACVC,MAAM;IACNC,UAAU;AACZ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AQ;QACjByD,SAASxD,IAAI;QACbwD,SAASvD,QAAQ,GAAG,CAAC,QAAQ,EAAEuD,SAASvD,QAAQ,EAAE,GAAG;KACtD,CACEmC,MAAM,CAAC+B,SACP5B,IAAI,CAAC;AACV"}
@@ -27,15 +27,25 @@ import type { AiJobSummary } from './ai-jobs.types';
27
27
  *
28
28
  * Pure: no React, no request. The page and its spec read the same rows.
29
29
  */
30
- export type AiSiteBuildRowState = 'done' | 'active' | 'waiting' | 'failed';
30
+ export type AiSiteBuildRowState = 'done' | 'active' | 'waiting' | 'failed' | 'skipped';
31
31
  export interface AiSiteBuildRow {
32
32
  id: string;
33
33
  label: string;
34
34
  state: AiSiteBuildRowState;
35
+ /** What the person should know about this row (AGL-3616): a build item's failure, note or refund. */
36
+ detail?: string | null;
37
+ /** What the row is doing while it is the active one, in a sentence. */
38
+ hint?: string | null;
39
+ /** A page's planned sections, in order, so the person sees what is being written. */
40
+ sections?: string[];
41
+ /** The credits this row's work used, once it has finished; absent while it runs. */
42
+ credits?: number;
43
+ /** When this row's work started, for the elapsed time beside the active row. */
44
+ startedAt?: string | null;
35
45
  }
36
46
  /** Where the whole job stands, as the page's header and actions read it. */
37
47
  export type AiSiteBuildPhase = 'working' | 'done' | 'stopped' | 'failed' | 'canceled';
38
- export declare function aiSiteBuildPhase(job: Pick<AiJobSummary, 'status'>): AiSiteBuildPhase;
48
+ export declare function aiSiteBuildPhase(job: Pick<AiJobSummary, 'status'> & Partial<Pick<AiJobSummary, 'review' | 'autoConfirm' | 'updatedAt'>>): AiSiteBuildPhase;
39
49
  /**
40
50
  * One row a stage: planning, then each creation the plan builds before its
41
51
  * pages — the colors, the layout, the form — then each page (AGL-3596). A
@@ -44,7 +54,18 @@ export declare function aiSiteBuildPhase(job: Pick<AiJobSummary, 'status'>): AiS
44
54
  * where a failure stopped it: a layout that broke is the layout's row, never
45
55
  * the first page's.
46
56
  */
47
- export declare function aiSiteBuildRows(job: Pick<AiJobSummary, 'status' | 'steps' | 'plan' | 'outputs' | 'review'>): AiSiteBuildRow[];
57
+ export declare function aiSiteBuildRows(job: Pick<AiJobSummary, 'status' | 'steps' | 'plan' | 'outputs' | 'review'> & Partial<Pick<AiJobSummary, 'items' | 'kind' | 'siteInputs' | 'sitePublish'>>): AiSiteBuildRow[];
58
+ /** What the planning row says while it runs. */
59
+ export declare const AI_SITE_PLAN_HINT = "Reading your answers and choosing your pages, what each one says, and the forms and layout they need. This usually takes under a minute.";
60
+ /** What the page being written says while it is the active row (AGL-3596). */
61
+ export declare const AI_SITE_PAGE_HINT = "Writing this page\u2019s sections from your plan. It is done once every section is in.";
62
+ /** What any other part being built says while it is the active row. */
63
+ export declare const AI_SITE_ITEM_HINT = "Building this now. The next step starts when it is done.";
64
+ /**
65
+ * How far the job is, from 0 to 1, by its rows: a finished row counts whole
66
+ * and the active one half. `null` before there is more than one row to count.
67
+ */
68
+ export declare function aiSiteBuildFraction(rows: readonly AiSiteBuildRow[]): number | null;
48
69
  /**
49
70
  * The job's one price (AGL-3594), never a plan's on its own: what it has used
50
71
  * so far while it works, what it used once done, and, on a failure we gave
@@ -66,4 +87,4 @@ export interface AiJobPageCopy {
66
87
  * done site job without that record — an older job, or one that was not a
67
88
  * guided start — built drafts, and says that instead.
68
89
  */
69
- export declare function aiJobPageCopy(job: Pick<AiJobSummary, 'kind' | 'status' | 'review' | 'error'> & Partial<Pick<AiJobSummary, 'sitePublish'>>, brand: string): AiJobPageCopy;
90
+ export declare function aiJobPageCopy(job: Pick<AiJobSummary, 'kind' | 'status' | 'review' | 'error'> & Partial<Pick<AiJobSummary, 'sitePublish' | 'items'>>, brand: string): AiJobPageCopy;
@@ -1,3 +1,4 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
1
2
  /**
2
3
  * @license
3
4
  * Copyright 2026 Aglyn LLC
@@ -13,9 +14,13 @@
13
14
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
15
  * See the License for the specific language governing permissions and
15
16
  * limitations under the License.
16
- */ import { aiJobKindNoun } from "./ai-job-activity.js";
17
+ */ import { aiJobConfirmingOwnPlan, aiJobKindNoun } from "./ai-job-activity.js";
17
18
  import { aiJobRefundCopy } from "./ai-job-failure-copy.js";
19
+ import { aiBuildItemRows, aiBuildOutcomeLine, aiSitePartialCopy } from "./ai-build-progress.js";
18
20
  export function aiSiteBuildPhase(job) {
21
+ // A guided start's plan parked for the instant its confirmation takes is
22
+ // the build going on (AGL-3596), never a stop.
23
+ if (aiJobConfirmingOwnPlan(job)) return 'working';
19
24
  switch(job.status){
20
25
  case 'done':
21
26
  return 'done';
@@ -55,19 +60,97 @@ export function aiSiteBuildPhase(job) {
55
60
  * where a failure stopped it: a layout that broke is the layout's row, never
56
61
  * the first page's.
57
62
  */ export function aiSiteBuildRows(job) {
58
- var _built_get, _ref;
59
- var _job_plan;
63
+ var _ref, _planStep_creditsSpent, _built_get, _ref1;
64
+ var _job_items, _job_plan;
60
65
  const phase = aiSiteBuildPhase(job);
66
+ // A build is read off its item ledger (AGL-3616): one row an item, each with
67
+ // its own state and what became of its credits.
68
+ if ((_job_items = job.items) == null ? void 0 : _job_items.length) {
69
+ var _job_items1;
70
+ const site = job.kind !== 'build';
71
+ const pages = ((_job_items1 = job.items) != null ? _job_items1 : []).filter((row)=>row.op === 'page');
72
+ return [
73
+ {
74
+ id: 'plan',
75
+ label: site ? 'Planning your pages' : 'Planning what to build',
76
+ state: 'done'
77
+ },
78
+ ...aiBuildItemRows(job).map((row, index)=>{
79
+ var _job_items, _ledger_creditsSpent, _ledger_creditsRefunded, _row_startedAt;
80
+ const ledger = ((_job_items = job.items) != null ? _job_items : [])[index];
81
+ // A site keeps the scaffold's own words for each stage (AGL-3596).
82
+ const label = !site || !ledger ? row.label : ledger.op === 'theme' ? 'Choosing your colors' : ledger.op === 'layout' ? `Building the header and footer: ${ledger.label}` : ledger.op === 'form' ? `Building the form: ${ledger.label}` : ledger.op === 'page' ? `Writing page ${pages.indexOf(ledger) + 1} of ${pages.length}: ${ledger.label}` : ledger.op === 'email' ? 'Writing your welcome email' : row.label;
83
+ const screen = (ledger == null ? void 0 : ledger.op) === 'page' ? aiPlanScreenFor(job.plan, ledger.label, pages.indexOf(ledger)) : null;
84
+ const finished = row.state === 'done' || row.state === 'failed';
85
+ const net = ledger ? Math.max(0, Math.floor(((_ledger_creditsSpent = ledger.creditsSpent) != null ? _ledger_creditsSpent : 0) - ((_ledger_creditsRefunded = ledger.creditsRefunded) != null ? _ledger_creditsRefunded : 0))) : 0;
86
+ return _extends({
87
+ id: row.slot,
88
+ label,
89
+ state: row.state,
90
+ // A part that failed while the rest is still being built says the
91
+ // build goes on (AGL-3596): read alone, it looked like the site had.
92
+ detail: row.state === 'failed' && phase === 'working' ? [
93
+ row.detail,
94
+ site ? 'The rest of your site keeps building.' : 'The rest keeps building.'
95
+ ].filter(Boolean).join(' ') : row.detail
96
+ }, row.state === 'active' ? {
97
+ startedAt: (_row_startedAt = row.startedAt) != null ? _row_startedAt : null,
98
+ hint: (ledger == null ? void 0 : ledger.op) === 'page' ? AI_SITE_PAGE_HINT : AI_SITE_ITEM_HINT
99
+ } : {}, (screen == null ? void 0 : screen.sections.length) ? {
100
+ sections: screen.sections.map((section)=>section.name)
101
+ } : {}, finished && ledger ? {
102
+ credits: net
103
+ } : {});
104
+ }),
105
+ ...aiSitePublishRow(job, phase)
106
+ ];
107
+ }
61
108
  const planStep = job.steps.find((step)=>step.name === 'plan');
62
109
  const planDone = (planStep == null ? void 0 : planStep.status) === 'done' || Boolean(job.plan);
63
110
  const stopped = phase === 'failed' || phase === 'stopped';
111
+ const planState = planDone ? 'done' : stopped ? 'failed' : phase === 'working' ? 'active' : 'waiting';
64
112
  const rows = [
65
- {
113
+ _extends({
66
114
  id: 'plan',
67
115
  label: 'Planning your pages',
68
- state: planDone ? 'done' : stopped ? 'failed' : phase === 'working' ? 'active' : 'waiting'
69
- }
116
+ state: planState,
117
+ startedAt: (_ref = planStep == null ? void 0 : planStep.startedAt) != null ? _ref : null,
118
+ hint: planState === 'active' ? AI_SITE_PLAN_HINT : null
119
+ }, planDone && planStep ? {
120
+ credits: Math.max(0, Math.floor((_planStep_creditsSpent = planStep.creditsSpent) != null ? _planStep_creditsSpent : 0))
121
+ } : {})
70
122
  ];
123
+ // Before there is a plan, the stages a guided start always goes through
124
+ // are named from its answers, so the page shows the whole way from the
125
+ // start rather than one row.
126
+ if (!job.plan && job.kind !== 'build') {
127
+ var _job_siteInputs;
128
+ const pagesAsked = typeof ((_job_siteInputs = job.siteInputs) == null ? void 0 : _job_siteInputs['pages']) === 'number' ? Math.round(job.siteInputs['pages']) : 0;
129
+ if (job.siteInputs) {
130
+ rows.push({
131
+ id: 'layout',
132
+ label: 'Building the header and footer',
133
+ state: 'waiting'
134
+ });
135
+ // A guided start that says where its contact form's submissions go
136
+ // plans that form, built after the layout and before the pages (AGL-3596).
137
+ const submissions = job.siteInputs['submissions'];
138
+ if (submissions === 'inbox' || submissions === 'lead') {
139
+ rows.push({
140
+ id: 'form',
141
+ label: 'Building your contact form',
142
+ state: 'waiting'
143
+ });
144
+ }
145
+ rows.push({
146
+ id: 'pages',
147
+ label: pagesAsked > 1 ? `Writing your ${pagesAsked} pages` : 'Writing your pages',
148
+ state: 'waiting'
149
+ });
150
+ rows.push(...aiSitePublishRow(job, phase));
151
+ }
152
+ return rows;
153
+ }
71
154
  const built = new Map();
72
155
  for (const output of job.outputs)built.set(output.resource, ((_built_get = built.get(output.resource)) != null ? _built_get : 0) + 1);
73
156
  const take = (resource)=>{
@@ -87,27 +170,66 @@ export function aiSiteBuildPhase(job) {
87
170
  resource: row.resource
88
171
  });
89
172
  }
90
- const pages = (_ref = (_job_plan = job.plan) == null ? void 0 : _job_plan.screens) != null ? _ref : [];
173
+ const pages = (_ref1 = (_job_plan = job.plan) == null ? void 0 : _job_plan.screens) != null ? _ref1 : [];
91
174
  pages.forEach((page, index)=>{
92
175
  stages.push({
93
176
  id: `page-${index}`,
94
177
  label: `Writing page ${index + 1} of ${pages.length}: ${page.title}`,
95
- resource: 'screen'
178
+ resource: 'screen',
179
+ sections: page.sections.map((section)=>section.name)
96
180
  });
97
181
  });
98
182
  let reached = false;
99
183
  for (const stage of stages){
184
+ var _stage_sections;
100
185
  const done = phase === 'done' || take(stage.resource);
101
186
  const current = !done && !reached && planDone;
102
187
  if (current) reached = true;
103
- rows.push({
188
+ rows.push(_extends({
104
189
  id: stage.id,
105
190
  label: stage.label,
106
191
  state: done ? 'done' : current && stopped ? 'failed' : current && phase === 'working' ? 'active' : 'waiting'
107
- });
192
+ }, ((_stage_sections = stage.sections) == null ? void 0 : _stage_sections.length) ? {
193
+ sections: stage.sections
194
+ } : {}));
108
195
  }
196
+ rows.push(...aiSitePublishRow(job, phase));
109
197
  return rows;
110
198
  }
199
+ /** What the planning row says while it runs. */ export const AI_SITE_PLAN_HINT = 'Reading your answers and choosing your pages, what each one says, and the forms and layout they need. This usually takes under a minute.';
200
+ /** What the page being written says while it is the active row (AGL-3596). */ export const AI_SITE_PAGE_HINT = 'Writing this page’s sections from your plan. It is done once every section is in.';
201
+ /** What any other part being built says while it is the active row. */ export const AI_SITE_ITEM_HINT = 'Building this now. The next step starts when it is done.';
202
+ /** The plan's page an item builds: by its title, else by its place among the pages. */ function aiPlanScreenFor(plan, title, index) {
203
+ var _ref, _screens_find, _screens_index;
204
+ const screens = (_ref = plan == null ? void 0 : plan.screens) != null ? _ref : [];
205
+ return (_screens_find = screens.find((screen)=>screen.title === title)) != null ? _screens_find : index >= 0 ? (_screens_index = screens[index]) != null ? _screens_index : null : null;
206
+ }
207
+ /**
208
+ * A guided start ends by putting its pages live (AGL-3596): the last row, so
209
+ * the person sees that step coming and when it is done. Only a site job
210
+ * publishes on its own; a build publishes when asked, and says so in its plan.
211
+ */ function aiSitePublishRow(job, phase) {
212
+ var _ref;
213
+ var _job_sitePublish;
214
+ if (job.kind !== 'site') return [];
215
+ const published = ((_ref = (_job_sitePublish = job.sitePublish) == null ? void 0 : _job_sitePublish.published.length) != null ? _ref : 0) > 0;
216
+ return [
217
+ {
218
+ id: 'publish',
219
+ label: 'Publishing your site',
220
+ // A job that stopped or failed publishes nothing, so the row is passed over.
221
+ state: phase === 'done' ? published ? 'done' : 'skipped' : phase === 'working' ? 'waiting' : 'skipped'
222
+ }
223
+ ];
224
+ }
225
+ /**
226
+ * How far the job is, from 0 to 1, by its rows: a finished row counts whole
227
+ * and the active one half. `null` before there is more than one row to count.
228
+ */ export function aiSiteBuildFraction(rows) {
229
+ if (rows.length < 2) return null;
230
+ const counted = rows.reduce((sum, row)=>sum + (row.state === 'active' ? 0.5 : row.state === 'waiting' ? 0 : 1), 0);
231
+ return Math.min(1, counted / rows.length);
232
+ }
111
233
  /**
112
234
  * The job's one price (AGL-3594), never a plan's on its own: what it has used
113
235
  * so far while it works, what it used once done, and, on a failure we gave
@@ -142,6 +264,8 @@ export function aiSiteBuildPhase(job) {
142
264
  var _ref, _ref1;
143
265
  var _job_review;
144
266
  const phase = aiSiteBuildPhase(job);
267
+ // A build is what the person asked for, item by item (AGL-3616).
268
+ if (job.kind === 'build') return aiBuildPageCopy(job, brand);
145
269
  const noun = job.kind === 'site' ? 'site' : aiJobKindNoun(job.kind);
146
270
  const generic = noun === 'AI job';
147
271
  // `products` is the one plural noun.
@@ -157,13 +281,25 @@ export function aiSiteBuildPhase(job) {
157
281
  var _ref2;
158
282
  var _job_sitePublish;
159
283
  const published = (_ref2 = (_job_sitePublish = job.sitePublish) == null ? void 0 : _job_sitePublish.published.length) != null ? _ref2 : 0;
284
+ // Part of the site was built (AGL-3616): what was, what was not, and its credits.
285
+ const partial = job.kind === 'site' ? aiSitePartialCopy({
286
+ items: job.items,
287
+ status: job.status
288
+ }) : null;
160
289
  if (job.kind === 'site' && published > 0) {
161
290
  var _job_sitePublish1;
162
291
  return {
163
292
  heading: 'Your site is live',
164
- lede: ((_job_sitePublish1 = job.sitePublish) == null ? void 0 : _job_sitePublish1.drafts.length) ? 'Your pages are published, except the ones listed below, which stayed drafts.' : 'Your pages are published, and anyone can visit your site now.'
293
+ lede: [
294
+ partial,
295
+ ((_job_sitePublish1 = job.sitePublish) == null ? void 0 : _job_sitePublish1.drafts.length) ? 'Your pages are published, except the ones listed below, which stayed drafts.' : 'Your pages are published, and anyone can visit your site now.'
296
+ ].filter(Boolean).join(' ')
165
297
  };
166
298
  }
299
+ if (partial) return {
300
+ heading: 'Your site is ready',
301
+ lede: `${partial} Your new pages are drafts. Publish them when you’re happy.`
302
+ };
167
303
  if (job.kind === 'site' && job.sitePublish) {
168
304
  return {
169
305
  heading: 'Your site is ready',
@@ -186,5 +322,52 @@ export function aiSiteBuildPhase(job) {
186
322
  lede: why != null ? why : generic ? 'Something went wrong running this job.' : `Something went wrong building your ${noun}.`
187
323
  };
188
324
  }
325
+ /** A build's page heading and sentence (AGL-3616). */ function aiBuildPageCopy(job, brand) {
326
+ var _job_items, _job_error;
327
+ const phase = aiSiteBuildPhase(job);
328
+ const outcome = aiBuildOutcomeLine({
329
+ items: (_job_items = job.items) != null ? _job_items : [],
330
+ status: job.status
331
+ });
332
+ if (phase === 'working') {
333
+ return {
334
+ heading: 'Building what you asked for',
335
+ lede: `${brand} AI is building each part in turn. You can leave this page; it keeps going.`
336
+ };
337
+ }
338
+ if (phase === 'stopped') {
339
+ var _ref, _ref1;
340
+ var _job_review, _job_review1;
341
+ return {
342
+ heading: ((_job_review = job.review) == null ? void 0 : _job_review.reason) === 'plan' ? 'Your plan is ready' : 'Your build needs you',
343
+ lede: (_ref = (_ref1 = (_job_review1 = job.review) == null ? void 0 : _job_review1.message) != null ? _ref1 : job.error) != null ? _ref : 'It waits for your decision.'
344
+ };
345
+ }
346
+ if (phase === 'done') {
347
+ var _job_items1, _ref2;
348
+ var _job_sitePublish;
349
+ const failed = ((_job_items1 = job.items) != null ? _job_items1 : []).some((row)=>row.status === 'failed' || row.status === 'skipped');
350
+ const live = (_ref2 = (_job_sitePublish = job.sitePublish) == null ? void 0 : _job_sitePublish.published.length) != null ? _ref2 : 0;
351
+ return {
352
+ heading: failed ? 'Most of it is ready' : 'Everything you asked for is ready',
353
+ lede: [
354
+ outcome,
355
+ live ? 'Your new pages are published.' : 'Everything it built is an unpublished draft until you publish it.',
356
+ failed ? 'Try again builds only what failed.' : ''
357
+ ].filter(Boolean).join(' ')
358
+ };
359
+ }
360
+ if (phase === 'canceled') return {
361
+ heading: 'Your build was canceled',
362
+ lede: 'The job was canceled.'
363
+ };
364
+ return {
365
+ heading: 'Nothing could be built',
366
+ lede: [
367
+ (_job_error = job.error) != null ? _job_error : 'Something went wrong building what you asked for.',
368
+ outcome
369
+ ].filter(Boolean).join(' ')
370
+ };
371
+ }
189
372
 
190
373
  //# sourceMappingURL=ai-site-build-progress.js.map