@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 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-build-unit-outcome.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 { aiBuildItemDelivered, type AiBuildUnit } from '../model/ai-build-job'\nimport type { AiJobItemLedger, AiJobOutput } from '../model/ai-jobs.types'\nimport { AiUpstreamError } from '../runtime/ai-runtime'\nimport type { AiSiteBuiltRef } from './ai-job-site-step'\nimport type { AiJobItemOutcome, AiJobStepOutcome } from './ai-job-text-step'\n\n/**\n * One delegated unit's pass as an ITEM of a job settled item by item\n * (AGL-3616) — a `build`, and a site scaffold, which is the build's preset.\n * The runner's spend is the pass's; what the runner came to is the item's\n * row: still running, built (or built without something that failed),\n * failed on our side, or failed on the model's or the workspace's.\n *\n * Shared by both steps, and importing neither, so neither imports the other.\n */\n\n/** What a unit says when it finished without reporting anything. */\nexport const AI_BUILD_UNIT_EMPTY_COPY = 'It could not be built this time.'\n\n/** What a unit's model declining the request says. */\nexport const AI_BUILD_UNIT_REFUSED_COPY = 'The AI declined to build this one.'\n\n/** A runner's outcome narrowed to its spend: no plan, no review, nothing the delegating job keeps. */\nexport function aiUnitSpend(outcome: AiJobStepOutcome): AiJobStepOutcome {\n return {\n outputs: outcome.outputs,\n usage: outcome.usage,\n estCostUsd: outcome.estCostUsd,\n model: outcome.model,\n stopReason: outcome.stopReason,\n ...(outcome.effort ? { effort: outcome.effort } : {}),\n }\n}\n\n/**\n * What a runner's outcome comes to for its item; `null` when the unit\n * reported what it built and the caller decides whether that counts.\n */\nexport function aiUnitFailure(slot: string, outcome: AiJobStepOutcome): AiJobItemOutcome | null {\n const outputs = outcome.outputs.map((output) => output.id)\n if (outcome.refused) {\n return { slot, status: 'failed', failure: { ours: false, reason: 'refused', message: AI_BUILD_UNIT_REFUSED_COPY }, outputs }\n }\n if (outcome.review) {\n // A building rule still broken after its re-ask is ours (AGL-3596); a\n // site at an allowance is the workspace's to change.\n const ours = outcome.review.reason === 'doctrine'\n return {\n slot,\n status: 'failed',\n failure: {\n ours,\n reason: ours ? 'doctrine-refused' : 'review',\n message: outcome.review.message || AI_BUILD_UNIT_EMPTY_COPY,\n ...(outcome.review.detail ? { detail: outcome.review.detail } : {}),\n },\n outputs,\n }\n }\n if (outcome.failure) {\n return { slot, status: 'failed', failure: { ours: true, reason: 'step-failure', message: outcome.failure }, outputs }\n }\n if (outcome.continue) return { slot, status: 'running', outputs }\n if (!outcome.outputs.length) {\n return { slot, status: 'failed', failure: { ours: true, reason: 'step-failure', message: AI_BUILD_UNIT_EMPTY_COPY } }\n }\n return null\n}\n\n/**\n * Whether an error a unit's runner threw is the machine's to retry — a\n * provider that will answer later, or a budget that ended — rather than this\n * item's failure.\n */\nexport function aiUnitErrorRetryable(error: unknown): boolean {\n if (error instanceof AiUpstreamError && error.retryable) return true\n const name = (error as { name?: string } | null)?.name\n return name === 'AbortError' || name === 'TimeoutError'\n}\n\n/**\n * What the build has created that a later unit can name: each delivered\n * creation's record, by its plan name. A creation's first output is the\n * record it wrote.\n */\nexport function aiBuildBuiltRefs(\n units: readonly AiBuildUnit[],\n ledger: readonly AiJobItemLedger[],\n outputs: readonly Pick<AiJobOutput, 'id' | 'label'>[],\n): Map<string, AiSiteBuiltRef> {\n const rows = new Map(ledger.map((row) => [row.slot, row]))\n const built = new Map<string, AiSiteBuiltRef>()\n for (const unit of units) {\n const creation = unit.creation\n const row = rows.get(unit.slot)\n if (!creation || !row || !aiBuildItemDelivered(row) || !row.outputs.length) continue\n if (creation.kind !== 'layout' && creation.kind !== 'form' && creation.kind !== 'component') continue\n const id = row.outputs[0]\n const label = outputs.find((output) => output.id === id)?.label || creation.name\n built.set(creation.name.toLowerCase(), { id, label, kind: creation.kind })\n }\n return built\n}\n"],"names":["aiBuildItemDelivered","AiUpstreamError","AI_BUILD_UNIT_EMPTY_COPY","AI_BUILD_UNIT_REFUSED_COPY","aiUnitSpend","outcome","outputs","usage","estCostUsd","model","stopReason","effort","aiUnitFailure","slot","map","output","id","refused","status","failure","ours","reason","message","review","detail","continue","length","aiUnitErrorRetryable","error","retryable","name","aiBuildBuiltRefs","units","ledger","rows","Map","row","built","unit","creation","get","kind","label","find","set","toLowerCase"],"mappings":"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"}
@@ -44,6 +44,14 @@ export declare function aiJobAutoConfirms(job: Pick<AiJob, 'kind' | 'inputs'>):
44
44
  * A job's inputs as the create door stores them: `autoConfirm` kept only on a
45
45
  * `site` job for a site that publishes nothing of the owner's yet, and dropped
46
46
  * from every other request, which then waits for a person as it always has.
47
+ *
48
+ * A `site` job that names no business is given its site's own name
49
+ * (AGL-3596). The guided start asks what the site is for, never what it is
50
+ * called — the person named it when they created it — and a plan, a header
51
+ * and a footer told no name invented one. Filled here, on the click, from the
52
+ * one read of the site the confirmation already makes, so every door that
53
+ * creates a site job carries it and nothing is read while the guided start
54
+ * renders. A name the request gave — an agency batch's — is kept.
47
55
  */
48
56
  export declare function aiJobAdmittedInputs(firestore: FirebaseFirestore.Firestore, request: {
49
57
  kind: string;
@@ -17,7 +17,7 @@ import { _ as _to_property_key } from "@swc/helpers/_/_to_property_key";
17
17
  * See the License for the specific language governing permissions and
18
18
  * limitations under the License.
19
19
  */ import { isFirstPublishedRoute } from "@aglyn/aglyn/app-utils/analytics-events";
20
- import { AI_JOB_AUTO_CONFIRM_INPUT } from "../model/ai-site-job.js";
20
+ import { AI_JOB_AUTO_CONFIRM_INPUT, AI_SITE_INPUT_MAX_CHARS } from "../model/ai-site-job.js";
21
21
  /**
22
22
  * A guided site start confirms its own plan (AGL-3594).
23
23
  *
@@ -46,17 +46,41 @@ import { AI_JOB_AUTO_CONFIRM_INPUT } from "../model/ai-site-job.js";
46
46
  * A job's inputs as the create door stores them: `autoConfirm` kept only on a
47
47
  * `site` job for a site that publishes nothing of the owner's yet, and dropped
48
48
  * from every other request, which then waits for a person as it always has.
49
+ *
50
+ * A `site` job that names no business is given its site's own name
51
+ * (AGL-3596). The guided start asks what the site is for, never what it is
52
+ * called — the person named it when they created it — and a plan, a header
53
+ * and a footer told no name invented one. Filled here, on the click, from the
54
+ * one read of the site the confirmation already makes, so every door that
55
+ * creates a site job carries it and nothing is read while the guided start
56
+ * renders. A name the request gave — an agency batch's — is kept.
49
57
  */ export async function aiJobAdmittedInputs(firestore, request) {
50
- if (!(AI_JOB_AUTO_CONFIRM_INPUT in request.inputs)) return request.inputs;
58
+ const askedToConfirm = AI_JOB_AUTO_CONFIRM_INPUT in request.inputs;
59
+ const unnamedSite = request.kind === 'site' && !!request.hostId && !aiSiteJobNamed(request.inputs);
60
+ if (!askedToConfirm && !unnamedSite) return request.inputs;
51
61
  const _request_inputs = request.inputs, { [AI_JOB_AUTO_CONFIRM_INPUT]: asked } = _request_inputs, rest = _object_without_properties_loose(_request_inputs, [
52
62
  _to_property_key(AI_JOB_AUTO_CONFIRM_INPUT)
53
63
  ]);
54
- if (request.kind !== 'site' || asked !== true || !request.hostId) return rest;
64
+ const mayConfirm = request.kind === 'site' && asked === true && !!request.hostId;
65
+ if (!mayConfirm && !unnamedSite) return rest;
55
66
  const host = await firestore.collection('hosts').doc(request.hostId).get();
56
- const blank = host.exists && isFirstPublishedRoute(host.get('screens'), host.get('defaultHomeScreenId'));
57
- return blank ? _extends({}, rest, {
67
+ const blank = mayConfirm && host.exists && isFirstPublishedRoute(host.get('screens'), host.get('defaultHomeScreenId'));
68
+ const name = unnamedSite && host.exists ? aiSiteJobNameOf(host.get('displayName')) : '';
69
+ // A request that asked nothing of this door, for a site with no name to give, is passed through untouched.
70
+ if (!askedToConfirm && !name) return request.inputs;
71
+ return _extends({}, rest, name ? {
72
+ businessName: name
73
+ } : {}, blank ? {
58
74
  [AI_JOB_AUTO_CONFIRM_INPUT]: true
59
- }) : rest;
75
+ } : {});
76
+ }
77
+ /** Whether a site job's inputs already name the business. */ function aiSiteJobNamed(inputs) {
78
+ const name = inputs['businessName'];
79
+ return typeof name === 'string' && name.trim() !== '';
80
+ }
81
+ /** A site's display name as a site job's `businessName`: one line, within what the job admits. */ function aiSiteJobNameOf(value) {
82
+ if (typeof value !== 'string') return '';
83
+ return value.replace(/\s+/g, ' ').trim().slice(0, AI_SITE_INPUT_MAX_CHARS).trim();
60
84
  }
61
85
 
62
86
  //# sourceMappingURL=ai-job-auto-confirm.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-job-auto-confirm.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 { isFirstPublishedRoute } from '@aglyn/aglyn/app-utils/analytics-events'\nimport type { AiJob } from '../model/ai-jobs.types'\nimport { AI_JOB_AUTO_CONFIRM_INPUT } from '../model/ai-site-job'\n\n/**\n * A guided site start confirms its own plan (AGL-3594).\n *\n * Every planned job stops after its plan for a person to read and confirm it.\n * For the guided start on a new site that stop read as a step nobody knew they\n * had to take: a person who had just answered \"what is your site?\" was shown a\n * plan to approve, and a site nobody approved was a site never built. So the\n * guided start asks for its plan to be confirmed for it, with this input, and\n * the machine confirms it the moment the plan step keeps a plan — the same\n * confirmation the resume door makes, by the job's creator, with the same\n * hold on what the plan is estimated to cost.\n *\n * Honored only where it is safe to skip the read: a `site` job, on a site\n * that has published nothing of its own yet — the site the guided start is\n * offered on. Everywhere else the create door drops it, so a page, a form or\n * a site job on an established site still waits for a person. What bounds the\n * spend is unchanged: the plan step's own checks (the Free page cap and the\n * Free wall among them), the plan's admission, and the reservation each step\n * takes.\n */\n\n/** The job input the guided start sets. */\nexport { AI_JOB_AUTO_CONFIRM_INPUT }\n\n/** Whether a job's plan is confirmed for it when the plan step keeps one. */\nexport function aiJobAutoConfirms(job: Pick<AiJob, 'kind' | 'inputs'>): boolean {\n return job.kind === 'site' && (job.inputs ?? {})[AI_JOB_AUTO_CONFIRM_INPUT] === true\n}\n\n/**\n * A job's inputs as the create door stores them: `autoConfirm` kept only on a\n * `site` job for a site that publishes nothing of the owner's yet, and dropped\n * from every other request, which then waits for a person as it always has.\n */\nexport async function aiJobAdmittedInputs(\n firestore: FirebaseFirestore.Firestore,\n request: { kind: string; hostId: string | null; inputs: Record<string, unknown> },\n): Promise<Record<string, unknown>> {\n if (!(AI_JOB_AUTO_CONFIRM_INPUT in request.inputs)) return request.inputs\n const { [AI_JOB_AUTO_CONFIRM_INPUT]: asked, ...rest } = request.inputs\n if (request.kind !== 'site' || asked !== true || !request.hostId) return rest\n const host = await firestore.collection('hosts').doc(request.hostId).get()\n const blank =\n host.exists &&\n isFirstPublishedRoute(\n host.get('screens') as Record<string, unknown> | undefined,\n host.get('defaultHomeScreenId') as string | undefined,\n )\n return blank ? { ...rest, [AI_JOB_AUTO_CONFIRM_INPUT]: true } : rest\n}\n"],"names":["isFirstPublishedRoute","AI_JOB_AUTO_CONFIRM_INPUT","aiJobAutoConfirms","job","kind","inputs","aiJobAdmittedInputs","firestore","request","asked","rest","hostId","host","collection","doc","get","blank","exists"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,qBAAqB,QAAQ,0CAAyC;AAE/E,SAASC,yBAAyB,QAAQ,0BAAsB;AAEhE;;;;;;;;;;;;;;;;;;;CAmBC,GAED,yCAAyC,GACzC,SAASA,yBAAyB,GAAE;AAEpC,2EAA2E,GAC3E,OAAO,SAASC,kBAAkBC,GAAmC;QACpCA;IAA/B,OAAOA,IAAIC,IAAI,KAAK,UAAU,EAACD,cAAAA,IAAIE,MAAM,YAAVF,cAAc,CAAC,EAAE,CAACF,0BAA0B,KAAK;AAClF;AAEA;;;;CAIC,GACD,OAAO,eAAeK,oBACpBC,SAAsC,EACtCC,OAAiF;IAEjF,IAAI,CAAEP,CAAAA,6BAA6BO,QAAQH,MAAM,AAAD,GAAI,OAAOG,QAAQH,MAAM;IACzE,MAAwDG,kBAAAA,QAAQH,MAAM,EAAhE,EAAE,CAACJ,0BAA0B,EAAEQ,KAAK,EAAW,GAAGD,iBAATE,wCAASF;yBAA/CP;;IACT,IAAIO,QAAQJ,IAAI,KAAK,UAAUK,UAAU,QAAQ,CAACD,QAAQG,MAAM,EAAE,OAAOD;IACzE,MAAME,OAAO,MAAML,UAAUM,UAAU,CAAC,SAASC,GAAG,CAACN,QAAQG,MAAM,EAAEI,GAAG;IACxE,MAAMC,QACJJ,KAAKK,MAAM,IACXjB,sBACEY,KAAKG,GAAG,CAAC,YACTH,KAAKG,GAAG,CAAC;IAEb,OAAOC,QAAQ,aAAKN;QAAM,CAACT,0BAA0B,EAAE;SAASS;AAClE"}
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-job-auto-confirm.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 { isFirstPublishedRoute } from '@aglyn/aglyn/app-utils/analytics-events'\nimport type { AiJob } from '../model/ai-jobs.types'\nimport { AI_JOB_AUTO_CONFIRM_INPUT, AI_SITE_INPUT_MAX_CHARS } from '../model/ai-site-job'\n\n/**\n * A guided site start confirms its own plan (AGL-3594).\n *\n * Every planned job stops after its plan for a person to read and confirm it.\n * For the guided start on a new site that stop read as a step nobody knew they\n * had to take: a person who had just answered \"what is your site?\" was shown a\n * plan to approve, and a site nobody approved was a site never built. So the\n * guided start asks for its plan to be confirmed for it, with this input, and\n * the machine confirms it the moment the plan step keeps a plan — the same\n * confirmation the resume door makes, by the job's creator, with the same\n * hold on what the plan is estimated to cost.\n *\n * Honored only where it is safe to skip the read: a `site` job, on a site\n * that has published nothing of its own yet — the site the guided start is\n * offered on. Everywhere else the create door drops it, so a page, a form or\n * a site job on an established site still waits for a person. What bounds the\n * spend is unchanged: the plan step's own checks (the Free page cap and the\n * Free wall among them), the plan's admission, and the reservation each step\n * takes.\n */\n\n/** The job input the guided start sets. */\nexport { AI_JOB_AUTO_CONFIRM_INPUT }\n\n/** Whether a job's plan is confirmed for it when the plan step keeps one. */\nexport function aiJobAutoConfirms(job: Pick<AiJob, 'kind' | 'inputs'>): boolean {\n return job.kind === 'site' && (job.inputs ?? {})[AI_JOB_AUTO_CONFIRM_INPUT] === true\n}\n\n/**\n * A job's inputs as the create door stores them: `autoConfirm` kept only on a\n * `site` job for a site that publishes nothing of the owner's yet, and dropped\n * from every other request, which then waits for a person as it always has.\n *\n * A `site` job that names no business is given its site's own name\n * (AGL-3596). The guided start asks what the site is for, never what it is\n * called — the person named it when they created it — and a plan, a header\n * and a footer told no name invented one. Filled here, on the click, from the\n * one read of the site the confirmation already makes, so every door that\n * creates a site job carries it and nothing is read while the guided start\n * renders. A name the request gave — an agency batch's — is kept.\n */\nexport async function aiJobAdmittedInputs(\n firestore: FirebaseFirestore.Firestore,\n request: { kind: string; hostId: string | null; inputs: Record<string, unknown> },\n): Promise<Record<string, unknown>> {\n const askedToConfirm = AI_JOB_AUTO_CONFIRM_INPUT in request.inputs\n const unnamedSite = request.kind === 'site' && !!request.hostId && !aiSiteJobNamed(request.inputs)\n if (!askedToConfirm && !unnamedSite) return request.inputs\n const { [AI_JOB_AUTO_CONFIRM_INPUT]: asked, ...rest } = request.inputs\n const mayConfirm = request.kind === 'site' && asked === true && !!request.hostId\n if (!mayConfirm && !unnamedSite) return rest\n const host = await firestore.collection('hosts').doc(request.hostId as string).get()\n const blank =\n mayConfirm &&\n host.exists &&\n isFirstPublishedRoute(\n host.get('screens') as Record<string, unknown> | undefined,\n host.get('defaultHomeScreenId') as string | undefined,\n )\n const name = unnamedSite && host.exists ? aiSiteJobNameOf(host.get('displayName')) : ''\n // A request that asked nothing of this door, for a site with no name to give, is passed through untouched.\n if (!askedToConfirm && !name) return request.inputs\n return {\n ...rest,\n ...(name ? { businessName: name } : {}),\n ...(blank ? { [AI_JOB_AUTO_CONFIRM_INPUT]: true } : {}),\n }\n}\n\n/** Whether a site job's inputs already name the business. */\nfunction aiSiteJobNamed(inputs: Readonly<Record<string, unknown>>): boolean {\n const name = inputs['businessName']\n return typeof name === 'string' && name.trim() !== ''\n}\n\n/** A site's display name as a site job's `businessName`: one line, within what the job admits. */\nfunction aiSiteJobNameOf(value: unknown): string {\n if (typeof value !== 'string') return ''\n return value.replace(/\\s+/g, ' ').trim().slice(0, AI_SITE_INPUT_MAX_CHARS).trim()\n}\n"],"names":["isFirstPublishedRoute","AI_JOB_AUTO_CONFIRM_INPUT","AI_SITE_INPUT_MAX_CHARS","aiJobAutoConfirms","job","kind","inputs","aiJobAdmittedInputs","firestore","request","askedToConfirm","unnamedSite","hostId","aiSiteJobNamed","asked","rest","mayConfirm","host","collection","doc","get","blank","exists","name","aiSiteJobNameOf","businessName","trim","value","replace","slice"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,qBAAqB,QAAQ,0CAAyC;AAE/E,SAASC,yBAAyB,EAAEC,uBAAuB,QAAQ,0BAAsB;AAEzF;;;;;;;;;;;;;;;;;;;CAmBC,GAED,yCAAyC,GACzC,SAASD,yBAAyB,GAAE;AAEpC,2EAA2E,GAC3E,OAAO,SAASE,kBAAkBC,GAAmC;QACpCA;IAA/B,OAAOA,IAAIC,IAAI,KAAK,UAAU,EAACD,cAAAA,IAAIE,MAAM,YAAVF,cAAc,CAAC,EAAE,CAACH,0BAA0B,KAAK;AAClF;AAEA;;;;;;;;;;;;CAYC,GACD,OAAO,eAAeM,oBACpBC,SAAsC,EACtCC,OAAiF;IAEjF,MAAMC,iBAAiBT,6BAA6BQ,QAAQH,MAAM;IAClE,MAAMK,cAAcF,QAAQJ,IAAI,KAAK,UAAU,CAAC,CAACI,QAAQG,MAAM,IAAI,CAACC,eAAeJ,QAAQH,MAAM;IACjG,IAAI,CAACI,kBAAkB,CAACC,aAAa,OAAOF,QAAQH,MAAM;IAC1D,MAAwDG,kBAAAA,QAAQH,MAAM,EAAhE,EAAE,CAACL,0BAA0B,EAAEa,KAAK,EAAW,GAAGL,iBAATM,wCAASN;yBAA/CR;;IACT,MAAMe,aAAaP,QAAQJ,IAAI,KAAK,UAAUS,UAAU,QAAQ,CAAC,CAACL,QAAQG,MAAM;IAChF,IAAI,CAACI,cAAc,CAACL,aAAa,OAAOI;IACxC,MAAME,OAAO,MAAMT,UAAUU,UAAU,CAAC,SAASC,GAAG,CAACV,QAAQG,MAAM,EAAYQ,GAAG;IAClF,MAAMC,QACJL,cACAC,KAAKK,MAAM,IACXtB,sBACEiB,KAAKG,GAAG,CAAC,YACTH,KAAKG,GAAG,CAAC;IAEb,MAAMG,OAAOZ,eAAeM,KAAKK,MAAM,GAAGE,gBAAgBP,KAAKG,GAAG,CAAC,kBAAkB;IACrF,2GAA2G;IAC3G,IAAI,CAACV,kBAAkB,CAACa,MAAM,OAAOd,QAAQH,MAAM;IACnD,OAAO,aACFS,MACCQ,OAAO;QAAEE,cAAcF;IAAK,IAAI,CAAC,GACjCF,QAAQ;QAAE,CAACpB,0BAA0B,EAAE;IAAK,IAAI,CAAC;AAEzD;AAEA,2DAA2D,GAC3D,SAASY,eAAeP,MAAyC;IAC/D,MAAMiB,OAAOjB,MAAM,CAAC,eAAe;IACnC,OAAO,OAAOiB,SAAS,YAAYA,KAAKG,IAAI,OAAO;AACrD;AAEA,gGAAgG,GAChG,SAASF,gBAAgBG,KAAc;IACrC,IAAI,OAAOA,UAAU,UAAU,OAAO;IACtC,OAAOA,MAAMC,OAAO,CAAC,QAAQ,KAAKF,IAAI,GAAGG,KAAK,CAAC,GAAG3B,yBAAyBwB,IAAI;AACjF"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { resolveOrgIdForHost } from '@aglyn/tenant-data-admin/server/organizations';
18
+ import { type AiBuildOps, type AiBuildUnit } from '../model/ai-build-job';
19
+ import type { AiJob, AiJobItemLedger, AiJobKind } from '../model/ai-jobs.types';
20
+ import { type AiBuildOpsContext } from './ai-build-capabilities';
21
+ import { aiJobAdmissionRefusal, type AiJobAdmission } from './ai-job-admission';
22
+ import { readAiDraftNodes } from './ai-job-drafts';
23
+ import { aiPluginDraftAdmissionRefusal, type AiPluginDraftWriterLookup } from './ai-job-plugin-drafts';
24
+ import { type AiJobStepRunner } from './ai-job-text-step';
25
+ import { aiPublishGuidedSite } from './ai-site-publish';
26
+ import { aiJobStepRunnerFor } from './ai-jobs';
27
+ /**
28
+ * The build step (AGL-3616): the generation step of a `build` job, run once
29
+ * the member confirmed the plan their request produced.
30
+ *
31
+ * Like the site scaffold it generalizes, it builds nothing itself and asks no
32
+ * model of its own. Each pass takes the next unit in dependency order and
33
+ * hands it to what builds that kind of thing — a page, layout, form,
34
+ * component, email design or template to this plugin's own step, under a job
35
+ * derived for the unit; another plugin's resource to that plugin's writer on
36
+ * the resource-draft seam, with the content the owner's capability derives
37
+ * from the item's arguments. One unit, one pass, one recorded spend.
38
+ *
39
+ * ── Settled item by item ────────────────────────────────────────────────
40
+ *
41
+ * Where a unit stands is read from the job's ITEM LEDGER, never from counting
42
+ * outputs: the machine writes each pass's row in the transaction that
43
+ * records its spend (`recordStep`). A unit that fails is a FAILED ROW, not a
44
+ * failed job: the pass reports it, the machine gives back that item's spend
45
+ * where the failure was ours, and the next pass builds the next unit. What
46
+ * depended on it is built without it, or skipped where it cannot stand
47
+ * without it (`aiBuildDegradation`). The machine ends the job when nothing is
48
+ * left: `done` when anything was delivered, `failed` — its planning given
49
+ * back too — when nothing was.
50
+ *
51
+ * ── Drafts, unless asked and confirmed ───────────────────────────────────
52
+ *
53
+ * Every unit writes the draft its own kind writes, which nothing publishes.
54
+ * Only a build whose request asked to publish AND whose member ticked the
55
+ * plan card's box puts its built pages live, once, on its last pass, through
56
+ * the guided start's publish.
57
+ */
58
+ /** What a build answers with no confirmed plan to build. */
59
+ export declare const AI_BUILD_NO_PLAN_COPY = "This build has no confirmed plan to build.";
60
+ /** What a unit says when nothing on this site builds its operation any more. */
61
+ export declare const aiBuildUnavailableCopy: (noun: string) => string;
62
+ /** What a page that was reported built but holds none of its plan says. */
63
+ export declare const AI_BUILD_PAGE_NOT_WRITTEN_COPY = "The page was not written from its plan.";
64
+ /**
65
+ * The most passes a build's step may take: every unit at a page's worst — its
66
+ * sections and its listing — so a runner that never finishes is still
67
+ * bounded while the largest plan is not. Try again starts the count over.
68
+ */
69
+ export declare const AI_BUILD_MAX_PASSES: number;
70
+ /** The job kind a unit is built by, where an AI runner builds it. */
71
+ export declare function aiBuildUnitJobKind(unit: AiBuildUnit, ops: AiBuildOps): AiJobKind | null;
72
+ /** The id a unit's job, and so its draft, is named by. */
73
+ export declare function aiBuildUnitJobId(job: Pick<AiJob, '$id'>, unit: AiBuildUnit): string;
74
+ /**
75
+ * The job a unit is built under (generalizing `aiSiteUnitJob`): this job's
76
+ * org, site, creator and model; the kind that builds the unit; a plan
77
+ * narrowed to the unit, its `new:` references resolved to what was built and
78
+ * the failed ones left out; and a brief that says what the unit is, what it
79
+ * is built without, and which blocks its sections place.
80
+ */
81
+ export declare function aiBuildUnitJob(job: AiJob, unit: AiBuildUnit, context: {
82
+ kind: AiJobKind;
83
+ units: readonly AiBuildUnit[];
84
+ ledger: readonly AiJobItemLedger[];
85
+ ops: AiBuildOps;
86
+ briefLines?: readonly string[];
87
+ }): AiJob;
88
+ export interface AiJobBuildStepDeps {
89
+ /** The runner registry; specs hand in fakes. */
90
+ runnerFor?: typeof aiJobStepRunnerFor;
91
+ /** The draft writer registry; specs hand in fakes. */
92
+ writerFor?: AiPluginDraftWriterLookup;
93
+ /** The operations this site may use; the registry and its gates otherwise. */
94
+ opsFor?: (context: AiBuildOpsContext) => Promise<AiBuildOps>;
95
+ /** A runner kind's own admission, asked before its item runs; the registry's otherwise. */
96
+ admissionFor?: typeof aiJobAdmissionRefusal;
97
+ /** Another plugin's admission for its writer; the seam's otherwise. */
98
+ pluginAdmission?: typeof aiPluginDraftAdmissionRefusal;
99
+ /** The draft reader a built page is checked through. */
100
+ readNodes?: typeof readAiDraftNodes;
101
+ /** The publish a build asked for and confirmed. */
102
+ publish?: typeof aiPublishGuidedSite;
103
+ }
104
+ /** Whether a build's workspace spends the Free taste. */
105
+ export declare function aiBuildFreeTaste(org: object | null | undefined): boolean;
106
+ export declare function createAiJobBuildStep(deps?: AiJobBuildStepDeps): AiJobStepRunner;
107
+ export declare const runAiJobBuildStep: AiJobStepRunner;
108
+ /**
109
+ * The least time a build's next pass needs: what the step that builds its
110
+ * next unit registers for the job derived for it; a page pass's when the
111
+ * next unit is another plugin's draft, which asks no model.
112
+ */
113
+ export declare function aiBuildJobRunMinimumMs(job: AiJob): number;
114
+ /**
115
+ * Why a Free build cannot be confirmed: its estimate is more than the owner's
116
+ * Free allowance has left this month. Read off the account month the meter
117
+ * writes, net of give-backs; a read that fails admits, since the reservation
118
+ * still refuses at the wall.
119
+ */
120
+ export declare function aiBuildFreeBalanceRefusal(input: {
121
+ firestore: FirebaseFirestore.Firestore;
122
+ org: object | null;
123
+ estimate: number;
124
+ now: Date;
125
+ }): Promise<string | null>;
126
+ export interface AiBuildAdmissionDeps {
127
+ opsFor?: (context: AiBuildOpsContext) => Promise<AiBuildOps>;
128
+ freeBalanceRefusal?: typeof aiBuildFreeBalanceRefusal;
129
+ ownerOf?: typeof resolveOrgIdForHost;
130
+ now?: () => Date;
131
+ }
132
+ /**
133
+ * A build is admitted for a site of the job's own org where a page can be
134
+ * built; and confirmed only for a plan it can build here — its shape, its
135
+ * operations as this site has them, and on the Free taste an estimate the
136
+ * month's Free credits still cover.
137
+ */
138
+ export declare function createAiBuildJobAdmission(deps?: AiBuildAdmissionDeps): AiJobAdmission;
139
+ export declare const aiBuildJobAdmission: AiJobAdmission;
140
+ /**
141
+ * Registers the build with the least time a pass needs, the time its next
142
+ * pass needs, the passes its largest plan may take, and its admission.
143
+ */
144
+ export declare function registerAiBuildJob(): void;