@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,344 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
3
+ /**
4
+ * @license
5
+ * Copyright 2026 Aglyn LLC
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */ import { assistProviderCostUsd, ASSIST_PROVIDER_COST_FIELD } from "@aglyn/aglyn/app-utils/assist-credits";
19
+ import { aiCacheHitRate } from "../model/ai-tokens.js";
20
+ import { aiUsageKindFromRoute } from "../model/ai-usage-by-user.js";
21
+ /** The kinds as the board lists them, dearest first. */ export function kindTokenRows(split) {
22
+ return Object.entries(split).map(([kind, value])=>_extends({
23
+ kind
24
+ }, value)).sort((a, b)=>b.providerCostUsd - a.providerCostUsd || b.messages - a.messages || a.kind.localeCompare(b.kind));
25
+ }
26
+ /** A sample's value at a percentile by nearest rank — always one that was seen; 0 for none. */ export function nearestRankPercentile(values, percentile) {
27
+ if (!values.length) return 0;
28
+ const sorted = [
29
+ ...values
30
+ ].sort((a, b)=>a - b);
31
+ const rank = Math.min(sorted.length, Math.max(1, Math.ceil(percentile * sorted.length)));
32
+ return sorted[rank - 1];
33
+ }
34
+ /**
35
+ * A cost breakdown as a sorted, labelled list — dearest first (AGL-2340).
36
+ *
37
+ * Exported because the ordering is the readable half. A breakdown in
38
+ * whatever order the keys happened to be inserted is a table you have to
39
+ * scan; the point of the panel is that the expensive line is the top line.
40
+ */ export function costSplitRows(split) {
41
+ return Object.entries(split).map(([key, value])=>({
42
+ key,
43
+ messages: value.messages,
44
+ providerCostUsd: value.providerCostUsd
45
+ })).sort((a, b)=>b.providerCostUsd - a.providerCostUsd || a.key.localeCompare(b.key));
46
+ }
47
+ /** The Free taste's refusals as one figure: the board names the wall, not each rung. */ export function freeTasteRefusals(refusals) {
48
+ return refusals.account + refusals.requests + refusals.refusals + refusals.platform;
49
+ }
50
+ /**
51
+ * The leaderboard's ordering: dearest first, then most credits, then by id
52
+ * so two equal rows render in one stable order rather than the order the
53
+ * scan happened to return them in. Returns the top `limit` and how many
54
+ * were ranked, so the page can say "top 25 of 140" rather than imply the
55
+ * cut is the whole fleet.
56
+ */ export function rankAssistSpend(rows, limit) {
57
+ const sorted = [
58
+ ...rows
59
+ ].sort((a, b)=>b.providerCostUsd - a.providerCostUsd || b.credits - a.credits || a.orgId.localeCompare(b.orgId));
60
+ const cap = Number.isFinite(limit) && limit > 0 ? Math.floor(limit) : sorted.length;
61
+ return {
62
+ rows: sorted.slice(0, cap),
63
+ ranked: sorted.length
64
+ };
65
+ }
66
+ const number = (value)=>{
67
+ const parsed = Number(value != null ? value : 0);
68
+ return Number.isFinite(parsed) ? parsed : 0;
69
+ };
70
+ /** A signal's kind: the field once it is written, else read off its route (AGL-2937). */ function signalKind(data, route) {
71
+ const kind = data['kind'];
72
+ if (typeof kind === 'string' && kind) return kind;
73
+ // A job step was metered under this route before its signal named the kind.
74
+ return route === 'ai/jobs' ? 'job' : aiUsageKindFromRoute(route);
75
+ }
76
+ /**
77
+ * Normalize one raw signal document. Every field is defaulted, because a
78
+ * signal written by an older build is still evidence and dropping it would
79
+ * bias the ranking toward whatever shipped most recently.
80
+ */ export function assistSignalRow(orgId, exchangeId, data) {
81
+ var _data_route, _data_model, _data_tier;
82
+ const rawPaths = Array.isArray(data['docsPaths']) ? data['docsPaths'] : [];
83
+ const feedback = data['feedback'];
84
+ const route = String((_data_route = data['route']) != null ? _data_route : '');
85
+ return {
86
+ orgId,
87
+ exchangeId,
88
+ route,
89
+ kind: signalKind(data, route),
90
+ model: String((_data_model = data['model']) != null ? _data_model : 'unknown'),
91
+ tier: String((_data_tier = data['tier']) != null ? _data_tier : 'unknown'),
92
+ inputTokens: number(data['inputTokens']),
93
+ outputTokens: number(data['outputTokens']),
94
+ cacheReadTokens: number(data['cacheReadTokens']),
95
+ cacheWriteTokens: number(data['cacheWriteTokens']),
96
+ // What the turn COST US (AGL-3015). The stored `estCostUsd` beside it
97
+ // is the same turn at BILLED rates — the figure the customer's credits
98
+ // came out of — and every dollar on the signals page is asking the other
99
+ // question. A signal written before the split carries only the billed
100
+ // figure, which over-reads our bill rather than under-reads it.
101
+ providerCostUsd: assistProviderCostUsd(data['estCostUsd'], data[ASSIST_PROVIDER_COST_FIELD]),
102
+ docsPaths: rawPaths.map((path)=>String(path)).filter(Boolean),
103
+ stopReason: data['stopReason'] == null ? null : String(data['stopReason']),
104
+ feedback: feedback === 'up' || feedback === 'down' ? feedback : null,
105
+ // Strict `=== true`, so a signal written before the field existed reads
106
+ // as "served by a model" rather than as deflected. Defaulting the other
107
+ // way would credit historic turns with a saving that never happened and
108
+ // make the rate look best on the day it shipped.
109
+ deflected: data['deflected'] === true
110
+ };
111
+ }
112
+ /** Accumulate one turn's spend into a `byTier`/`byModel` bucket. */ function addToSplit(split, key, providerCostUsd) {
113
+ var _split_key;
114
+ const bucket = (_split_key = split[key]) != null ? _split_key : {
115
+ messages: 0,
116
+ providerCostUsd: 0
117
+ };
118
+ bucket.messages += 1;
119
+ bucket.providerCostUsd += providerCostUsd;
120
+ split[key] = bucket;
121
+ }
122
+ /**
123
+ * Rank the docs gaps and roll the money up.
124
+ *
125
+ * `truncated` is carried through rather than hidden. A sweep that quietly
126
+ * stops at a ceiling and presents the remainder as the whole is the AGL-2220
127
+ * defect, and it is worse here than there: a partial sample of a RANKING
128
+ * looks exactly like a complete one, and the thing being ranked is where to
129
+ * spend documentation effort.
130
+ */ export function mineAssistSignals(rows, options = {}) {
131
+ var _options_limit;
132
+ const limit = (_options_limit = options.limit) != null ? _options_limit : 25;
133
+ const totals = {
134
+ messages: 0,
135
+ inputTokens: 0,
136
+ outputTokens: 0,
137
+ cacheReadTokens: 0,
138
+ cacheWriteTokens: 0,
139
+ providerCostUsd: 0,
140
+ deflected: 0,
141
+ deflectionRate: null,
142
+ cacheReadRate: null,
143
+ byTier: {},
144
+ byModel: {},
145
+ byKind: {},
146
+ stopReasons: {},
147
+ feedback: {
148
+ up: 0,
149
+ down: 0,
150
+ none: 0
151
+ }
152
+ };
153
+ const gaps = new Map();
154
+ const ungroundedRoutes = new Map();
155
+ const orgs = new Map();
156
+ const proseCandidates = [];
157
+ const kinds = new Map();
158
+ let ungroundedQuestions = 0;
159
+ let ungroundedDown = 0;
160
+ for (const row of rows){
161
+ var _row_stopReason, _totals_stopReasons_stop, _orgs_get;
162
+ totals.messages += 1;
163
+ totals.inputTokens += row.inputTokens;
164
+ totals.outputTokens += row.outputTokens;
165
+ totals.cacheReadTokens += row.cacheReadTokens;
166
+ totals.cacheWriteTokens += row.cacheWriteTokens;
167
+ totals.providerCostUsd += row.providerCostUsd;
168
+ if (row.deflected) totals.deflected += 1;
169
+ addToSplit(totals.byTier, row.tier, row.providerCostUsd);
170
+ addToSplit(totals.byModel, row.model, row.providerCostUsd);
171
+ if (!row.deflected) {
172
+ var _kinds_get;
173
+ const kind = row.kind || 'unknown';
174
+ const bucket = (_kinds_get = kinds.get(kind)) != null ? _kinds_get : {
175
+ messages: 0,
176
+ providerCostUsd: 0,
177
+ inputTokens: 0,
178
+ outputTokens: 0,
179
+ cacheReadTokens: 0,
180
+ cacheWriteTokens: 0,
181
+ outputs: []
182
+ };
183
+ bucket.messages += 1;
184
+ bucket.providerCostUsd += row.providerCostUsd;
185
+ bucket.inputTokens += row.inputTokens;
186
+ bucket.outputTokens += row.outputTokens;
187
+ bucket.cacheReadTokens += row.cacheReadTokens;
188
+ bucket.cacheWriteTokens += row.cacheWriteTokens;
189
+ bucket.outputs.push(row.outputTokens);
190
+ kinds.set(kind, bucket);
191
+ }
192
+ const stop = (_row_stopReason = row.stopReason) != null ? _row_stopReason : 'none';
193
+ totals.stopReasons[stop] = ((_totals_stopReasons_stop = totals.stopReasons[stop]) != null ? _totals_stopReasons_stop : 0) + 1;
194
+ if (row.feedback === 'up') totals.feedback.up += 1;
195
+ else if (row.feedback === 'down') totals.feedback.down += 1;
196
+ else totals.feedback.none += 1;
197
+ const org = (_orgs_get = orgs.get(row.orgId)) != null ? _orgs_get : {
198
+ orgId: row.orgId,
199
+ messages: 0,
200
+ inputTokens: 0,
201
+ outputTokens: 0,
202
+ cacheReadTokens: 0,
203
+ cacheWriteTokens: 0,
204
+ providerCostUsd: 0,
205
+ down: 0
206
+ };
207
+ org.messages += 1;
208
+ org.inputTokens += row.inputTokens;
209
+ org.outputTokens += row.outputTokens;
210
+ org.cacheReadTokens += row.cacheReadTokens;
211
+ org.cacheWriteTokens += row.cacheWriteTokens;
212
+ org.providerCostUsd += row.providerCostUsd;
213
+ if (row.feedback === 'down') org.down += 1;
214
+ orgs.set(row.orgId, org);
215
+ /**
216
+ * A FAILING turn. Thumbs-down, or nothing retrieved at all (AGL-2314).
217
+ *
218
+ * Collected before the `continue` below, so an ungrounded turn — the case
219
+ * that leaves the loop early — is not silently excluded from the very
220
+ * shortlist it most belongs on.
221
+ */ if (row.feedback === 'down' || !row.docsPaths.length) {
222
+ proseCandidates.push({
223
+ orgId: row.orgId,
224
+ exchangeId: row.exchangeId,
225
+ route: row.route || '(unknown)',
226
+ feedback: row.feedback,
227
+ grounded: row.docsPaths.length > 0
228
+ });
229
+ }
230
+ if (!row.docsPaths.length) {
231
+ var _ungroundedRoutes_get;
232
+ // Retrieval matched nothing. Counted here and NOT in `docsGaps` — a
233
+ // question with no citation has no path to rank under, which is
234
+ // precisely why a path-keyed ranking cannot see a missing page.
235
+ ungroundedQuestions += 1;
236
+ if (row.feedback === 'down') ungroundedDown += 1;
237
+ const route = row.route || '(unknown)';
238
+ const entry = (_ungroundedRoutes_get = ungroundedRoutes.get(route)) != null ? _ungroundedRoutes_get : {
239
+ route,
240
+ questions: 0,
241
+ down: 0
242
+ };
243
+ entry.questions += 1;
244
+ if (row.feedback === 'down') entry.down += 1;
245
+ ungroundedRoutes.set(route, entry);
246
+ continue;
247
+ }
248
+ // Cost is attributed to EVERY path the turn cited, so the column is
249
+ // "what did questions touching this page cost", not a partition of the
250
+ // total. Splitting a turn's cost across its citations would understate
251
+ // an expensive page that is always cited alongside others, and the
252
+ // column exists to find pages worth rewriting, not to balance a ledger.
253
+ for (const path of new Set(row.docsPaths)){
254
+ var _gaps_get;
255
+ const entry = (_gaps_get = gaps.get(path)) != null ? _gaps_get : {
256
+ row: {
257
+ path,
258
+ questions: 0,
259
+ up: 0,
260
+ down: 0,
261
+ providerCostUsd: 0
262
+ },
263
+ orgs: new Set()
264
+ };
265
+ entry.row.questions += 1;
266
+ entry.row.providerCostUsd += row.providerCostUsd;
267
+ if (row.feedback === 'up') entry.row.up += 1;
268
+ if (row.feedback === 'down') entry.row.down += 1;
269
+ entry.orgs.add(row.orgId);
270
+ gaps.set(path, entry);
271
+ }
272
+ }
273
+ /**
274
+ * Thumbs-down first, then the ungrounded ones.
275
+ *
276
+ * A rated failure is somebody telling us the answer was wrong; an
277
+ * ungrounded turn is us telling ourselves we had nothing to answer with.
278
+ * Both are worth reading, and the first is worth reading first.
279
+ */ proseCandidates.sort((a, b)=>{
280
+ const rank = (candidate)=>candidate.feedback === 'down' ? 0 : 1;
281
+ return rank(a) - rank(b);
282
+ });
283
+ totals.cacheReadRate = aiCacheHitRate({
284
+ input: totals.inputTokens,
285
+ cached: totals.cacheReadTokens,
286
+ cacheWrite: totals.cacheWriteTokens
287
+ });
288
+ for (const _ref of kinds){
289
+ let [kind, _ref1] = _ref, { outputs } = _ref1, bucket = _object_without_properties_loose(_ref1, [
290
+ "outputs"
291
+ ]);
292
+ totals.byKind[kind] = _extends({}, bucket, {
293
+ outputP95: nearestRankPercentile(outputs, 0.95),
294
+ cacheHitRate: aiCacheHitRate({
295
+ input: bucket.inputTokens,
296
+ cached: bucket.cacheReadTokens,
297
+ cacheWrite: bucket.cacheWriteTokens
298
+ })
299
+ });
300
+ }
301
+ totals.deflectionRate = totals.messages ? totals.deflected / totals.messages : null;
302
+ const docsGaps = [
303
+ ...gaps.values()
304
+ ].map(({ row, orgs: orgSet })=>{
305
+ const rated = row.up + row.down;
306
+ return _extends({}, row, {
307
+ orgs: orgSet.size,
308
+ downRate: rated ? row.down / rated : null
309
+ });
310
+ })// Thumbs-down first, then volume. Ranking on volume alone surfaces the
311
+ // pages people read most, which is a popularity list and not a gap list;
312
+ // ranking on rate alone puts a single grumpy rating above a page that
313
+ // failed forty people. Down count leads, volume breaks the tie.
314
+ .sort((a, b)=>b.down - a.down || b.questions - a.questions).slice(0, limit);
315
+ const ungroundedRouteRows = [
316
+ ...ungroundedRoutes.values()
317
+ ].sort((a, b)=>b.questions - a.questions || b.down - a.down);
318
+ const orgRows = [
319
+ ...orgs.values()
320
+ ].sort((a, b)=>b.providerCostUsd - a.providerCostUsd || b.messages - a.messages);
321
+ return {
322
+ scanned: rows.length,
323
+ truncated: Boolean(options.truncated),
324
+ totals,
325
+ docsGaps,
326
+ ranked: {
327
+ // `gaps` rather than `docsGaps`: the latter is already sliced, so
328
+ // measuring it would report the cap as the total and the disclosure
329
+ // would agree with itself forever.
330
+ docsGaps: gaps.size,
331
+ ungroundedRoutes: ungroundedRoutes.size,
332
+ orgs: orgs.size
333
+ },
334
+ proseCandidates: proseCandidates.slice(0, limit),
335
+ ungrounded: {
336
+ questions: ungroundedQuestions,
337
+ down: ungroundedDown,
338
+ routes: ungroundedRouteRows.slice(0, limit)
339
+ },
340
+ orgs: orgRows.slice(0, limit)
341
+ };
342
+ }
343
+
344
+ //# sourceMappingURL=assist-signal-mining.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/ai/src/lib/usage/assist-signal-mining.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 assistProviderCostUsd,\n ASSIST_PROVIDER_COST_FIELD,\n} from '@aglyn/aglyn/app-utils/assist-credits'\nimport { aiCacheHitRate } from '../model/ai-tokens'\nimport { aiUsageKindFromRoute } from '../model/ai-usage-by-user'\n\n/**\n * The read side of the Aglyn Assist data loop (AGL-1860, AGL-2252).\n *\n * `orgs/{id}/assistSignals/{id}` is written on every assist turn and, until\n * this module, was read by nothing. That is a specific kind of failure: the\n * signal document exists BECAUSE AGL-1972 split the prose from the analytics\n * so the corpus could outlive the 180-day expiry on what people typed. A\n * corpus preserved for a reader that does not exist is just retention.\n *\n * Three questions, answered from one pass:\n *\n * 1. **Where are the docs thin?** Rank the cited docs paths by how often a\n * question landed on them and how often the answer was rated down. A\n * page cited constantly and rated down is a page that is being FOUND and\n * is not answering — the single most actionable row in the set, and the\n * one AGL-1860 wants turned into a docs issue.\n * 2. **What did retrieval miss entirely?** A turn with no `docsPaths` is a\n * question the corpus could not match at all, so the model answered\n * ungrounded. That is a sharper gap signal than a low rating, and it is\n * invisible in any ranking keyed on paths — a missing page cites nothing,\n * so it appears nowhere. It is counted separately, by ROUTE, so the gap\n * comes with the screen the person was looking at when they hit it.\n * 3. **What is this costing, and to whom?** Per-org and fleet-wide token and\n * dollar rollups, plus the cache-read rate. That last one settles a\n * question the chat route could only pose: the cached system prefix\n * measures 1,030–1,190 tokens against Sonnet 5's 1,024-token minimum, so\n * whether it caches at all is an empirical question and `cacheReadTokens`\n * is the only evidence. A prefix under the minimum caches silently not at\n * all, and the bill is the only place it shows.\n *\n * Pure and free of Firestore, so it can be tested on fixtures rather than on\n * a mocked SDK — the route does the reading, this does the arithmetic.\n */\n\n/** One `assistSignals` document, as the route projects it. */\nexport interface AssistSignalRow {\n orgId: string\n /**\n * The signal's document id, which IS the exchange's id (AGL-2314).\n *\n * `recordAssistExchange` mints one id and writes both halves under it —\n * `assistExchanges/{id}` for the prose that expires and `assistSignals/{id}`\n * for the analytics that do not — deliberately, \"so an exchange and its\n * signal are joinable for as long as both exist, without storing a second\n * pointer that could rot\". Nothing ever made the join. This is the field\n * that lets the corpus be read.\n */\n exchangeId: string\n route: string\n /**\n * What the turn was for, as the rollups name it (AGL-2937): `assist`, a\n * besigner mode, or a job kind. A signal written before the field is read\n * by its route, where a generation job's step reads as `job`.\n */\n kind?: string\n model: string\n tier: 'free' | 'entitled' | string\n inputTokens: number\n outputTokens: number\n cacheReadTokens: number\n cacheWriteTokens: number\n /**\n * What this turn cost us, at the serving model's provider rates. Every\n * dollar mined out of this module is that figure: the signals page asks\n * one money question and it is \"what are we spending\" (AGL-3015).\n */\n providerCostUsd: number\n docsPaths: string[]\n stopReason: string | null\n feedback: 'up' | 'down' | null\n /** Served with no model call — docs retrieval or a cache hit (AGL-2486). */\n deflected: boolean\n}\n\nexport interface DocsGapRow {\n path: string\n /** Turns that cited this path. */\n questions: number\n up: number\n down: number\n /** Distinct orgs that landed here — a gap one org has is not a gap. */\n orgs: number\n providerCostUsd: number\n /** `down / (up + down)`, or null when nobody rated. */\n downRate: number | null\n}\n\nexport interface UngroundedRoute {\n route: string\n questions: number\n down: number\n}\n\n/**\n * A turn whose PROSE is worth reading (AGL-2314).\n *\n * `assistExchanges` holds the verbatim half — the question a customer typed\n * and the answer we gave — for 180 days, and the module header calls it \"the\n * data loop's corpus\". No corpus consumer existed: nothing in the repo read\n * the collection, so we were retaining customers' words, and publicly\n * promising to, for zero product value.\n *\n * The shortlist is deliberately NOT every turn. Prose is fetched only for\n * turns that FAILED — rated thumbs-down, or grounded in no documentation at\n * all — because those are the ones where the counts cannot say what went\n * wrong and the words can. Reading the successful ones would be surveillance\n * with a dashboard on it.\n */\nexport interface ProseCandidate {\n orgId: string\n /**\n * That workspace by name, filled in by the route.\n *\n * Optional because this module is pure and Firestore-free: it can count a\n * workspace's turns and it cannot know what the workspace is called. The\n * route resolves the labels and the reader falls back to the id, so a\n * workspace outside the lookup is still a lead somebody can search for.\n */\n orgLabel?: string | null\n exchangeId: string\n /** The console screen the question was asked from. */\n route: string\n feedback: 'up' | 'down' | null\n /** False when retrieval cited no documentation at all. */\n grounded: boolean\n}\n\nexport interface OrgCostRow {\n orgId: string\n /** That workspace by name — see {@link ProseCandidate.orgLabel}. */\n orgLabel?: string | null\n messages: number\n inputTokens: number\n outputTokens: number\n cacheReadTokens: number\n cacheWriteTokens: number\n providerCostUsd: number\n down: number\n}\n\n/** One row of a cost breakdown — see `totals.byTier` / `totals.byModel`. */\nexport interface CostSplit {\n messages: number\n providerCostUsd: number\n}\n\n/** One kind of model turn, summed (AGL-2937) — see `totals.byKind`. */\nexport interface KindTokenSplit {\n messages: number\n providerCostUsd: number\n inputTokens: number\n outputTokens: number\n cacheReadTokens: number\n cacheWriteTokens: number\n /**\n * The output 95 of every 100 turns of this kind stayed within, by nearest\n * rank — the figure a kind's `max_tokens` is sized against.\n */\n outputP95: number\n /** The share of this kind's prompt tokens the cache served — `aiCacheHitRate`. */\n cacheHitRate: number | null\n}\n\n/** The kinds as the board lists them, dearest first. */\nexport function kindTokenRows(\n split: Record<string, KindTokenSplit>,\n): Array<KindTokenSplit & { kind: string }> {\n return Object.entries(split)\n .map(([kind, value]) => ({ kind, ...value }))\n .sort(\n (a, b) =>\n b.providerCostUsd - a.providerCostUsd || b.messages - a.messages || a.kind.localeCompare(b.kind),\n )\n}\n\n/** A sample's value at a percentile by nearest rank — always one that was seen; 0 for none. */\nexport function nearestRankPercentile(values: readonly number[], percentile: number): number {\n if (!values.length) return 0\n const sorted = [...values].sort((a, b) => a - b)\n const rank = Math.min(sorted.length, Math.max(1, Math.ceil(percentile * sorted.length)))\n return sorted[rank - 1]\n}\n\n/**\n * A cost breakdown as a sorted, labelled list — dearest first (AGL-2340).\n *\n * Exported because the ordering is the readable half. A breakdown in\n * whatever order the keys happened to be inserted is a table you have to\n * scan; the point of the panel is that the expensive line is the top line.\n */\nexport function costSplitRows(\n split: Record<string, CostSplit>,\n): { key: string; messages: number; providerCostUsd: number }[] {\n return Object.entries(split)\n .map(([key, value]) => ({\n key,\n messages: value.messages,\n providerCostUsd: value.providerCostUsd,\n }))\n .sort((a, b) => b.providerCostUsd - a.providerCostUsd || a.key.localeCompare(b.key))\n}\n\n/**\n * One workspace on the month's spend leaderboard (AGL-2930).\n *\n * Read off `assistUsage/{month}` rather than off the signals: the signals\n * carry every turn ever recorded and no month, so ranking them answers\n * \"who has spent the most since the beginning\", and the board's question is\n * \"who is spending the most NOW\". The month document is also where the\n * refusal counter lives, so the row can say how often the org was refused\n * beside how much it spent — the two numbers a staff reader compares.\n */\nexport interface AssistSpendRow {\n orgId: string\n orgLabel?: string | null\n plan: string\n aiAddon: boolean\n /** Credits drawn this month, from the measured spend. */\n credits: number\n providerCostUsd: number\n refusals: {\n band: number\n cap: number\n messages: number\n budget: number\n /** A hard AI allotment a manager set (AGL-2942). */\n allotment: number\n /** The Free taste's rungs (AGL-2925); zero on every paid workspace. */\n account: number\n requests: number\n refusals: number\n platform: number\n total: number\n }\n}\n\n/** The Free taste's refusals as one figure: the board names the wall, not each rung. */\nexport function freeTasteRefusals(refusals: AssistSpendRow['refusals']): number {\n return refusals.account + refusals.requests + refusals.refusals + refusals.platform\n}\n\n/**\n * The leaderboard's ordering: dearest first, then most credits, then by id\n * so two equal rows render in one stable order rather than the order the\n * scan happened to return them in. Returns the top `limit` and how many\n * were ranked, so the page can say \"top 25 of 140\" rather than imply the\n * cut is the whole fleet.\n */\nexport function rankAssistSpend(\n rows: readonly AssistSpendRow[],\n limit: number,\n): { rows: AssistSpendRow[]; ranked: number } {\n const sorted = [...rows].sort(\n (a, b) =>\n b.providerCostUsd - a.providerCostUsd ||\n b.credits - a.credits ||\n a.orgId.localeCompare(b.orgId),\n )\n const cap = Number.isFinite(limit) && limit > 0 ? Math.floor(limit) : sorted.length\n return { rows: sorted.slice(0, cap), ranked: sorted.length }\n}\n\n/**\n * Today's platform-wide free-tier AI spend against its daily ceiling\n * (AGL-2925), as the route reads it beside the mined signals. Declared here,\n * where the page's report type lives, so the client page needs no import\n * from the admin library to name it.\n */\nexport interface AssistFreeSpendReadout {\n /** The UTC day the figures describe. */\n day: string\n /**\n * The day's free spend as the CEILING measures it — the billed figure,\n * because the ceiling this is compared against was sized against it and\n * the reservation refuses on the same reading (AGL-3015). The one dollar\n * on this page that is not our provider bill, and it is a wall rather than\n * a cost.\n */\n estCostUsd: number\n requests: number\n refusals: number\n ceilingUsd: number\n /** True once staff were mailed at 80% today. */\n alerted: boolean\n /** True while every Free workspace is refused generation for the day. */\n paused: boolean\n}\n\nexport interface AssistMiningReport {\n scanned: number\n /** True when the read hit its ceiling — see `mineAssistSignals`. */\n truncated: boolean\n totals: {\n messages: number\n inputTokens: number\n outputTokens: number\n cacheReadTokens: number\n cacheWriteTokens: number\n providerCostUsd: number\n /**\n * Turns answered with NO model call — docs retrieval or an answer-cache\n * hit (AGL-2486). Counted separately from `messages`, which is every\n * turn, so `deflected / messages` is the deflection rate.\n */\n deflected: number\n /**\n * That rate, or `null` when nothing was scanned.\n *\n * Nullable rather than 0 for the reason `costUsd` on a reservation is:\n * \"no turns were scanned\" and \"every turn cost a model call\" are opposite\n * findings, and 0 says the second one when the truth is the first. This\n * is the headline number for whether Assist is affordable to leave on,\n * and it must not be able to report a false alarm on an idle month.\n */\n deflectionRate: number | null\n /**\n * Share of prompt tokens served from cache — reads over everything the\n * prompts were billed as, cache writes included (`aiCacheHitRate`) — or\n * null at zero.\n */\n cacheReadRate: number | null\n /**\n * Cost split by entitlement tier, then by model (AGL-2340).\n *\n * Both carried as `{ messages, providerCostUsd }` rather than a bare turn\n * count, because the questions these answer are money questions and a\n * count cannot answer either of them. `byTier` settles \"is the free tier\n * eating the margin, or are paying orgs?\" — the free tier can be a\n * minority of turns and a majority of spend, and a count says the\n * opposite of the truth in exactly that case. `byModel` settles \"would a\n * cheaper model on the common path fix this?\", where the whole point is\n * that turns and dollars do not move together.\n */\n byTier: Record<string, CostSplit>\n byModel: Record<string, CostSplit>\n /**\n * Model turns split by what they were for (AGL-2937): cost, the four\n * token counts, the p95 output and the cache hit rate of each kind. A\n * turn answered with no model call has no tokens to split and is left\n * out.\n */\n byKind: Record<string, KindTokenSplit>\n stopReasons: Record<string, number>\n feedback: { up: number; down: number; none: number }\n }\n docsGaps: DocsGapRow[]\n /**\n * How tall each ranking was BEFORE it was cut to `limit`.\n *\n * `truncated` reports only that the SCAN hit its ceiling. It says nothing\n * about the rankings built from what was scanned, and those are cut too —\n * every list below is sliced to `limit`. A table showing twenty-five of a\n * hundred and thirty-seven cited pages looks exactly like one showing all\n * twenty-five there are, which is the AGL-2220 shape the scan ceiling was\n * given a banner to avoid, reproduced one layer down.\n *\n * Counted rather than inferred from `length === limit`: a ranking that is\n * exactly `limit` rows tall is the case where the guess is wrong in both\n * directions.\n */\n ranked: {\n docsGaps: number\n ungroundedRoutes: number\n orgs: number\n }\n /**\n * Today's free-tier spend against the platform ceiling (AGL-2925).\n * Optional because the miner is pure and does not produce it — the route\n * reads it from Firestore and attaches it beside the mined report.\n */\n freeSpend?: AssistFreeSpendReadout\n /** Turns whose words are worth reading — see {@link ProseCandidate}. */\n proseCandidates: ProseCandidate[]\n ungrounded: {\n questions: number\n down: number\n routes: UngroundedRoute[]\n }\n orgs: OrgCostRow[]\n}\n\nconst number = (value: unknown) => {\n const parsed = Number(value ?? 0)\n return Number.isFinite(parsed) ? parsed : 0\n}\n\n/** A signal's kind: the field once it is written, else read off its route (AGL-2937). */\nfunction signalKind(data: Record<string, unknown>, route: string): string {\n const kind = data['kind']\n if (typeof kind === 'string' && kind) return kind\n // A job step was metered under this route before its signal named the kind.\n return route === 'ai/jobs' ? 'job' : aiUsageKindFromRoute(route)\n}\n\n/**\n * Normalize one raw signal document. Every field is defaulted, because a\n * signal written by an older build is still evidence and dropping it would\n * bias the ranking toward whatever shipped most recently.\n */\nexport function assistSignalRow(\n orgId: string,\n exchangeId: string,\n data: Record<string, unknown>,\n): AssistSignalRow {\n const rawPaths = Array.isArray(data['docsPaths']) ? data['docsPaths'] : []\n const feedback = data['feedback']\n const route = String(data['route'] ?? '')\n return {\n orgId,\n exchangeId,\n route,\n kind: signalKind(data, route),\n model: String(data['model'] ?? 'unknown'),\n tier: String(data['tier'] ?? 'unknown'),\n inputTokens: number(data['inputTokens']),\n outputTokens: number(data['outputTokens']),\n cacheReadTokens: number(data['cacheReadTokens']),\n cacheWriteTokens: number(data['cacheWriteTokens']),\n // What the turn COST US (AGL-3015). The stored `estCostUsd` beside it\n // is the same turn at BILLED rates — the figure the customer's credits\n // came out of — and every dollar on the signals page is asking the other\n // question. A signal written before the split carries only the billed\n // figure, which over-reads our bill rather than under-reads it.\n providerCostUsd: assistProviderCostUsd(\n data['estCostUsd'],\n data[ASSIST_PROVIDER_COST_FIELD],\n ),\n docsPaths: rawPaths.map((path) => String(path)).filter(Boolean),\n stopReason: data['stopReason'] == null ? null : String(data['stopReason']),\n feedback: feedback === 'up' || feedback === 'down' ? feedback : null,\n // Strict `=== true`, so a signal written before the field existed reads\n // as \"served by a model\" rather than as deflected. Defaulting the other\n // way would credit historic turns with a saving that never happened and\n // make the rate look best on the day it shipped.\n deflected: data['deflected'] === true,\n }\n}\n\n/** Accumulate one turn's spend into a `byTier`/`byModel` bucket. */\nfunction addToSplit(\n split: Record<string, CostSplit>,\n key: string,\n providerCostUsd: number,\n) {\n const bucket = split[key] ?? { messages: 0, providerCostUsd: 0 }\n bucket.messages += 1\n bucket.providerCostUsd += providerCostUsd\n split[key] = bucket\n}\n\n/**\n * Rank the docs gaps and roll the money up.\n *\n * `truncated` is carried through rather than hidden. A sweep that quietly\n * stops at a ceiling and presents the remainder as the whole is the AGL-2220\n * defect, and it is worse here than there: a partial sample of a RANKING\n * looks exactly like a complete one, and the thing being ranked is where to\n * spend documentation effort.\n */\nexport function mineAssistSignals(\n rows: AssistSignalRow[],\n options: { truncated?: boolean; limit?: number } = {},\n): AssistMiningReport {\n const limit = options.limit ?? 25\n const totals = {\n messages: 0,\n inputTokens: 0,\n outputTokens: 0,\n cacheReadTokens: 0,\n cacheWriteTokens: 0,\n providerCostUsd: 0,\n deflected: 0,\n deflectionRate: null as number | null,\n cacheReadRate: null as number | null,\n byTier: {} as Record<string, CostSplit>,\n byModel: {} as Record<string, CostSplit>,\n byKind: {} as Record<string, KindTokenSplit>,\n stopReasons: {} as Record<string, number>,\n feedback: { up: 0, down: 0, none: 0 },\n }\n\n const gaps = new Map<\n string,\n { row: Omit<DocsGapRow, 'orgs' | 'downRate'>; orgs: Set<string> }\n >()\n const ungroundedRoutes = new Map<string, UngroundedRoute>()\n const orgs = new Map<string, OrgCostRow>()\n const proseCandidates: ProseCandidate[] = []\n const kinds = new Map<\n string,\n Omit<KindTokenSplit, 'outputP95' | 'cacheHitRate'> & { outputs: number[] }\n >()\n let ungroundedQuestions = 0\n let ungroundedDown = 0\n\n for (const row of rows) {\n totals.messages += 1\n totals.inputTokens += row.inputTokens\n totals.outputTokens += row.outputTokens\n totals.cacheReadTokens += row.cacheReadTokens\n totals.cacheWriteTokens += row.cacheWriteTokens\n totals.providerCostUsd += row.providerCostUsd\n if (row.deflected) totals.deflected += 1\n addToSplit(totals.byTier, row.tier, row.providerCostUsd)\n addToSplit(totals.byModel, row.model, row.providerCostUsd)\n if (!row.deflected) {\n const kind = row.kind || 'unknown'\n const bucket = kinds.get(kind) ?? {\n messages: 0,\n providerCostUsd: 0,\n inputTokens: 0,\n outputTokens: 0,\n cacheReadTokens: 0,\n cacheWriteTokens: 0,\n outputs: [],\n }\n bucket.messages += 1\n bucket.providerCostUsd += row.providerCostUsd\n bucket.inputTokens += row.inputTokens\n bucket.outputTokens += row.outputTokens\n bucket.cacheReadTokens += row.cacheReadTokens\n bucket.cacheWriteTokens += row.cacheWriteTokens\n bucket.outputs.push(row.outputTokens)\n kinds.set(kind, bucket)\n }\n const stop = row.stopReason ?? 'none'\n totals.stopReasons[stop] = (totals.stopReasons[stop] ?? 0) + 1\n if (row.feedback === 'up') totals.feedback.up += 1\n else if (row.feedback === 'down') totals.feedback.down += 1\n else totals.feedback.none += 1\n\n const org = orgs.get(row.orgId) ?? {\n orgId: row.orgId,\n messages: 0,\n inputTokens: 0,\n outputTokens: 0,\n cacheReadTokens: 0,\n cacheWriteTokens: 0,\n providerCostUsd: 0,\n down: 0,\n }\n org.messages += 1\n org.inputTokens += row.inputTokens\n org.outputTokens += row.outputTokens\n org.cacheReadTokens += row.cacheReadTokens\n org.cacheWriteTokens += row.cacheWriteTokens\n org.providerCostUsd += row.providerCostUsd\n if (row.feedback === 'down') org.down += 1\n orgs.set(row.orgId, org)\n\n /**\n * A FAILING turn. Thumbs-down, or nothing retrieved at all (AGL-2314).\n *\n * Collected before the `continue` below, so an ungrounded turn — the case\n * that leaves the loop early — is not silently excluded from the very\n * shortlist it most belongs on.\n */\n if (row.feedback === 'down' || !row.docsPaths.length) {\n proseCandidates.push({\n orgId: row.orgId,\n exchangeId: row.exchangeId,\n route: row.route || '(unknown)',\n feedback: row.feedback,\n grounded: row.docsPaths.length > 0,\n })\n }\n\n if (!row.docsPaths.length) {\n // Retrieval matched nothing. Counted here and NOT in `docsGaps` — a\n // question with no citation has no path to rank under, which is\n // precisely why a path-keyed ranking cannot see a missing page.\n ungroundedQuestions += 1\n if (row.feedback === 'down') ungroundedDown += 1\n const route = row.route || '(unknown)'\n const entry = ungroundedRoutes.get(route) ?? {\n route,\n questions: 0,\n down: 0,\n }\n entry.questions += 1\n if (row.feedback === 'down') entry.down += 1\n ungroundedRoutes.set(route, entry)\n continue\n }\n\n // Cost is attributed to EVERY path the turn cited, so the column is\n // \"what did questions touching this page cost\", not a partition of the\n // total. Splitting a turn's cost across its citations would understate\n // an expensive page that is always cited alongside others, and the\n // column exists to find pages worth rewriting, not to balance a ledger.\n for (const path of new Set(row.docsPaths)) {\n const entry = gaps.get(path) ?? {\n row: { path, questions: 0, up: 0, down: 0, providerCostUsd: 0 },\n orgs: new Set<string>(),\n }\n entry.row.questions += 1\n entry.row.providerCostUsd += row.providerCostUsd\n if (row.feedback === 'up') entry.row.up += 1\n if (row.feedback === 'down') entry.row.down += 1\n entry.orgs.add(row.orgId)\n gaps.set(path, entry)\n }\n }\n\n /**\n * Thumbs-down first, then the ungrounded ones.\n *\n * A rated failure is somebody telling us the answer was wrong; an\n * ungrounded turn is us telling ourselves we had nothing to answer with.\n * Both are worth reading, and the first is worth reading first.\n */\n proseCandidates.sort((a, b) => {\n const rank = (candidate: ProseCandidate) =>\n candidate.feedback === 'down' ? 0 : 1\n return rank(a) - rank(b)\n })\n\n totals.cacheReadRate = aiCacheHitRate({\n input: totals.inputTokens,\n cached: totals.cacheReadTokens,\n cacheWrite: totals.cacheWriteTokens,\n })\n for (const [kind, { outputs, ...bucket }] of kinds) {\n totals.byKind[kind] = {\n ...bucket,\n outputP95: nearestRankPercentile(outputs, 0.95),\n cacheHitRate: aiCacheHitRate({\n input: bucket.inputTokens,\n cached: bucket.cacheReadTokens,\n cacheWrite: bucket.cacheWriteTokens,\n }),\n }\n }\n totals.deflectionRate = totals.messages\n ? totals.deflected / totals.messages\n : null\n\n const docsGaps = [...gaps.values()]\n .map(({ row, orgs: orgSet }) => {\n const rated = row.up + row.down\n return {\n ...row,\n orgs: orgSet.size,\n downRate: rated ? row.down / rated : null,\n }\n })\n // Thumbs-down first, then volume. Ranking on volume alone surfaces the\n // pages people read most, which is a popularity list and not a gap list;\n // ranking on rate alone puts a single grumpy rating above a page that\n // failed forty people. Down count leads, volume breaks the tie.\n .sort((a, b) => b.down - a.down || b.questions - a.questions)\n .slice(0, limit)\n\n const ungroundedRouteRows = [...ungroundedRoutes.values()].sort(\n (a, b) => b.questions - a.questions || b.down - a.down,\n )\n const orgRows = [...orgs.values()].sort(\n (a, b) => b.providerCostUsd - a.providerCostUsd || b.messages - a.messages,\n )\n\n return {\n scanned: rows.length,\n truncated: Boolean(options.truncated),\n totals,\n docsGaps,\n ranked: {\n // `gaps` rather than `docsGaps`: the latter is already sliced, so\n // measuring it would report the cap as the total and the disclosure\n // would agree with itself forever.\n docsGaps: gaps.size,\n ungroundedRoutes: ungroundedRoutes.size,\n orgs: orgs.size,\n },\n proseCandidates: proseCandidates.slice(0, limit),\n ungrounded: {\n questions: ungroundedQuestions,\n down: ungroundedDown,\n routes: ungroundedRouteRows.slice(0, limit),\n },\n orgs: orgRows.slice(0, limit),\n }\n}\n"],"names":["assistProviderCostUsd","ASSIST_PROVIDER_COST_FIELD","aiCacheHitRate","aiUsageKindFromRoute","kindTokenRows","split","Object","entries","map","kind","value","sort","a","b","providerCostUsd","messages","localeCompare","nearestRankPercentile","values","percentile","length","sorted","rank","Math","min","max","ceil","costSplitRows","key","freeTasteRefusals","refusals","account","requests","platform","rankAssistSpend","rows","limit","credits","orgId","cap","Number","isFinite","floor","slice","ranked","number","parsed","signalKind","data","route","assistSignalRow","exchangeId","rawPaths","Array","isArray","feedback","String","model","tier","inputTokens","outputTokens","cacheReadTokens","cacheWriteTokens","docsPaths","path","filter","Boolean","stopReason","deflected","addToSplit","bucket","mineAssistSignals","options","totals","deflectionRate","cacheReadRate","byTier","byModel","byKind","stopReasons","up","down","none","gaps","Map","ungroundedRoutes","orgs","proseCandidates","kinds","ungroundedQuestions","ungroundedDown","row","get","outputs","push","set","stop","org","grounded","entry","questions","Set","add","candidate","input","cached","cacheWrite","outputP95","cacheHitRate","docsGaps","orgSet","rated","size","downRate","ungroundedRouteRows","orgRows","scanned","truncated","ungrounded","routes"],"mappings":";;AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,qBAAqB,EACrBC,0BAA0B,QACrB,wCAAuC;AAC9C,SAASC,cAAc,QAAQ,wBAAoB;AACnD,SAASC,oBAAoB,QAAQ,+BAA2B;AAqKhE,sDAAsD,GACtD,OAAO,SAASC,cACdC,KAAqC;IAErC,OAAOC,OAAOC,OAAO,CAACF,OACnBG,GAAG,CAAC,CAAC,CAACC,MAAMC,MAAM,GAAM;YAAED;WAASC,QACnCC,IAAI,CACH,CAACC,GAAGC,IACFA,EAAEC,eAAe,GAAGF,EAAEE,eAAe,IAAID,EAAEE,QAAQ,GAAGH,EAAEG,QAAQ,IAAIH,EAAEH,IAAI,CAACO,aAAa,CAACH,EAAEJ,IAAI;AAEvG;AAEA,6FAA6F,GAC7F,OAAO,SAASQ,sBAAsBC,MAAyB,EAAEC,UAAkB;IACjF,IAAI,CAACD,OAAOE,MAAM,EAAE,OAAO;IAC3B,MAAMC,SAAS;WAAIH;KAAO,CAACP,IAAI,CAAC,CAACC,GAAGC,IAAMD,IAAIC;IAC9C,MA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