@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,132 @@
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
+ */ 'use client';
17
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
18
+ import { useSnackbar } from "@aglyn/shared-ui-snackstack";
19
+ import { authorizedFetch } from "@aglyn/shared-util-http/authorized-token";
20
+ import { useUser } from "@aglyn/tenant-feature-instance";
21
+ import { Checkbox, FormControlLabel, Stack } from "@mui/material";
22
+ import { useCallback, useState } from "react";
23
+ import { AI_PERMISSION_KEYS, HOST_ROLE_AI_PERMISSIONS } from "../model/ai-permissions.js";
24
+ /** What each toggle is called in the row. */ const TOGGLE_LABELS = {
25
+ 'ai.use': 'Assist',
26
+ 'ai.generate': 'Generate'
27
+ };
28
+ /**
29
+ * A collaborator's AI verdict on the site, as the row shows it: the roster
30
+ * copy the toggle door wrote, else the host role's default — which is what
31
+ * the doors resolve for a member document the toggle has never touched, so
32
+ * a row never shows a state the server does not hold.
33
+ */ export function collaboratorAiPermissions(member) {
34
+ var _ref, _HOST_ROLE_AI_PERMISSIONS_role, _ref1, _ref2;
35
+ const role = (_ref = member == null ? void 0 : member.role) != null ? _ref : 'editor';
36
+ const base = (_HOST_ROLE_AI_PERMISSIONS_role = HOST_ROLE_AI_PERMISSIONS[role]) != null ? _HOST_ROLE_AI_PERMISSIONS_role : HOST_ROLE_AI_PERMISSIONS.viewer;
37
+ const stored = member == null ? void 0 : member.aiPermissions;
38
+ return {
39
+ 'ai.use': (_ref1 = stored == null ? void 0 : stored['ai.use']) != null ? _ref1 : base['ai.use'],
40
+ 'ai.generate': (_ref2 = stored == null ? void 0 : stored['ai.generate']) != null ? _ref2 : base['ai.generate']
41
+ };
42
+ }
43
+ /**
44
+ * THE COLLABORATORS TABLE'S AI COLUMN (AGL-2927, AGL-2984): whether this
45
+ * person may open the AI doors ON THIS SITE, through the `hostMembers`
46
+ * zone. The host role sets the default; the boxes refine it, and the doors
47
+ * read the same answer, so an unticked box is a closed door rather than a
48
+ * hidden button. The owner is decided by the org role, and says so.
49
+ */ export function AiCollaboratorPermissionsCell(props) {
50
+ const { hostId, canManage, member } = props;
51
+ const { data: user } = useUser();
52
+ const { enqueueSnackbar } = useSnackbar();
53
+ const [busy, setBusy] = useState(false);
54
+ const memberId = member == null ? void 0 : member.$id;
55
+ const handleToggle = useCallback((key)=>async (_event, checked)=>{
56
+ if (!memberId || !hostId) return;
57
+ setBusy(true);
58
+ try {
59
+ const response = await authorizedFetch(user, '/api/ai/host-permissions', {
60
+ method: 'PATCH',
61
+ headers: {
62
+ 'Content-Type': 'application/json'
63
+ },
64
+ body: JSON.stringify({
65
+ hostId,
66
+ memberId,
67
+ aiPermissions: {
68
+ [key]: checked
69
+ }
70
+ })
71
+ });
72
+ const payload = await response.json().catch(()=>({}));
73
+ if (!response.ok) {
74
+ var _ref;
75
+ enqueueSnackbar((_ref = payload == null ? void 0 : payload.error) != null ? _ref : 'Member operation failed', {
76
+ variant: 'warning',
77
+ persist: false
78
+ });
79
+ return;
80
+ }
81
+ enqueueSnackbar('AI access updated', {
82
+ variant: 'success',
83
+ persist: false
84
+ });
85
+ } catch (error) {
86
+ console.error(error);
87
+ enqueueSnackbar('Member operation failed', {
88
+ variant: 'error'
89
+ });
90
+ } finally{
91
+ setBusy(false);
92
+ }
93
+ }, [
94
+ user,
95
+ hostId,
96
+ memberId,
97
+ enqueueSnackbar
98
+ ]);
99
+ if ((member == null ? void 0 : member.role) === 'owner') return /*#__PURE__*/ _jsx(_Fragment, {
100
+ children: 'By org role'
101
+ });
102
+ const verdict = collaboratorAiPermissions(member);
103
+ return(// An invited row has no member document to carry a toggle yet; it
104
+ // becomes settable once the invite is accepted, which is when the person
105
+ // gains the role the default derives from.
106
+ /*#__PURE__*/ _jsx(Stack, {
107
+ direction: "row",
108
+ spacing: 0,
109
+ children: AI_PERMISSION_KEYS.map((key)=>/*#__PURE__*/ _jsx(FormControlLabel, {
110
+ label: TOGGLE_LABELS[key],
111
+ slotProps: {
112
+ typography: {
113
+ variant: 'caption'
114
+ }
115
+ },
116
+ control: /*#__PURE__*/ _jsx(Checkbox, {
117
+ size: "small",
118
+ checked: verdict[key],
119
+ onChange: handleToggle(key),
120
+ disabled: busy || !canManage || (member == null ? void 0 : member.status) === 'invited',
121
+ slotProps: {
122
+ input: {
123
+ 'aria-label': `${TOGGLE_LABELS[key]} with AI`
124
+ }
125
+ }
126
+ })
127
+ }, key))
128
+ }));
129
+ }
130
+ AiCollaboratorPermissionsCell.displayName = 'AiCollaboratorPermissionsCell';
131
+
132
+ //# sourceMappingURL=ai-collaborator-permissions-column.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-collaborator-permissions-column.component.tsx"],"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'use client'\n\nimport type { HostAccessRole } from '@aglyn/aglyn/foundation/definitions/organization.types'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport { authorizedFetch } from '@aglyn/shared-util-http/authorized-token'\nimport { useUser } from '@aglyn/tenant-feature-instance'\nimport { Checkbox, FormControlLabel, Stack } from '@mui/material'\nimport { useCallback, useState } from 'react'\nimport {\n AI_PERMISSION_KEYS,\n HOST_ROLE_AI_PERMISSIONS,\n type AiPermission,\n type AiPermissionVerdict,\n} from '../model/ai-permissions'\n\n/** A roster row as the collaborators table hands it to a column. */\ninterface CollaboratorRow {\n $id?: string\n uid?: string\n role?: string\n status?: string\n aiPermissions?: Partial<AiPermissionVerdict>\n}\n\n/** What each toggle is called in the row. */\nconst TOGGLE_LABELS: Record<AiPermission, string> = {\n 'ai.use': 'Assist',\n 'ai.generate': 'Generate',\n}\n\n/**\n * A collaborator's AI verdict on the site, as the row shows it: the roster\n * copy the toggle door wrote, else the host role's default — which is what\n * the doors resolve for a member document the toggle has never touched, so\n * a row never shows a state the server does not hold.\n */\nexport function collaboratorAiPermissions(member: CollaboratorRow | undefined): AiPermissionVerdict {\n const role = (member?.role ?? 'editor') as HostAccessRole\n const base = HOST_ROLE_AI_PERMISSIONS[role] ?? HOST_ROLE_AI_PERMISSIONS.viewer\n const stored = member?.aiPermissions\n return {\n 'ai.use': stored?.['ai.use'] ?? base['ai.use'],\n 'ai.generate': stored?.['ai.generate'] ?? base['ai.generate'],\n }\n}\n\n/**\n * THE COLLABORATORS TABLE'S AI COLUMN (AGL-2927, AGL-2984): whether this\n * person may open the AI doors ON THIS SITE, through the `hostMembers`\n * zone. The host role sets the default; the boxes refine it, and the doors\n * read the same answer, so an unticked box is a closed door rather than a\n * hidden button. The owner is decided by the org role, and says so.\n */\nexport function AiCollaboratorPermissionsCell(props: {\n hostId?: string\n canManage?: boolean\n member?: CollaboratorRow\n}) {\n const { hostId, canManage, member } = props\n const { data: user } = useUser()\n const { enqueueSnackbar } = useSnackbar()\n const [busy, setBusy] = useState(false)\n const memberId = member?.$id\n\n const handleToggle = useCallback(\n (key: AiPermission) => async (_event: unknown, checked: boolean) => {\n if (!memberId || !hostId) return\n setBusy(true)\n try {\n const response = await authorizedFetch(user, '/api/ai/host-permissions', {\n method: 'PATCH',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ hostId, memberId, aiPermissions: { [key]: checked } }),\n })\n const payload = await response.json().catch(() => ({}))\n if (!response.ok) {\n enqueueSnackbar(payload?.error ?? 'Member operation failed', {\n variant: 'warning',\n persist: false,\n })\n return\n }\n enqueueSnackbar('AI access updated', { variant: 'success', persist: false })\n } catch (error) {\n console.error(error)\n enqueueSnackbar('Member operation failed', { variant: 'error' })\n } finally {\n setBusy(false)\n }\n },\n [user, hostId, memberId, enqueueSnackbar],\n )\n\n if (member?.role === 'owner') return <>{'By org role'}</>\n const verdict = collaboratorAiPermissions(member)\n return (\n // An invited row has no member document to carry a toggle yet; it\n // becomes settable once the invite is accepted, which is when the person\n // gains the role the default derives from.\n <Stack direction=\"row\" spacing={0}>\n {AI_PERMISSION_KEYS.map((key) => (\n <FormControlLabel\n key={key}\n label={TOGGLE_LABELS[key]}\n slotProps={{ typography: { variant: 'caption' } }}\n control={\n <Checkbox\n size=\"small\"\n checked={verdict[key]}\n onChange={handleToggle(key)}\n disabled={busy || !canManage || member?.status === 'invited'}\n slotProps={{\n input: { 'aria-label': `${TOGGLE_LABELS[key]} with AI` },\n }}\n />\n }\n />\n ))}\n </Stack>\n )\n}\nAiCollaboratorPermissionsCell.displayName = 'AiCollaboratorPermissionsCell'\n"],"names":["useSnackbar","authorizedFetch","useUser","Checkbox","FormControlLabel","Stack","useCallback","useState","AI_PERMISSION_KEYS","HOST_ROLE_AI_PERMISSIONS","TOGGLE_LABELS","collaboratorAiPermissions","member","role","base","viewer","stored","aiPermissions","AiCollaboratorPermissionsCell","props","hostId","canManage","data","user","enqueueSnackbar","busy","setBusy","memberId","$id","handleToggle","key","_event","checked","response","method","headers","body","JSON","stringify","payload","json","catch","ok","error","variant","persist","console","verdict","direction","spacing","map","label","slotProps","typography","control","size","onChange","disabled","status","input","displayName"],"mappings":"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"}
@@ -0,0 +1,34 @@
1
+ import { type AglynOrgBilling } from '@aglyn/aglyn';
2
+ export interface AiCreditsCardProps {
3
+ orgId?: string | null;
4
+ /** The billing-merged org doc the Usage page resolved. */
5
+ org?: Partial<AglynOrgBilling> | null;
6
+ /** The Billing overview's path, for the one caption that points at the add-ons card. */
7
+ billingHref?: string;
8
+ }
9
+ /**
10
+ * The AI credits meter (AGL-2899), on the Billing → Usage page's plugin
11
+ * band below the platform's own meters (AGL-2939).
12
+ *
13
+ * Credits, because AI actions differ in cost by up to two orders of
14
+ * magnitude — a question against generating a screen — and a message count
15
+ * would price them the same. The band is refused at the cap, so this
16
+ * readout is the only thing standing between a customer and learning their
17
+ * limit by being turned down mid-build.
18
+ *
19
+ * Rendered only where a band is sold, which since AGL-3203 is every plan
20
+ * row: Free carries the taste and Starter 750, so both render a meter even
21
+ * though neither carries `aiAssist` — the band is credits, not the guided
22
+ * rung. What still renders nothing is a band of ZERO, which now reaches this
23
+ * component only as a per-org override, and a "0 of 0" meter is not a
24
+ * readout of anything. ONE meter for one pool: the
25
+ * add-on widens `assistCreditsPerMonth` rather than opening a second band,
26
+ * so the limit here is already plan plus add-on and the caption under it
27
+ * says how much of that the add-on is.
28
+ *
29
+ * From the server, not from Firestore like the platform's meters:
30
+ * `orgs/{orgId}/assistUsage` is default-deny for every client, so a browser
31
+ * read would fail silently and leave this reading "not yet metered" forever.
32
+ * Credits, never dollars: the route is where the one conversion happens.
33
+ */
34
+ export default function AiCreditsCard(props: AiCreditsCardProps): import("react").JSX.Element;
@@ -0,0 +1,131 @@
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
+ */ 'use client';
17
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
+ import { AI_ADDON_CREDITS_PER_MONTH, aiAddonName, hasAiAddon, isUnlimitedQuota, resolveEffectivePlan, resolveOrgEntitlements, resolvePlanPricing } from "@aglyn/aglyn";
19
+ import { pluginDocsHelp } from "@aglyn/aglyn/app-utils/docs-help";
20
+ import { CardDisplay } from "@aglyn/shared-ui-jsx";
21
+ import { UsageMeter } from "@aglyn/shared-ui-jsx/components/usage-meter.component";
22
+ import { authorizedFetch } from "@aglyn/shared-util-http/authorized-token";
23
+ import { Link, Typography } from "@mui/material";
24
+ import { useEffect, useState } from "react";
25
+ import { useUser } from "@aglyn/tenant-feature-instance";
26
+ /**
27
+ * The AI credits meter (AGL-2899), on the Billing → Usage page's plugin
28
+ * band below the platform's own meters (AGL-2939).
29
+ *
30
+ * Credits, because AI actions differ in cost by up to two orders of
31
+ * magnitude — a question against generating a screen — and a message count
32
+ * would price them the same. The band is refused at the cap, so this
33
+ * readout is the only thing standing between a customer and learning their
34
+ * limit by being turned down mid-build.
35
+ *
36
+ * Rendered only where a band is sold, which since AGL-3203 is every plan
37
+ * row: Free carries the taste and Starter 750, so both render a meter even
38
+ * though neither carries `aiAssist` — the band is credits, not the guided
39
+ * rung. What still renders nothing is a band of ZERO, which now reaches this
40
+ * component only as a per-org override, and a "0 of 0" meter is not a
41
+ * readout of anything. ONE meter for one pool: the
42
+ * add-on widens `assistCreditsPerMonth` rather than opening a second band,
43
+ * so the limit here is already plan plus add-on and the caption under it
44
+ * says how much of that the add-on is.
45
+ *
46
+ * From the server, not from Firestore like the platform's meters:
47
+ * `orgs/{orgId}/assistUsage` is default-deny for every client, so a browser
48
+ * read would fail silently and leave this reading "not yet metered" forever.
49
+ * Credits, never dollars: the route is where the one conversion happens.
50
+ */ export default function AiCreditsCard(props) {
51
+ const { orgId, org, billingHref } = props;
52
+ const { data: user } = useUser();
53
+ const [credits, setCredits] = useState(null);
54
+ useEffect(()=>{
55
+ if (!orgId || !user) return undefined;
56
+ let active = true;
57
+ void (async ()=>{
58
+ try {
59
+ const response = await authorizedFetch(user, `/api/ai/billing/credits?orgId=${encodeURIComponent(orgId)}`);
60
+ if (!response.ok) return;
61
+ const result = await response.json();
62
+ if (active && (result == null ? void 0 : result.credits)) setCredits(result.credits);
63
+ } catch (unused) {
64
+ // The meter keeps its "not yet metered" state on failure —
65
+ // deliberately not 0, which reads as "you have used none".
66
+ }
67
+ })();
68
+ return ()=>{
69
+ active = false;
70
+ };
71
+ }, [
72
+ orgId,
73
+ user
74
+ ]);
75
+ const entitlements = resolveOrgEntitlements(org);
76
+ if (entitlements.assistCreditsPerMonth <= 0) return null;
77
+ const plan = resolveEffectivePlan(org);
78
+ const aiAddonCredits = hasAiAddon(org) ? AI_ADDON_CREDITS_PER_MONTH[plan] : 0;
79
+ // Sold to THIS workspace, not merely on its plan: a staff comp has no
80
+ // subscription to add the item to, so its price list sells none (AGL-3034).
81
+ const aiAddonSold = resolvePlanPricing(org).aiAddonMonthlyUsd != null;
82
+ return /*#__PURE__*/ _jsxs(CardDisplay, {
83
+ header: 'AI credits',
84
+ help: pluginDocsHelp('billing', {
85
+ anchor: '#usage-meters',
86
+ excerpt: 'AI credits drawn this month against your included band, plan ' + 'plus the AI add-on where you have it.'
87
+ }),
88
+ contentGutterX: true,
89
+ contentGutterY: true,
90
+ children: [
91
+ /*#__PURE__*/ _jsx(UsageMeter, {
92
+ label: "AI credits (this month)",
93
+ used: credits ? credits.used : null,
94
+ limit: entitlements.assistCreditsPerMonth,
95
+ unlimited: isUnlimitedQuota(entitlements.assistCreditsPerMonth),
96
+ upgradeHref: billingHref ? `${billingHref}#plans` : '#plans'
97
+ }),
98
+ aiAddonCredits > 0 ? /*#__PURE__*/ _jsx(Typography, {
99
+ variant: "caption",
100
+ color: "text.secondary",
101
+ sx: {
102
+ display: 'block',
103
+ mt: -1.5,
104
+ mb: 2
105
+ },
106
+ children: `Includes ${aiAddonCredits.toLocaleString()} credits a month from ` + `the ${aiAddonName()} add-on.`
107
+ }) : null,
108
+ !entitlements.features.aiGenerative && aiAddonSold ? /*#__PURE__*/ _jsxs(Typography, {
109
+ variant: "caption",
110
+ color: "text.secondary",
111
+ sx: {
112
+ display: 'block',
113
+ mt: -1.5,
114
+ mb: 2
115
+ },
116
+ children: [
117
+ `Generate pages, emails, campaigns and more with ${aiAddonName()}, ` + `and add ${AI_ADDON_CREDITS_PER_MONTH[plan].toLocaleString()} ` + 'credits a month to this pool: ',
118
+ /*#__PURE__*/ _jsx(Link, {
119
+ href: `${billingHref != null ? billingHref : ''}#addons`,
120
+ color: "primary",
121
+ underline: "hover",
122
+ children: `Add ${aiAddonName()}`
123
+ }),
124
+ ' in Billing → Plans.'
125
+ ]
126
+ }) : null
127
+ ]
128
+ });
129
+ }
130
+
131
+ //# sourceMappingURL=ai-credits-card.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-credits-card.component.tsx"],"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'use client'\n\nimport {\n AI_ADDON_CREDITS_PER_MONTH,\n aiAddonName,\n hasAiAddon,\n isUnlimitedQuota,\n resolveEffectivePlan,\n resolveOrgEntitlements,\n resolvePlanPricing,\n type AglynOrgBilling,\n} from '@aglyn/aglyn'\nimport { pluginDocsHelp } from '@aglyn/aglyn/app-utils/docs-help'\nimport { CardDisplay } from '@aglyn/shared-ui-jsx'\nimport { UsageMeter } from '@aglyn/shared-ui-jsx/components/usage-meter.component'\nimport { authorizedFetch } from '@aglyn/shared-util-http/authorized-token'\nimport { Link, Typography } from '@mui/material'\nimport { useEffect, useState } from 'react'\nimport { useUser } from '@aglyn/tenant-feature-instance'\n\nexport interface AiCreditsCardProps {\n orgId?: string | null\n /** The billing-merged org doc the Usage page resolved. */\n org?: Partial<AglynOrgBilling> | null\n /** The Billing overview's path, for the one caption that points at the add-ons card. */\n billingHref?: string\n}\n\n/**\n * The AI credits meter (AGL-2899), on the Billing → Usage page's plugin\n * band below the platform's own meters (AGL-2939).\n *\n * Credits, because AI actions differ in cost by up to two orders of\n * magnitude — a question against generating a screen — and a message count\n * would price them the same. The band is refused at the cap, so this\n * readout is the only thing standing between a customer and learning their\n * limit by being turned down mid-build.\n *\n * Rendered only where a band is sold, which since AGL-3203 is every plan\n * row: Free carries the taste and Starter 750, so both render a meter even\n * though neither carries `aiAssist` — the band is credits, not the guided\n * rung. What still renders nothing is a band of ZERO, which now reaches this\n * component only as a per-org override, and a \"0 of 0\" meter is not a\n * readout of anything. ONE meter for one pool: the\n * add-on widens `assistCreditsPerMonth` rather than opening a second band,\n * so the limit here is already plan plus add-on and the caption under it\n * says how much of that the add-on is.\n *\n * From the server, not from Firestore like the platform's meters:\n * `orgs/{orgId}/assistUsage` is default-deny for every client, so a browser\n * read would fail silently and leave this reading \"not yet metered\" forever.\n * Credits, never dollars: the route is where the one conversion happens.\n */\nexport default function AiCreditsCard(props: AiCreditsCardProps) {\n const { orgId, org, billingHref } = props\n const { data: user } = useUser()\n const [credits, setCredits] = useState<{ used: number; limit: number | null } | null>(null)\n useEffect(() => {\n if (!orgId || !user) return undefined\n let active = true\n void (async () => {\n try {\n const response = await authorizedFetch(\n user,\n `/api/ai/billing/credits?orgId=${encodeURIComponent(orgId)}`,\n )\n if (!response.ok) return\n const result = await response.json()\n if (active && result?.credits) setCredits(result.credits)\n } catch {\n // The meter keeps its \"not yet metered\" state on failure —\n // deliberately not 0, which reads as \"you have used none\".\n }\n })()\n return () => {\n active = false\n }\n }, [orgId, user])\n\n const entitlements = resolveOrgEntitlements(org)\n if (entitlements.assistCreditsPerMonth <= 0) return null\n const plan = resolveEffectivePlan(org)\n const aiAddonCredits = hasAiAddon(org) ? AI_ADDON_CREDITS_PER_MONTH[plan] : 0\n // Sold to THIS workspace, not merely on its plan: a staff comp has no\n // subscription to add the item to, so its price list sells none (AGL-3034).\n const aiAddonSold = resolvePlanPricing(org).aiAddonMonthlyUsd != null\n return (\n <CardDisplay\n header={'AI credits'}\n help={pluginDocsHelp('billing', {\n anchor: '#usage-meters',\n excerpt:\n 'AI credits drawn this month against your included band, plan ' +\n 'plus the AI add-on where you have it.',\n })}\n contentGutterX\n contentGutterY\n >\n {/* An uncapped staff comp (AGL-3049) resolves this band `UNLIMITED`:\n the meter reads \"Unlimited\" and draws no bar, never \"/ Infinity\". */}\n <UsageMeter\n label=\"AI credits (this month)\"\n used={credits ? credits.used : null}\n limit={entitlements.assistCreditsPerMonth}\n unlimited={isUnlimitedQuota(entitlements.assistCreditsPerMonth)}\n upgradeHref={billingHref ? `${billingHref}#plans` : '#plans'}\n />\n {aiAddonCredits > 0 ? (\n <Typography\n variant=\"caption\"\n color=\"text.secondary\"\n sx={{ display: 'block', mt: -1.5, mb: 2 }}\n >\n {`Includes ${aiAddonCredits.toLocaleString()} credits a month from ` +\n `the ${aiAddonName()} add-on.`}\n </Typography>\n ) : null}\n {/* A plan with a band that sells the add-on and has not bought it:\n the one line on the meters that points at more capacity rather\n than at an upgrade. */}\n {!entitlements.features.aiGenerative && aiAddonSold ? (\n <Typography\n variant=\"caption\"\n color=\"text.secondary\"\n sx={{ display: 'block', mt: -1.5, mb: 2 }}\n >\n {`Generate pages, emails, campaigns and more with ${aiAddonName()}, ` +\n `and add ${AI_ADDON_CREDITS_PER_MONTH[plan].toLocaleString()} ` +\n 'credits a month to this pool: '}\n <Link href={`${billingHref ?? ''}#addons`} color=\"primary\" underline=\"hover\">\n {`Add ${aiAddonName()}`}\n </Link>\n {' in Billing → Plans.'}\n </Typography>\n ) : null}\n </CardDisplay>\n )\n}\n"],"names":["AI_ADDON_CREDITS_PER_MONTH","aiAddonName","hasAiAddon","isUnlimitedQuota","resolveEffectivePlan","resolveOrgEntitlements","resolvePlanPricing","pluginDocsHelp","CardDisplay","UsageMeter","authorizedFetch","Link","Typography","useEffect","useState","useUser","AiCreditsCard","props","orgId","org","billingHref","data","user","credits","setCredits","undefined","active","response","encodeURIComponent","ok","result","json","entitlements","assistCreditsPerMonth","plan","aiAddonCredits","aiAddonSold","aiAddonMonthlyUsd","header","help","anchor","excerpt","contentGutterX","contentGutterY","label","used","limit","unlimited","upgradeHref","variant","color","sx","display","mt","mb","toLocaleString","features","aiGenerative","href","underline"],"mappings":"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"}
@@ -0,0 +1,56 @@
1
+ import type { ConsoleWidgetColumnHeaderProps } from '@aglyn/aglyn';
2
+ /** A roster row as the member tables hand it to a column. */
3
+ interface MemberRow {
4
+ $id?: string;
5
+ uid?: string;
6
+ status?: string;
7
+ }
8
+ /**
9
+ * THE ORG TEAM TABLE'S AI CREDITS COLUMN (AGL-2928): the credits each member
10
+ * drew this month across every site, through the `orgMembersListColumn`
11
+ * zone. Every cell and the header share one read of the month. A reader the
12
+ * route refuses — a manager without `billing.view` — sees a dash in every
13
+ * row, not a warning: the roster is theirs to manage whether or not the
14
+ * spend is theirs to see.
15
+ */
16
+ export declare function AiMemberCreditsHeader(props: {
17
+ orgId?: string;
18
+ } & Partial<ConsoleWidgetColumnHeaderProps>): import("react").JSX.Element;
19
+ export declare namespace AiMemberCreditsHeader {
20
+ var displayName: string;
21
+ }
22
+ /** One member's credits this month, or a dash until the month is read. */
23
+ export declare function AiMemberCreditsCell(props: {
24
+ orgId?: string;
25
+ member?: MemberRow;
26
+ }): import("react").JSX.Element;
27
+ export declare namespace AiMemberCreditsCell {
28
+ var displayName: string;
29
+ }
30
+ /**
31
+ * THE SITE COLLABORATORS TABLE'S AI CREDITS COLUMN (AGL-2928): what each
32
+ * collaborator drew ON THIS SITE this month, from the per-member rollup's
33
+ * split by host — so an agency sees which client site's people spend. Not
34
+ * across the workspace, which is the org Team table's column.
35
+ */
36
+ export declare function AiCollaboratorCreditsHeader(props: {
37
+ orgId?: string;
38
+ hostId?: string;
39
+ }): import("react").JSX.Element;
40
+ export declare namespace AiCollaboratorCreditsHeader {
41
+ var displayName: string;
42
+ }
43
+ /**
44
+ * One collaborator's credits on this site this month. An invitation not yet
45
+ * accepted has drawn nothing and reads as a dash; the owner's row is a row
46
+ * like any other.
47
+ */
48
+ export declare function AiCollaboratorCreditsCell(props: {
49
+ orgId?: string;
50
+ hostId?: string;
51
+ member?: MemberRow;
52
+ }): import("react").JSX.Element;
53
+ export declare namespace AiCollaboratorCreditsCell {
54
+ var displayName: string;
55
+ }
56
+ export {};
@@ -0,0 +1,118 @@
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
+ */ 'use client';
17
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
18
+ import { TableSortLabel, Tooltip } from "@mui/material";
19
+ import { useEffect, useMemo, useRef, useState } from "react";
20
+ import { aiUsageMonthLabel } from "../usage/ai-usage-wire.js";
21
+ import { useOrgAiUsage } from "./use-org-ai-usage.js";
22
+ /**
23
+ * THE ORG TEAM TABLE'S AI CREDITS COLUMN (AGL-2928): the credits each member
24
+ * drew this month across every site, through the `orgMembersListColumn`
25
+ * zone. Every cell and the header share one read of the month. A reader the
26
+ * route refuses — a manager without `billing.view` — sees a dash in every
27
+ * row, not a warning: the roster is theirs to manage whether or not the
28
+ * spend is theirs to see.
29
+ */ export function AiMemberCreditsHeader(props) {
30
+ const { orgId, onSort, sorted } = props;
31
+ const usage = useOrgAiUsage(orgId);
32
+ const [direction, setDirection] = useState(null);
33
+ const onSortRef = useRef(onSort);
34
+ onSortRef.current = onSort;
35
+ const compare = useMemo(()=>{
36
+ if (!direction || usage.status !== 'ready') return null;
37
+ const credits = (row)=>{
38
+ var _usage_creditsByUid_get, _ref;
39
+ return (_usage_creditsByUid_get = usage.creditsByUid.get(String((_ref = row == null ? void 0 : row.$id) != null ? _ref : ''))) != null ? _usage_creditsByUid_get : 0;
40
+ };
41
+ return direction === 'desc' ? (a, b)=>credits(b) - credits(a) : (a, b)=>credits(a) - credits(b);
42
+ }, [
43
+ direction,
44
+ usage.status,
45
+ usage.creditsByUid
46
+ ]);
47
+ const compareRef = useRef(compare);
48
+ compareRef.current = compare;
49
+ // Keyed on the comparator, which changes only with the direction or the
50
+ // month's answer, so handing it over cannot re-run on every render.
51
+ useEffect(()=>{
52
+ onSortRef.current == null ? void 0 : onSortRef.current.call(onSortRef, compare);
53
+ }, [
54
+ compare
55
+ ]);
56
+ // Another column taking the sort puts this one back to unsorted; a
57
+ // comparator withdrawn while the month re-reads keeps its direction.
58
+ useEffect(()=>{
59
+ if (sorted === false && compareRef.current) setDirection(null);
60
+ }, [
61
+ sorted
62
+ ]);
63
+ return /*#__PURE__*/ _jsx(Tooltip, {
64
+ title: `AI credits each member has drawn in ${aiUsageMonthLabel(usage.month)}, across every site. Open a member for the split by site.`,
65
+ children: /*#__PURE__*/ _jsx(TableSortLabel, {
66
+ active: direction !== null,
67
+ direction: direction != null ? direction : 'desc',
68
+ disabled: usage.status !== 'ready',
69
+ onClick: ()=>setDirection((current)=>current === 'desc' ? 'asc' : current === 'asc' ? null : 'desc'),
70
+ children: 'AI credits (month)'
71
+ })
72
+ });
73
+ }
74
+ AiMemberCreditsHeader.displayName = 'AiMemberCreditsHeader';
75
+ /** One member's credits this month, or a dash until the month is read. */ export function AiMemberCreditsCell(props) {
76
+ var _usage_creditsByUid_get, _ref;
77
+ var _props_member;
78
+ const usage = useOrgAiUsage(props.orgId);
79
+ return /*#__PURE__*/ _jsx(_Fragment, {
80
+ children: usage.status === 'ready' ? ((_usage_creditsByUid_get = usage.creditsByUid.get(String((_ref = (_props_member = props.member) == null ? void 0 : _props_member.$id) != null ? _ref : ''))) != null ? _usage_creditsByUid_get : 0).toLocaleString() : '—'
81
+ });
82
+ }
83
+ AiMemberCreditsCell.displayName = 'AiMemberCreditsCell';
84
+ /**
85
+ * THE SITE COLLABORATORS TABLE'S AI CREDITS COLUMN (AGL-2928): what each
86
+ * collaborator drew ON THIS SITE this month, from the per-member rollup's
87
+ * split by host — so an agency sees which client site's people spend. Not
88
+ * across the workspace, which is the org Team table's column.
89
+ */ export function AiCollaboratorCreditsHeader(props) {
90
+ const usage = useOrgAiUsage(props.orgId, {
91
+ hostId: props.hostId
92
+ });
93
+ return /*#__PURE__*/ _jsx(Tooltip, {
94
+ title: `AI credits drawn on this site in ${aiUsageMonthLabel(usage.month)}, per collaborator.`,
95
+ children: /*#__PURE__*/ _jsx("span", {
96
+ children: 'AI credits (site, month)'
97
+ })
98
+ });
99
+ }
100
+ AiCollaboratorCreditsHeader.displayName = 'AiCollaboratorCreditsHeader';
101
+ /**
102
+ * One collaborator's credits on this site this month. An invitation not yet
103
+ * accepted has drawn nothing and reads as a dash; the owner's row is a row
104
+ * like any other.
105
+ */ export function AiCollaboratorCreditsCell(props) {
106
+ var _ref, _usage_hostCreditsByUid_get;
107
+ const usage = useOrgAiUsage(props.orgId, {
108
+ hostId: props.hostId
109
+ });
110
+ const member = props.member;
111
+ const uid = (_ref = member == null ? void 0 : member.uid) != null ? _ref : member == null ? void 0 : member.$id;
112
+ return /*#__PURE__*/ _jsx(_Fragment, {
113
+ children: usage.status === 'ready' && uid && (member == null ? void 0 : member.status) !== 'invited' ? ((_usage_hostCreditsByUid_get = usage.hostCreditsByUid.get(uid)) != null ? _usage_hostCreditsByUid_get : 0).toLocaleString() : '—'
114
+ });
115
+ }
116
+ AiCollaboratorCreditsCell.displayName = 'AiCollaboratorCreditsCell';
117
+
118
+ //# sourceMappingURL=ai-credits-columns.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/components/ai-credits-columns.component.tsx"],"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'use client'\n\nimport type { ConsoleWidgetColumnHeaderProps } from '@aglyn/aglyn'\nimport { TableSortLabel, Tooltip } from '@mui/material'\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport { aiUsageMonthLabel } from '../usage/ai-usage-wire'\nimport { useOrgAiUsage } from './use-org-ai-usage'\n\n/** A roster row as the member tables hand it to a column. */\ninterface MemberRow {\n $id?: string\n uid?: string\n status?: string\n}\n\n/**\n * THE ORG TEAM TABLE'S AI CREDITS COLUMN (AGL-2928): the credits each member\n * drew this month across every site, through the `orgMembersListColumn`\n * zone. Every cell and the header share one read of the month. A reader the\n * route refuses — a manager without `billing.view` — sees a dash in every\n * row, not a warning: the roster is theirs to manage whether or not the\n * spend is theirs to see.\n */\nexport function AiMemberCreditsHeader(\n props: { orgId?: string } & Partial<ConsoleWidgetColumnHeaderProps>,\n) {\n const { orgId, onSort, sorted } = props\n const usage = useOrgAiUsage(orgId)\n const [direction, setDirection] = useState<'desc' | 'asc' | null>(null)\n const onSortRef = useRef(onSort)\n onSortRef.current = onSort\n const compare = useMemo(() => {\n if (!direction || usage.status !== 'ready') return null\n const credits = (row: MemberRow) => usage.creditsByUid.get(String(row?.$id ?? '')) ?? 0\n return direction === 'desc'\n ? (a: MemberRow, b: MemberRow) => credits(b) - credits(a)\n : (a: MemberRow, b: MemberRow) => credits(a) - credits(b)\n }, [direction, usage.status, usage.creditsByUid])\n const compareRef = useRef(compare)\n compareRef.current = compare\n // Keyed on the comparator, which changes only with the direction or the\n // month's answer, so handing it over cannot re-run on every render.\n useEffect(() => {\n onSortRef.current?.(compare as never)\n }, [compare])\n // Another column taking the sort puts this one back to unsorted; a\n // comparator withdrawn while the month re-reads keeps its direction.\n useEffect(() => {\n if (sorted === false && compareRef.current) setDirection(null)\n }, [sorted])\n return (\n <Tooltip\n title={`AI credits each member has drawn in ${aiUsageMonthLabel(usage.month)}, across every site. Open a member for the split by site.`}\n >\n <TableSortLabel\n active={direction !== null}\n direction={direction ?? 'desc'}\n disabled={usage.status !== 'ready'}\n onClick={() =>\n setDirection((current) =>\n current === 'desc' ? 'asc' : current === 'asc' ? null : 'desc',\n )\n }\n >\n {'AI credits (month)'}\n </TableSortLabel>\n </Tooltip>\n )\n}\nAiMemberCreditsHeader.displayName = 'AiMemberCreditsHeader'\n\n/** One member's credits this month, or a dash until the month is read. */\nexport function AiMemberCreditsCell(props: { orgId?: string; member?: MemberRow }) {\n const usage = useOrgAiUsage(props.orgId)\n return (\n <>\n {usage.status === 'ready'\n ? (usage.creditsByUid.get(String(props.member?.$id ?? '')) ?? 0).toLocaleString()\n : '—'}\n </>\n )\n}\nAiMemberCreditsCell.displayName = 'AiMemberCreditsCell'\n\n/**\n * THE SITE COLLABORATORS TABLE'S AI CREDITS COLUMN (AGL-2928): what each\n * collaborator drew ON THIS SITE this month, from the per-member rollup's\n * split by host — so an agency sees which client site's people spend. Not\n * across the workspace, which is the org Team table's column.\n */\nexport function AiCollaboratorCreditsHeader(props: { orgId?: string; hostId?: string }) {\n const usage = useOrgAiUsage(props.orgId, { hostId: props.hostId })\n return (\n <Tooltip\n title={`AI credits drawn on this site in ${aiUsageMonthLabel(usage.month)}, per collaborator.`}\n >\n <span>{'AI credits (site, month)'}</span>\n </Tooltip>\n )\n}\nAiCollaboratorCreditsHeader.displayName = 'AiCollaboratorCreditsHeader'\n\n/**\n * One collaborator's credits on this site this month. An invitation not yet\n * accepted has drawn nothing and reads as a dash; the owner's row is a row\n * like any other.\n */\nexport function AiCollaboratorCreditsCell(props: {\n orgId?: string\n hostId?: string\n member?: MemberRow\n}) {\n const usage = useOrgAiUsage(props.orgId, { hostId: props.hostId })\n const member = props.member\n const uid = member?.uid ?? member?.$id\n return (\n <>\n {usage.status === 'ready' && uid && member?.status !== 'invited'\n ? (usage.hostCreditsByUid.get(uid) ?? 0).toLocaleString()\n : '—'}\n </>\n )\n}\nAiCollaboratorCreditsCell.displayName = 'AiCollaboratorCreditsCell'\n"],"names":["TableSortLabel","Tooltip","useEffect","useMemo","useRef","useState","aiUsageMonthLabel","useOrgAiUsage","AiMemberCreditsHeader","props","orgId","onSort","sorted","usage","direction","setDirection","onSortRef","current","compare","status","credits","row","creditsByUid","get","String","$id","a","b","compareRef","title","month","active","disabled","onClick","displayName","AiMemberCreditsCell","member","toLocaleString","AiCollaboratorCreditsHeader","hostId","span","AiCollaboratorCreditsCell","uid","hostCreditsByUid"],"mappings":"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"}
@@ -0,0 +1,17 @@
1
+ import type { ConsoleRecordEmailZoneProps } from '@aglyn/aglyn/plugin-manager/feature-plugins';
2
+ /**
3
+ * "Draft the message" (AGL-2917), in the CRM's one-to-one composer through
4
+ * the `recordEmail` zone: the member says what the email should say, a `crm`
5
+ * job drafts a subject and a message from that and the record's timeline, and
6
+ * the draft goes into the composer through `proposeDraft`, which asks before
7
+ * it replaces a written message.
8
+ *
9
+ * Nothing here sends anything, and nothing can: the composer's Send is the
10
+ * member's. A draft is asked afresh each time, so the card recalls no earlier
11
+ * one, and the answer door serves a draft only to the member who asked.
12
+ */
13
+ export declare function AiCrmEmailDraft(props: ConsoleRecordEmailZoneProps): import("react").JSX.Element;
14
+ export declare namespace AiCrmEmailDraft {
15
+ var displayName: string;
16
+ }
17
+ export default AiCrmEmailDraft;