@aglyn/plugins-ai 1.0.0-beta.230 → 1.0.0-beta.232

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 (305) hide show
  1. package/package.json +17 -17
  2. package/src/lib/activity/ai-activity-actions.js +8 -4
  3. package/src/lib/activity/ai-activity-actions.js.map +1 -1
  4. package/src/lib/components/ai-assist-provider-on-host.component.d.ts +66 -0
  5. package/src/lib/components/ai-assist-provider-on-host.component.js +78 -0
  6. package/src/lib/components/ai-assist-provider-on-host.component.js.map +1 -0
  7. package/src/lib/components/ai-assist-provider.component.js +9 -10
  8. package/src/lib/components/ai-assist-provider.component.js.map +1 -1
  9. package/src/lib/components/ai-job-follow.component.js +1 -0
  10. package/src/lib/components/ai-job-follow.component.js.map +1 -1
  11. package/src/lib/components/ai-job-links.js +13 -0
  12. package/src/lib/components/ai-job-links.js.map +1 -1
  13. package/src/lib/components/ai-job-plan.component.js +3 -1
  14. package/src/lib/components/ai-job-plan.component.js.map +1 -1
  15. package/src/lib/components/ai-jobs-list-page.component.js +1 -0
  16. package/src/lib/components/ai-jobs-list-page.component.js.map +1 -1
  17. package/src/lib/components/ai-media-create.component.d.ts +20 -7
  18. package/src/lib/components/ai-media-create.component.js +107 -55
  19. package/src/lib/components/ai-media-create.component.js.map +1 -1
  20. package/src/lib/components/ai-permissions-on-host.component.d.ts +3 -46
  21. package/src/lib/components/ai-permissions-on-host.component.js +5 -53
  22. package/src/lib/components/ai-permissions-on-host.component.js.map +1 -1
  23. package/src/lib/components/ai-seo-fields-card.component.js +1 -0
  24. package/src/lib/components/ai-seo-fields-card.component.js.map +1 -1
  25. package/src/lib/components/ai-site-build-page.component.js +20 -8
  26. package/src/lib/components/ai-site-build-page.component.js.map +1 -1
  27. package/src/lib/components/ai-site-memory-card.component.d.ts +32 -0
  28. package/src/lib/components/ai-site-memory-card.component.js +187 -0
  29. package/src/lib/components/ai-site-memory-card.component.js.map +1 -0
  30. package/src/lib/components/ai-site-start-card.component.js +80 -77
  31. package/src/lib/components/ai-site-start-card.component.js.map +1 -1
  32. package/src/lib/components/ai-theme-proposal-card.component.js +4 -0
  33. package/src/lib/components/ai-theme-proposal-card.component.js.map +1 -1
  34. package/src/lib/components/ai-usage-strip.component.js +1 -0
  35. package/src/lib/components/ai-usage-strip.component.js.map +1 -1
  36. package/src/lib/components/assist-panel.component.d.ts +10 -0
  37. package/src/lib/components/assist-panel.component.js +119 -9
  38. package/src/lib/components/assist-panel.component.js.map +1 -1
  39. package/src/lib/components/assist-signals-page.component.js +2 -0
  40. package/src/lib/components/assist-signals-page.component.js.map +1 -1
  41. package/src/lib/components/billing-ai-allotments.component.js +3 -0
  42. package/src/lib/components/billing-ai-allotments.component.js.map +1 -1
  43. package/src/lib/components/billing-ai-top-users.component.js +1 -0
  44. package/src/lib/components/billing-ai-top-users.component.js.map +1 -1
  45. package/src/lib/components/billing-assist-overage-card.component.js +2 -0
  46. package/src/lib/components/billing-assist-overage-card.component.js.map +1 -1
  47. package/src/lib/components/member-ai-usage-card.component.js +10 -0
  48. package/src/lib/components/member-ai-usage-card.component.js.map +1 -1
  49. package/src/lib/components/staff-org-ai-card.component.js +1 -0
  50. package/src/lib/components/staff-org-ai-card.component.js.map +1 -1
  51. package/src/lib/components/staff-org-ai-conversations.component.d.ts +23 -0
  52. package/src/lib/components/staff-org-ai-conversations.component.js +346 -0
  53. package/src/lib/components/staff-org-ai-conversations.component.js.map +1 -0
  54. package/src/lib/jobs/ai-build-capabilities.d.ts +13 -1
  55. package/src/lib/jobs/ai-build-capabilities.js +101 -7
  56. package/src/lib/jobs/ai-build-capabilities.js.map +1 -1
  57. package/src/lib/jobs/ai-build-unit-outcome.js +4 -2
  58. package/src/lib/jobs/ai-build-unit-outcome.js.map +1 -1
  59. package/src/lib/jobs/ai-business-profile-prefill.d.ts +29 -0
  60. package/src/lib/jobs/ai-business-profile-prefill.js +85 -0
  61. package/src/lib/jobs/ai-business-profile-prefill.js.map +1 -0
  62. package/src/lib/jobs/ai-job-auto-confirm.d.ts +8 -0
  63. package/src/lib/jobs/ai-job-auto-confirm.js +30 -6
  64. package/src/lib/jobs/ai-job-auto-confirm.js.map +1 -1
  65. package/src/lib/jobs/ai-job-build-step.js +14 -1
  66. package/src/lib/jobs/ai-job-build-step.js.map +1 -1
  67. package/src/lib/jobs/ai-job-edit-step.d.ts +225 -0
  68. package/src/lib/jobs/ai-job-edit-step.js +631 -0
  69. package/src/lib/jobs/ai-job-edit-step.js.map +1 -0
  70. package/src/lib/jobs/ai-job-generation.d.ts +8 -0
  71. package/src/lib/jobs/ai-job-generation.js +13 -2
  72. package/src/lib/jobs/ai-job-generation.js.map +1 -1
  73. package/src/lib/jobs/ai-job-insight-step.js +29 -5
  74. package/src/lib/jobs/ai-job-insight-step.js.map +1 -1
  75. package/src/lib/jobs/ai-job-layout-language.d.ts +78 -0
  76. package/src/lib/jobs/ai-job-layout-language.js +200 -0
  77. package/src/lib/jobs/ai-job-layout-language.js.map +1 -0
  78. package/src/lib/jobs/ai-job-layout-site-pages.d.ts +13 -2
  79. package/src/lib/jobs/ai-job-layout-site-pages.js +18 -2
  80. package/src/lib/jobs/ai-job-layout-site-pages.js.map +1 -1
  81. package/src/lib/jobs/ai-job-layout-step.d.ts +5 -0
  82. package/src/lib/jobs/ai-job-layout-step.js +107 -6
  83. package/src/lib/jobs/ai-job-layout-step.js.map +1 -1
  84. package/src/lib/jobs/ai-job-logic-step.d.ts +20 -0
  85. package/src/lib/jobs/ai-job-logic-step.js +87 -6
  86. package/src/lib/jobs/ai-job-logic-step.js.map +1 -1
  87. package/src/lib/jobs/ai-job-page-language.d.ts +194 -0
  88. package/src/lib/jobs/ai-job-page-language.js +418 -0
  89. package/src/lib/jobs/ai-job-page-language.js.map +1 -0
  90. package/src/lib/jobs/ai-job-page-sections.d.ts +37 -1
  91. package/src/lib/jobs/ai-job-page-sections.js +93 -11
  92. package/src/lib/jobs/ai-job-page-sections.js.map +1 -1
  93. package/src/lib/jobs/ai-job-page-step.d.ts +4 -4
  94. package/src/lib/jobs/ai-job-page-step.js +115 -14
  95. package/src/lib/jobs/ai-job-page-step.js.map +1 -1
  96. package/src/lib/jobs/ai-job-plan-step.d.ts +20 -6
  97. package/src/lib/jobs/ai-job-plan-step.js +62 -22
  98. package/src/lib/jobs/ai-job-plan-step.js.map +1 -1
  99. package/src/lib/jobs/ai-job-site-content.d.ts +163 -0
  100. package/src/lib/jobs/ai-job-site-content.js +443 -0
  101. package/src/lib/jobs/ai-job-site-content.js.map +1 -0
  102. package/src/lib/jobs/ai-job-site-look.d.ts +112 -0
  103. package/src/lib/jobs/ai-job-site-look.js +322 -0
  104. package/src/lib/jobs/ai-job-site-look.js.map +1 -0
  105. package/src/lib/jobs/ai-job-site-step.d.ts +30 -5
  106. package/src/lib/jobs/ai-job-site-step.js +183 -27
  107. package/src/lib/jobs/ai-job-site-step.js.map +1 -1
  108. package/src/lib/jobs/ai-job-workflow-step.js +2 -2
  109. package/src/lib/jobs/ai-job-workflow-step.js.map +1 -1
  110. package/src/lib/jobs/ai-jobs-notify.d.ts +6 -1
  111. package/src/lib/jobs/ai-jobs-notify.js +15 -3
  112. package/src/lib/jobs/ai-jobs-notify.js.map +1 -1
  113. package/src/lib/jobs/ai-jobs.d.ts +1 -1
  114. package/src/lib/jobs/ai-jobs.js +17 -8
  115. package/src/lib/jobs/ai-jobs.js.map +1 -1
  116. package/src/lib/jobs/ai-layout-full-height.d.ts +40 -0
  117. package/src/lib/jobs/ai-layout-full-height.js +82 -0
  118. package/src/lib/jobs/ai-layout-full-height.js.map +1 -0
  119. package/src/lib/jobs/ai-layout-site-facts.d.ts +54 -0
  120. package/src/lib/jobs/ai-layout-site-facts.js +153 -0
  121. package/src/lib/jobs/ai-layout-site-facts.js.map +1 -0
  122. package/src/lib/layout-language/ai-layout-compiler.d.ts +154 -0
  123. package/src/lib/layout-language/ai-layout-compiler.js +1235 -0
  124. package/src/lib/layout-language/ai-layout-compiler.js.map +1 -0
  125. package/src/lib/layout-language/ai-layout-copy.d.ts +73 -0
  126. package/src/lib/layout-language/ai-layout-copy.js +137 -0
  127. package/src/lib/layout-language/ai-layout-copy.js.map +1 -0
  128. package/src/lib/layout-language/ai-layout-frame.d.ts +52 -0
  129. package/src/lib/layout-language/ai-layout-frame.js +458 -0
  130. package/src/lib/layout-language/ai-layout-frame.js.map +1 -0
  131. package/src/lib/layout-language/ai-layout-gaps.d.ts +63 -0
  132. package/src/lib/layout-language/ai-layout-gaps.js +345 -0
  133. package/src/lib/layout-language/ai-layout-gaps.js.map +1 -0
  134. package/src/lib/layout-language/ai-layout-language.d.ts +168 -0
  135. package/src/lib/layout-language/ai-layout-language.js +529 -0
  136. package/src/lib/layout-language/ai-layout-language.js.map +1 -0
  137. package/src/lib/layout-language/ai-layout-links.d.ts +80 -0
  138. package/src/lib/layout-language/ai-layout-links.js +109 -0
  139. package/src/lib/layout-language/ai-layout-links.js.map +1 -0
  140. package/src/lib/layout-language/ai-layout-pictures.d.ts +144 -0
  141. package/src/lib/layout-language/ai-layout-pictures.js +214 -0
  142. package/src/lib/layout-language/ai-layout-pictures.js.map +1 -0
  143. package/src/lib/layout-language/ai-layout-store.d.ts +41 -0
  144. package/src/lib/layout-language/ai-layout-store.js +75 -0
  145. package/src/lib/layout-language/ai-layout-store.js.map +1 -0
  146. package/src/lib/layout-language/ai-layout-tree.d.ts +59 -0
  147. package/src/lib/layout-language/ai-layout-tree.js +84 -0
  148. package/src/lib/layout-language/ai-layout-tree.js.map +1 -0
  149. package/src/lib/lazy-widget.d.ts +45 -0
  150. package/src/lib/lazy-widget.js +53 -0
  151. package/src/lib/lazy-widget.js.map +1 -0
  152. package/src/lib/model/ai-build-job.js +2 -1
  153. package/src/lib/model/ai-build-job.js.map +1 -1
  154. package/src/lib/model/ai-build-progress.d.ts +20 -3
  155. package/src/lib/model/ai-build-progress.js +52 -7
  156. package/src/lib/model/ai-build-progress.js.map +1 -1
  157. package/src/lib/model/ai-edit-job.d.ts +109 -0
  158. package/src/lib/model/ai-edit-job.js +157 -0
  159. package/src/lib/model/ai-edit-job.js.map +1 -0
  160. package/src/lib/model/ai-host-publish-context.d.ts +51 -0
  161. package/src/lib/model/ai-host-publish-context.js +104 -0
  162. package/src/lib/model/ai-host-publish-context.js.map +1 -0
  163. package/src/lib/model/ai-job-activity.d.ts +22 -0
  164. package/src/lib/model/ai-job-activity.js +23 -1
  165. package/src/lib/model/ai-job-activity.js.map +1 -1
  166. package/src/lib/model/ai-job-failure-copy.d.ts +38 -1
  167. package/src/lib/model/ai-job-failure-copy.js +56 -1
  168. package/src/lib/model/ai-job-failure-copy.js.map +1 -1
  169. package/src/lib/model/ai-job-notice.d.ts +3 -1
  170. package/src/lib/model/ai-job-notice.js +31 -9
  171. package/src/lib/model/ai-job-notice.js.map +1 -1
  172. package/src/lib/model/ai-jobs.types.d.ts +22 -1
  173. package/src/lib/model/ai-jobs.types.js.map +1 -1
  174. package/src/lib/model/ai-logic-job.d.ts +18 -1
  175. package/src/lib/model/ai-logic-job.js +24 -3
  176. package/src/lib/model/ai-logic-job.js.map +1 -1
  177. package/src/lib/model/ai-media-credits.d.ts +8 -4
  178. package/src/lib/model/ai-media-credits.js +11 -4
  179. package/src/lib/model/ai-media-credits.js.map +1 -1
  180. package/src/lib/model/ai-media-kinds.d.ts +68 -0
  181. package/src/lib/model/ai-media-kinds.js +98 -0
  182. package/src/lib/model/ai-media-kinds.js.map +1 -0
  183. package/src/lib/model/ai-site-build-progress.d.ts +9 -1
  184. package/src/lib/model/ai-site-build-progress.js +54 -14
  185. package/src/lib/model/ai-site-build-progress.js.map +1 -1
  186. package/src/lib/model/ai-site-context.d.ts +111 -0
  187. package/src/lib/model/ai-site-context.js +222 -0
  188. package/src/lib/model/ai-site-context.js.map +1 -0
  189. package/src/lib/model/ai-site-job.d.ts +18 -2
  190. package/src/lib/model/ai-site-job.js +21 -5
  191. package/src/lib/model/ai-site-job.js.map +1 -1
  192. package/src/lib/model/ai-site-kinds.d.ts +164 -0
  193. package/src/lib/model/ai-site-kinds.js +1942 -0
  194. package/src/lib/model/ai-site-kinds.js.map +1 -0
  195. package/src/lib/model/ai-site-look.d.ts +150 -0
  196. package/src/lib/model/ai-site-look.js +1236 -0
  197. package/src/lib/model/ai-site-look.js.map +1 -0
  198. package/src/lib/model/ai-site-memory.d.ts +80 -0
  199. package/src/lib/model/ai-site-memory.js +171 -0
  200. package/src/lib/model/ai-site-memory.js.map +1 -0
  201. package/src/lib/model/ai-site-start-seo.d.ts +1 -1
  202. package/src/lib/model/ai-site-start.d.ts +15 -3
  203. package/src/lib/model/ai-site-start.js +21 -4
  204. package/src/lib/model/ai-site-start.js.map +1 -1
  205. package/src/lib/model/assist-follow-up.d.ts +92 -0
  206. package/src/lib/model/assist-follow-up.js +128 -0
  207. package/src/lib/model/assist-follow-up.js.map +1 -0
  208. package/src/lib/plugin-config.js +2 -0
  209. package/src/lib/plugin-config.js.map +1 -1
  210. package/src/lib/plugin.js +99 -48
  211. package/src/lib/plugin.js.map +1 -1
  212. package/src/lib/providers/anthropic.d.ts +9 -1
  213. package/src/lib/providers/anthropic.js +143 -9
  214. package/src/lib/providers/anthropic.js.map +1 -1
  215. package/src/lib/providers/catalog.d.ts +38 -8
  216. package/src/lib/providers/catalog.js +106 -14
  217. package/src/lib/providers/catalog.js.map +1 -1
  218. package/src/lib/providers/contract.d.ts +29 -0
  219. package/src/lib/providers/contract.js.map +1 -1
  220. package/src/lib/providers/image-contract.d.ts +22 -1
  221. package/src/lib/providers/image-contract.js +40 -1
  222. package/src/lib/providers/image-contract.js.map +1 -1
  223. package/src/lib/providers/image-endpoints.d.ts +24 -0
  224. package/src/lib/providers/image-endpoints.js +28 -0
  225. package/src/lib/providers/image-endpoints.js.map +1 -0
  226. package/src/lib/providers/model-choice.js +23 -2
  227. package/src/lib/providers/model-choice.js.map +1 -1
  228. package/src/lib/providers/routing.js +18 -0
  229. package/src/lib/providers/routing.js.map +1 -1
  230. package/src/lib/providers/vertex-image-endpoint.d.ts +48 -0
  231. package/src/lib/providers/vertex-image-endpoint.js +80 -0
  232. package/src/lib/providers/vertex-image-endpoint.js.map +1 -0
  233. package/src/lib/providers/vertex-image.d.ts +13 -27
  234. package/src/lib/providers/vertex-image.js +15 -42
  235. package/src/lib/providers/vertex-image.js.map +1 -1
  236. package/src/lib/runtime/ai-blog-post-generation.d.ts +62 -0
  237. package/src/lib/runtime/ai-blog-post-generation.js +89 -0
  238. package/src/lib/runtime/ai-blog-post-generation.js.map +1 -0
  239. package/src/lib/runtime/ai-dev-env.d.ts +53 -0
  240. package/src/lib/runtime/ai-dev-env.js +72 -0
  241. package/src/lib/runtime/ai-dev-env.js.map +1 -0
  242. package/src/lib/runtime/ai-dev-replay.d.ts +116 -0
  243. package/src/lib/runtime/ai-dev-replay.js +313 -0
  244. package/src/lib/runtime/ai-dev-replay.js.map +1 -0
  245. package/src/lib/runtime/ai-doctrine-validators.d.ts +82 -0
  246. package/src/lib/runtime/ai-doctrine-validators.js +436 -4
  247. package/src/lib/runtime/ai-doctrine-validators.js.map +1 -1
  248. package/src/lib/runtime/ai-doctrine.js +16 -3
  249. package/src/lib/runtime/ai-doctrine.js.map +1 -1
  250. package/src/lib/runtime/ai-eval-live.js +4 -0
  251. package/src/lib/runtime/ai-eval-live.js.map +1 -1
  252. package/src/lib/runtime/ai-eval.d.ts +13 -1
  253. package/src/lib/runtime/ai-eval.js +84 -1
  254. package/src/lib/runtime/ai-eval.js.map +1 -1
  255. package/src/lib/runtime/ai-icon-library.d.ts +257 -0
  256. package/src/lib/runtime/ai-icon-library.js +254 -0
  257. package/src/lib/runtime/ai-icon-library.js.map +1 -0
  258. package/src/lib/runtime/ai-live-batch.d.ts +45 -0
  259. package/src/lib/runtime/ai-live-batch.js +89 -0
  260. package/src/lib/runtime/ai-live-batch.js.map +1 -0
  261. package/src/lib/runtime/ai-node-tree.d.ts +9 -0
  262. package/src/lib/runtime/ai-node-tree.js +30 -4
  263. package/src/lib/runtime/ai-node-tree.js.map +1 -1
  264. package/src/lib/runtime/ai-palette.d.ts +6 -0
  265. package/src/lib/runtime/ai-palette.generated.js +70 -0
  266. package/src/lib/runtime/ai-palette.generated.js.map +1 -1
  267. package/src/lib/runtime/ai-palette.js.map +1 -1
  268. package/src/lib/runtime/ai-runtime.js +46 -2
  269. package/src/lib/runtime/ai-runtime.js.map +1 -1
  270. package/src/lib/runtime/site-context.d.ts +58 -0
  271. package/src/lib/runtime/site-context.js +127 -0
  272. package/src/lib/runtime/site-context.js.map +1 -0
  273. package/src/lib/server/ai-admin-conversations.d.ts +22 -0
  274. package/src/lib/server/ai-admin-conversations.js +197 -0
  275. package/src/lib/server/ai-admin-conversations.js.map +1 -0
  276. package/src/lib/server/ai-media-image.d.ts +5 -5
  277. package/src/lib/server/ai-media-image.js +25 -11
  278. package/src/lib/server/ai-media-image.js.map +1 -1
  279. package/src/lib/server/ai-media-raster-prompt.d.ts +34 -0
  280. package/src/lib/server/ai-media-raster-prompt.js +53 -0
  281. package/src/lib/server/ai-media-raster-prompt.js.map +1 -0
  282. package/src/lib/server/assist-chat.d.ts +11 -0
  283. package/src/lib/server/assist-chat.js +57 -18
  284. package/src/lib/server/assist-chat.js.map +1 -1
  285. package/src/lib/server/assist-edit-applied.js +16 -3
  286. package/src/lib/server/assist-edit-applied.js.map +1 -1
  287. package/src/lib/server/assist-view-context.d.ts +19 -1
  288. package/src/lib/server/assist-view-context.js +38 -1
  289. package/src/lib/server/assist-view-context.js.map +1 -1
  290. package/src/lib/server.js +10 -0
  291. package/src/lib/server.js.map +1 -1
  292. package/src/lib/subprocessors.js +17 -1
  293. package/src/lib/subprocessors.js.map +1 -1
  294. package/src/lib/tools/ai-blog-post-tool.d.ts +60 -0
  295. package/src/lib/tools/ai-blog-post-tool.js +175 -0
  296. package/src/lib/tools/ai-blog-post-tool.js.map +1 -0
  297. package/src/lib/tools/ai-workflow-tool.d.ts +6 -2
  298. package/src/lib/tools/ai-workflow-tool.js +16 -14
  299. package/src/lib/tools/ai-workflow-tool.js.map +1 -1
  300. package/src/lib/usage/assist-usage.d.ts +3 -0
  301. package/src/lib/usage/assist-usage.js +4 -2
  302. package/src/lib/usage/assist-usage.js.map +1 -1
  303. package/src/lib/usage/staff-org-ai-conversations.d.ts +103 -0
  304. package/src/lib/usage/staff-org-ai-conversations.js +152 -0
  305. package/src/lib/usage/staff-org-ai-conversations.js.map +1 -0
@@ -0,0 +1,418 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ /**
3
+ * @license
4
+ * Copyright 2026 Aglyn LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */ import { CANVAS_ROOT_ELEMENT_ID } from "@aglyn/aglyn/foundation/constants/canvas";
18
+ import { isAiPlanNewRef } from "../model/ai-build-plan.js";
19
+ import { aiHomeScreenIds } from "../model/ai-site-inventory.js";
20
+ import { aiCompileLayoutPage } from "../layout-language/ai-layout-compiler.js";
21
+ import { AI_LAYOUT_LANGUAGE_TEXT, AI_LAYOUT_PAGE_TOOL, aiReadLayoutPage } from "../layout-language/ai-layout-language.js";
22
+ import { aiLayoutCopyCheck } from "../layout-language/ai-layout-gaps.js";
23
+ import { aiLayoutStoredTree } from "../layout-language/ai-layout-store.js";
24
+ import { AI_GENERATION_MAX_ATTEMPTS } from "../runtime/ai-generation-bounds.js";
25
+ import { AI_STEP_TIERS } from "../providers/catalog.js";
26
+ import { runValidatedGeneration } from "../runtime/ai-doctrine.js";
27
+ import { validateAiDoctrineTree } from "../runtime/ai-doctrine-validators.js";
28
+ import { aiSiteKindDesignLines } from "../model/ai-site-kinds.js";
29
+ import { aiGenerationWorstCaseOnTierMs, aiJobStepBudget } from "./ai-job-budget.js";
30
+ import { aiJobBriefLine, aiPlanReferenceLines } from "./ai-job-generation.js";
31
+ import { aiLayoutSitePages } from "./ai-job-layout-site-pages.js";
32
+ import { aiLayoutInventedContactViolations } from "./ai-layout-site-facts.js";
33
+ /**
34
+ * A page built in the compact layout language (AGL-3660): the page step's
35
+ * pass for a site's page units — a guided start's and a build's — in place of
36
+ * the raw-tree section passes.
37
+ *
38
+ * ONE answer a page: every planned section, in the language, through
39
+ * `submit_page`. The compiler writes the tree, the palette validator stores
40
+ * it as it stores any generated tree, and the doctrine checks the whole page.
41
+ * A section the answer left out or left empty is the one thing a re-ask asks
42
+ * for: the sections that read are kept, and the second answer fills only
43
+ * what is still missing. Then the page step's last pass runs as it always
44
+ * has — the whole page held to the doctrine again, its listing written, the
45
+ * draft reported — so the item ledger, the credits and Try again work exactly
46
+ * as they did.
47
+ */ /** The unit input that says a page or a layout is built in the layout language. */ export const AI_LAYOUT_LANGUAGE_INPUT = 'layoutLanguage';
48
+ /** The unit input naming the page of the site that places its form, where it is another page. */ export const AI_LAYOUT_FORM_PAGE_INPUT = 'layoutFormPage';
49
+ /** Whether this job builds its page or its layout in the layout language. */ export function aiJobUsesLayoutLanguage(job) {
50
+ var _job_inputs;
51
+ return ((_job_inputs = job.inputs) == null ? void 0 : _job_inputs[AI_LAYOUT_LANGUAGE_INPUT]) === true;
52
+ }
53
+ /**
54
+ * How the language doors think (AGL-3660): adaptively, at an effort named
55
+ * rather than left to the model's default. Zach, 2026-10-07: quality first —
56
+ * a page and a site's frame are designed, not transcribed, and the caching
57
+ * work pays for the thinking. Medium is where Claude Sonnet 5.5, the balanced
58
+ * default, is tuned to start for multistep design work.
59
+ */ export const AI_LAYOUT_LANGUAGE_THINKING = {
60
+ thinking: 'adaptive',
61
+ effort: 'medium'
62
+ };
63
+ /**
64
+ * Room for the thinking a page's answer does before it writes, inside the
65
+ * same `max_tokens` as the answer: thinking is drawn from the ceiling first,
66
+ * so a ceiling sized for the answer alone would cut a thoughtful answer off.
67
+ *
68
+ * Bounded by TIME, not by money: the page step's answer, its re-ask and the
69
+ * follow-up must fit the least time a beat gives a step
70
+ * (`AI_JOB_STEP_MAX_MINIMUM_MS`), and `aiJobStepBudget` quietly lowers every
71
+ * ceiling to what fits. 2,000 here, with the follow-up's 500, is the most
72
+ * that fits whole on the balanced tier; at 5,000 the budget cut a page's
73
+ * ceiling to 879 tokens, under the answer itself.
74
+ */ export const AI_LAYOUT_PAGE_THINKING_TOKENS = 2000;
75
+ /** The same room for a site's header and footer, whose step has the time for more. */ export const AI_LAYOUT_FRAME_THINKING_TOKENS = 4000;
76
+ /**
77
+ * The most one page's answer asks for: the answer and the thinking before it.
78
+ * A section in the language is about 120 to 250 tokens with its copy, so the
79
+ * largest page a plan admits — eight sections — fits in 3,000 with room (the
80
+ * live runs of 2026-10-07 wrote 683 to 1,745); the compiler, not the ceiling,
81
+ * keeps a page small.
82
+ */ export const AI_JOB_PAGE_LANGUAGE_TOKENS = 3000 + AI_LAYOUT_PAGE_THINKING_TOKENS;
83
+ /**
84
+ * The time a language page pass needs: its lookup rounds, its answer and its
85
+ * re-ask at `AI_JOB_PAGE_LANGUAGE_TOKENS` on the tier the page step is served
86
+ * from, with the step's reads and writes.
87
+ */ /** The most the follow-up asking only for the sections an answer left out may run to, its thinking included. */ export const AI_JOB_PAGE_LANGUAGE_FOLLOW_UP_TOKENS = 1500 + 500;
88
+ export const AI_JOB_PAGE_LANGUAGE_BUDGET = aiJobStepBudget({
89
+ tier: AI_STEP_TIERS['job.page'],
90
+ maxTokens: AI_JOB_PAGE_LANGUAGE_TOKENS,
91
+ // The follow-up for sections an answer left out is one more generation.
92
+ ownReadsMs: aiGenerationWorstCaseOnTierMs({
93
+ tier: AI_STEP_TIERS['job.page'],
94
+ maxTokens: AI_JOB_PAGE_LANGUAGE_FOLLOW_UP_TOKENS
95
+ })
96
+ });
97
+ /** The doctrine scope the language doors are told: values the compiler checks itself. */ export const AI_LAYOUT_PAGE_KIND = 'layout-page';
98
+ /** The language, as the page door's cached instructions. */ export const AI_JOB_PAGE_LANGUAGE_INSTRUCTIONS = [
99
+ {
100
+ text: [
101
+ AI_LAYOUT_LANGUAGE_TEXT,
102
+ '',
103
+ 'Answer with submit_page: the whole page, one entry in sections for each planned section, in order.'
104
+ ].join('\n'),
105
+ cacheBreakpoint: true
106
+ }
107
+ ];
108
+ /** The page of a site plan that places its form: the form the plan creates, or one the site has. */ export function aiLayoutFormPageOfPlan(plan, formIds = []) {
109
+ const created = new Set(plan.create.filter((entry)=>entry.kind === 'form').map((entry)=>`new:${entry.name}`.toLowerCase()));
110
+ const forms = new Set(formIds);
111
+ const screen = plan.screens.find((entry)=>entry.sections.some((section)=>section.uses.some((ref)=>isAiPlanNewRef(ref) ? created.has(ref.toLowerCase()) : forms.has(ref))));
112
+ return typeof (screen == null ? void 0 : screen.id) === 'string' ? screen.id : null;
113
+ }
114
+ /** Every word the job was given, which a page's contact details are held to. */ export function aiLayoutFacts(job) {
115
+ var _job_inputs;
116
+ const values = Object.values((_job_inputs = job.inputs) != null ? _job_inputs : {}).filter((value)=>typeof value === 'string');
117
+ return [
118
+ job.brief,
119
+ ...values
120
+ ].join('\n');
121
+ }
122
+ /** What a page's links resolve against: the site's pages, built and planned, its forms and components. */ export function aiLayoutPageTargets(input) {
123
+ var _ref, _own_, _ref1, _ref2;
124
+ var _job_inputs;
125
+ const { job, inventory } = input;
126
+ const own = input.own.filter((id)=>!!id);
127
+ const planned = aiLayoutSitePages(job.inputs);
128
+ const pages = [
129
+ ...planned,
130
+ ...((_ref = inventory == null ? void 0 : inventory.screens) != null ? _ref : []).filter((row)=>!row.template && !planned.some((page)=>page.id === row.id)).map((row)=>({
131
+ id: row.id,
132
+ label: row.name,
133
+ slug: row.slug
134
+ }))
135
+ ];
136
+ const formPage = (_job_inputs = job.inputs) == null ? void 0 : _job_inputs[AI_LAYOUT_FORM_PAGE_INPUT];
137
+ return {
138
+ pageId: (_own_ = own[0]) != null ? _own_ : null,
139
+ pages: pages.filter((page)=>!own.includes(page.id)),
140
+ homeIds: aiHomeScreenIds(inventory),
141
+ forms: ((_ref1 = inventory == null ? void 0 : inventory.forms) != null ? _ref1 : []).map((form)=>({
142
+ id: form.id,
143
+ name: form.name
144
+ })),
145
+ formPageId: typeof formPage === 'string' && !own.includes(formPage) ? formPage : null,
146
+ components: ((_ref2 = inventory == null ? void 0 : inventory.components) != null ? _ref2 : []).map((component)=>({
147
+ id: component.id,
148
+ name: component.name,
149
+ props: component.props
150
+ })),
151
+ facts: aiLayoutFacts(job)
152
+ };
153
+ }
154
+ /** The page's user turn: the page, the brief, the plan, its sections and where its links may go. */ export function aiLayoutPagePrompt(input) {
155
+ const { job, plan, screen, targets } = input;
156
+ const sections = screen.sections.map((section, index)=>{
157
+ const places = section.uses.length ? `; places ${section.uses.join(', ')}` : '';
158
+ const items = section.items ? `; shows ${section.items} items` : '';
159
+ return `${index + 1}. "${section.name}"${places}${items}`;
160
+ });
161
+ const pages = targets.pages.map((page)=>`${page.label} (page:${page.id})`);
162
+ const components = targets.components.map((component)=>`${component.name} (${component.id}; props ${Object.keys(component.props).join(', ') || 'none'})`);
163
+ return [
164
+ `Page: "${screen.title}" at ${screen.slug}`,
165
+ aiJobBriefLine(job),
166
+ // The kind of site the person picked sets how its pages are arranged (AGL-3660).
167
+ ...aiSiteKindDesignLines(job.inputs),
168
+ ...aiPlanReferenceLines(plan),
169
+ `Sections to design, in order:`,
170
+ ...sections,
171
+ pages.length ? `Other pages of this site: ${pages.join(', ')}.` : 'This site has no other page to link.',
172
+ targets.forms.length ? `The site's form: ${targets.forms.map((form)=>`${form.name} (${form.id})`).join(', ')}.` : 'The site has no saved form: place none.',
173
+ ...components.length ? [
174
+ `Components this page may place: ${components.join('; ')}.`
175
+ ] : [],
176
+ input.reusableComponents ? 'Where a section repeats an item, place the component its plan line names with cards whose to is that component.' : 'This site keeps no reusable components: draw repeated items as cards, steps, stats or a list.',
177
+ // A per-job word, so two identical briefs are designed apart.
178
+ `Design seed: ${job.$id.slice(-6)}.`
179
+ ].join('\n');
180
+ }
181
+ /**
182
+ * The follow-up turn for the sections a page's answer left out (AGL-3660):
183
+ * the page as before, told which sections it already has, and asked for only
184
+ * the missing ones, in order — the one part of a page asked for again.
185
+ */ export function aiLayoutMissingSectionsPrompt(input) {
186
+ const names = input.missing.map((index)=>`${index + 1}. "${input.screen.sections[index].name}"`);
187
+ return [
188
+ input.base,
189
+ '',
190
+ `The other sections of this page are already designed. Design ONLY these, in this order, one entry in sections each: ${names.join('; ')}. Give each at least one block.`
191
+ ].join('\n');
192
+ }
193
+ /** The plan indices a page still lacks, after the answers so far. */ export function aiLayoutMissingSections(kept) {
194
+ return kept.flatMap((section, index)=>section ? [] : [
195
+ index
196
+ ]);
197
+ }
198
+ /** The violation a planned section the answer gave nothing usable for is named by. */ export const AI_LAYOUT_SECTION_MISSING_CODE = 'layout-section-missing';
199
+ /** The code a section planned with items that shows none is refused under (AGL-3660). */ export const AI_LAYOUT_SECTION_EMPTY_CODE = 'layout-section-no-items';
200
+ /** How many of a section's planned items it must show: one for a short list, two for anything longer. */ const leastItems = (planned)=>planned >= 3 ? 2 : planned >= 1 ? 1 : 0;
201
+ /**
202
+ * How many repeated items each section shows once stored (AGL-3660): the
203
+ * elements the compiler drew for them, under the ids they are stored by,
204
+ * that are still in the page after anything later took words out.
205
+ */ export function aiLayoutShownItems(itemIds, storedIds, nodes) {
206
+ return itemIds.map((ids)=>ids.filter((id)=>storedIds[id] !== undefined && storedIds[id] in nodes).length);
207
+ }
208
+ /**
209
+ * The sections a page planned with repeated items — cards, steps, a list —
210
+ * that show none, or too few, once the page is built (AGL-3660). A heading
211
+ * and an intro over nothing is a section a visitor reads as broken, so it is
212
+ * asked for again.
213
+ */ export function aiLayoutEmptyItemSections(screen, items) {
214
+ return screen.sections.flatMap((section, index)=>{
215
+ var _items_index;
216
+ const least = leastItems(section.items);
217
+ if (!least) return [];
218
+ const shown = (_items_index = items[index]) != null ? _items_index : 0;
219
+ if (shown >= least) return [];
220
+ return [
221
+ {
222
+ rule: null,
223
+ code: AI_LAYOUT_SECTION_EMPTY_CODE,
224
+ message: `Section ${index + 1} ("${section.name}") is planned with ${section.items} items and shows ${shown || 'none'}.`,
225
+ detail: `Give section ${index + 1} one cards, steps, stats, list or faq block holding its ${section.items} items, each with a title and its words.`
226
+ }
227
+ ];
228
+ });
229
+ }
230
+ /**
231
+ * The check a language page answer is held to: each planned section read,
232
+ * the page compiled, stored and checked whole. Sections that read are kept
233
+ * across the re-ask, so the second answer is asked only for what was missing,
234
+ * and a section it sends again that already read is not taken twice.
235
+ */ export function aiLayoutPageCheck(input) {
236
+ var _input_kept, _input_only;
237
+ const kept = (_input_kept = input.kept) != null ? _input_kept : input.screen.sections.map(()=>null);
238
+ const fills = (_input_only = input.only) != null ? _input_only : input.screen.sections.map((_, index)=>index);
239
+ let answers = 0;
240
+ return (answer)=>{
241
+ // The last answer a generation takes has its gaps taken out rather than asked about again.
242
+ answers += 1;
243
+ const last = answers >= AI_GENERATION_MAX_ATTEMPTS;
244
+ const reading = aiReadLayoutPage(answer, fills.length, fills.map((index)=>input.screen.sections[index]));
245
+ reading.sections.forEach((section, position)=>{
246
+ // A section the answer gives is taken as given; one it leaves out keeps
247
+ // what an earlier answer gave, so a re-ask may send only what was missing.
248
+ if (section) kept[fills[position]] = section;
249
+ });
250
+ const missing = kept.flatMap((section, index)=>section ? [] : [
251
+ index
252
+ ]);
253
+ if (missing.length) {
254
+ const names = missing.map((index)=>`${index + 1} ("${input.screen.sections[index].name}")`);
255
+ return {
256
+ value: null,
257
+ violations: [
258
+ {
259
+ rule: null,
260
+ code: AI_LAYOUT_SECTION_MISSING_CODE,
261
+ message: `The page left out section ${names.join(', ')}.`,
262
+ detail: `Answer again with every section in order; the sections you already designed are kept, so only ${names.join(', ')} ${missing.length === 1 ? 'needs' : 'need'} its design. Give each at least one block.`
263
+ }
264
+ ]
265
+ };
266
+ }
267
+ const compiled = aiCompileLayoutPage(kept, {
268
+ title: input.screen.title,
269
+ sections: input.screen.sections
270
+ }, input.targets, {
271
+ reusableComponents: input.reusableComponents,
272
+ sectionIds: input.sectionIds
273
+ });
274
+ const stored = aiLayoutStoredTree(compiled.tree, 'screen', input.context, input.sectionIds);
275
+ if (stored.ok === false) {
276
+ // The compiler writes only palette trees, which the property spec holds;
277
+ // a refusal here is the platform's, and is reported as one.
278
+ console.error('ai layout page: a compiled page did not store', {
279
+ error: stored.error
280
+ });
281
+ return {
282
+ value: null,
283
+ violations: [
284
+ {
285
+ rule: null,
286
+ code: 'layout-compile',
287
+ message: 'This page could not be built. Try again.',
288
+ detail: stored.error
289
+ }
290
+ ]
291
+ };
292
+ }
293
+ // No gap and no internal reference in the words of a page that is published as built.
294
+ const copy = aiLayoutCopyCheck(stored.nodes, CANVAS_ROOT_ELEMENT_ID, {
295
+ pages: input.targets.pages,
296
+ ids: [
297
+ ...input.targets.pages.map((page)=>page.id),
298
+ ...input.targets.forms.map((form)=>form.id),
299
+ ...input.targets.components.map((component)=>component.id),
300
+ ...input.sectionIds,
301
+ ...input.targets.pageId ? [
302
+ input.targets.pageId
303
+ ] : []
304
+ ]
305
+ }, last);
306
+ const { nodes, dropped } = copy;
307
+ const report = validateAiDoctrineTree({
308
+ rootId: CANVAS_ROOT_ELEMENT_ID,
309
+ nodes
310
+ }, 'page', _extends({}, input.context, {
311
+ scrollTargetIds: input.sectionIds
312
+ }));
313
+ // Each section's items as they are stored, after anything the gaps took out.
314
+ const items = aiLayoutShownItems(compiled.itemIds, stored.storedIds, nodes);
315
+ // A street address or opening hours the job was never given is invented
316
+ // (rule 14, AGL-3596), the same check a layout is held to; a phone number
317
+ // or an email the compiler already writes as its gap.
318
+ const violations = [
319
+ ...report.violations,
320
+ ...copy.violations,
321
+ ...aiLayoutEmptyItemSections(input.screen, items),
322
+ ...aiLayoutInventedContactViolations({
323
+ rootId: CANVAS_ROOT_ELEMENT_ID,
324
+ nodes: nodes
325
+ }, input.targets.facts)
326
+ ];
327
+ return {
328
+ value: violations.length ? null : {
329
+ nodes,
330
+ load: report.load,
331
+ settled: [
332
+ ...reading.settled,
333
+ ...compiled.settled
334
+ ],
335
+ dropped,
336
+ items
337
+ },
338
+ violations
339
+ };
340
+ };
341
+ }
342
+ /** Two generations' spend as one: every call is billed. */ function spentTogether(first, second) {
343
+ const usage = {
344
+ inputTokens: first.usage.inputTokens + second.usage.inputTokens,
345
+ outputTokens: first.usage.outputTokens + second.usage.outputTokens,
346
+ cacheReadTokens: first.usage.cacheReadTokens + second.usage.cacheReadTokens,
347
+ cacheWriteTokens: first.usage.cacheWriteTokens + second.usage.cacheWriteTokens
348
+ };
349
+ return {
350
+ attempts: first.attempts + second.attempts,
351
+ usage,
352
+ estCostUsd: Math.round((first.estCostUsd + second.estCostUsd) * 1000000) / 1000000,
353
+ model: second.model,
354
+ stopReason: second.stopReason,
355
+ effort: second.effort
356
+ };
357
+ }
358
+ /**
359
+ * A whole page in the layout language: one answer for every section, and,
360
+ * where that answer and its re-ask still left a section out, one follow-up
361
+ * asking for only those (AGL-3660). The sections that read are kept between
362
+ * them, so the page is compiled whole once every section is designed.
363
+ */ export async function aiRunLayoutPage(input) {
364
+ var _input_observe;
365
+ const kept = input.screen.sections.map(()=>null);
366
+ const observe = (_input_observe = input.observe) != null ? _input_observe : (check)=>check;
367
+ const base = aiLayoutPagePrompt({
368
+ job: input.job,
369
+ plan: input.plan,
370
+ screen: input.screen,
371
+ targets: input.targets,
372
+ reusableComponents: input.reusableComponents
373
+ });
374
+ const ask = (content, maxTokens, only)=>runValidatedGeneration(AI_LAYOUT_PAGE_KIND, _extends({
375
+ step: 'job.page',
376
+ model: input.model,
377
+ instructions: AI_JOB_PAGE_LANGUAGE_INSTRUCTIONS,
378
+ inventory: input.inventory,
379
+ messages: [
380
+ {
381
+ role: 'user',
382
+ content
383
+ }
384
+ ],
385
+ tool: AI_LAYOUT_PAGE_TOOL,
386
+ maxTokens,
387
+ cutOff: {
388
+ noun: 'page',
389
+ smaller: 'Write shorter copy, and fewer items in each group.'
390
+ }
391
+ }, AI_LAYOUT_LANGUAGE_THINKING, {
392
+ check: observe(aiLayoutPageCheck(_extends({
393
+ screen: input.screen,
394
+ sectionIds: input.sectionIds,
395
+ targets: input.targets,
396
+ context: input.context,
397
+ reusableComponents: input.reusableComponents,
398
+ kept
399
+ }, only ? {
400
+ only
401
+ } : {})))
402
+ }, input.signal ? {
403
+ signal: input.signal
404
+ } : {}));
405
+ const first = await ask(base, AI_JOB_PAGE_LANGUAGE_BUDGET.maxTokens(input.model));
406
+ const missing = aiLayoutMissingSections(kept);
407
+ if (first.status !== 'needs_input' || !missing.length || !first.violations.every((violation)=>violation.code === AI_LAYOUT_SECTION_MISSING_CODE)) {
408
+ return first;
409
+ }
410
+ const second = await ask(aiLayoutMissingSectionsPrompt({
411
+ base,
412
+ screen: input.screen,
413
+ missing
414
+ }), Math.min(AI_JOB_PAGE_LANGUAGE_FOLLOW_UP_TOKENS, AI_JOB_PAGE_LANGUAGE_BUDGET.maxTokens(input.model)), missing);
415
+ return _extends({}, second, spentTogether(first, second));
416
+ }
417
+
418
+ //# sourceMappingURL=ai-job-page-language.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/jobs/ai-job-page-language.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 { CANVAS_ROOT_ELEMENT_ID } from '@aglyn/aglyn/foundation/constants/canvas'\nimport type { NodesMap } from '@aglyn/aglyn/types/nodes'\nimport { isAiPlanNewRef, type AiBuildPlanScreen } from '../model/ai-build-plan'\nimport type { AiJob, AiJobPlan } from '../model/ai-jobs.types'\nimport {\n aiHomeScreenIds,\n type AiSiteInventory,\n} from '../model/ai-site-inventory'\nimport { aiCompileLayoutPage } from '../layout-language/ai-layout-compiler'\nimport {\n AI_LAYOUT_LANGUAGE_TEXT,\n AI_LAYOUT_PAGE_TOOL,\n aiReadLayoutPage,\n type AiLayoutSection,\n type AiLayoutSettlement,\n} from '../layout-language/ai-layout-language'\nimport type {\n AiLayoutPage,\n AiLayoutTargets,\n} from '../layout-language/ai-layout-links'\nimport { aiLayoutCopyCheck } from '../layout-language/ai-layout-gaps'\nimport { aiLayoutStoredTree } from '../layout-language/ai-layout-store'\nimport { AI_GENERATION_MAX_ATTEMPTS } from '../runtime/ai-generation-bounds'\nimport { AI_STEP_TIERS } from '../providers/catalog'\nimport {\n runValidatedGeneration,\n type AiGenerationCheck,\n type AiGenerationSpend,\n type AiValidatedGeneration,\n} from '../runtime/ai-doctrine'\nimport type { AiUsage } from '../providers/contract'\nimport {\n validateAiDoctrineTree,\n type AiDoctrineNode,\n type AiDoctrineTreeContext,\n type AiDoctrineViolation,\n} from '../runtime/ai-doctrine-validators'\nimport type { AiLoadEstimate } from '../runtime/ai-palette'\nimport { aiSiteKindDesignLines } from '../model/ai-site-kinds'\nimport type { AiSystemBlock } from '../runtime/ai-runtime'\nimport { aiGenerationWorstCaseOnTierMs, aiJobStepBudget } from './ai-job-budget'\nimport { aiJobBriefLine, aiPlanReferenceLines } from './ai-job-generation'\nimport { aiLayoutSitePages } from './ai-job-layout-site-pages'\nimport { aiLayoutInventedContactViolations } from './ai-layout-site-facts'\n\n/**\n * A page built in the compact layout language (AGL-3660): the page step's\n * pass for a site's page units — a guided start's and a build's — in place of\n * the raw-tree section passes.\n *\n * ONE answer a page: every planned section, in the language, through\n * `submit_page`. The compiler writes the tree, the palette validator stores\n * it as it stores any generated tree, and the doctrine checks the whole page.\n * A section the answer left out or left empty is the one thing a re-ask asks\n * for: the sections that read are kept, and the second answer fills only\n * what is still missing. Then the page step's last pass runs as it always\n * has — the whole page held to the doctrine again, its listing written, the\n * draft reported — so the item ledger, the credits and Try again work exactly\n * as they did.\n */\n\n/** The unit input that says a page or a layout is built in the layout language. */\nexport const AI_LAYOUT_LANGUAGE_INPUT = 'layoutLanguage'\n\n/** The unit input naming the page of the site that places its form, where it is another page. */\nexport const AI_LAYOUT_FORM_PAGE_INPUT = 'layoutFormPage'\n\n/** Whether this job builds its page or its layout in the layout language. */\nexport function aiJobUsesLayoutLanguage(job: Pick<AiJob, 'inputs'>): boolean {\n return job.inputs?.[AI_LAYOUT_LANGUAGE_INPUT] === true\n}\n\n/**\n * How the language doors think (AGL-3660): adaptively, at an effort named\n * rather than left to the model's default. Zach, 2026-10-07: quality first —\n * a page and a site's frame are designed, not transcribed, and the caching\n * work pays for the thinking. Medium is where Claude Sonnet 5.5, the balanced\n * default, is tuned to start for multistep design work.\n */\nexport const AI_LAYOUT_LANGUAGE_THINKING = { thinking: 'adaptive', effort: 'medium' } as const\n\n/**\n * Room for the thinking a page's answer does before it writes, inside the\n * same `max_tokens` as the answer: thinking is drawn from the ceiling first,\n * so a ceiling sized for the answer alone would cut a thoughtful answer off.\n *\n * Bounded by TIME, not by money: the page step's answer, its re-ask and the\n * follow-up must fit the least time a beat gives a step\n * (`AI_JOB_STEP_MAX_MINIMUM_MS`), and `aiJobStepBudget` quietly lowers every\n * ceiling to what fits. 2,000 here, with the follow-up's 500, is the most\n * that fits whole on the balanced tier; at 5,000 the budget cut a page's\n * ceiling to 879 tokens, under the answer itself.\n */\nexport const AI_LAYOUT_PAGE_THINKING_TOKENS = 2_000\n\n/** The same room for a site's header and footer, whose step has the time for more. */\nexport const AI_LAYOUT_FRAME_THINKING_TOKENS = 4_000\n\n/**\n * The most one page's answer asks for: the answer and the thinking before it.\n * A section in the language is about 120 to 250 tokens with its copy, so the\n * largest page a plan admits — eight sections — fits in 3,000 with room (the\n * live runs of 2026-10-07 wrote 683 to 1,745); the compiler, not the ceiling,\n * keeps a page small.\n */\nexport const AI_JOB_PAGE_LANGUAGE_TOKENS = 3_000 + AI_LAYOUT_PAGE_THINKING_TOKENS\n\n/**\n * The time a language page pass needs: its lookup rounds, its answer and its\n * re-ask at `AI_JOB_PAGE_LANGUAGE_TOKENS` on the tier the page step is served\n * from, with the step's reads and writes.\n */\n/** The most the follow-up asking only for the sections an answer left out may run to, its thinking included. */\nexport const AI_JOB_PAGE_LANGUAGE_FOLLOW_UP_TOKENS = 1_500 + 500\n\nexport const AI_JOB_PAGE_LANGUAGE_BUDGET = aiJobStepBudget({\n tier: AI_STEP_TIERS['job.page'],\n maxTokens: AI_JOB_PAGE_LANGUAGE_TOKENS,\n // The follow-up for sections an answer left out is one more generation.\n ownReadsMs: aiGenerationWorstCaseOnTierMs({\n tier: AI_STEP_TIERS['job.page'],\n maxTokens: AI_JOB_PAGE_LANGUAGE_FOLLOW_UP_TOKENS,\n }),\n})\n\n/** The doctrine scope the language doors are told: values the compiler checks itself. */\nexport const AI_LAYOUT_PAGE_KIND = 'layout-page'\n\n/** The language, as the page door's cached instructions. */\nexport const AI_JOB_PAGE_LANGUAGE_INSTRUCTIONS: readonly AiSystemBlock[] = [\n {\n text: [\n AI_LAYOUT_LANGUAGE_TEXT,\n '',\n 'Answer with submit_page: the whole page, one entry in sections for each planned section, in order.',\n ].join('\\n'),\n cacheBreakpoint: true,\n },\n]\n\n/** The page of a site plan that places its form: the form the plan creates, or one the site has. */\nexport function aiLayoutFormPageOfPlan(\n plan: Pick<AiJobPlan, 'create' | 'screens'>,\n formIds: readonly string[] = [],\n): string | null {\n const created = new Set(\n plan.create\n .filter((entry) => entry.kind === 'form')\n .map((entry) => `new:${entry.name}`.toLowerCase()),\n )\n const forms = new Set(formIds)\n const screen = plan.screens.find((entry) =>\n entry.sections.some((section) =>\n section.uses.some((ref) =>\n isAiPlanNewRef(ref) ? created.has(ref.toLowerCase()) : forms.has(ref),\n ),\n ),\n )\n return typeof screen?.id === 'string' ? screen.id : null\n}\n\n/** Every word the job was given, which a page's contact details are held to. */\nexport function aiLayoutFacts(job: Pick<AiJob, 'brief' | 'inputs'>): string {\n const values = Object.values(job.inputs ?? {}).filter(\n (value): value is string => typeof value === 'string',\n )\n return [job.brief, ...values].join('\\n')\n}\n\n/** What a page's links resolve against: the site's pages, built and planned, its forms and components. */\nexport function aiLayoutPageTargets(input: {\n job: Pick<AiJob, 'brief' | 'inputs'>\n inventory: AiSiteInventory | null\n own: ReadonlyArray<string | null | undefined>\n}): AiLayoutTargets {\n const { job, inventory } = input\n const own = input.own.filter((id): id is string => !!id)\n const planned = aiLayoutSitePages(job.inputs)\n const pages: AiLayoutPage[] = [\n ...planned,\n ...(inventory?.screens ?? [])\n .filter(\n (row) => !row.template && !planned.some((page) => page.id === row.id),\n )\n .map((row) => ({ id: row.id, label: row.name, slug: row.slug })),\n ]\n const formPage = job.inputs?.[AI_LAYOUT_FORM_PAGE_INPUT]\n return {\n pageId: own[0] ?? null,\n pages: pages.filter((page) => !own.includes(page.id)),\n homeIds: aiHomeScreenIds(inventory),\n forms: (inventory?.forms ?? []).map((form) => ({\n id: form.id,\n name: form.name,\n })),\n formPageId:\n typeof formPage === 'string' && !own.includes(formPage) ? formPage : null,\n components: (inventory?.components ?? []).map((component) => ({\n id: component.id,\n name: component.name,\n props: component.props,\n })),\n facts: aiLayoutFacts(job),\n }\n}\n\n/** The page's user turn: the page, the brief, the plan, its sections and where its links may go. */\nexport function aiLayoutPagePrompt(input: {\n job: Pick<AiJob, 'brief' | 'inputs' | '$id'>\n plan: AiJobPlan\n screen: AiBuildPlanScreen\n targets: AiLayoutTargets\n reusableComponents: boolean\n /** The sections a re-ask still needs, by plan index; absent on the first ask. */\n missing?: readonly number[]\n}): string {\n const { job, plan, screen, targets } = input\n const sections = screen.sections.map((section, index) => {\n const places = section.uses.length\n ? `; places ${section.uses.join(', ')}`\n : ''\n const items = section.items ? `; shows ${section.items} items` : ''\n return `${index + 1}. \"${section.name}\"${places}${items}`\n })\n const pages = targets.pages.map((page) => `${page.label} (page:${page.id})`)\n const components = targets.components.map(\n (component) =>\n `${component.name} (${component.id}; props ${Object.keys(component.props).join(', ') || 'none'})`,\n )\n return [\n `Page: \"${screen.title}\" at ${screen.slug}`,\n aiJobBriefLine(job),\n // The kind of site the person picked sets how its pages are arranged (AGL-3660).\n ...aiSiteKindDesignLines(job.inputs),\n ...aiPlanReferenceLines(plan),\n `Sections to design, in order:`,\n ...sections,\n pages.length\n ? `Other pages of this site: ${pages.join(', ')}.`\n : 'This site has no other page to link.',\n targets.forms.length\n ? `The site's form: ${targets.forms.map((form) => `${form.name} (${form.id})`).join(', ')}.`\n : 'The site has no saved form: place none.',\n ...(components.length\n ? [`Components this page may place: ${components.join('; ')}.`]\n : []),\n input.reusableComponents\n ? 'Where a section repeats an item, place the component its plan line names with cards whose to is that component.'\n : 'This site keeps no reusable components: draw repeated items as cards, steps, stats or a list.',\n // A per-job word, so two identical briefs are designed apart.\n `Design seed: ${job.$id.slice(-6)}.`,\n ].join('\\n')\n}\n\n/** A validated language page, stored as the page keeps it. */\nexport interface AiLayoutPageBuilt {\n nodes: NodesMap\n load: AiLoadEstimate | null\n settled: AiLayoutSettlement[]\n /** What the last answer's gaps took out of the page (`ai-layout-gaps.ts`). */\n dropped: string[]\n /** How many repeated items each plan section shows, as built (AGL-3660). */\n items: number[]\n}\n\nexport interface AiLayoutPageCheckInput {\n screen: AiBuildPlanScreen\n sectionIds: readonly string[]\n targets: AiLayoutTargets\n context: AiDoctrineTreeContext\n reusableComponents: boolean\n /**\n * What earlier answers gave, by plan index, shared between the page's\n * generations: a follow-up asking only for missing sections fills the rest.\n */\n kept?: Array<AiLayoutSection | null>\n /** The plan indices this answer's sections fill, in order; absent, every section. */\n only?: readonly number[]\n}\n\n/**\n * The follow-up turn for the sections a page's answer left out (AGL-3660):\n * the page as before, told which sections it already has, and asked for only\n * the missing ones, in order — the one part of a page asked for again.\n */\nexport function aiLayoutMissingSectionsPrompt(input: {\n base: string\n screen: AiBuildPlanScreen\n missing: readonly number[]\n}): string {\n const names = input.missing.map((index) => `${index + 1}. \"${input.screen.sections[index].name}\"`)\n return [\n input.base,\n '',\n `The other sections of this page are already designed. Design ONLY these, in this order, one entry in sections each: ${names.join('; ')}. Give each at least one block.`,\n ].join('\\n')\n}\n\n/** The plan indices a page still lacks, after the answers so far. */\nexport function aiLayoutMissingSections(kept: ReadonlyArray<AiLayoutSection | null>): number[] {\n return kept.flatMap((section, index) => (section ? [] : [index]))\n}\n\n/** The violation a planned section the answer gave nothing usable for is named by. */\nexport const AI_LAYOUT_SECTION_MISSING_CODE = 'layout-section-missing'\n\n/** The code a section planned with items that shows none is refused under (AGL-3660). */\nexport const AI_LAYOUT_SECTION_EMPTY_CODE = 'layout-section-no-items'\n\n/** How many of a section's planned items it must show: one for a short list, two for anything longer. */\nconst leastItems = (planned: number) => (planned >= 3 ? 2 : planned >= 1 ? 1 : 0)\n\n/**\n * How many repeated items each section shows once stored (AGL-3660): the\n * elements the compiler drew for them, under the ids they are stored by,\n * that are still in the page after anything later took words out.\n */\nexport function aiLayoutShownItems(\n itemIds: readonly (readonly string[])[],\n storedIds: Readonly<Record<string, string>>,\n nodes: Readonly<Record<string, unknown>>,\n): number[] {\n return itemIds.map((ids) => ids.filter((id) => storedIds[id] !== undefined && storedIds[id] in nodes).length)\n}\n\n/**\n * The sections a page planned with repeated items — cards, steps, a list —\n * that show none, or too few, once the page is built (AGL-3660). A heading\n * and an intro over nothing is a section a visitor reads as broken, so it is\n * asked for again.\n */\nexport function aiLayoutEmptyItemSections(\n screen: Pick<AiBuildPlanScreen, 'sections'>,\n items: readonly number[],\n): AiDoctrineViolation[] {\n return screen.sections.flatMap((section, index): AiDoctrineViolation[] => {\n const least = leastItems(section.items)\n if (!least) return []\n const shown = items[index] ?? 0\n if (shown >= least) return []\n return [\n {\n rule: null,\n code: AI_LAYOUT_SECTION_EMPTY_CODE,\n message: `Section ${index + 1} (\"${section.name}\") is planned with ${section.items} items and shows ${shown || 'none'}.`,\n detail: `Give section ${index + 1} one cards, steps, stats, list or faq block holding its ${section.items} items, each with a title and its words.`,\n },\n ]\n })\n}\n\n/**\n * The check a language page answer is held to: each planned section read,\n * the page compiled, stored and checked whole. Sections that read are kept\n * across the re-ask, so the second answer is asked only for what was missing,\n * and a section it sends again that already read is not taken twice.\n */\nexport function aiLayoutPageCheck(\n input: AiLayoutPageCheckInput,\n): AiGenerationCheck<AiLayoutPageBuilt> {\n const kept: Array<AiLayoutSection | null> = input.kept ?? input.screen.sections.map(() => null)\n const fills = input.only ?? input.screen.sections.map((_, index) => index)\n let answers = 0\n return (answer) => {\n // The last answer a generation takes has its gaps taken out rather than asked about again.\n answers += 1\n const last = answers >= AI_GENERATION_MAX_ATTEMPTS\n const reading = aiReadLayoutPage(\n answer,\n fills.length,\n fills.map((index) => input.screen.sections[index]),\n )\n reading.sections.forEach((section, position) => {\n // A section the answer gives is taken as given; one it leaves out keeps\n // what an earlier answer gave, so a re-ask may send only what was missing.\n if (section) kept[fills[position]] = section\n })\n const missing = kept.flatMap((section, index) => (section ? [] : [index]))\n if (missing.length) {\n const names = missing.map(\n (index) => `${index + 1} (\"${input.screen.sections[index].name}\")`,\n )\n return {\n value: null,\n violations: [\n {\n rule: null,\n code: AI_LAYOUT_SECTION_MISSING_CODE,\n message: `The page left out section ${names.join(', ')}.`,\n detail: `Answer again with every section in order; the sections you already designed are kept, so only ${names.join(', ')} ${missing.length === 1 ? 'needs' : 'need'} its design. Give each at least one block.`,\n },\n ],\n }\n }\n const compiled = aiCompileLayoutPage(\n kept as AiLayoutSection[],\n { title: input.screen.title, sections: input.screen.sections },\n input.targets,\n {\n reusableComponents: input.reusableComponents,\n sectionIds: input.sectionIds,\n },\n )\n const stored = aiLayoutStoredTree(\n compiled.tree,\n 'screen',\n input.context,\n input.sectionIds,\n )\n if (stored.ok === false) {\n // The compiler writes only palette trees, which the property spec holds;\n // a refusal here is the platform's, and is reported as one.\n console.error('ai layout page: a compiled page did not store', {\n error: stored.error,\n })\n return {\n value: null,\n violations: [\n {\n rule: null,\n code: 'layout-compile',\n message: 'This page could not be built. Try again.',\n detail: stored.error,\n },\n ],\n }\n }\n // No gap and no internal reference in the words of a page that is published as built.\n const copy = aiLayoutCopyCheck(\n stored.nodes,\n CANVAS_ROOT_ELEMENT_ID,\n {\n pages: input.targets.pages,\n ids: [\n ...input.targets.pages.map((page) => page.id),\n ...input.targets.forms.map((form) => form.id),\n ...input.targets.components.map((component) => component.id),\n ...input.sectionIds,\n ...(input.targets.pageId ? [input.targets.pageId] : []),\n ],\n },\n last,\n )\n const { nodes, dropped } = copy\n const report = validateAiDoctrineTree(\n { rootId: CANVAS_ROOT_ELEMENT_ID, nodes },\n 'page',\n {\n ...input.context,\n scrollTargetIds: input.sectionIds,\n },\n )\n // Each section's items as they are stored, after anything the gaps took out.\n const items = aiLayoutShownItems(compiled.itemIds, stored.storedIds, nodes as unknown as Record<string, unknown>)\n // A street address or opening hours the job was never given is invented\n // (rule 14, AGL-3596), the same check a layout is held to; a phone number\n // or an email the compiler already writes as its gap.\n const violations: AiDoctrineViolation[] = [\n ...report.violations,\n ...copy.violations,\n ...aiLayoutEmptyItemSections(input.screen, items),\n ...aiLayoutInventedContactViolations(\n { rootId: CANVAS_ROOT_ELEMENT_ID, nodes: nodes as unknown as Record<string, AiDoctrineNode> },\n input.targets.facts,\n ),\n ]\n return {\n value: violations.length\n ? null\n : {\n nodes,\n load: report.load,\n settled: [...reading.settled, ...compiled.settled],\n dropped,\n items,\n },\n violations,\n }\n }\n}\n\nexport interface AiLayoutPageRunInput {\n job: Pick<AiJob, 'brief' | 'inputs' | '$id'>\n plan: AiJobPlan\n screen: AiBuildPlanScreen\n sectionIds: readonly string[]\n targets: AiLayoutTargets\n context: AiDoctrineTreeContext\n reusableComponents: boolean\n inventory: AiSiteInventory | null\n model: string\n signal?: AbortSignal\n /** Wraps the check, for an eval that records each answer it reads. */\n observe?: (check: AiGenerationCheck<AiLayoutPageBuilt>) => AiGenerationCheck<AiLayoutPageBuilt>\n}\n\n/** Two generations' spend as one: every call is billed. */\nfunction spentTogether(first: AiGenerationSpend, second: AiGenerationSpend): AiGenerationSpend {\n const usage: AiUsage = {\n inputTokens: first.usage.inputTokens + second.usage.inputTokens,\n outputTokens: first.usage.outputTokens + second.usage.outputTokens,\n cacheReadTokens: first.usage.cacheReadTokens + second.usage.cacheReadTokens,\n cacheWriteTokens: first.usage.cacheWriteTokens + second.usage.cacheWriteTokens,\n }\n return {\n attempts: first.attempts + second.attempts,\n usage,\n estCostUsd: Math.round((first.estCostUsd + second.estCostUsd) * 1_000_000) / 1_000_000,\n model: second.model,\n stopReason: second.stopReason,\n effort: second.effort,\n }\n}\n\n/**\n * A whole page in the layout language: one answer for every section, and,\n * where that answer and its re-ask still left a section out, one follow-up\n * asking for only those (AGL-3660). The sections that read are kept between\n * them, so the page is compiled whole once every section is designed.\n */\nexport async function aiRunLayoutPage(input: AiLayoutPageRunInput): Promise<AiValidatedGeneration<AiLayoutPageBuilt>> {\n const kept: Array<AiLayoutSection | null> = input.screen.sections.map(() => null)\n const observe = input.observe ?? ((check) => check)\n const base = aiLayoutPagePrompt({\n job: input.job,\n plan: input.plan,\n screen: input.screen,\n targets: input.targets,\n reusableComponents: input.reusableComponents,\n })\n const ask = (content: string, maxTokens: number, only?: readonly number[]) =>\n runValidatedGeneration<AiLayoutPageBuilt>(AI_LAYOUT_PAGE_KIND, {\n step: 'job.page',\n model: input.model,\n instructions: AI_JOB_PAGE_LANGUAGE_INSTRUCTIONS,\n inventory: input.inventory,\n messages: [{ role: 'user', content }],\n tool: AI_LAYOUT_PAGE_TOOL,\n maxTokens,\n cutOff: { noun: 'page', smaller: 'Write shorter copy, and fewer items in each group.' },\n ...AI_LAYOUT_LANGUAGE_THINKING,\n check: observe(\n aiLayoutPageCheck({\n screen: input.screen,\n sectionIds: input.sectionIds,\n targets: input.targets,\n context: input.context,\n reusableComponents: input.reusableComponents,\n kept,\n ...(only ? { only } : {}),\n }),\n ),\n ...(input.signal ? { signal: input.signal } : {}),\n })\n const first = await ask(base, AI_JOB_PAGE_LANGUAGE_BUDGET.maxTokens(input.model))\n const missing = aiLayoutMissingSections(kept)\n if (\n first.status !== 'needs_input' ||\n !missing.length ||\n !first.violations.every((violation) => violation.code === AI_LAYOUT_SECTION_MISSING_CODE)\n ) {\n return first\n }\n const second = await ask(\n aiLayoutMissingSectionsPrompt({ base, screen: input.screen, missing }),\n Math.min(AI_JOB_PAGE_LANGUAGE_FOLLOW_UP_TOKENS, AI_JOB_PAGE_LANGUAGE_BUDGET.maxTokens(input.model)),\n missing,\n )\n return { ...second, ...spentTogether(first, second) }\n}\n"],"names":["CANVAS_ROOT_ELEMENT_ID","isAiPlanNewRef","aiHomeScreenIds","aiCompileLayoutPage","AI_LAYOUT_LANGUAGE_TEXT","AI_LAYOUT_PAGE_TOOL","aiReadLayoutPage","aiLayoutCopyCheck","aiLayoutStoredTree","AI_GENERATION_MAX_ATTEMPTS","AI_STEP_TIERS","runValidatedGeneration","validateAiDoctrineTree","aiSiteKindDesignLines","aiGenerationWorstCaseOnTierMs","aiJobStepBudget","aiJobBriefLine","aiPlanReferenceLines","aiLayoutSitePages","aiLayoutInventedContactViolations","AI_LAYOUT_LANGUAGE_INPUT","AI_LAYOUT_FORM_PAGE_INPUT","aiJobUsesLayoutLanguage","job","inputs","AI_LAYOUT_LANGUAGE_THINKING","thinking","effort","AI_LAYOUT_PAGE_THINKING_TOKENS","AI_LAYOUT_FRAME_THINKING_TOKENS","AI_JOB_PAGE_LANGUAGE_TOKENS","AI_JOB_PAGE_LANGUAGE_FOLLOW_UP_TOKENS","AI_JOB_PAGE_LANGUAGE_BUDGET","tier","maxTokens","ownReadsMs","AI_LAYOUT_PAGE_KIND","AI_JOB_PAGE_LANGUAGE_INSTRUCTIONS","text","join","cacheBreakpoint","aiLayoutFormPageOfPlan","plan","formIds","created","Set","create","filter","entry","kind","map","name","toLowerCase","forms","screen","screens","find","sections","some","section","uses","ref","has","id","aiLayoutFacts","values","Object","value","brief","aiLayoutPageTargets","input","own","inventory","planned","pages","row","template","page","label","slug","formPage","pageId","includes","homeIds","form","formPageId","components","component","props","facts","aiLayoutPagePrompt","targets","index","places","length","items","keys","title","reusableComponents","$id","slice","aiLayoutMissingSectionsPrompt","names","missing","base","aiLayoutMissingSections","kept","flatMap","AI_LAYOUT_SECTION_MISSING_CODE","AI_LAYOUT_SECTION_EMPTY_CODE","leastItems","aiLayoutShownItems","itemIds","storedIds","nodes","ids","undefined","aiLayoutEmptyItemSections","least","shown","rule","code","message","detail","aiLayoutPageCheck","fills","only","_","answers","answer","last","reading","forEach","position","violations","compiled","sectionIds","stored","tree","context","ok","console","error","copy","dropped","report","rootId","scrollTargetIds","load","settled","spentTogether","first","second","usage","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","attempts","estCostUsd","Math","round","model","stopReason","aiRunLayoutPage","observe","check","ask","content","step","instructions","messages","role","tool","cutOff","noun","smaller","signal","status","every","violation","min"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,sBAAsB,QAAQ,2CAA0C;AAEjF,SAASC,cAAc,QAAgC,4BAAwB;AAE/E,SACEC,eAAe,QAEV,gCAA4B;AACnC,SAASC,mBAAmB,QAAQ,2CAAuC;AAC3E,SACEC,uBAAuB,EACvBC,mBAAmB,EACnBC,gBAAgB,QAGX,2CAAuC;AAK9C,SAASC,iBAAiB,QAAQ,uCAAmC;AACrE,SAASC,kBAAkB,QAAQ,wCAAoC;AACvE,SAASC,0BAA0B,QAAQ,qCAAiC;AAC5E,SAASC,aAAa,QAAQ,0BAAsB;AACpD,SACEC,sBAAsB,QAIjB,4BAAwB;AAE/B,SACEC,sBAAsB,QAIjB,uCAAmC;AAE1C,SAASC,qBAAqB,QAAQ,4BAAwB;AAE9D,SAASC,6BAA6B,EAAEC,eAAe,QAAQ,qBAAiB;AAChF,SA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OD,QACLzC,kBAAkB;gBAChBtE,QAAQgB,MAAMhB,MAAM;gBACpBkF,YAAYlE,MAAMkE,UAAU;gBAC5B7C,SAASrB,MAAMqB,OAAO;gBACtBgD,SAASrE,MAAMqE,OAAO;gBACtBzC,oBAAoB5B,MAAM4B,kBAAkB;gBAC5CQ;eACIoB,OAAO;gBAAEA;YAAK,IAAI,CAAC;WAGvBxD,MAAM2G,MAAM,GAAG;YAAEA,QAAQ3G,MAAM2G,MAAM;QAAC,IAAI,CAAC;IAEnD,MAAM1B,QAAQ,MAAMgB,IAAI/D,MAAMxE,4BAA4BE,SAAS,CAACoC,MAAM4F,KAAK;IAC/E,MAAM3D,UAAUE,wBAAwBC;IACxC,IACE6C,MAAM2B,MAAM,KAAK,iBACjB,CAAC3E,QAAQT,MAAM,IACf,CAACyD,MAAMjB,UAAU,CAAC6C,KAAK,CAAC,CAACC,YAAcA,UAAU3D,IAAI,KAAKb,iCAC1D;QACA,OAAO2C;IACT;IACA,MAAMC,SAAS,MAAMe,IACnBlE,8BAA8B;QAAEG;QAAMlD,QAAQgB,MAAMhB,MAAM;QAAEiD;IAAQ,IACpEyD,KAAKqB,GAAG,CAACtJ,uCAAuCC,4BAA4BE,SAAS,CAACoC,MAAM4F,KAAK,IACjG3D;IAEF,OAAO,aAAKiD,QAAWF,cAAcC,OAAOC;AAC9C"}
@@ -103,7 +103,34 @@ export interface AiPageSectionPromptInput {
103
103
  reusableComponents?: boolean;
104
104
  /** The dataset this page is the record template of; absent for a page that is one page. */
105
105
  record?: AiPageRecordTemplate | null;
106
+ /**
107
+ * The site's other pages a link may go to by id (AGL-3596): a guided
108
+ * start's pages are minted on its plan before any is built, so the Home
109
+ * page is built before the Contact page its buttons go to exists.
110
+ */
111
+ linkablePages?: readonly AiLinkablePage[];
106
112
  }
113
+ /** A page of the site a section may link by its id, built or still to come. */
114
+ export interface AiLinkablePage {
115
+ id: string;
116
+ label: string;
117
+ slug: string;
118
+ }
119
+ /**
120
+ * The pages a section may link by id beyond the ones the site has built, and
121
+ * the one page a link that names no destination can only mean (AGL-3596).
122
+ * `planned` are a guided start's pages, minted on its plan (the input the
123
+ * layout reads them from); `own` are this page's ids, which neither counts.
124
+ * The link target is the site's one page that is neither its home nor this
125
+ * page, where it has exactly one, built or planned: a two-page guided start's
126
+ * Contact page, which its Home hero's "Book an appointment" goes to.
127
+ */
128
+ export declare function aiPageLinkablePages(inventory: AiSiteInventory | null, planned: readonly AiLinkablePage[], own: ReadonlyArray<string | null | undefined>): {
129
+ linkablePages: AiLinkablePage[];
130
+ linkTarget: string | null;
131
+ };
132
+ /** The line a section request names the site's other pages in. */
133
+ export declare function aiPageSectionLinkablePagesLine(pages: readonly AiLinkablePage[]): string | null;
107
134
  /** What a section request says where the workspace keeps no reusable components. */
108
135
  export declare const AI_PAGE_SECTION_INLINE_LINE = "This site keeps no reusable components: write a repeated item once.";
109
136
  /**
@@ -207,6 +234,8 @@ export declare function aiPageCheckContext(inventory: AiSiteInventory | null, op
207
234
  embeds?: AiDoctrineTreeContext['plannedEmbeds'];
208
235
  /** A record template's tokens, which its links and images may name (AGL-3475). */
209
236
  recordTokens?: readonly string[];
237
+ /** The site's pages still to be built that a link may go to by id (AGL-3596). */
238
+ linkablePages?: readonly AiLinkablePage[];
210
239
  }): AiDoctrineTreeContext;
211
240
  export interface AiPageSectionCheckInput {
212
241
  /** The page as stored so far; an empty page on the first pass. */
@@ -221,11 +250,18 @@ export interface AiPageSectionCheckInput {
221
250
  */
222
251
  section: Pick<AiBuildPlanSection, 'name' | 'uses' | 'items'>;
223
252
  inventory: AiSiteInventory | null;
253
+ /**
254
+ * The one page a link that goes nowhere can only mean, where the site has
255
+ * exactly one page besides its home and this one (AGL-3596): a guided
256
+ * start's Contact page. Absent or `null`, such a link is re-asked.
257
+ */
258
+ linkTarget?: string | null;
224
259
  }
225
260
  /**
226
261
  * The check a section's answer is held to: a repeated item written once drawn
227
262
  * into its copies (AGL-3053), then the palette validator on the section, with
228
- * any line it cut at its ceiling refused (AGL-3076), the doctrine's page check
263
+ * any line it cut at its ceiling refused (AGL-3076), a Grid container's items
264
+ * sized where rule 12 has one answer (AGL-3596), the doctrine's page check
229
265
  * on the page with the section added, and the plan line — every component it
230
266
  * names placed as an instance, every form bound by its id (rule 7), and as
231
267
  * many items as it promised (AGL-3024). Violations