@aglyn/plugins-ai 1.0.0-beta.143

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (717) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +25 -0
  3. package/package.json +60 -0
  4. package/src/index.d.ts +21 -0
  5. package/src/index.js +22 -0
  6. package/src/index.js.map +1 -0
  7. package/src/lib/activity/ai-activity-actions.d.ts +106 -0
  8. package/src/lib/activity/ai-activity-actions.js +209 -0
  9. package/src/lib/activity/ai-activity-actions.js.map +1 -0
  10. package/src/lib/activity/ai-activity.d.ts +219 -0
  11. package/src/lib/activity/ai-activity.js +251 -0
  12. package/src/lib/activity/ai-activity.js.map +1 -0
  13. package/src/lib/billing/ai-overage-charge.d.ts +102 -0
  14. package/src/lib/billing/ai-overage-charge.js +258 -0
  15. package/src/lib/billing/ai-overage-charge.js.map +1 -0
  16. package/src/lib/billing/ai-overage-close.d.ts +62 -0
  17. package/src/lib/billing/ai-overage-close.js +129 -0
  18. package/src/lib/billing/ai-overage-close.js.map +1 -0
  19. package/src/lib/billing/ai-overage-cutover.d.ts +63 -0
  20. package/src/lib/billing/ai-overage-cutover.js +114 -0
  21. package/src/lib/billing/ai-overage-cutover.js.map +1 -0
  22. package/src/lib/billing/ai-overage-events.d.ts +77 -0
  23. package/src/lib/billing/ai-overage-events.js +174 -0
  24. package/src/lib/billing/ai-overage-events.js.map +1 -0
  25. package/src/lib/billing/ai-overage-gate.d.ts +147 -0
  26. package/src/lib/billing/ai-overage-gate.js +177 -0
  27. package/src/lib/billing/ai-overage-gate.js.map +1 -0
  28. package/src/lib/billing/ai-overage-ledger.d.ts +135 -0
  29. package/src/lib/billing/ai-overage-ledger.js +278 -0
  30. package/src/lib/billing/ai-overage-ledger.js.map +1 -0
  31. package/src/lib/billing/ai-overage-standing-writes.d.ts +110 -0
  32. package/src/lib/billing/ai-overage-standing-writes.js +205 -0
  33. package/src/lib/billing/ai-overage-standing-writes.js.map +1 -0
  34. package/src/lib/billing/ai-overage-standing.d.ts +168 -0
  35. package/src/lib/billing/ai-overage-standing.js +215 -0
  36. package/src/lib/billing/ai-overage-standing.js.map +1 -0
  37. package/src/lib/billing/ai-overage-trigger.d.ts +30 -0
  38. package/src/lib/billing/ai-overage-trigger.js +76 -0
  39. package/src/lib/billing/ai-overage-trigger.js.map +1 -0
  40. package/src/lib/components/ai-allotment-editor.component.d.ts +40 -0
  41. package/src/lib/components/ai-allotment-editor.component.js +213 -0
  42. package/src/lib/components/ai-allotment-editor.component.js.map +1 -0
  43. package/src/lib/components/ai-assist-actions-context.d.ts +13 -0
  44. package/src/lib/components/ai-assist-actions-context.js +21 -0
  45. package/src/lib/components/ai-assist-actions-context.js.map +1 -0
  46. package/src/lib/components/ai-assist-provider.component.d.ts +51 -0
  47. package/src/lib/components/ai-assist-provider.component.js +519 -0
  48. package/src/lib/components/ai-assist-provider.component.js.map +1 -0
  49. package/src/lib/components/ai-brief-dialog.component.d.ts +56 -0
  50. package/src/lib/components/ai-brief-dialog.component.js +319 -0
  51. package/src/lib/components/ai-brief-dialog.component.js.map +1 -0
  52. package/src/lib/components/ai-collaborator-permissions-column.component.d.ts +32 -0
  53. package/src/lib/components/ai-collaborator-permissions-column.component.js +132 -0
  54. package/src/lib/components/ai-collaborator-permissions-column.component.js.map +1 -0
  55. package/src/lib/components/ai-credits-card.component.d.ts +34 -0
  56. package/src/lib/components/ai-credits-card.component.js +131 -0
  57. package/src/lib/components/ai-credits-card.component.js.map +1 -0
  58. package/src/lib/components/ai-credits-columns.component.d.ts +56 -0
  59. package/src/lib/components/ai-credits-columns.component.js +118 -0
  60. package/src/lib/components/ai-credits-columns.component.js.map +1 -0
  61. package/src/lib/components/ai-crm-email-draft.component.d.ts +17 -0
  62. package/src/lib/components/ai-crm-email-draft.component.js +159 -0
  63. package/src/lib/components/ai-crm-email-draft.component.js.map +1 -0
  64. package/src/lib/components/ai-crm-import-mapping.component.d.ts +20 -0
  65. package/src/lib/components/ai-crm-import-mapping.component.js +167 -0
  66. package/src/lib/components/ai-crm-import-mapping.component.js.map +1 -0
  67. package/src/lib/components/ai-crm-record-card.component.d.ts +27 -0
  68. package/src/lib/components/ai-crm-record-card.component.js +263 -0
  69. package/src/lib/components/ai-crm-record-card.component.js.map +1 -0
  70. package/src/lib/components/ai-describe-automation.component.d.ts +31 -0
  71. package/src/lib/components/ai-describe-automation.component.js +226 -0
  72. package/src/lib/components/ai-describe-automation.component.js.map +1 -0
  73. package/src/lib/components/ai-describe-button.component.d.ts +39 -0
  74. package/src/lib/components/ai-describe-button.component.js +87 -0
  75. package/src/lib/components/ai-describe-button.component.js.map +1 -0
  76. package/src/lib/components/ai-describe-page.component.d.ts +26 -0
  77. package/src/lib/components/ai-describe-page.component.js +18 -0
  78. package/src/lib/components/ai-describe-page.component.js.map +1 -0
  79. package/src/lib/components/ai-experiment-cards.component.d.ts +75 -0
  80. package/src/lib/components/ai-experiment-cards.component.js +573 -0
  81. package/src/lib/components/ai-experiment-cards.component.js.map +1 -0
  82. package/src/lib/components/ai-explain-automation.component.d.ts +31 -0
  83. package/src/lib/components/ai-explain-automation.component.js +265 -0
  84. package/src/lib/components/ai-explain-automation.component.js.map +1 -0
  85. package/src/lib/components/ai-insight-dialog.component.d.ts +37 -0
  86. package/src/lib/components/ai-insight-dialog.component.js +441 -0
  87. package/src/lib/components/ai-insight-dialog.component.js.map +1 -0
  88. package/src/lib/components/ai-job-plan.component.d.ts +46 -0
  89. package/src/lib/components/ai-job-plan.component.js +192 -0
  90. package/src/lib/components/ai-job-plan.component.js.map +1 -0
  91. package/src/lib/components/ai-model-selector.component.d.ts +21 -0
  92. package/src/lib/components/ai-model-selector.component.js +109 -0
  93. package/src/lib/components/ai-model-selector.component.js.map +1 -0
  94. package/src/lib/components/ai-page-brief-dialog.component.d.ts +29 -0
  95. package/src/lib/components/ai-page-brief-dialog.component.js +27 -0
  96. package/src/lib/components/ai-page-brief-dialog.component.js.map +1 -0
  97. package/src/lib/components/ai-permissions-on-host.component.d.ts +55 -0
  98. package/src/lib/components/ai-permissions-on-host.component.js +91 -0
  99. package/src/lib/components/ai-permissions-on-host.component.js.map +1 -0
  100. package/src/lib/components/ai-product-copy-card.component.d.ts +25 -0
  101. package/src/lib/components/ai-product-copy-card.component.js +328 -0
  102. package/src/lib/components/ai-product-copy-card.component.js.map +1 -0
  103. package/src/lib/components/ai-product-import-option.component.d.ts +14 -0
  104. package/src/lib/components/ai-product-import-option.component.js +58 -0
  105. package/src/lib/components/ai-product-import-option.component.js.map +1 -0
  106. package/src/lib/components/ai-products-hub-card.component.d.ts +15 -0
  107. package/src/lib/components/ai-products-hub-card.component.js +418 -0
  108. package/src/lib/components/ai-products-hub-card.component.js.map +1 -0
  109. package/src/lib/components/ai-products-proposals.component.d.ts +19 -0
  110. package/src/lib/components/ai-products-proposals.component.js +547 -0
  111. package/src/lib/components/ai-products-proposals.component.js.map +1 -0
  112. package/src/lib/components/ai-save-as-component.component.d.ts +38 -0
  113. package/src/lib/components/ai-save-as-component.component.js +231 -0
  114. package/src/lib/components/ai-save-as-component.component.js.map +1 -0
  115. package/src/lib/components/ai-seo-audit-card.component.d.ts +9 -0
  116. package/src/lib/components/ai-seo-audit-card.component.js +620 -0
  117. package/src/lib/components/ai-seo-audit-card.component.js.map +1 -0
  118. package/src/lib/components/ai-seo-fields-card.component.d.ts +10 -0
  119. package/src/lib/components/ai-seo-fields-card.component.js +453 -0
  120. package/src/lib/components/ai-seo-fields-card.component.js.map +1 -0
  121. package/src/lib/components/ai-site-batch-card.component.d.ts +32 -0
  122. package/src/lib/components/ai-site-batch-card.component.js +531 -0
  123. package/src/lib/components/ai-site-batch-card.component.js.map +1 -0
  124. package/src/lib/components/ai-site-seo-start-card.component.d.ts +26 -0
  125. package/src/lib/components/ai-site-seo-start-card.component.js +178 -0
  126. package/src/lib/components/ai-site-seo-start-card.component.js.map +1 -0
  127. package/src/lib/components/ai-site-start-card.component.d.ts +19 -0
  128. package/src/lib/components/ai-site-start-card.component.js +348 -0
  129. package/src/lib/components/ai-site-start-card.component.js.map +1 -0
  130. package/src/lib/components/ai-template-collection-field.component.d.ts +32 -0
  131. package/src/lib/components/ai-template-collection-field.component.js +63 -0
  132. package/src/lib/components/ai-template-collection-field.component.js.map +1 -0
  133. package/src/lib/components/ai-theme-proposal-card.component.d.ts +6 -0
  134. package/src/lib/components/ai-theme-proposal-card.component.js +619 -0
  135. package/src/lib/components/ai-theme-proposal-card.component.js.map +1 -0
  136. package/src/lib/components/ai-usage-strip.component.d.ts +27 -0
  137. package/src/lib/components/ai-usage-strip.component.js +145 -0
  138. package/src/lib/components/ai-usage-strip.component.js.map +1 -0
  139. package/src/lib/components/assist-edit-canvas.d.ts +169 -0
  140. package/src/lib/components/assist-edit-canvas.js +636 -0
  141. package/src/lib/components/assist-edit-canvas.js.map +1 -0
  142. package/src/lib/components/assist-edit-card.component.d.ts +16 -0
  143. package/src/lib/components/assist-edit-card.component.js +181 -0
  144. package/src/lib/components/assist-edit-card.component.js.map +1 -0
  145. package/src/lib/components/assist-jobs-drawer.component.d.ts +72 -0
  146. package/src/lib/components/assist-jobs-drawer.component.js +626 -0
  147. package/src/lib/components/assist-jobs-drawer.component.js.map +1 -0
  148. package/src/lib/components/assist-panel.component.d.ts +136 -0
  149. package/src/lib/components/assist-panel.component.js +1099 -0
  150. package/src/lib/components/assist-panel.component.js.map +1 -0
  151. package/src/lib/components/assist-signals-page.component.d.ts +3 -0
  152. package/src/lib/components/assist-signals-page.component.js +1017 -0
  153. package/src/lib/components/assist-signals-page.component.js.map +1 -0
  154. package/src/lib/components/besigner-ai-controls.component.d.ts +29 -0
  155. package/src/lib/components/besigner-ai-controls.component.js +81 -0
  156. package/src/lib/components/besigner-ai-controls.component.js.map +1 -0
  157. package/src/lib/components/billing-ai-allotments.component.d.ts +36 -0
  158. package/src/lib/components/billing-ai-allotments.component.js +486 -0
  159. package/src/lib/components/billing-ai-allotments.component.js.map +1 -0
  160. package/src/lib/components/billing-ai-top-users.component.d.ts +44 -0
  161. package/src/lib/components/billing-ai-top-users.component.js +304 -0
  162. package/src/lib/components/billing-ai-top-users.component.js.map +1 -0
  163. package/src/lib/components/billing-assist-overage-card.component.d.ts +69 -0
  164. package/src/lib/components/billing-assist-overage-card.component.js +437 -0
  165. package/src/lib/components/billing-assist-overage-card.component.js.map +1 -0
  166. package/src/lib/components/host-ai-allotments.component.d.ts +40 -0
  167. package/src/lib/components/host-ai-allotments.component.js +239 -0
  168. package/src/lib/components/host-ai-allotments.component.js.map +1 -0
  169. package/src/lib/components/member-ai-allotment-card.component.d.ts +28 -0
  170. package/src/lib/components/member-ai-allotment-card.component.js +172 -0
  171. package/src/lib/components/member-ai-allotment-card.component.js.map +1 -0
  172. package/src/lib/components/member-ai-usage-card.component.d.ts +28 -0
  173. package/src/lib/components/member-ai-usage-card.component.js +240 -0
  174. package/src/lib/components/member-ai-usage-card.component.js.map +1 -0
  175. package/src/lib/components/staff-org-ai-card.component.d.ts +17 -0
  176. package/src/lib/components/staff-org-ai-card.component.js +739 -0
  177. package/src/lib/components/staff-org-ai-card.component.js.map +1 -0
  178. package/src/lib/components/staff-org-usage-ai-columns.component.d.ts +41 -0
  179. package/src/lib/components/staff-org-usage-ai-columns.component.js +65 -0
  180. package/src/lib/components/staff-org-usage-ai-columns.component.js.map +1 -0
  181. package/src/lib/components/staff-orgs-ai-spend-column.component.d.ts +28 -0
  182. package/src/lib/components/staff-orgs-ai-spend-column.component.js +89 -0
  183. package/src/lib/components/staff-orgs-ai-spend-column.component.js.map +1 -0
  184. package/src/lib/components/staff-user-ai-usage-card.component.d.ts +27 -0
  185. package/src/lib/components/staff-user-ai-usage-card.component.js +183 -0
  186. package/src/lib/components/staff-user-ai-usage-card.component.js.map +1 -0
  187. package/src/lib/components/use-ai-allotments.d.ts +49 -0
  188. package/src/lib/components/use-ai-allotments.js +171 -0
  189. package/src/lib/components/use-ai-allotments.js.map +1 -0
  190. package/src/lib/components/use-ai-crm-answer.d.ts +50 -0
  191. package/src/lib/components/use-ai-crm-answer.js +220 -0
  192. package/src/lib/components/use-ai-crm-answer.js.map +1 -0
  193. package/src/lib/components/use-ai-job-run.d.ts +51 -0
  194. package/src/lib/components/use-ai-job-run.js +176 -0
  195. package/src/lib/components/use-ai-job-run.js.map +1 -0
  196. package/src/lib/components/use-ai-model-choice.d.ts +47 -0
  197. package/src/lib/components/use-ai-model-choice.js +150 -0
  198. package/src/lib/components/use-ai-model-choice.js.map +1 -0
  199. package/src/lib/components/use-ai-products-jobs.d.ts +36 -0
  200. package/src/lib/components/use-ai-products-jobs.js +190 -0
  201. package/src/lib/components/use-ai-products-jobs.js.map +1 -0
  202. package/src/lib/components/use-ai-usage-meter.d.ts +11 -0
  203. package/src/lib/components/use-ai-usage-meter.js +96 -0
  204. package/src/lib/components/use-ai-usage-meter.js.map +1 -0
  205. package/src/lib/components/use-org-ai-usage.d.ts +42 -0
  206. package/src/lib/components/use-org-ai-usage.js +181 -0
  207. package/src/lib/components/use-org-ai-usage.js.map +1 -0
  208. package/src/lib/components/use-staff-orgs-ai-spend.d.ts +18 -0
  209. package/src/lib/components/use-staff-orgs-ai-spend.js +127 -0
  210. package/src/lib/components/use-staff-orgs-ai-spend.js.map +1 -0
  211. package/src/lib/constants.d.ts +24 -0
  212. package/src/lib/constants.js +23 -0
  213. package/src/lib/constants.js.map +1 -0
  214. package/src/lib/declarations.d.ts +48 -0
  215. package/src/lib/declarations.js +129 -0
  216. package/src/lib/declarations.js.map +1 -0
  217. package/src/lib/declarations.server.d.ts +35 -0
  218. package/src/lib/declarations.server.js +138 -0
  219. package/src/lib/declarations.server.js.map +1 -0
  220. package/src/lib/insights/ai-figure-readers.d.ts +90 -0
  221. package/src/lib/insights/ai-figure-readers.js +863 -0
  222. package/src/lib/insights/ai-figure-readers.js.map +1 -0
  223. package/src/lib/insights/ai-insight-digest.d.ts +165 -0
  224. package/src/lib/insights/ai-insight-digest.js +363 -0
  225. package/src/lib/insights/ai-insight-digest.js.map +1 -0
  226. package/src/lib/insights/ai-insight-readers.d.ts +71 -0
  227. package/src/lib/insights/ai-insight-readers.js +141 -0
  228. package/src/lib/insights/ai-insight-readers.js.map +1 -0
  229. package/src/lib/jobs/ai-crm-access.d.ts +61 -0
  230. package/src/lib/jobs/ai-crm-access.js +94 -0
  231. package/src/lib/jobs/ai-crm-access.js.map +1 -0
  232. package/src/lib/jobs/ai-email-bindings.d.ts +97 -0
  233. package/src/lib/jobs/ai-email-bindings.js +147 -0
  234. package/src/lib/jobs/ai-email-bindings.js.map +1 -0
  235. package/src/lib/jobs/ai-job-admission.d.ts +82 -0
  236. package/src/lib/jobs/ai-job-admission.js +45 -0
  237. package/src/lib/jobs/ai-job-admission.js.map +1 -0
  238. package/src/lib/jobs/ai-job-budget.d.ts +167 -0
  239. package/src/lib/jobs/ai-job-budget.js +161 -0
  240. package/src/lib/jobs/ai-job-budget.js.map +1 -0
  241. package/src/lib/jobs/ai-job-campaign-step.d.ts +108 -0
  242. package/src/lib/jobs/ai-job-campaign-step.js +340 -0
  243. package/src/lib/jobs/ai-job-campaign-step.js.map +1 -0
  244. package/src/lib/jobs/ai-job-component-checks.d.ts +74 -0
  245. package/src/lib/jobs/ai-job-component-checks.js +442 -0
  246. package/src/lib/jobs/ai-job-component-checks.js.map +1 -0
  247. package/src/lib/jobs/ai-job-component-step.d.ts +75 -0
  248. package/src/lib/jobs/ai-job-component-step.js +262 -0
  249. package/src/lib/jobs/ai-job-component-step.js.map +1 -0
  250. package/src/lib/jobs/ai-job-crm-step.d.ts +192 -0
  251. package/src/lib/jobs/ai-job-crm-step.js +734 -0
  252. package/src/lib/jobs/ai-job-crm-step.js.map +1 -0
  253. package/src/lib/jobs/ai-job-draft-ids.d.ts +62 -0
  254. package/src/lib/jobs/ai-job-draft-ids.js +132 -0
  255. package/src/lib/jobs/ai-job-draft-ids.js.map +1 -0
  256. package/src/lib/jobs/ai-job-drafts.d.ts +304 -0
  257. package/src/lib/jobs/ai-job-drafts.js +557 -0
  258. package/src/lib/jobs/ai-job-drafts.js.map +1 -0
  259. package/src/lib/jobs/ai-job-email-step.d.ts +195 -0
  260. package/src/lib/jobs/ai-job-email-step.js +547 -0
  261. package/src/lib/jobs/ai-job-email-step.js.map +1 -0
  262. package/src/lib/jobs/ai-job-experiment-step.d.ts +105 -0
  263. package/src/lib/jobs/ai-job-experiment-step.js +445 -0
  264. package/src/lib/jobs/ai-job-experiment-step.js.map +1 -0
  265. package/src/lib/jobs/ai-job-form-step.d.ts +250 -0
  266. package/src/lib/jobs/ai-job-form-step.js +634 -0
  267. package/src/lib/jobs/ai-job-form-step.js.map +1 -0
  268. package/src/lib/jobs/ai-job-generation.d.ts +114 -0
  269. package/src/lib/jobs/ai-job-generation.js +384 -0
  270. package/src/lib/jobs/ai-job-generation.js.map +1 -0
  271. package/src/lib/jobs/ai-job-insight-budget.d.ts +41 -0
  272. package/src/lib/jobs/ai-job-insight-budget.js +46 -0
  273. package/src/lib/jobs/ai-job-insight-budget.js.map +1 -0
  274. package/src/lib/jobs/ai-job-insight-step.d.ts +58 -0
  275. package/src/lib/jobs/ai-job-insight-step.js +350 -0
  276. package/src/lib/jobs/ai-job-insight-step.js.map +1 -0
  277. package/src/lib/jobs/ai-job-layout-step.d.ts +103 -0
  278. package/src/lib/jobs/ai-job-layout-step.js +340 -0
  279. package/src/lib/jobs/ai-job-layout-step.js.map +1 -0
  280. package/src/lib/jobs/ai-job-page-budget.d.ts +57 -0
  281. package/src/lib/jobs/ai-job-page-budget.js +60 -0
  282. package/src/lib/jobs/ai-job-page-budget.js.map +1 -0
  283. package/src/lib/jobs/ai-job-page-sections.d.ts +150 -0
  284. package/src/lib/jobs/ai-job-page-sections.js +450 -0
  285. package/src/lib/jobs/ai-job-page-sections.js.map +1 -0
  286. package/src/lib/jobs/ai-job-page-step.d.ts +198 -0
  287. package/src/lib/jobs/ai-job-page-step.js +667 -0
  288. package/src/lib/jobs/ai-job-page-step.js.map +1 -0
  289. package/src/lib/jobs/ai-job-plan-conformance.d.ts +107 -0
  290. package/src/lib/jobs/ai-job-plan-conformance.js +164 -0
  291. package/src/lib/jobs/ai-job-plan-conformance.js.map +1 -0
  292. package/src/lib/jobs/ai-job-plan-step.d.ts +196 -0
  293. package/src/lib/jobs/ai-job-plan-step.js +458 -0
  294. package/src/lib/jobs/ai-job-plan-step.js.map +1 -0
  295. package/src/lib/jobs/ai-job-plugin-drafts.d.ts +76 -0
  296. package/src/lib/jobs/ai-job-plugin-drafts.js +91 -0
  297. package/src/lib/jobs/ai-job-plugin-drafts.js.map +1 -0
  298. package/src/lib/jobs/ai-job-products-step.d.ts +106 -0
  299. package/src/lib/jobs/ai-job-products-step.js +436 -0
  300. package/src/lib/jobs/ai-job-products-step.js.map +1 -0
  301. package/src/lib/jobs/ai-job-seo-budget.d.ts +52 -0
  302. package/src/lib/jobs/ai-job-seo-budget.js +63 -0
  303. package/src/lib/jobs/ai-job-seo-budget.js.map +1 -0
  304. package/src/lib/jobs/ai-job-seo-step.d.ts +145 -0
  305. package/src/lib/jobs/ai-job-seo-step.js +809 -0
  306. package/src/lib/jobs/ai-job-seo-step.js.map +1 -0
  307. package/src/lib/jobs/ai-job-site-step.d.ts +252 -0
  308. package/src/lib/jobs/ai-job-site-step.js +538 -0
  309. package/src/lib/jobs/ai-job-site-step.js.map +1 -0
  310. package/src/lib/jobs/ai-job-template-step.d.ts +105 -0
  311. package/src/lib/jobs/ai-job-template-step.js +391 -0
  312. package/src/lib/jobs/ai-job-template-step.js.map +1 -0
  313. package/src/lib/jobs/ai-job-text-step.d.ts +125 -0
  314. package/src/lib/jobs/ai-job-text-step.js +128 -0
  315. package/src/lib/jobs/ai-job-text-step.js.map +1 -0
  316. package/src/lib/jobs/ai-job-theme-budget.d.ts +38 -0
  317. package/src/lib/jobs/ai-job-theme-budget.js +43 -0
  318. package/src/lib/jobs/ai-job-theme-budget.js.map +1 -0
  319. package/src/lib/jobs/ai-job-theme-step.d.ts +115 -0
  320. package/src/lib/jobs/ai-job-theme-step.js +337 -0
  321. package/src/lib/jobs/ai-job-theme-step.js.map +1 -0
  322. package/src/lib/jobs/ai-job-workflow-step.d.ts +139 -0
  323. package/src/lib/jobs/ai-job-workflow-step.js +530 -0
  324. package/src/lib/jobs/ai-job-workflow-step.js.map +1 -0
  325. package/src/lib/jobs/ai-jobs-beat.d.ts +78 -0
  326. package/src/lib/jobs/ai-jobs-beat.js +93 -0
  327. package/src/lib/jobs/ai-jobs-beat.js.map +1 -0
  328. package/src/lib/jobs/ai-jobs-pause.d.ts +38 -0
  329. package/src/lib/jobs/ai-jobs-pause.js +45 -0
  330. package/src/lib/jobs/ai-jobs-pause.js.map +1 -0
  331. package/src/lib/jobs/ai-jobs.d.ts +558 -0
  332. package/src/lib/jobs/ai-jobs.js +1410 -0
  333. package/src/lib/jobs/ai-jobs.js.map +1 -0
  334. package/src/lib/jobs/ai-media-asset-server.d.ts +34 -0
  335. package/src/lib/jobs/ai-media-asset-server.js +34 -0
  336. package/src/lib/jobs/ai-media-asset-server.js.map +1 -0
  337. package/src/lib/jobs/ai-media-asset.d.ts +59 -0
  338. package/src/lib/jobs/ai-media-asset.js +86 -0
  339. package/src/lib/jobs/ai-media-asset.js.map +1 -0
  340. package/src/lib/jobs/ai-product-image.d.ts +78 -0
  341. package/src/lib/jobs/ai-product-image.js +113 -0
  342. package/src/lib/jobs/ai-product-image.js.map +1 -0
  343. package/src/lib/jobs/ai-theme-brand-inputs.d.ts +125 -0
  344. package/src/lib/jobs/ai-theme-brand-inputs.js +378 -0
  345. package/src/lib/jobs/ai-theme-brand-inputs.js.map +1 -0
  346. package/src/lib/jobs/ai-theme-brand-server.d.ts +33 -0
  347. package/src/lib/jobs/ai-theme-brand-server.js +33 -0
  348. package/src/lib/jobs/ai-theme-brand-server.js.map +1 -0
  349. package/src/lib/jobs/ai-workflow-records.d.ts +84 -0
  350. package/src/lib/jobs/ai-workflow-records.js +158 -0
  351. package/src/lib/jobs/ai-workflow-records.js.map +1 -0
  352. package/src/lib/jobs/fixtures/ai-free-page-built-recording.d.ts +31 -0
  353. package/src/lib/jobs/fixtures/ai-free-page-built-recording.js +367 -0
  354. package/src/lib/jobs/fixtures/ai-free-page-built-recording.js.map +1 -0
  355. package/src/lib/jobs/fixtures/ai-free-page-recording.d.ts +69 -0
  356. package/src/lib/jobs/fixtures/ai-free-page-recording.js +442 -0
  357. package/src/lib/jobs/fixtures/ai-free-page-recording.js.map +1 -0
  358. package/src/lib/jobs/fixtures/ai-page-briefs.d.ts +146 -0
  359. package/src/lib/jobs/fixtures/ai-page-briefs.js +1850 -0
  360. package/src/lib/jobs/fixtures/ai-page-briefs.js.map +1 -0
  361. package/src/lib/model/ai-allotments.d.ts +208 -0
  362. package/src/lib/model/ai-allotments.js +269 -0
  363. package/src/lib/model/ai-allotments.js.map +1 -0
  364. package/src/lib/model/ai-automation-draft.d.ts +74 -0
  365. package/src/lib/model/ai-automation-draft.js +310 -0
  366. package/src/lib/model/ai-automation-draft.js.map +1 -0
  367. package/src/lib/model/ai-automation-outline.d.ts +50 -0
  368. package/src/lib/model/ai-automation-outline.js +262 -0
  369. package/src/lib/model/ai-automation-outline.js.map +1 -0
  370. package/src/lib/model/ai-build-plan.d.ts +197 -0
  371. package/src/lib/model/ai-build-plan.js +438 -0
  372. package/src/lib/model/ai-build-plan.js.map +1 -0
  373. package/src/lib/model/ai-crm.d.ts +237 -0
  374. package/src/lib/model/ai-crm.js +225 -0
  375. package/src/lib/model/ai-crm.js.map +1 -0
  376. package/src/lib/model/ai-experiment-proposal.d.ts +68 -0
  377. package/src/lib/model/ai-experiment-proposal.js +146 -0
  378. package/src/lib/model/ai-experiment-proposal.js.map +1 -0
  379. package/src/lib/model/ai-experiment.d.ts +309 -0
  380. package/src/lib/model/ai-experiment.js +395 -0
  381. package/src/lib/model/ai-experiment.js.map +1 -0
  382. package/src/lib/model/ai-insight.d.ts +178 -0
  383. package/src/lib/model/ai-insight.js +201 -0
  384. package/src/lib/model/ai-insight.js.map +1 -0
  385. package/src/lib/model/ai-jobs.types.d.ts +412 -0
  386. package/src/lib/model/ai-jobs.types.js +42 -0
  387. package/src/lib/model/ai-jobs.types.js.map +1 -0
  388. package/src/lib/model/ai-page-job.d.ts +92 -0
  389. package/src/lib/model/ai-page-job.js +159 -0
  390. package/src/lib/model/ai-page-job.js.map +1 -0
  391. package/src/lib/model/ai-permissions.d.ts +49 -0
  392. package/src/lib/model/ai-permissions.js +97 -0
  393. package/src/lib/model/ai-permissions.js.map +1 -0
  394. package/src/lib/model/ai-plan-capabilities.d.ts +139 -0
  395. package/src/lib/model/ai-plan-capabilities.js +149 -0
  396. package/src/lib/model/ai-plan-capabilities.js.map +1 -0
  397. package/src/lib/model/ai-products.d.ts +251 -0
  398. package/src/lib/model/ai-products.js +253 -0
  399. package/src/lib/model/ai-products.js.map +1 -0
  400. package/src/lib/model/ai-seo.d.ts +208 -0
  401. package/src/lib/model/ai-seo.js +150 -0
  402. package/src/lib/model/ai-seo.js.map +1 -0
  403. package/src/lib/model/ai-site-inventory.d.ts +164 -0
  404. package/src/lib/model/ai-site-inventory.js +145 -0
  405. package/src/lib/model/ai-site-inventory.js.map +1 -0
  406. package/src/lib/model/ai-site-job.d.ts +247 -0
  407. package/src/lib/model/ai-site-job.js +314 -0
  408. package/src/lib/model/ai-site-job.js.map +1 -0
  409. package/src/lib/model/ai-site-start-seo.d.ts +103 -0
  410. package/src/lib/model/ai-site-start-seo.js +154 -0
  411. package/src/lib/model/ai-site-start-seo.js.map +1 -0
  412. package/src/lib/model/ai-site-start.d.ts +122 -0
  413. package/src/lib/model/ai-site-start.js +159 -0
  414. package/src/lib/model/ai-site-start.js.map +1 -0
  415. package/src/lib/model/ai-site-switch.d.ts +56 -0
  416. package/src/lib/model/ai-site-switch.js +73 -0
  417. package/src/lib/model/ai-site-switch.js.map +1 -0
  418. package/src/lib/model/ai-storefront-claims.d.ts +70 -0
  419. package/src/lib/model/ai-storefront-claims.js +130 -0
  420. package/src/lib/model/ai-storefront-claims.js.map +1 -0
  421. package/src/lib/model/ai-template-subjects.d.ts +82 -0
  422. package/src/lib/model/ai-template-subjects.js +136 -0
  423. package/src/lib/model/ai-template-subjects.js.map +1 -0
  424. package/src/lib/model/ai-theme-proposal.d.ts +210 -0
  425. package/src/lib/model/ai-theme-proposal.js +506 -0
  426. package/src/lib/model/ai-theme-proposal.js.map +1 -0
  427. package/src/lib/model/ai-tokens.d.ts +96 -0
  428. package/src/lib/model/ai-tokens.js +117 -0
  429. package/src/lib/model/ai-tokens.js.map +1 -0
  430. package/src/lib/model/ai-usage-by-user.d.ts +120 -0
  431. package/src/lib/model/ai-usage-by-user.js +139 -0
  432. package/src/lib/model/ai-usage-by-user.js.map +1 -0
  433. package/src/lib/model/ai-workflow-job.d.ts +111 -0
  434. package/src/lib/model/ai-workflow-job.js +183 -0
  435. package/src/lib/model/ai-workflow-job.js.map +1 -0
  436. package/src/lib/model/assist-edit.d.ts +261 -0
  437. package/src/lib/model/assist-edit.js +175 -0
  438. package/src/lib/model/assist-edit.js.map +1 -0
  439. package/src/lib/plugin-config.d.ts +33 -0
  440. package/src/lib/plugin-config.js +118 -0
  441. package/src/lib/plugin-config.js.map +1 -0
  442. package/src/lib/plugin.d.ts +30 -0
  443. package/src/lib/plugin.js +525 -0
  444. package/src/lib/plugin.js.map +1 -0
  445. package/src/lib/providers/anthropic.d.ts +84 -0
  446. package/src/lib/providers/anthropic.js +432 -0
  447. package/src/lib/providers/anthropic.js.map +1 -0
  448. package/src/lib/providers/catalog.d.ts +197 -0
  449. package/src/lib/providers/catalog.js +312 -0
  450. package/src/lib/providers/catalog.js.map +1 -0
  451. package/src/lib/providers/contract.d.ts +464 -0
  452. package/src/lib/providers/contract.js +274 -0
  453. package/src/lib/providers/contract.js.map +1 -0
  454. package/src/lib/providers/model-choice.d.ts +119 -0
  455. package/src/lib/providers/model-choice.js +416 -0
  456. package/src/lib/providers/model-choice.js.map +1 -0
  457. package/src/lib/providers/openai-compatible.d.ts +58 -0
  458. package/src/lib/providers/openai-compatible.js +361 -0
  459. package/src/lib/providers/openai-compatible.js.map +1 -0
  460. package/src/lib/providers/registry.d.ts +49 -0
  461. package/src/lib/providers/registry.js +71 -0
  462. package/src/lib/providers/registry.js.map +1 -0
  463. package/src/lib/providers/routing.d.ts +98 -0
  464. package/src/lib/providers/routing.js +450 -0
  465. package/src/lib/providers/routing.js.map +1 -0
  466. package/src/lib/runtime/ai-abuse-guards.d.ts +113 -0
  467. package/src/lib/runtime/ai-abuse-guards.js +148 -0
  468. package/src/lib/runtime/ai-abuse-guards.js.map +1 -0
  469. package/src/lib/runtime/ai-component-bindings.d.ts +67 -0
  470. package/src/lib/runtime/ai-component-bindings.js +106 -0
  471. package/src/lib/runtime/ai-component-bindings.js.map +1 -0
  472. package/src/lib/runtime/ai-device-audit.d.ts +109 -0
  473. package/src/lib/runtime/ai-device-audit.js +97 -0
  474. package/src/lib/runtime/ai-device-audit.js.map +1 -0
  475. package/src/lib/runtime/ai-doctrine-validators.d.ts +720 -0
  476. package/src/lib/runtime/ai-doctrine-validators.js +3133 -0
  477. package/src/lib/runtime/ai-doctrine-validators.js.map +1 -0
  478. package/src/lib/runtime/ai-doctrine.d.ts +372 -0
  479. package/src/lib/runtime/ai-doctrine.js +944 -0
  480. package/src/lib/runtime/ai-doctrine.js.map +1 -0
  481. package/src/lib/runtime/ai-eval-live.d.ts +321 -0
  482. package/src/lib/runtime/ai-eval-live.js +1257 -0
  483. package/src/lib/runtime/ai-eval-live.js.map +1 -0
  484. package/src/lib/runtime/ai-eval-memory-firestore.d.ts +51 -0
  485. package/src/lib/runtime/ai-eval-memory-firestore.js +183 -0
  486. package/src/lib/runtime/ai-eval-memory-firestore.js.map +1 -0
  487. package/src/lib/runtime/ai-eval.d.ts +441 -0
  488. package/src/lib/runtime/ai-eval.js +1151 -0
  489. package/src/lib/runtime/ai-eval.js.map +1 -0
  490. package/src/lib/runtime/ai-gate.d.ts +130 -0
  491. package/src/lib/runtime/ai-gate.js +272 -0
  492. package/src/lib/runtime/ai-gate.js.map +1 -0
  493. package/src/lib/runtime/ai-generation-bounds.d.ts +24 -0
  494. package/src/lib/runtime/ai-generation-bounds.js +23 -0
  495. package/src/lib/runtime/ai-generation-bounds.js.map +1 -0
  496. package/src/lib/runtime/ai-insight-check.d.ts +76 -0
  497. package/src/lib/runtime/ai-insight-check.js +281 -0
  498. package/src/lib/runtime/ai-insight-check.js.map +1 -0
  499. package/src/lib/runtime/ai-node-tree.d.ts +181 -0
  500. package/src/lib/runtime/ai-node-tree.js +931 -0
  501. package/src/lib/runtime/ai-node-tree.js.map +1 -0
  502. package/src/lib/runtime/ai-page-links.d.ts +79 -0
  503. package/src/lib/runtime/ai-page-links.js +135 -0
  504. package/src/lib/runtime/ai-page-links.js.map +1 -0
  505. package/src/lib/runtime/ai-palette.d.ts +252 -0
  506. package/src/lib/runtime/ai-palette.generated.d.ts +34 -0
  507. package/src/lib/runtime/ai-palette.generated.js +5263 -0
  508. package/src/lib/runtime/ai-palette.generated.js.map +1 -0
  509. package/src/lib/runtime/ai-palette.js +187 -0
  510. package/src/lib/runtime/ai-palette.js.map +1 -0
  511. package/src/lib/runtime/ai-products-generation.d.ts +107 -0
  512. package/src/lib/runtime/ai-products-generation.js +250 -0
  513. package/src/lib/runtime/ai-products-generation.js.map +1 -0
  514. package/src/lib/runtime/ai-repeated-items.d.ts +95 -0
  515. package/src/lib/runtime/ai-repeated-items.js +397 -0
  516. package/src/lib/runtime/ai-repeated-items.js.map +1 -0
  517. package/src/lib/runtime/ai-runtime.d.ts +148 -0
  518. package/src/lib/runtime/ai-runtime.js +237 -0
  519. package/src/lib/runtime/ai-runtime.js.map +1 -0
  520. package/src/lib/runtime/ai-template-examples.d.ts +71 -0
  521. package/src/lib/runtime/ai-template-examples.js +135 -0
  522. package/src/lib/runtime/ai-template-examples.js.map +1 -0
  523. package/src/lib/runtime/assist-answer-cache.d.ts +80 -0
  524. package/src/lib/runtime/assist-answer-cache.js +184 -0
  525. package/src/lib/runtime/assist-answer-cache.js.map +1 -0
  526. package/src/lib/runtime/seo-audit.d.ts +93 -0
  527. package/src/lib/runtime/seo-audit.js +260 -0
  528. package/src/lib/runtime/seo-audit.js.map +1 -0
  529. package/src/lib/runtime/seo-content-fixes.d.ts +41 -0
  530. package/src/lib/runtime/seo-content-fixes.js +168 -0
  531. package/src/lib/runtime/seo-content-fixes.js.map +1 -0
  532. package/src/lib/runtime/seo-fields.d.ts +152 -0
  533. package/src/lib/runtime/seo-fields.js +215 -0
  534. package/src/lib/runtime/seo-fields.js.map +1 -0
  535. package/src/lib/runtime/seo-page-facts.d.ts +61 -0
  536. package/src/lib/runtime/seo-page-facts.js +150 -0
  537. package/src/lib/runtime/seo-page-facts.js.map +1 -0
  538. package/src/lib/runtime/site-inventory.d.ts +63 -0
  539. package/src/lib/runtime/site-inventory.js +230 -0
  540. package/src/lib/runtime/site-inventory.js.map +1 -0
  541. package/src/lib/server/ai-admin-org.d.ts +33 -0
  542. package/src/lib/server/ai-admin-org.js +381 -0
  543. package/src/lib/server/ai-admin-org.js.map +1 -0
  544. package/src/lib/server/ai-admin-orgs-spend.d.ts +40 -0
  545. package/src/lib/server/ai-admin-orgs-spend.js +129 -0
  546. package/src/lib/server/ai-admin-orgs-spend.js.map +1 -0
  547. package/src/lib/server/ai-admin-overage.d.ts +19 -0
  548. package/src/lib/server/ai-admin-overage.js +246 -0
  549. package/src/lib/server/ai-admin-overage.js.map +1 -0
  550. package/src/lib/server/ai-admin-signals.d.ts +34 -0
  551. package/src/lib/server/ai-admin-signals.js +330 -0
  552. package/src/lib/server/ai-admin-signals.js.map +1 -0
  553. package/src/lib/server/ai-admin-user.d.ts +27 -0
  554. package/src/lib/server/ai-admin-user.js +128 -0
  555. package/src/lib/server/ai-admin-user.js.map +1 -0
  556. package/src/lib/server/ai-allotments.d.ts +27 -0
  557. package/src/lib/server/ai-allotments.js +544 -0
  558. package/src/lib/server/ai-allotments.js.map +1 -0
  559. package/src/lib/server/ai-assist-prompts.d.ts +102 -0
  560. package/src/lib/server/ai-assist-prompts.js +207 -0
  561. package/src/lib/server/ai-assist-prompts.js.map +1 -0
  562. package/src/lib/server/ai-assist.d.ts +119 -0
  563. package/src/lib/server/ai-assist.js +517 -0
  564. package/src/lib/server/ai-assist.js.map +1 -0
  565. package/src/lib/server/ai-crm-answer.d.ts +30 -0
  566. package/src/lib/server/ai-crm-answer.js +98 -0
  567. package/src/lib/server/ai-crm-answer.js.map +1 -0
  568. package/src/lib/server/ai-generate-component.d.ts +111 -0
  569. package/src/lib/server/ai-generate-component.js +643 -0
  570. package/src/lib/server/ai-generate-component.js.map +1 -0
  571. package/src/lib/server/ai-host-permissions.d.ts +46 -0
  572. package/src/lib/server/ai-host-permissions.js +204 -0
  573. package/src/lib/server/ai-host-permissions.js.map +1 -0
  574. package/src/lib/server/ai-insight-answer.d.ts +30 -0
  575. package/src/lib/server/ai-insight-answer.js +83 -0
  576. package/src/lib/server/ai-insight-answer.js.map +1 -0
  577. package/src/lib/server/ai-insight-digest-route.d.ts +30 -0
  578. package/src/lib/server/ai-insight-digest-route.js +156 -0
  579. package/src/lib/server/ai-insight-digest-route.js.map +1 -0
  580. package/src/lib/server/ai-jobs-batch.d.ts +48 -0
  581. package/src/lib/server/ai-jobs-batch.js +306 -0
  582. package/src/lib/server/ai-jobs-batch.js.map +1 -0
  583. package/src/lib/server/ai-jobs-beat-route.d.ts +36 -0
  584. package/src/lib/server/ai-jobs-beat-route.js +86 -0
  585. package/src/lib/server/ai-jobs-beat-route.js.map +1 -0
  586. package/src/lib/server/ai-jobs-cancel.d.ts +30 -0
  587. package/src/lib/server/ai-jobs-cancel.js +74 -0
  588. package/src/lib/server/ai-jobs-cancel.js.map +1 -0
  589. package/src/lib/server/ai-jobs-events-route.d.ts +31 -0
  590. package/src/lib/server/ai-jobs-events-route.js +51 -0
  591. package/src/lib/server/ai-jobs-events-route.js.map +1 -0
  592. package/src/lib/server/ai-jobs-events.d.ts +55 -0
  593. package/src/lib/server/ai-jobs-events.js +144 -0
  594. package/src/lib/server/ai-jobs-events.js.map +1 -0
  595. package/src/lib/server/ai-jobs-gate.d.ts +47 -0
  596. package/src/lib/server/ai-jobs-gate.js +106 -0
  597. package/src/lib/server/ai-jobs-gate.js.map +1 -0
  598. package/src/lib/server/ai-jobs-resume.d.ts +23 -0
  599. package/src/lib/server/ai-jobs-resume.js +209 -0
  600. package/src/lib/server/ai-jobs-resume.js.map +1 -0
  601. package/src/lib/server/ai-jobs-route.d.ts +32 -0
  602. package/src/lib/server/ai-jobs-route.js +307 -0
  603. package/src/lib/server/ai-jobs-route.js.map +1 -0
  604. package/src/lib/server/ai-models.d.ts +18 -0
  605. package/src/lib/server/ai-models.js +134 -0
  606. package/src/lib/server/ai-models.js.map +1 -0
  607. package/src/lib/server/ai-seo-apply.d.ts +53 -0
  608. package/src/lib/server/ai-seo-apply.js +294 -0
  609. package/src/lib/server/ai-seo-apply.js.map +1 -0
  610. package/src/lib/server/ai-usage.d.ts +18 -0
  611. package/src/lib/server/ai-usage.js +220 -0
  612. package/src/lib/server/ai-usage.js.map +1 -0
  613. package/src/lib/server/assist-chat.d.ts +234 -0
  614. package/src/lib/server/assist-chat.js +1446 -0
  615. package/src/lib/server/assist-chat.js.map +1 -0
  616. package/src/lib/server/assist-edit-applied.d.ts +22 -0
  617. package/src/lib/server/assist-edit-applied.js +239 -0
  618. package/src/lib/server/assist-edit-applied.js.map +1 -0
  619. package/src/lib/server/assist-edit.d.ts +124 -0
  620. package/src/lib/server/assist-edit.js +1000 -0
  621. package/src/lib/server/assist-edit.js.map +1 -0
  622. package/src/lib/server/assist-feedback.d.ts +31 -0
  623. package/src/lib/server/assist-feedback.js +115 -0
  624. package/src/lib/server/assist-feedback.js.map +1 -0
  625. package/src/lib/server/assist-view-context.d.ts +343 -0
  626. package/src/lib/server/assist-view-context.js +690 -0
  627. package/src/lib/server/assist-view-context.js.map +1 -0
  628. package/src/lib/server/billing-credits.d.ts +59 -0
  629. package/src/lib/server/billing-credits.js +146 -0
  630. package/src/lib/server/billing-credits.js.map +1 -0
  631. package/src/lib/server/billing-overage.d.ts +19 -0
  632. package/src/lib/server/billing-overage.js +337 -0
  633. package/src/lib/server/billing-overage.js.map +1 -0
  634. package/src/lib/server.d.ts +32 -0
  635. package/src/lib/server.js +265 -0
  636. package/src/lib/server.js.map +1 -0
  637. package/src/lib/subprocessors.d.ts +18 -0
  638. package/src/lib/subprocessors.js +52 -0
  639. package/src/lib/subprocessors.js.map +1 -0
  640. package/src/lib/tools/ai-component-tool.d.ts +99 -0
  641. package/src/lib/tools/ai-component-tool.js +369 -0
  642. package/src/lib/tools/ai-component-tool.js.map +1 -0
  643. package/src/lib/tools/ai-crm-tool.d.ts +106 -0
  644. package/src/lib/tools/ai-crm-tool.js +488 -0
  645. package/src/lib/tools/ai-crm-tool.js.map +1 -0
  646. package/src/lib/tools/ai-duplicate-resource-tool.d.ts +71 -0
  647. package/src/lib/tools/ai-duplicate-resource-tool.js +164 -0
  648. package/src/lib/tools/ai-duplicate-resource-tool.js.map +1 -0
  649. package/src/lib/tools/ai-experiment-tool.d.ts +40 -0
  650. package/src/lib/tools/ai-experiment-tool.js +155 -0
  651. package/src/lib/tools/ai-experiment-tool.js.map +1 -0
  652. package/src/lib/tools/ai-insight-tool.d.ts +46 -0
  653. package/src/lib/tools/ai-insight-tool.js +200 -0
  654. package/src/lib/tools/ai-insight-tool.js.map +1 -0
  655. package/src/lib/tools/ai-inventory-lookup-tool.d.ts +86 -0
  656. package/src/lib/tools/ai-inventory-lookup-tool.js +164 -0
  657. package/src/lib/tools/ai-inventory-lookup-tool.js.map +1 -0
  658. package/src/lib/tools/ai-products-tool.d.ts +65 -0
  659. package/src/lib/tools/ai-products-tool.js +644 -0
  660. package/src/lib/tools/ai-products-tool.js.map +1 -0
  661. package/src/lib/tools/ai-seo-tool.d.ts +162 -0
  662. package/src/lib/tools/ai-seo-tool.js +546 -0
  663. package/src/lib/tools/ai-seo-tool.js.map +1 -0
  664. package/src/lib/tools/ai-theme-tool.d.ts +101 -0
  665. package/src/lib/tools/ai-theme-tool.js +562 -0
  666. package/src/lib/tools/ai-theme-tool.js.map +1 -0
  667. package/src/lib/tools/ai-workflow-tool.d.ts +166 -0
  668. package/src/lib/tools/ai-workflow-tool.js +860 -0
  669. package/src/lib/tools/ai-workflow-tool.js.map +1 -0
  670. package/src/lib/usage/ai-allotment-alerts.d.ts +72 -0
  671. package/src/lib/usage/ai-allotment-alerts.js +157 -0
  672. package/src/lib/usage/ai-allotment-alerts.js.map +1 -0
  673. package/src/lib/usage/ai-allotments.d.ts +125 -0
  674. package/src/lib/usage/ai-allotments.js +239 -0
  675. package/src/lib/usage/ai-allotments.js.map +1 -0
  676. package/src/lib/usage/ai-model-sample.d.ts +36 -0
  677. package/src/lib/usage/ai-model-sample.js +68 -0
  678. package/src/lib/usage/ai-model-sample.js.map +1 -0
  679. package/src/lib/usage/ai-usage-alerts.d.ts +55 -0
  680. package/src/lib/usage/ai-usage-alerts.js +114 -0
  681. package/src/lib/usage/ai-usage-alerts.js.map +1 -0
  682. package/src/lib/usage/ai-usage-by-user.d.ts +161 -0
  683. package/src/lib/usage/ai-usage-by-user.js +211 -0
  684. package/src/lib/usage/ai-usage-by-user.js.map +1 -0
  685. package/src/lib/usage/ai-usage-eraser.d.ts +29 -0
  686. package/src/lib/usage/ai-usage-eraser.js +40 -0
  687. package/src/lib/usage/ai-usage-eraser.js.map +1 -0
  688. package/src/lib/usage/ai-usage-meter.d.ts +39 -0
  689. package/src/lib/usage/ai-usage-meter.js +85 -0
  690. package/src/lib/usage/ai-usage-meter.js.map +1 -0
  691. package/src/lib/usage/ai-usage-wire.d.ts +184 -0
  692. package/src/lib/usage/ai-usage-wire.js +98 -0
  693. package/src/lib/usage/ai-usage-wire.js.map +1 -0
  694. package/src/lib/usage/assist-ceiling.d.ts +87 -0
  695. package/src/lib/usage/assist-ceiling.js +110 -0
  696. package/src/lib/usage/assist-ceiling.js.map +1 -0
  697. package/src/lib/usage/assist-free-taste.d.ts +225 -0
  698. package/src/lib/usage/assist-free-taste.js +308 -0
  699. package/src/lib/usage/assist-free-taste.js.map +1 -0
  700. package/src/lib/usage/assist-refusals.d.ts +69 -0
  701. package/src/lib/usage/assist-refusals.js +79 -0
  702. package/src/lib/usage/assist-refusals.js.map +1 -0
  703. package/src/lib/usage/assist-signal-mining.d.ts +375 -0
  704. package/src/lib/usage/assist-signal-mining.js +344 -0
  705. package/src/lib/usage/assist-signal-mining.js.map +1 -0
  706. package/src/lib/usage/assist-usage.d.ts +571 -0
  707. package/src/lib/usage/assist-usage.js +978 -0
  708. package/src/lib/usage/assist-usage.js.map +1 -0
  709. package/src/lib/usage/staff-org-ai.d.ts +242 -0
  710. package/src/lib/usage/staff-org-ai.js +173 -0
  711. package/src/lib/usage/staff-org-ai.js.map +1 -0
  712. package/src/lib/usage/staff-org-usage-ai.d.ts +83 -0
  713. package/src/lib/usage/staff-org-usage-ai.js +59 -0
  714. package/src/lib/usage/staff-org-usage-ai.js.map +1 -0
  715. package/src/lib/usage/staff-orgs-ai-spend.d.ts +83 -0
  716. package/src/lib/usage/staff-orgs-ai-spend.js +114 -0
  717. package/src/lib/usage/staff-orgs-ai-spend.js.map +1 -0
@@ -0,0 +1,159 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { AI_BUILD_PLAN_CREATION_NOUNS, aiPlanUndeclaredRefs } from "./ai-build-plan.js";
17
+ export const AI_PAGE_TYPES = [
18
+ {
19
+ id: 'landing',
20
+ label: 'Landing',
21
+ purpose: 'a landing page that makes one offer and asks for one action'
22
+ },
23
+ {
24
+ id: 'about',
25
+ label: 'About',
26
+ purpose: 'an about page: who the business is, what it stands for and who is behind it'
27
+ },
28
+ {
29
+ id: 'pricing',
30
+ label: 'Pricing',
31
+ purpose: 'a pricing page: the plans or packages, what each includes and how to start'
32
+ },
33
+ {
34
+ id: 'contact',
35
+ label: 'Contact',
36
+ purpose: 'a contact page: how to reach the business, and where and when'
37
+ },
38
+ {
39
+ id: 'blogIndex',
40
+ label: 'Blog index',
41
+ purpose: 'a blog index that lists the posts of the site’s content collection'
42
+ },
43
+ {
44
+ id: 'product',
45
+ label: 'Product',
46
+ purpose: 'a page about one product: what it is, who it is for and how to get it'
47
+ },
48
+ {
49
+ id: 'service',
50
+ label: 'Service',
51
+ purpose: 'a page about one service: what it covers, how it works and how to book it'
52
+ },
53
+ {
54
+ id: 'event',
55
+ label: 'Event',
56
+ purpose: 'an event page: what it is, when and where, and how to attend'
57
+ }
58
+ ];
59
+ const PAGE_TYPE_BY_ID = new Map(AI_PAGE_TYPES.map((type)=>[
60
+ type.id,
61
+ type
62
+ ]));
63
+ /** The definition of a page type id, or `null` for anything else. */ export function aiPageTypeDefinition(id) {
64
+ var _PAGE_TYPE_BY_ID_get;
65
+ return typeof id === 'string' ? (_PAGE_TYPE_BY_ID_get = PAGE_TYPE_BY_ID.get(id)) != null ? _PAGE_TYPE_BY_ID_get : null : null;
66
+ }
67
+ /** A page job's inputs, or the sentence the door refuses them with. */ export function parseAiPageJobInputs(inputs) {
68
+ const raw = inputs == null ? void 0 : inputs['pageType'];
69
+ if (raw === undefined || raw === null || raw === '') return {
70
+ pageType: null
71
+ };
72
+ const definition = aiPageTypeDefinition(raw);
73
+ return definition ? {
74
+ pageType: definition.id
75
+ } : `pageType must be one of ${AI_PAGE_TYPES.map((type)=>type.id).join(', ')}`;
76
+ }
77
+ /**
78
+ * What the plan asks to be created that a page job does not build, in the
79
+ * order the plan lists it, each named once: every entry is something a
80
+ * member makes first.
81
+ */ export function aiPagePlanPrerequisites(plan) {
82
+ const seen = new Set();
83
+ const prerequisites = [];
84
+ const add = (kind, name)=>{
85
+ const key = `${kind}:${name.toLowerCase()}`;
86
+ if (seen.has(key)) return;
87
+ seen.add(key);
88
+ prerequisites.push({
89
+ kind,
90
+ name
91
+ });
92
+ };
93
+ for (const entry of plan.create){
94
+ if (!AI_PAGE_CREATE_KINDS.includes(entry.kind)) add(entry.kind, entry.name);
95
+ }
96
+ // A reference the create list does not carry is refused by the plan rules
97
+ // before a plan is kept: rule 2 for a screen's layout, rule 7 for anything
98
+ // else (`plan-creation-undeclared`, AGL-3040). A plan confirmed before that
99
+ // rule existed can still carry one. It is named as a component: the
100
+ // reference carries no kind, and the refusal must say where one is made.
101
+ for (const { name } of aiPlanUndeclaredRefs(plan))add('component', name);
102
+ return prerequisites;
103
+ }
104
+ /**
105
+ * The creations a page job builds itself from its own plan (AGL-3031): the
106
+ * layout the page renders inside, and the forms and components it places.
107
+ * Each is built before the page, as a draft, by the step that builds that
108
+ * kind on its own. The plan step is told this list before it answers, and
109
+ * the plan rules refuse a creation outside it with the one re-ask every rule
110
+ * gets, so a plan that needs another never reaches a member's Confirm.
111
+ */ export const AI_PAGE_CREATE_KINDS = [
112
+ 'layout',
113
+ 'form',
114
+ 'component'
115
+ ];
116
+ /**
117
+ * Why a page job cannot build a plan of this SHAPE — no page, several pages,
118
+ * a page with no sections — in a sentence a member reads; `null` when the
119
+ * shape is one it builds. The plan step holds a plan to it with a re-ask, and
120
+ * the doors hold a confirmed plan to it again through `aiPagePlanRefusal`.
121
+ */ export function aiPagePlanShapeRefusal(plan) {
122
+ if (plan.screens.length === 0) {
123
+ return 'This plan has no page to build. Describe the page again.';
124
+ }
125
+ if (plan.screens.length > 1) {
126
+ return `This plan builds ${plan.screens.length} pages, and a page job builds one. Describe each page on its own.`;
127
+ }
128
+ if (!plan.screens[0].sections.length) {
129
+ return 'This plan’s page has no sections to build. Describe the page again.';
130
+ }
131
+ return null;
132
+ }
133
+ /**
134
+ * Why a page job cannot build this plan, in a sentence a member reads when
135
+ * confirming it; `null` when it can. A page job builds exactly one screen,
136
+ * from what the site already has.
137
+ */ export function aiPagePlanRefusal(plan) {
138
+ const shape = aiPagePlanShapeRefusal(plan);
139
+ if (shape) return shape;
140
+ const prerequisites = aiPagePlanPrerequisites(plan);
141
+ if (!prerequisites.length) return null;
142
+ const parts = prerequisites.map(({ kind, name })=>`the ${AI_BUILD_PLAN_CREATION_NOUNS[kind].noun} “${name}” ${AI_BUILD_PLAN_CREATION_NOUNS[kind].where}`);
143
+ const listed = parts.length === 1 ? parts[0] : `${parts.slice(0, -1).join(', ')} and ${parts[parts.length - 1]}`;
144
+ return `This page needs what the site does not have yet. Create ${listed}, then describe the page again.`;
145
+ }
146
+ /**
147
+ * Why a page job cannot build the creations its plan names ON THIS SITE NOW,
148
+ * in a sentence a member reads when confirming it: what the workspace's plan
149
+ * does not include, or what the site has no room left for. The plan step was
150
+ * told what could be created, so this is the site changing between the plan
151
+ * and its confirmation.
152
+ */ export function aiPageCreationRefusal(refused) {
153
+ if (!refused.length) return null;
154
+ const parts = refused.map(({ kind, name, reason })=>`the ${AI_BUILD_PLAN_CREATION_NOUNS[kind].noun} “${name}”, because ${reason}`);
155
+ const listed = parts.length === 1 ? parts[0] : `${parts.slice(0, -1).join('; ')}; and ${parts[parts.length - 1]}`;
156
+ return `This page cannot be built as planned: it creates ${listed}. Describe the page again.`;
157
+ }
158
+
159
+ //# sourceMappingURL=ai-page-job.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-page-job.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AI_BUILD_PLAN_CREATION_NOUNS,\n aiPlanUndeclaredRefs,\n type AiBuildPlan,\n type AiBuildPlanCreateKind,\n} from './ai-build-plan'\nimport type { AiPlanUncreatable } from './ai-plan-capabilities'\n\n/**\n * What a page job is (AGL-2907): the page types a brief may name, the inputs\n * the job doors admit, and the plans a page generator can build.\n *\n * A page job builds ONE screen. It places the site's components by id, binds\n * its forms by id, and renders inside a layout — and since AGL-3031 it first\n * builds the layout, forms and components its own plan creates, in the same\n * job, through the steps that own them, so a doctrine-correct plan is one it\n * finishes rather than one it sends the member away from. Anything else a\n * plan creates — a template, a theme change, a dataset, an email — is another\n * job's work, and such a plan is refused before anything is spent, with a\n * sentence naming what to make first.\n *\n * This module imports nothing at runtime, so the doors, the step, the console\n * dialog and the specs read one vocabulary.\n */\n\nexport type AiPageType =\n | 'landing'\n | 'about'\n | 'pricing'\n | 'contact'\n | 'blogIndex'\n | 'product'\n | 'service'\n | 'event'\n\nexport interface AiPageTypeDefinition {\n id: AiPageType\n /** The chip's label in the Describe dialog. */\n label: string\n /** What the page is for, as the plan and the generation are told. */\n purpose: string\n}\n\nexport const AI_PAGE_TYPES: readonly AiPageTypeDefinition[] = [\n {\n id: 'landing',\n label: 'Landing',\n purpose: 'a landing page that makes one offer and asks for one action',\n },\n {\n id: 'about',\n label: 'About',\n purpose: 'an about page: who the business is, what it stands for and who is behind it',\n },\n {\n id: 'pricing',\n label: 'Pricing',\n purpose: 'a pricing page: the plans or packages, what each includes and how to start',\n },\n {\n id: 'contact',\n label: 'Contact',\n purpose: 'a contact page: how to reach the business, and where and when',\n },\n {\n id: 'blogIndex',\n label: 'Blog index',\n purpose: 'a blog index that lists the posts of the site’s content collection',\n },\n {\n id: 'product',\n label: 'Product',\n purpose: 'a page about one product: what it is, who it is for and how to get it',\n },\n {\n id: 'service',\n label: 'Service',\n purpose: 'a page about one service: what it covers, how it works and how to book it',\n },\n {\n id: 'event',\n label: 'Event',\n purpose: 'an event page: what it is, when and where, and how to attend',\n },\n]\n\nconst PAGE_TYPE_BY_ID = new Map(AI_PAGE_TYPES.map((type) => [type.id, type]))\n\n/** The definition of a page type id, or `null` for anything else. */\nexport function aiPageTypeDefinition(id: unknown): AiPageTypeDefinition | null {\n return typeof id === 'string' ? (PAGE_TYPE_BY_ID.get(id as AiPageType) ?? null) : null\n}\n\nexport interface AiPageJobInputs {\n /** The type the member picked; `null` when they picked none. */\n pageType: AiPageType | null\n}\n\n/** A page job's inputs, or the sentence the door refuses them with. */\nexport function parseAiPageJobInputs(\n inputs: Readonly<Record<string, unknown>> | null | undefined,\n): AiPageJobInputs | string {\n const raw = inputs?.['pageType']\n if (raw === undefined || raw === null || raw === '') return { pageType: null }\n const definition = aiPageTypeDefinition(raw)\n return definition\n ? { pageType: definition.id }\n : `pageType must be one of ${AI_PAGE_TYPES.map((type) => type.id).join(', ')}`\n}\n\n/** A creation a plan names, as the refusal lists it. */\nexport interface AiPagePrerequisite {\n kind: AiBuildPlanCreateKind\n name: string\n}\n\n/**\n * What the plan asks to be created that a page job does not build, in the\n * order the plan lists it, each named once: every entry is something a\n * member makes first.\n */\nexport function aiPagePlanPrerequisites(plan: AiBuildPlan): AiPagePrerequisite[] {\n const seen = new Set<string>()\n const prerequisites: AiPagePrerequisite[] = []\n const add = (kind: AiBuildPlanCreateKind, name: string) => {\n const key = `${kind}:${name.toLowerCase()}`\n if (seen.has(key)) return\n seen.add(key)\n prerequisites.push({ kind, name })\n }\n for (const entry of plan.create) {\n if (!AI_PAGE_CREATE_KINDS.includes(entry.kind)) add(entry.kind, entry.name)\n }\n // A reference the create list does not carry is refused by the plan rules\n // before a plan is kept: rule 2 for a screen's layout, rule 7 for anything\n // else (`plan-creation-undeclared`, AGL-3040). A plan confirmed before that\n // rule existed can still carry one. It is named as a component: the\n // reference carries no kind, and the refusal must say where one is made.\n for (const { name } of aiPlanUndeclaredRefs(plan)) add('component', name)\n return prerequisites\n}\n\n/**\n * The creations a page job builds itself from its own plan (AGL-3031): the\n * layout the page renders inside, and the forms and components it places.\n * Each is built before the page, as a draft, by the step that builds that\n * kind on its own. The plan step is told this list before it answers, and\n * the plan rules refuse a creation outside it with the one re-ask every rule\n * gets, so a plan that needs another never reaches a member's Confirm.\n */\nexport const AI_PAGE_CREATE_KINDS: readonly AiBuildPlanCreateKind[] = ['layout', 'form', 'component']\n\n/**\n * Why a page job cannot build a plan of this SHAPE — no page, several pages,\n * a page with no sections — in a sentence a member reads; `null` when the\n * shape is one it builds. The plan step holds a plan to it with a re-ask, and\n * the doors hold a confirmed plan to it again through `aiPagePlanRefusal`.\n */\nexport function aiPagePlanShapeRefusal(plan: AiBuildPlan): string | null {\n if (plan.screens.length === 0) {\n return 'This plan has no page to build. Describe the page again.'\n }\n if (plan.screens.length > 1) {\n return `This plan builds ${plan.screens.length} pages, and a page job builds one. Describe each page on its own.`\n }\n if (!plan.screens[0].sections.length) {\n return 'This plan’s page has no sections to build. Describe the page again.'\n }\n return null\n}\n\n/**\n * Why a page job cannot build this plan, in a sentence a member reads when\n * confirming it; `null` when it can. A page job builds exactly one screen,\n * from what the site already has.\n */\nexport function aiPagePlanRefusal(plan: AiBuildPlan): string | null {\n const shape = aiPagePlanShapeRefusal(plan)\n if (shape) return shape\n const prerequisites = aiPagePlanPrerequisites(plan)\n if (!prerequisites.length) return null\n const parts = prerequisites.map(\n ({ kind, name }) => `the ${AI_BUILD_PLAN_CREATION_NOUNS[kind].noun} “${name}” ${AI_BUILD_PLAN_CREATION_NOUNS[kind].where}`,\n )\n const listed =\n parts.length === 1 ? parts[0] : `${parts.slice(0, -1).join(', ')} and ${parts[parts.length - 1]}`\n return `This page needs what the site does not have yet. Create ${listed}, then describe the page again.`\n}\n\n/**\n * Why a page job cannot build the creations its plan names ON THIS SITE NOW,\n * in a sentence a member reads when confirming it: what the workspace's plan\n * does not include, or what the site has no room left for. The plan step was\n * told what could be created, so this is the site changing between the plan\n * and its confirmation.\n */\nexport function aiPageCreationRefusal(refused: readonly AiPlanUncreatable[]): string | null {\n if (!refused.length) return null\n const parts = refused.map(\n ({ kind, name, reason }) => `the ${AI_BUILD_PLAN_CREATION_NOUNS[kind].noun} “${name}”, because ${reason}`,\n )\n const listed =\n parts.length === 1 ? parts[0] : `${parts.slice(0, -1).join('; ')}; and ${parts[parts.length - 1]}`\n return `This page cannot be built as planned: it creates ${listed}. Describe the page again.`\n}\n"],"names":["AI_BUILD_PLAN_CREATION_NOUNS","aiPlanUndeclaredRefs","AI_PAGE_TYPES","id","label","purpose","PAGE_TYPE_BY_ID","Map","map","type","aiPageTypeDefinition","get","parseAiPageJobInputs","inputs","raw","undefined","pageType","definition","join","aiPagePlanPrerequisites","plan","seen","Set","prerequisites","add","kind","name","key","toLowerCase","has","push","entry","create","AI_PAGE_CREATE_KINDS","includes","aiPagePlanShapeRefusal","screens","length","sections","aiPagePlanRefusal","shape","parts","noun","where","listed","slice","aiPageCreationRefusal","refused","reason"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,4BAA4B,EAC5BC,oBAAoB,QAGf,qBAAiB;AAsCxB,OAAO,MAAMC,gBAAiD;IAC5D;QACEC,IAAI;QACJC,OAAO;QACPC,SAAS;IACX;IACA;QACEF,IAAI;QACJC,OAAO;QACPC,SAAS;IACX;IACA;QACEF,IAAI;QACJC,OAAO;QACPC,SAAS;IACX;IACA;QACEF,IAAI;QACJC,OAAO;QACPC,SAAS;IACX;IACA;QACEF,IAAI;QACJC,OAAO;QACPC,SAAS;IACX;IACA;QACEF,IAAI;QACJC,OAAO;QACPC,SAAS;IACX;IACA;QACEF,IAAI;QACJC,OAAO;QACPC,SAAS;IACX;IACA;QACEF,IAAI;QACJC,OAAO;QACPC,SAAS;IACX;CACD,CAAA;AAED,MAAMC,kBAAkB,IAAIC,IAAIL,cAAcM,GAAG,CAAC,CAACC,OAAS;QAACA,KAAKN,EAAE;QAAEM;KAAK;AAE3E,mEAAmE,GACnE,OAAO,SAASC,qBAAqBP,EAAW;QACbG;IAAjC,OAAO,OAAOH,OAAO,YAAYG,uBAAAA,gBAAgBK,GAAG,CAACR,eAApBG,uBAAyC,OAAQ;AACpF;AAOA,qEAAqE,GACrE,OAAO,SAASM,qBACdC,MAA4D;IAE5D,MAAMC,MAAMD,0BAAAA,MAAQ,CAAC,WAAW;IAChC,IAAIC,QAAQC,aAAaD,QAAQ,QAAQA,QAAQ,IAAI,OAAO;QAAEE,UAAU;IAAK;IAC7E,MAAMC,aAAaP,qBAAqBI;IACxC,OAAOG,aACH;QAAED,UAAUC,WAAWd,EAAE;IAAC,IAC1B,CAAC,wBAAwB,EAAED,cAAcM,GAAG,CAAC,CAACC,OAASA,KAAKN,EAAE,EAAEe,IAAI,CAAC,OAAO;AAClF;AAQA;;;;CAIC,GACD,OAAO,SAASC,wBAAwBC,IAAiB;IACvD,MAAMC,OAAO,IAAIC;IACjB,MAAMC,gBAAsC,EAAE;IAC9C,MAAMC,MAAM,CAACC,MAA6BC;QACxC,MAAMC,MAAM,GAAGF,KAAK,CAAC,EAAEC,KAAKE,WAAW,IAAI;QAC3C,IAAIP,KAAKQ,GAAG,CAACF,MAAM;QACnBN,KAAKG,GAAG,CAACG;QACTJ,cAAcO,IAAI,CAAC;YAAEL;YAAMC;QAAK;IAClC;IACA,KAAK,MAAMK,SAASX,KAAKY,MAAM,CAAE;QAC/B,IAAI,CAACC,qBAAqBC,QAAQ,CAACH,MAAMN,IAAI,GAAGD,IAAIO,MAAMN,IAAI,EAAEM,MAAML,IAAI;IAC5E;IACA,0EAA0E;IAC1E,2EAA2E;IAC3E,4EAA4E;IAC5E,oEAAoE;IACpE,yEAAyE;IACzE,KAAK,MAAM,EAAEA,IAAI,EAAE,IAAIzB,qBAAqBmB,MAAOI,IAAI,aAAaE;IACpE,OAAOH;AACT;AAEA;;;;;;;CAOC,GACD,OAAO,MAAMU,uBAAyD;IAAC;IAAU;IAAQ;CAAY,CAAA;AAErG;;;;;CAKC,GACD,OAAO,SAASE,uBAAuBf,IAAiB;IACtD,IAAIA,KAAKgB,OAAO,CAACC,MAAM,KAAK,GAAG;QAC7B,OAAO;IACT;IACA,IAAIjB,KAAKgB,OAAO,CAACC,MAAM,GAAG,GAAG;QAC3B,OAAO,CAAC,iBAAiB,EAAEjB,KAAKgB,OAAO,CAACC,MAAM,CAAC,iEAAiE,CAAC;IACnH;IACA,IAAI,CAACjB,KAAKgB,OAAO,CAAC,EAAE,CAACE,QAAQ,CAACD,MAAM,EAAE;QACpC,OAAO;IACT;IACA,OAAO;AACT;AAEA;;;;CAIC,GACD,OAAO,SAASE,kBAAkBnB,IAAiB;IACjD,MAAMoB,QAAQL,uBAAuBf;IACrC,IAAIoB,OAAO,OAAOA;IAClB,MAAMjB,gBAAgBJ,wBAAwBC;IAC9C,IAAI,CAACG,cAAcc,MAAM,EAAE,OAAO;IAClC,MAAMI,QAAQlB,cAAcf,GAAG,CAC7B,CAAC,EAAEiB,IAAI,EAAEC,IAAI,EAAE,GAAK,CAAC,IAAI,EAAE1B,4BAA4B,CAACyB,KAAK,CAACiB,IAAI,CAAC,EAAE,EAAEhB,KAAK,EAAE,EAAE1B,4BAA4B,CAACyB,KAAK,CAACkB,KAAK,EAAE;IAE5H,MAAMC,SACJH,MAAMJ,MAAM,KAAK,IAAII,KAAK,CAAC,EAAE,GAAG,GAAGA,MAAMI,KAAK,CAAC,GAAG,CAAC,GAAG3B,IAAI,CAAC,MAAM,KAAK,EAAEuB,KAAK,CAACA,MAAMJ,MAAM,GAAG,EAAE,EAAE;IACnG,OAAO,CAAC,wDAAwD,EAAEO,OAAO,+BAA+B,CAAC;AAC3G;AAEA;;;;;;CAMC,GACD,OAAO,SAASE,sBAAsBC,OAAqC;IACzE,IAAI,CAACA,QAAQV,MAAM,EAAE,OAAO;IAC5B,MAAMI,QAAQM,QAAQvC,GAAG,CACvB,CAAC,EAAEiB,IAAI,EAAEC,IAAI,EAAEsB,MAAM,EAAE,GAAK,CAAC,IAAI,EAAEhD,4BAA4B,CAACyB,KAAK,CAACiB,IAAI,CAAC,EAAE,EAAEhB,KAAK,WAAW,EAAEsB,QAAQ;IAE3G,MAAMJ,SACJH,MAAMJ,MAAM,KAAK,IAAII,KAAK,CAAC,EAAE,GAAG,GAAGA,MAAMI,KAAK,CAAC,GAAG,CAAC,GAAG3B,IAAI,CAAC,MAAM,MAAM,EAAEuB,KAAK,CAACA,MAAMJ,MAAM,GAAG,EAAE,EAAE;IACpG,OAAO,CAAC,iDAAiD,EAAEO,OAAO,0BAA0B,CAAC;AAC/F"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type { HostAccessRole } from '@aglyn/aglyn/foundation/definitions/organization.types';
18
+ import type { PluginOrgPermissionDeclaration } from '@aglyn/aglyn/plugin-manager/plugin-entitlements';
19
+ /**
20
+ * The two AI keys (AGL-2927): `ai.use` for the assistants, `ai.generate` for
21
+ * generation jobs and AI edits.
22
+ */
23
+ export type AiPermission = 'ai.use' | 'ai.generate';
24
+ /** The AI keys, in the order the editors render them. */
25
+ export declare const AI_PERMISSION_KEYS: readonly AiPermission[];
26
+ export declare function isAiPermission(value: unknown): value is AiPermission;
27
+ /** One verdict per AI key. */
28
+ export type AiPermissionVerdict = Record<AiPermission, boolean>;
29
+ /**
30
+ * The AI keys as this plugin declares them into the org permission catalog
31
+ * (AGL-2927, AGL-2984): listed on the role editor, stored on custom roles and
32
+ * per-member overrides, and decided per site for a collaborator.
33
+ *
34
+ * Both are enforced at the AI doors themselves — the chat and copy
35
+ * assistant doors through `memberHasPermissionOnHost`, and every door built
36
+ * on `aiGateLadder` through its `permission` option — so a role that unticks
37
+ * one closes the door, not only the button.
38
+ *
39
+ * Owners, admins and editors hold both by default: editors work on content,
40
+ * the AI doors included. A viewer holds neither, because read-only includes
41
+ * asking the assistant nothing: a viewer spends none of the workspace's AI
42
+ * credits. A site collaborator holds both on a site where their host role
43
+ * may change content.
44
+ */
45
+ export declare const AI_ORG_PERMISSIONS: readonly PluginOrgPermissionDeclaration[];
46
+ /** What each host role grants of the AI keys, before any per-site toggle. */
47
+ export declare const HOST_ROLE_AI_PERMISSIONS: Readonly<Record<HostAccessRole, AiPermissionVerdict>>;
48
+ /** The AI keys of a verdict map the shell resolved; an absent key is refused. */
49
+ export declare function aiPermissionsOf(granted: Readonly<Record<string, boolean>> | null | undefined): AiPermissionVerdict;
@@ -0,0 +1,97 @@
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
+ */ /** The AI keys, in the order the editors render them. */ export const AI_PERMISSION_KEYS = [
17
+ 'ai.use',
18
+ 'ai.generate'
19
+ ];
20
+ export function isAiPermission(value) {
21
+ return value === 'ai.use' || value === 'ai.generate';
22
+ }
23
+ /**
24
+ * The host roles that may change a site's content may also ask a model to
25
+ * change it. A viewer who cannot edit has nothing for a generation to land
26
+ * on, and would spend the workspace's credits producing it anyway.
27
+ */ const CONTENT_ROLES = {
28
+ admin: true,
29
+ editor: true,
30
+ author: true,
31
+ viewer: false
32
+ };
33
+ /**
34
+ * The AI keys as this plugin declares them into the org permission catalog
35
+ * (AGL-2927, AGL-2984): listed on the role editor, stored on custom roles and
36
+ * per-member overrides, and decided per site for a collaborator.
37
+ *
38
+ * Both are enforced at the AI doors themselves — the chat and copy
39
+ * assistant doors through `memberHasPermissionOnHost`, and every door built
40
+ * on `aiGateLadder` through its `permission` option — so a role that unticks
41
+ * one closes the door, not only the button.
42
+ *
43
+ * Owners, admins and editors hold both by default: editors work on content,
44
+ * the AI doors included. A viewer holds neither, because read-only includes
45
+ * asking the assistant nothing: a viewer spends none of the workspace's AI
46
+ * credits. A site collaborator holds both on a site where their host role
47
+ * may change content.
48
+ */ export const AI_ORG_PERMISSIONS = [
49
+ {
50
+ key: 'ai.use',
51
+ label: 'Use AI assistance',
52
+ description: 'Ask the assistant, rewrite copy with AI, and generate a section.',
53
+ roleDefaults: {
54
+ owner: true,
55
+ admin: true,
56
+ editor: true,
57
+ viewer: false
58
+ },
59
+ hostRoleDefaults: CONTENT_ROLES
60
+ },
61
+ {
62
+ key: 'ai.generate',
63
+ label: 'Generate with AI',
64
+ description: 'Run AI generation jobs and AI edits: pages, components, emails, campaigns, products, CRM, insights, workflows.',
65
+ roleDefaults: {
66
+ owner: true,
67
+ admin: true,
68
+ editor: true,
69
+ viewer: false
70
+ },
71
+ hostRoleDefaults: CONTENT_ROLES
72
+ }
73
+ ];
74
+ const HOST_ROLES = [
75
+ 'admin',
76
+ 'editor',
77
+ 'author',
78
+ 'viewer'
79
+ ];
80
+ /** What each host role grants of the AI keys, before any per-site toggle. */ export const HOST_ROLE_AI_PERMISSIONS = Object.fromEntries(HOST_ROLES.map((role)=>[
81
+ role,
82
+ Object.fromEntries(AI_ORG_PERMISSIONS.map((permission)=>{
83
+ var _permission_hostRoleDefaults;
84
+ return [
85
+ permission.key,
86
+ ((_permission_hostRoleDefaults = permission.hostRoleDefaults) == null ? void 0 : _permission_hostRoleDefaults[role]) === true
87
+ ];
88
+ }))
89
+ ]));
90
+ /** The AI keys of a verdict map the shell resolved; an absent key is refused. */ export function aiPermissionsOf(granted) {
91
+ return {
92
+ 'ai.use': (granted == null ? void 0 : granted['ai.use']) === true,
93
+ 'ai.generate': (granted == null ? void 0 : granted['ai.generate']) === true
94
+ };
95
+ }
96
+
97
+ //# sourceMappingURL=ai-permissions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/model/ai-permissions.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 type { HostAccessRole } from '@aglyn/aglyn/foundation/definitions/organization.types'\nimport type { PluginOrgPermissionDeclaration } from '@aglyn/aglyn/plugin-manager/plugin-entitlements'\n\n/**\n * The two AI keys (AGL-2927): `ai.use` for the assistants, `ai.generate` for\n * generation jobs and AI edits.\n */\nexport type AiPermission = 'ai.use' | 'ai.generate'\n\n/** The AI keys, in the order the editors render them. */\nexport const AI_PERMISSION_KEYS: readonly AiPermission[] = ['ai.use', 'ai.generate']\n\nexport function isAiPermission(value: unknown): value is AiPermission {\n return value === 'ai.use' || value === 'ai.generate'\n}\n\n/** One verdict per AI key. */\nexport type AiPermissionVerdict = Record<AiPermission, boolean>\n\n/**\n * The host roles that may change a site's content may also ask a model to\n * change it. A viewer who cannot edit has nothing for a generation to land\n * on, and would spend the workspace's credits producing it anyway.\n */\nconst CONTENT_ROLES: Readonly<Record<HostAccessRole, boolean>> = {\n admin: true,\n editor: true,\n author: true,\n viewer: false,\n}\n\n/**\n * The AI keys as this plugin declares them into the org permission catalog\n * (AGL-2927, AGL-2984): listed on the role editor, stored on custom roles and\n * per-member overrides, and decided per site for a collaborator.\n *\n * Both are enforced at the AI doors themselves — the chat and copy\n * assistant doors through `memberHasPermissionOnHost`, and every door built\n * on `aiGateLadder` through its `permission` option — so a role that unticks\n * one closes the door, not only the button.\n *\n * Owners, admins and editors hold both by default: editors work on content,\n * the AI doors included. A viewer holds neither, because read-only includes\n * asking the assistant nothing: a viewer spends none of the workspace's AI\n * credits. A site collaborator holds both on a site where their host role\n * may change content.\n */\nexport const AI_ORG_PERMISSIONS: readonly PluginOrgPermissionDeclaration[] = [\n {\n key: 'ai.use',\n label: 'Use AI assistance',\n description: 'Ask the assistant, rewrite copy with AI, and generate a section.',\n roleDefaults: { owner: true, admin: true, editor: true, viewer: false },\n hostRoleDefaults: CONTENT_ROLES,\n },\n {\n key: 'ai.generate',\n label: 'Generate with AI',\n description:\n 'Run AI generation jobs and AI edits: pages, components, emails, campaigns, products, CRM, insights, workflows.',\n roleDefaults: { owner: true, admin: true, editor: true, viewer: false },\n hostRoleDefaults: CONTENT_ROLES,\n },\n]\n\nconst HOST_ROLES: readonly HostAccessRole[] = ['admin', 'editor', 'author', 'viewer']\n\n/** What each host role grants of the AI keys, before any per-site toggle. */\nexport const HOST_ROLE_AI_PERMISSIONS: Readonly<Record<HostAccessRole, AiPermissionVerdict>> =\n Object.fromEntries(\n HOST_ROLES.map((role) => [\n role,\n Object.fromEntries(\n AI_ORG_PERMISSIONS.map((permission) => [\n permission.key,\n permission.hostRoleDefaults?.[role] === true,\n ]),\n ) as AiPermissionVerdict,\n ]),\n ) as Record<HostAccessRole, AiPermissionVerdict>\n\n/** The AI keys of a verdict map the shell resolved; an absent key is refused. */\nexport function aiPermissionsOf(\n granted: Readonly<Record<string, boolean>> | null | undefined,\n): AiPermissionVerdict {\n return {\n 'ai.use': granted?.['ai.use'] === true,\n 'ai.generate': granted?.['ai.generate'] === true,\n }\n}\n"],"names":["AI_PERMISSION_KEYS","isAiPermission","value","CONTENT_ROLES","admin","editor","author","viewer","AI_ORG_PERMISSIONS","key","label","description","roleDefaults","owner","hostRoleDefaults","HOST_ROLES","HOST_ROLE_AI_PERMISSIONS","Object","fromEntries","map","role","permission","aiPermissionsOf","granted"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAWD,uDAAuD,GACvD,OAAO,MAAMA,qBAA8C;IAAC;IAAU;CAAc,CAAA;AAEpF,OAAO,SAASC,eAAeC,KAAc;IAC3C,OAAOA,UAAU,YAAYA,UAAU;AACzC;AAKA;;;;CAIC,GACD,MAAMC,gBAA2D;IAC/DC,OAAO;IACPC,QAAQ;IACRC,QAAQ;IACRC,QAAQ;AACV;AAEA;;;;;;;;;;;;;;;CAeC,GACD,OAAO,MAAMC,qBAAgE;IAC3E;QACEC,KAAK;QACLC,OAAO;QACPC,aAAa;QACbC,cAAc;YAAEC,OAAO;YAAMT,OAAO;YAAMC,QAAQ;YAAME,QAAQ;QAAM;QACtEO,kBAAkBX;IACpB;IACA;QACEM,KAAK;QACLC,OAAO;QACPC,aACE;QACFC,cAAc;YAAEC,OAAO;YAAMT,OAAO;YAAMC,QAAQ;YAAME,QAAQ;QAAM;QACtEO,kBAAkBX;IACpB;CACD,CAAA;AAED,MAAMY,aAAwC;IAAC;IAAS;IAAU;IAAU;CAAS;AAErF,2EAA2E,GAC3E,OAAO,MAAMC,2BACXC,OAAOC,WAAW,CAChBH,WAAWI,GAAG,CAAC,CAACC,OAAS;QACvBA;QACAH,OAAOC,WAAW,CAChBV,mBAAmBW,GAAG,CAAC,CAACE;gBAEtBA;mBAFqC;gBACrCA,WAAWZ,GAAG;gBACdY,EAAAA,+BAAAA,WAAWP,gBAAgB,qBAA3BO,4BAA6B,CAACD,KAAK,MAAK;aACzC;;KAEJ,GAC6C;AAElD,+EAA+E,GAC/E,OAAO,SAASE,gBACdC,OAA6D;IAE7D,OAAO;QACL,UAAUA,CAAAA,2BAAAA,OAAS,CAAC,SAAS,MAAK;QAClC,eAAeA,CAAAA,2BAAAA,OAAS,CAAC,cAAc,MAAK;IAC9C;AACF"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { type AiBuildPlan, type AiBuildPlanCreateKind } from './ai-build-plan';
18
+ /**
19
+ * What a plan may create on one site (AGL-3030): the workspace's plan and the
20
+ * site's counts against its limits, narrowed to what the job itself builds.
21
+ *
22
+ * A plan that names a creation nothing can make is a dead end the member pays
23
+ * for twice: once for the plan, and again for the plan they describe after
24
+ * being told to make the creation by hand — which, on a workspace whose plan
25
+ * does not include it, they cannot. So the plan step is TOLD what may be
26
+ * created before it answers, and the plan rules refuse a creation outside it
27
+ * with the one re-ask every other rule gets.
28
+ *
29
+ * ── Where the doctrine builds inline ─────────────────────────────────────
30
+ *
31
+ * The building doctrine makes a repeat a reusable component and a form a
32
+ * saved form placed by id. A workspace whose plan keeps no reusable
33
+ * components can do neither: the create route refuses a component and a
34
+ * saved form on that entitlement. There, and only there, the doctrine builds
35
+ * inline instead — a form is a Form element the page carries with its fields
36
+ * inside it, which the site's submit route collects like any other, and a
37
+ * list's repeated items are drawn in one section (AGL-3071).
38
+ * `reusableComponents` is the one flag every validator reads for that.
39
+ *
40
+ * ── Kept out of the cached prefix ────────────────────────────────────────
41
+ *
42
+ * The capabilities are per workspace and per site, so they ride the plan's
43
+ * USER turn, never a system block: the doctrine's cached prefix stays one
44
+ * entry for the platform. The doctrine states the rule once — create only
45
+ * what the request says may be created, and build inline where it says the
46
+ * workspace keeps no reusable components — and the request states the facts.
47
+ *
48
+ * This module imports nothing at runtime beyond the plan's own model, so the
49
+ * validators, the plan step, the doors and their specs read one vocabulary.
50
+ * What a workspace's plan and counts come to is read by
51
+ * `readAiPlanCapabilities` in `jobs/ai-job-drafts.ts`, beside the band
52
+ * arithmetic the create route and the draft writer share.
53
+ */
54
+ /** One creation kind, as a job on this site may make it or not. */
55
+ export interface AiPlanCreation {
56
+ allowed: boolean;
57
+ /** How many more the site may hold; `null` when the plan counts none. */
58
+ left: number | null;
59
+ /**
60
+ * Why not, as a clause a sentence completes: "this workspace's plan does
61
+ * not include reusable components". `null` when allowed.
62
+ */
63
+ reason: string | null;
64
+ }
65
+ export interface AiPlanCapabilities {
66
+ /**
67
+ * Whether the workspace keeps reusable components and saved forms. Where
68
+ * it does not, the doctrine builds inline: a form is a Form element holding
69
+ * its fields, and a list's repeated items are drawn in one section.
70
+ */
71
+ reusableComponents: boolean;
72
+ /** Every creation kind a plan may name, and whether this job may make one here. */
73
+ create: Readonly<Record<AiBuildPlanCreateKind, AiPlanCreation>>;
74
+ /**
75
+ * Whether the workspace spends the Free taste, whose monthly credits are a
76
+ * wall (AGL-2925): a plan is then held to the sections the wall's worst
77
+ * case pays for (AGL-3070). Absent is `false`.
78
+ */
79
+ freeTaste?: boolean;
80
+ }
81
+ /** What a job of one kind builds from its own plan, where it builds only some creations. */
82
+ export interface AiPlanJobScope {
83
+ /** The job as a refusal names it: "a page job". */
84
+ noun: string;
85
+ /** The creation kinds the job builds itself; any other is refused before the plan is kept. */
86
+ creates: readonly AiBuildPlanCreateKind[];
87
+ }
88
+ /**
89
+ * Capabilities that restrict nothing: what a plan is held to when no
90
+ * workspace was read — an org-level job, an eval, a spec about something
91
+ * else. The doctrine applies whole.
92
+ */
93
+ export declare function aiUnrestrictedPlanCapabilities(): AiPlanCapabilities;
94
+ /**
95
+ * The workspace's capabilities narrowed to what a job of one kind builds.
96
+ * A creation the workspace itself cannot make keeps the workspace's reason,
97
+ * which is the one a member can act on; one the job does not build says so.
98
+ */
99
+ export declare function aiPlanCapabilitiesForJob(capabilities: AiPlanCapabilities, scope: AiPlanJobScope | null | undefined): AiPlanCapabilities;
100
+ /** "a layout", "an email design": a creation kind with its article. */
101
+ export declare function aiCreationNoun(kind: AiBuildPlanCreateKind): string;
102
+ /**
103
+ * The sentence a request states when the workspace keeps no reusable
104
+ * components. It says a list's repeated items go in one section (AGL-3071):
105
+ * "a repeated item in its own section" reads just as well as a section for
106
+ * each item, which is how a live About page's four practice areas came to be
107
+ * planned as four sections of one item.
108
+ */
109
+ export declare const AI_PLAN_INLINE_SENTENCE = "This workspace keeps no reusable components or saved forms: draw a list's repeated items in one section, and a form as a Form element holding its Form Fields.";
110
+ /**
111
+ * What the plan step's user turn says the job may create here: one line a
112
+ * kind, and the inline sentence where the workspace keeps no reusable
113
+ * components. Per workspace and per site, so it is never a system block.
114
+ */
115
+ export declare function aiPlanCapabilityLines(capabilities: AiPlanCapabilities): string[];
116
+ /** One creation a plan names that this job may not make here. */
117
+ export interface AiPlanUncreatable {
118
+ kind: AiBuildPlanCreateKind;
119
+ name: string;
120
+ /** The plan path of the creation: `create[2]`. */
121
+ path: string;
122
+ /** Why not, as a clause: "this site has room for 1 more". */
123
+ reason: string;
124
+ /** One customer-safe sentence: what was refused, why, and what to do instead. */
125
+ message: string;
126
+ }
127
+ /** The creations a plan names that the capabilities refuse, in plan order. */
128
+ export declare function aiPlanUncreatable(plan: Pick<AiBuildPlan, 'create'>, capabilities: AiPlanCapabilities): AiPlanUncreatable[];
129
+ /**
130
+ * Why the plan could not add one more creation of a kind here, and what to
131
+ * do instead; `null` when it could (AGL-3040). Counted past the creations of
132
+ * that kind the plan already names, as `aiPlanUncreatable` counts them, so a
133
+ * plan told to declare a creation is never told to declare one the next
134
+ * answer is refused for.
135
+ */
136
+ export declare function aiPlanUncreatableKind(plan: Pick<AiBuildPlan, 'create'>, kind: AiBuildPlanCreateKind, capabilities: AiPlanCapabilities): {
137
+ reason: string;
138
+ instead: string;
139
+ } | null;
@@ -0,0 +1,149 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ /**
3
+ * @license
4
+ * Copyright 2026 Aglyn LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */ import { AI_BUILD_PLAN_CREATE_KINDS, AI_BUILD_PLAN_CREATION_NOUNS } from "./ai-build-plan.js";
18
+ const ALLOWED = {
19
+ allowed: true,
20
+ left: null,
21
+ reason: null
22
+ };
23
+ /**
24
+ * Capabilities that restrict nothing: what a plan is held to when no
25
+ * workspace was read — an org-level job, an eval, a spec about something
26
+ * else. The doctrine applies whole.
27
+ */ export function aiUnrestrictedPlanCapabilities() {
28
+ return {
29
+ reusableComponents: true,
30
+ create: Object.fromEntries(AI_BUILD_PLAN_CREATE_KINDS.map((kind)=>[
31
+ kind,
32
+ ALLOWED
33
+ ]))
34
+ };
35
+ }
36
+ /**
37
+ * The workspace's capabilities narrowed to what a job of one kind builds.
38
+ * A creation the workspace itself cannot make keeps the workspace's reason,
39
+ * which is the one a member can act on; one the job does not build says so.
40
+ */ export function aiPlanCapabilitiesForJob(capabilities, scope) {
41
+ if (!scope) return capabilities;
42
+ const create = _extends({}, capabilities.create);
43
+ for (const kind of AI_BUILD_PLAN_CREATE_KINDS){
44
+ if (!create[kind].allowed || scope.creates.includes(kind)) continue;
45
+ create[kind] = {
46
+ allowed: false,
47
+ left: null,
48
+ reason: `${scope.noun} does not build one`
49
+ };
50
+ }
51
+ return _extends({}, capabilities, {
52
+ create
53
+ });
54
+ }
55
+ /** "a layout", "an email design": a creation kind with its article. */ export function aiCreationNoun(kind) {
56
+ const noun = AI_BUILD_PLAN_CREATION_NOUNS[kind].noun;
57
+ return `${/^[aeiou]/.test(noun) ? 'an' : 'a'} ${noun}`;
58
+ }
59
+ /**
60
+ * The sentence a request states when the workspace keeps no reusable
61
+ * components. It says a list's repeated items go in one section (AGL-3071):
62
+ * "a repeated item in its own section" reads just as well as a section for
63
+ * each item, which is how a live About page's four practice areas came to be
64
+ * planned as four sections of one item.
65
+ */ export const AI_PLAN_INLINE_SENTENCE = "This workspace keeps no reusable components or saved forms: draw a list's repeated items in one section, and a form as a Form element holding its Form Fields.";
66
+ /**
67
+ * What the plan step's user turn says the job may create here: one line a
68
+ * kind, and the inline sentence where the workspace keeps no reusable
69
+ * components. Per workspace and per site, so it is never a system block.
70
+ */ export function aiPlanCapabilityLines(capabilities) {
71
+ const lines = [
72
+ 'What this job may create on this site:'
73
+ ];
74
+ for (const kind of AI_BUILD_PLAN_CREATE_KINDS){
75
+ const entry = capabilities.create[kind];
76
+ const noun = AI_BUILD_PLAN_CREATION_NOUNS[kind].noun;
77
+ if (entry.allowed) {
78
+ lines.push(`- ${noun}: yes${entry.left === null ? '' : `, ${entry.left} more`}`);
79
+ } else {
80
+ var _entry_reason;
81
+ lines.push(`- ${noun}: no, because ${(_entry_reason = entry.reason) != null ? _entry_reason : 'it cannot be made here'}`);
82
+ }
83
+ }
84
+ if (!capabilities.reusableComponents) lines.push(AI_PLAN_INLINE_SENTENCE);
85
+ return lines;
86
+ }
87
+ /** What to do instead of a creation the job may not make, for the re-ask and the review. */ function insteadOf(kind, capabilities) {
88
+ switch(kind){
89
+ case 'component':
90
+ return capabilities.reusableComponents ? 'Place a component the site already has.' : "Draw a list's repeated items in one section instead.";
91
+ case 'form':
92
+ return capabilities.reusableComponents ? 'Place a form the site already has.' : 'Draw the form on the page instead, as a Form element holding its Form Fields.';
93
+ case 'layout':
94
+ return 'Put the page in a layout the site already has.';
95
+ case 'template':
96
+ return 'Build the page without a template.';
97
+ case 'theme-change':
98
+ return "Use the colors the theme already has.";
99
+ case 'dataset':
100
+ return 'Bind a dataset or collection the site already has, or keep the list short enough to write out.';
101
+ case 'email':
102
+ return 'Leave the email out of this job.';
103
+ }
104
+ }
105
+ /**
106
+ * Why the nth creation of a kind may not be made here, as a clause; `null`
107
+ * when it may. A kind the site may make only so many more of refuses the ones
108
+ * past that count, not the first of them.
109
+ */ function refusedReason(capability, nth) {
110
+ var _capability_reason;
111
+ const overCount = capability.allowed && capability.left !== null && nth > capability.left;
112
+ if (capability.allowed && !overCount) return null;
113
+ return overCount ? `this site has room for ${capability.left} more` : (_capability_reason = capability.reason) != null ? _capability_reason : 'it cannot be made here';
114
+ }
115
+ /** The creations a plan names that the capabilities refuse, in plan order. */ export function aiPlanUncreatable(plan, capabilities) {
116
+ const refused = [];
117
+ const counted = new Map();
118
+ plan.create.forEach((entry, index)=>{
119
+ var _counted_get;
120
+ const nth = ((_counted_get = counted.get(entry.kind)) != null ? _counted_get : 0) + 1;
121
+ counted.set(entry.kind, nth);
122
+ const reason = refusedReason(capabilities.create[entry.kind], nth);
123
+ if (reason === null) return;
124
+ refused.push({
125
+ kind: entry.kind,
126
+ name: entry.name,
127
+ path: `create[${index}]`,
128
+ reason,
129
+ message: `The plan creates ${aiCreationNoun(entry.kind)} named "${entry.name}", and ${reason}. ${insteadOf(entry.kind, capabilities)}`
130
+ });
131
+ });
132
+ return refused;
133
+ }
134
+ /**
135
+ * Why the plan could not add one more creation of a kind here, and what to
136
+ * do instead; `null` when it could (AGL-3040). Counted past the creations of
137
+ * that kind the plan already names, as `aiPlanUncreatable` counts them, so a
138
+ * plan told to declare a creation is never told to declare one the next
139
+ * answer is refused for.
140
+ */ export function aiPlanUncreatableKind(plan, kind, capabilities) {
141
+ const planned = plan.create.filter((entry)=>entry.kind === kind).length;
142
+ const reason = refusedReason(capabilities.create[kind], planned + 1);
143
+ return reason === null ? null : {
144
+ reason,
145
+ instead: insteadOf(kind, capabilities)
146
+ };
147
+ }
148
+
149
+ //# sourceMappingURL=ai-plan-capabilities.js.map