@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,690 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { resolveEffectivePlan } from "@aglyn/aglyn/app-utils/plan-entitlements";
17
+ import { ASSIST_EDIT_ACTION_ID, ASSIST_EDIT_DOCUMENT_KINDS, ASSIST_EDIT_TOOL_NAME } from "../model/assist-edit.js";
18
+ /**
19
+ * Destinations verified to read `assist_*` search params. EMPTY on purpose:
20
+ * `assertInertActions()` fails any action with `prefill: true` whose route is
21
+ * not listed, so turning prefill on requires wiring the page first rather
22
+ * than remembering to.
23
+ */ export const PREFILL_READY_ROUTES = [];
24
+ /** Query-param prefix for proposed values. Namespaced so a page opting in
25
+ * can never confuse an assistant suggestion with its own state. */ export const ASSIST_PREFILL_PREFIX = 'assist_';
26
+ const orgAction = (id, label, outcome, route, params = [])=>({
27
+ id,
28
+ label,
29
+ outcome,
30
+ route,
31
+ params,
32
+ prefill: false
33
+ });
34
+ const isNavigateAction = (action)=>action.kind !== 'edit';
35
+ /**
36
+ * The registry. Ordered specific-first — `describeView` takes the first
37
+ * match, so a host sub-page must precede the host dashboard, and every
38
+ * host route must precede the bare `/[orgSlug]` home.
39
+ *
40
+ * Content rule: every line here has to be TRUE of the shipped console. These
41
+ * strings are asserted to the model as fact and it will repeat them, so a
42
+ * guessed button label becomes a confidently wrong instruction. Where the
43
+ * exact affordance is uncertain the line names the SCREEN and its purpose
44
+ * and lets docs retrieval supply the steps — a vaguer sentence that is right
45
+ * beats a specific one that is invented.
46
+ */ export const ASSIST_VIEWS = [
47
+ {
48
+ key: 'besigner',
49
+ match: /^\/[^/]+\/hosts\/[^/]+\/(screens|components|templates|layouts|emails)\/.*\/besigner$/,
50
+ screen: 'The Besigner — the visual editor for a screen, component, template, layout or email.',
51
+ plain: [
52
+ 'Edit the page visually: pick an element on the canvas and change its text, styling and layout.',
53
+ 'Work is saved to a draft version; publishing is a separate, deliberate step.',
54
+ 'Preview shows the draft as a visitor would see it, without publishing.'
55
+ ],
56
+ technical: [
57
+ 'Route: /[orgSlug]/hosts/[host]/screens/[screenId]/versions/[versionId]/besigner (and the component, template, layout and email variants).',
58
+ 'Editing writes to the version named in the path — versioning is the undo, so a save never overwrites what is live.',
59
+ 'The preview route is the same path with /preview in place of /besigner.'
60
+ ],
61
+ actions: [
62
+ {
63
+ kind: 'edit',
64
+ id: ASSIST_EDIT_ACTION_ID,
65
+ label: 'Apply as draft',
66
+ outcome: 'the proposed changes on the open canvas, unsaved until the document is saved',
67
+ documents: ASSIST_EDIT_DOCUMENT_KINDS
68
+ }
69
+ ]
70
+ },
71
+ {
72
+ key: 'host-screens',
73
+ match: /^\/[^/]+\/hosts\/[^/]+\/screens(\/|$)/,
74
+ screen: 'Screens — the list of pages on this site.',
75
+ plain: [
76
+ 'Every page a visitor can reach is a screen listed here.',
77
+ 'Open a screen to see its versions, then open the Besigner to edit it.',
78
+ 'Publishing a screen version is what puts a change on the live site.'
79
+ ],
80
+ technical: [
81
+ 'Route: /[orgSlug]/hosts/[host]/screens; detail is .../screens/[screenId]/versions/[versionId]/view.',
82
+ '[host] in the path is the site (host) document id, not the domain name.'
83
+ ],
84
+ actions: [
85
+ orgAction('open.host.screens', 'Open Screens', 'the list of pages on this site', '/[orgSlug]/hosts/[host]/screens')
86
+ ]
87
+ },
88
+ {
89
+ key: 'host-theme',
90
+ match: /^\/[^/]+\/hosts\/[^/]+\/theme(\/|$)/,
91
+ screen: 'Theme — the site-wide colors, type and spacing every screen inherits.',
92
+ plain: [
93
+ 'Change something here and it changes everywhere on the site at once.',
94
+ 'This is the place to fix a color or a font you keep re-setting on individual elements.'
95
+ ],
96
+ technical: [
97
+ 'Route: /[orgSlug]/hosts/[host]/theme.',
98
+ 'Theme values resolve at render time, so screens pick them up without being republished individually.'
99
+ ],
100
+ actions: []
101
+ },
102
+ {
103
+ // The key is the analytics/debug handle and stays as it is; the section
104
+ // it names is what was renamed. Both addresses match because the console
105
+ // redirects the older one, so a client can report either.
106
+ key: 'host-workflows',
107
+ match: /^\/[^/]+\/hosts\/[^/]+\/(automation|workflows)(\/|$)/,
108
+ screen: 'Automation — workflows, actions and webhooks that run when something happens on the site.',
109
+ plain: [
110
+ 'A workflow is a trigger plus the actions that follow it, such as sending an email when a form is submitted.',
111
+ 'Build the trigger first, then add the actions it should run.',
112
+ 'Workflows, Actions and Webhooks are the three tabs of this section.'
113
+ ],
114
+ technical: [
115
+ 'Route: /[orgSlug]/hosts/[host]/automation, with ?tab=workflows, ?tab=actions or ?tab=webhooks.',
116
+ 'Webhook actions let a workflow call an external endpoint; see the automation docs for the payload shape.'
117
+ ],
118
+ actions: []
119
+ },
120
+ {
121
+ key: 'host-products',
122
+ match: /^\/[^/]+\/hosts\/[^/]+\/products(\/|$)/,
123
+ screen: 'Products — the commerce catalog for this site.',
124
+ plain: [
125
+ 'Add and edit the things this site sells, including price and availability.',
126
+ 'A product has to exist here before a screen can put it in front of a buyer.'
127
+ ],
128
+ technical: [
129
+ 'Route: /[orgSlug]/hosts/[host]/products.',
130
+ 'Catalog data is site-scoped: products belong to [host], not to the workspace.'
131
+ ],
132
+ actions: []
133
+ },
134
+ {
135
+ key: 'host-redirects',
136
+ match: /^\/[^/]+\/hosts\/[^/]+\/redirects(\/|$)/,
137
+ screen: 'Redirects — rules that send one path on this site to another.',
138
+ plain: [
139
+ 'Use a redirect when a page has moved, so an old link still lands somewhere useful.',
140
+ 'Each rule is a path to match and a destination to send it to.'
141
+ ],
142
+ technical: [
143
+ 'Route: /[orgSlug]/hosts/[host]/redirects.',
144
+ 'Rules are evaluated by the tenant runtime on the request path, before the screen is resolved.'
145
+ ],
146
+ actions: [
147
+ orgAction('open.host.redirects', 'Open Redirects', 'the redirect rules for this site', '/[orgSlug]/hosts/[host]/redirects', [
148
+ 'source',
149
+ 'target'
150
+ ])
151
+ ]
152
+ },
153
+ {
154
+ key: 'host-analytics',
155
+ match: /^\/[^/]+\/hosts\/[^/]+\/analytics(\/|$)/,
156
+ screen: 'Analytics — traffic and visitor figures for this site.',
157
+ plain: [
158
+ 'See how many people visited, and which screens they landed on.',
159
+ 'Figures cover the live site only — drafts and previews are not counted.'
160
+ ],
161
+ technical: [
162
+ 'Route: /[orgSlug]/hosts/[host]/analytics.'
163
+ ],
164
+ actions: []
165
+ },
166
+ {
167
+ key: 'host-setup',
168
+ match: /^\/[^/]+\/hosts\/[^/]+\/setup(\/|$)/,
169
+ screen: 'Site setup — the site’s own settings, including its domain.',
170
+ plain: [
171
+ 'Connecting a custom domain starts here.',
172
+ 'A domain change needs DNS records at whoever the domain is registered with; the console shows which ones.'
173
+ ],
174
+ technical: [
175
+ 'Route: /[orgSlug]/hosts/[host]/setup.',
176
+ 'Owner/admin-only controls live on the sibling /admin page rather than here, so collaborators can use Setup safely.'
177
+ ],
178
+ actions: [
179
+ orgAction('open.host.setup', 'Open site setup', 'this site’s settings, where a custom domain is connected', '/[orgSlug]/hosts/[host]/setup', [
180
+ 'domain'
181
+ ])
182
+ ]
183
+ },
184
+ {
185
+ key: 'host-data',
186
+ match: /^\/[^/]+\/hosts\/[^/]+\/data(\/|$)/,
187
+ screen: 'Site data — the datasets this site reads and writes.',
188
+ plain: [
189
+ 'A dataset is a structured list — products, posts, submissions — that screens can display.',
190
+ 'Define the fields first; screens bind to them afterwards.'
191
+ ],
192
+ technical: [
193
+ 'Route: /[orgSlug]/hosts/[host]/data. The workspace-wide view is /[orgSlug]/data.'
194
+ ],
195
+ actions: []
196
+ },
197
+ {
198
+ key: 'host-dashboard',
199
+ match: /^\/[^/]+\/hosts\/[^/]+(\/|$)/,
200
+ screen: 'Site dashboard — the home page for one site in this workspace.',
201
+ plain: [
202
+ 'Everything about one site hangs off this page: its screens, theme, data, commerce and settings.',
203
+ 'A workspace can hold several sites; this is one of them.'
204
+ ],
205
+ technical: [
206
+ 'Route: /[orgSlug]/hosts/[host]. The [host] segment is the site document id.'
207
+ ],
208
+ actions: []
209
+ },
210
+ {
211
+ key: 'org-hosts',
212
+ match: /^\/[^/]+\/hosts(\/|$)/,
213
+ screen: 'Sites — every site in this workspace.',
214
+ plain: [
215
+ 'Each row is a site with its own screens, theme and domain.',
216
+ 'Agencies typically run one site per client from here.'
217
+ ],
218
+ technical: [
219
+ 'Route: /[orgSlug]/hosts.'
220
+ ],
221
+ actions: [
222
+ orgAction('open.org.hosts', 'Open Sites', 'every site in this workspace', '/[orgSlug]/hosts')
223
+ ]
224
+ },
225
+ {
226
+ key: 'org-billing',
227
+ match: /^\/[^/]+\/billing(\/|$)/,
228
+ screen: 'Billing & plans — the workspace subscription, plan and invoices.',
229
+ plain: [
230
+ 'The current plan and what it includes, and where to change it.',
231
+ 'Plan limits that stop you elsewhere in the console are set here.'
232
+ ],
233
+ technical: [
234
+ 'Route: /[orgSlug]/billing.',
235
+ 'Entitlements are resolved from the org plan; a limit reached elsewhere reports the entitlement it needs.'
236
+ ],
237
+ actions: [
238
+ orgAction('open.billing', 'Open Billing & plans', 'the plan for this workspace and how to change it', '/[orgSlug]/billing')
239
+ ]
240
+ },
241
+ {
242
+ key: 'org-team',
243
+ match: /^\/[^/]+\/team(\/|$)/,
244
+ screen: 'Team — the people in this workspace and what each may do.',
245
+ plain: [
246
+ 'Invite a teammate by email, and choose the role that decides what they can reach.',
247
+ 'Removing someone here removes their access to every site in the workspace.'
248
+ ],
249
+ technical: [
250
+ 'Route: /[orgSlug]/team; one member is /[orgSlug]/team/[uid].',
251
+ 'Seat counts follow the plan, so an invite can be refused by the billing entitlement rather than by permissions.'
252
+ ],
253
+ actions: [
254
+ orgAction('open.team', 'Open Team', 'the members of this workspace, where invites are sent', '/[orgSlug]/team', [
255
+ 'email',
256
+ 'role'
257
+ ])
258
+ ]
259
+ },
260
+ {
261
+ key: 'org-data',
262
+ match: /^\/[^/]+\/data(\/|$)/,
263
+ screen: 'Data — datasets shared across the whole workspace.',
264
+ plain: [
265
+ 'Structured lists defined once here can be used by any site in the workspace.',
266
+ 'If a list only belongs to one site, define it on that site’s own Data page instead.',
267
+ 'Define the fields before building the screen that displays them — screens bind to fields that already exist.'
268
+ ],
269
+ technical: [
270
+ 'Route: /[orgSlug]/data. The per-site view is /[orgSlug]/hosts/[host]/data.',
271
+ 'Workspace datasets are visible to every site in the workspace, so a field change here reaches all of them.'
272
+ ],
273
+ actions: [
274
+ orgAction('open.org.data', 'Open Data', 'the datasets shared across this workspace', '/[orgSlug]/data')
275
+ ]
276
+ },
277
+ {
278
+ key: 'org-media',
279
+ match: /^\/[^/]+\/media(\/|$)/,
280
+ screen: 'Media — images and files for this workspace.',
281
+ plain: [
282
+ 'Upload once here and use the file on any site in the workspace.',
283
+ 'If the file belongs to one site only, upload it on that site’s own Media page instead.',
284
+ 'Files are referenced by the screens that use them, so replacing a file changes it everywhere it appears.'
285
+ ],
286
+ technical: [
287
+ 'Route: /[orgSlug]/media. The per-site library is /[orgSlug]/hosts/[host]/media.',
288
+ 'Workspace media is shared across every site in the workspace; site media is scoped to that site.'
289
+ ],
290
+ actions: [
291
+ orgAction('open.org.media', 'Open Media', 'the images and files shared across this workspace', '/[orgSlug]/media')
292
+ ]
293
+ },
294
+ {
295
+ key: 'org-plugins',
296
+ match: /^\/[^/]+\/plugins(\/|$)/,
297
+ screen: 'Plugins — what is installed in this workspace.',
298
+ plain: [
299
+ 'A plugin adds a feature to the console, to your sites, or to both.',
300
+ 'Open one to see its settings and the permissions it was granted.'
301
+ ],
302
+ technical: [
303
+ 'Route: /[orgSlug]/plugins; one install is /[orgSlug]/plugins/[pluginRef].',
304
+ 'Plugins run inside a sandbox; the permissions listed on the install page are the boundary.'
305
+ ],
306
+ actions: []
307
+ },
308
+ {
309
+ key: 'org-marketplace',
310
+ match: /^\/[^/]+\/marketplace(\/|$)/,
311
+ screen: 'Marketplace — plugins and items available to install.',
312
+ plain: [
313
+ 'Browse what can be added, and install into this workspace.'
314
+ ],
315
+ technical: [
316
+ 'Route: /[orgSlug]/marketplace; a listing is /[orgSlug]/marketplace/[listingId].',
317
+ 'Publishing your own plugin is /[orgSlug]/marketplace/publish/plugin.'
318
+ ],
319
+ actions: []
320
+ },
321
+ {
322
+ key: 'org-support',
323
+ match: /^\/[^/]+\/support(\/|$)/,
324
+ screen: 'Support — the channels for getting help.',
325
+ plain: [
326
+ 'Raise a ticket, or ask in the forum.',
327
+ 'Which channels are available depends on the workspace plan.'
328
+ ],
329
+ technical: [
330
+ 'Route: /[orgSlug]/support, which forwards to the channel the plan makes primary.',
331
+ 'Channels are /[orgSlug]/support/tickets and /[orgSlug]/support/forum.'
332
+ ],
333
+ actions: [
334
+ orgAction('open.support', 'Open Support', 'the support channels for this workspace', '/[orgSlug]/support')
335
+ ]
336
+ },
337
+ {
338
+ key: 'org-settings',
339
+ match: /^\/[^/]+\/settings(\/|$)/,
340
+ screen: 'Workspace settings — the workspace’s own name, slug and options.',
341
+ plain: [
342
+ 'Settings that apply to the whole workspace rather than to one site.'
343
+ ],
344
+ technical: [
345
+ 'Route: /[orgSlug]/settings.',
346
+ 'The workspace slug is the [orgSlug] segment in every console URL, so changing it changes those links.'
347
+ ],
348
+ actions: []
349
+ },
350
+ {
351
+ key: 'org-home',
352
+ match: /^\/[^/]+\/?$/,
353
+ screen: 'Workspace home — the landing page for one workspace.',
354
+ plain: [
355
+ 'The starting point for a workspace: its sites, and the workspace-wide areas beside them.'
356
+ ],
357
+ technical: [
358
+ 'Route: /[orgSlug].'
359
+ ],
360
+ actions: []
361
+ }
362
+ ];
363
+ /** The view the user is standing on, or null where the route is unknown. */ export function describeView(route) {
364
+ var _ASSIST_VIEWS_find;
365
+ const path = sanitiseRoute(route);
366
+ if (!path) return null;
367
+ return (_ASSIST_VIEWS_find = ASSIST_VIEWS.find((view)=>view.match.test(path))) != null ? _ASSIST_VIEWS_find : null;
368
+ }
369
+ /**
370
+ * The actions a view offers a request: every navigation, and the edit action
371
+ * only to a request that cleared the edit rung.
372
+ */ export function offeredActions(view, rung) {
373
+ if (!view) return [];
374
+ return view.actions.filter((action)=>action.kind !== 'edit' || rung.edit);
375
+ }
376
+ /**
377
+ * Client-supplied strings that end up inside a SYSTEM block have to be
378
+ * treated as hostile, not merely untidy. `route` is whatever the panel says
379
+ * the pathname is, and an attacker who can shape it can otherwise write
380
+ * newlines, backticks and prose into the model's instructions — including a
381
+ * forged action fence, which is the one construct in this feature the model
382
+ * is told to treat as meaningful.
383
+ *
384
+ * So the allowed alphabet is exactly what a console path is made of. Anything
385
+ * else is dropped rather than escaped: there is no legitimate route that
386
+ * needs a backtick, and a sanitiser that tries to preserve intent is a
387
+ * sanitiser with a bypass in it.
388
+ */ export function sanitiseRoute(route) {
389
+ const cleaned = String(route != null ? route : '').replace(/[^A-Za-z0-9/_\-.[\]]/g, '').slice(0, 200);
390
+ return cleaned.startsWith('/') ? cleaned : '';
391
+ }
392
+ /**
393
+ * Same reasoning as `sanitiseRoute`, for a Firestore-shaped document id.
394
+ *
395
+ * Rejects rather than truncates, which is the difference between refusing an
396
+ * id and quietly pointing at a different one: `slice(0, 64)` on an over-long
397
+ * value yields a well-formed id for some OTHER document, and this function's
398
+ * output is substituted straight into a destination path.
399
+ */ export function sanitiseId(value) {
400
+ const raw = String(value != null ? value : '');
401
+ return raw.length <= 64 && /^[A-Za-z0-9_-]+$/.test(raw) ? raw : '';
402
+ }
403
+ /**
404
+ * The ONLY fields of the org document that may enter a prompt.
405
+ *
406
+ * An allowlist rather than a denylist, and stated as a literal rather than
407
+ * derived, because the failure mode is silent: the org doc grows a field one
408
+ * day — a Stripe customer id, an owner's email, a support note — and a
409
+ * spread would carry it into a third party's API without anything failing.
410
+ * Both fields named here are already on screen for any member who can open
411
+ * the panel, so nothing is disclosed that the asker could not read anyway.
412
+ *
413
+ * The plan is the one the workspace resolves to, as the console's badges name
414
+ * it (AGL-3034): a canceled subscription's stored plan grants nothing, and a
415
+ * staff comp grants a plan the stored field may not name.
416
+ */ export function safeOrgFacts(org) {
417
+ var _ref;
418
+ return {
419
+ name: String((_ref = org == null ? void 0 : org['name']) != null ? _ref : '').slice(0, 120),
420
+ plan: resolveEffectivePlan(org).slice(0, 40)
421
+ };
422
+ }
423
+ /**
424
+ * The per-VIEW system block — the screen description, and nothing about who
425
+ * is looking at it.
426
+ *
427
+ * The split from `viewFactsBlock` is the whole caching design, and it was
428
+ * not the first shape this took. Folding the workspace name, plan, slug and
429
+ * host id in here reads more natural and quietly destroys the cache: a
430
+ * prefix carrying the tenant's name is unique to that tenant, so on a
431
+ * multi-tenant console every org warms its own copy and the entry is usually
432
+ * cold when it matters. Derived purely from the route, the same block serves
433
+ * every workspace asking anything on that screen — which on a shared console
434
+ * is the difference between a cache that pays and one that mostly writes.
435
+ *
436
+ * So this block is a pure function of the registry and the rung — two
437
+ * variants a route at most, neither carrying a tenant byte — and everything
438
+ * that varies per request lives after the breakpoint.
439
+ */ export function viewScreenBlock(view, rung = {
440
+ edit: false
441
+ }) {
442
+ const lines = [];
443
+ if (view) {
444
+ lines.push(`This screen: ${view.screen}`);
445
+ if (view.plain.length) {
446
+ lines.push('What the user can do here:');
447
+ for (const line of view.plain)lines.push(`- ${line}`);
448
+ }
449
+ if (view.technical.length) {
450
+ lines.push('Technical detail for the "Under the hood" line:');
451
+ for (const line of view.technical)lines.push(`- ${line}`);
452
+ }
453
+ const offered = offeredActions(view, rung);
454
+ const navigations = offered.filter(isNavigateAction);
455
+ if (navigations.length) {
456
+ lines.push('Actions you may PROPOSE from this screen (ids are exact; propose at most one, and only when the user asked to get something done):');
457
+ for (const action of navigations){
458
+ const params = action.params.length ? ` params: ${action.params.join(', ')}` : ' params: none';
459
+ lines.push(`- id "${action.id}" — ${action.label}: opens ${action.outcome}.${params}`);
460
+ }
461
+ } else if (offered.length) {
462
+ lines.push('This screen offers no page to open. Do not emit an action block here.');
463
+ } else {
464
+ lines.push('This screen offers no proposable actions. Do not emit an action block here.');
465
+ }
466
+ for (const action of offered){
467
+ if (action.kind !== 'edit') continue;
468
+ lines.push(`Edits you may PROPOSE on this screen (id "${action.id}"): through the ${ASSIST_EDIT_TOOL_NAME} tool described below, never an action block.`);
469
+ }
470
+ } else {
471
+ lines.push('This exact screen is not in the assistant’s screen index. Answer from the documentation and describe navigation in words rather than asserting what this page contains.', 'Do not emit an action block.');
472
+ }
473
+ return lines.join('\n');
474
+ }
475
+ /**
476
+ * The per-REQUEST facts. Everything here varies by workspace or by page, so
477
+ * it sits after the last cache breakpoint where it invalidates nothing.
478
+ *
479
+ * Only `safeOrgFacts`' two allowlisted fields and the three sanitised client
480
+ * strings ever reach this — see the module header.
481
+ */ export function viewFactsBlock(facts) {
482
+ const lines = [
483
+ 'Where the user is right now:'
484
+ ];
485
+ lines.push(`- Console page path: ${facts.route}`);
486
+ if (facts.orgSlug) lines.push(`- Workspace URL slug: ${facts.orgSlug}`);
487
+ if (facts.hostId) lines.push(`- Selected site (host) id: ${facts.hostId}`);
488
+ if (facts.name) lines.push(`- Workspace name: ${facts.name}`);
489
+ if (facts.plan) lines.push(`- Workspace plan: ${facts.plan}`);
490
+ return lines.join('\n');
491
+ }
492
+ /* ------------------------------------------------------------------ *
493
+ * The proposal channel
494
+ * ------------------------------------------------------------------ */ /** Fence the model wraps a proposal in. Kept out of the visible answer. */ export const ASSIST_ACTION_FENCE = '```aglyn:action';
495
+ /**
496
+ * How much of `raw` is safe to stream to the user.
497
+ *
498
+ * The proposal fence must never reach the panel as text — a user watching
499
+ * raw JSON appear mid-answer reads it as the assistant breaking. Trimming
500
+ * only at the end is not enough either, because by then the tokens have
501
+ * already been emitted as deltas.
502
+ *
503
+ * So the visible prefix is recomputed on every delta, and the tail is held
504
+ * back only while it could still turn out to be the start of a fence. That
505
+ * matters for latency: holding a fixed window would delay every answer by
506
+ * the fence's length, whereas this holds nothing back unless the text
507
+ * genuinely ends in a backtick run.
508
+ */ export function visibleAssistText(raw) {
509
+ const cut = raw.indexOf(ASSIST_ACTION_FENCE);
510
+ if (cut >= 0) return raw.slice(0, cut);
511
+ for(let n = Math.min(ASSIST_ACTION_FENCE.length - 1, raw.length); n > 0; n--){
512
+ if (ASSIST_ACTION_FENCE.startsWith(raw.slice(raw.length - n))) {
513
+ return raw.slice(0, raw.length - n);
514
+ }
515
+ }
516
+ return raw;
517
+ }
518
+ /**
519
+ * The visible answer once the stream has ENDED — no holdback.
520
+ *
521
+ * `visibleAssistText` withholds a tail that might still become a fence,
522
+ * which is right mid-stream and wrong at the end: an answer that genuinely
523
+ * closes on a code fence would otherwise lose its last three characters
524
+ * permanently, both on screen and in the stored exchange. Once there are no
525
+ * more deltas the ambiguity is resolved, so the only cut left is a real one.
526
+ */ export function finalAssistText(raw) {
527
+ const cut = raw.indexOf(ASSIST_ACTION_FENCE);
528
+ return cut >= 0 ? raw.slice(0, cut) : raw;
529
+ }
530
+ /** The raw JSON body between the fences, if the model emitted one. */ export function extractAssistAction(raw) {
531
+ const start = raw.indexOf(ASSIST_ACTION_FENCE);
532
+ if (start < 0) return null;
533
+ const bodyStart = start + ASSIST_ACTION_FENCE.length;
534
+ const end = raw.indexOf('```', bodyStart);
535
+ const body = (end < 0 ? raw.slice(bodyStart) : raw.slice(bodyStart, end)).trim();
536
+ return body || null;
537
+ }
538
+ const MAX_PARAM_VALUE_CHARS = 200;
539
+ /**
540
+ * Turn a model-emitted action block into a proposal, or nothing.
541
+ *
542
+ * Everything here is a narrowing. The id must be one the CURRENT view
543
+ * offers as a navigation — not merely a real id somewhere in the registry,
544
+ * because "propose the billing page from the besigner" is exactly the kind
545
+ * of plausible wandering that makes an assistant feel unsafe, and not the
546
+ * edit action either, which is never a destination. Param names must be ones
547
+ * that action declared. The href is composed from the registry template and
548
+ * the caller's own server-resolved slug and host, so a completion cannot
549
+ * steer the user anywhere the registry does not already point.
550
+ *
551
+ * Anything unexpected returns null. A dropped proposal costs the user a
552
+ * button; an honoured bad one costs them trust.
553
+ */ export function resolveAssistProposal(rawBlock, view, scope) {
554
+ var _parsed_id, _parsed_params;
555
+ if (!rawBlock || !view) return null;
556
+ const navigations = view.actions.filter(isNavigateAction);
557
+ if (!navigations.length) return null;
558
+ let parsed;
559
+ try {
560
+ parsed = JSON.parse(rawBlock);
561
+ } catch (unused) {
562
+ return null;
563
+ }
564
+ if (!parsed || typeof parsed !== 'object') return null;
565
+ const id = String((_parsed_id = parsed['id']) != null ? _parsed_id : '').trim();
566
+ const action = navigations.find((candidate)=>candidate.id === id);
567
+ if (!action) return null;
568
+ const supplied = (_parsed_params = parsed['params']) != null ? _parsed_params : {};
569
+ const values = [];
570
+ if (supplied && typeof supplied === 'object' && !Array.isArray(supplied)) {
571
+ for (const name of action.params){
572
+ var _supplied_name;
573
+ const value = String((_supplied_name = supplied[name]) != null ? _supplied_name : '').replace(/[\r\n]+/g, ' ').trim().slice(0, MAX_PARAM_VALUE_CHARS);
574
+ if (value) values.push({
575
+ name,
576
+ value
577
+ });
578
+ }
579
+ }
580
+ const href = buildActionHref(action, scope, values);
581
+ if (!href) return null;
582
+ return {
583
+ id: action.id,
584
+ label: action.label,
585
+ outcome: action.outcome,
586
+ href,
587
+ values,
588
+ prefill: action.prefill
589
+ };
590
+ }
591
+ /**
592
+ * Compose the destination from the registry template and the server's own
593
+ * scope values. Returns '' when the template needs a segment this page does
594
+ * not have — a half-substituted path like `/acme/hosts//setup` is a 404 with
595
+ * a confirm button on it, which is worse than no button.
596
+ */ function buildActionHref(action, scope, values) {
597
+ const orgSlug = sanitiseId(scope.orgSlug);
598
+ const hostId = sanitiseId(scope.hostId);
599
+ let path = action.route;
600
+ if (path.includes('[orgSlug]')) {
601
+ if (!orgSlug) return '';
602
+ path = path.replace('[orgSlug]', orgSlug);
603
+ }
604
+ if (path.includes('[host]')) {
605
+ if (!hostId) return '';
606
+ path = path.replace('[host]', hostId);
607
+ }
608
+ // Nothing above can produce these, which is exactly why they are worth
609
+ // asserting: this is the last line before a path reaches a router.
610
+ if (!path.startsWith('/') || path.includes('..') || path.includes('//')) return '';
611
+ if (/\[|\]/.test(path)) return '';
612
+ if (!action.prefill || !values.length) return path;
613
+ const query = values.map(({ name, value })=>`${ASSIST_PREFILL_PREFIX}${encodeURIComponent(name)}=${encodeURIComponent(value)}`).join('&');
614
+ return `${path}?${query}`;
615
+ }
616
+ /**
617
+ * The write boundary, asserted over the live table rather than described in
618
+ * a comment. Called by the spec; exported so the check travels with the data
619
+ * it checks rather than living in a test file someone can delete.
620
+ *
621
+ * Every action is inert UNLESS it is an edit action and the request cleared
622
+ * the edit rung: a navigation carries no write-capable field and no ops, an
623
+ * edit action carries no destination, and an edit action offered to a
624
+ * request below the rung is a violation. `offer` is the function the doors
625
+ * decide with; a spec passes a broken one to show this check can fail.
626
+ *
627
+ * Returns the list of violations so a failure names the offending action.
628
+ */ export function assertInertActions(views = ASSIST_VIEWS, rung = {
629
+ edit: false
630
+ }, offer = offeredActions) {
631
+ const problems = [];
632
+ const seen = new Set();
633
+ const forbidden = [
634
+ 'method',
635
+ 'body',
636
+ 'endpoint',
637
+ 'submit',
638
+ 'url',
639
+ 'api',
640
+ 'mutation'
641
+ ];
642
+ for (const view of views){
643
+ const offered = offer(view, rung);
644
+ for (const action of view.actions){
645
+ const where = `${view.key}/${action.id}`;
646
+ if (seen.has(action.id)) problems.push(`${where}: duplicate action id`);
647
+ seen.add(action.id);
648
+ for (const key of Object.keys(action)){
649
+ if (forbidden.includes(key.toLowerCase())) {
650
+ problems.push(`${where}: action carries a write-capable field "${key}"`);
651
+ }
652
+ }
653
+ if (action.kind === 'edit') {
654
+ var _action_documents;
655
+ if (!rung.edit && offered.includes(action)) {
656
+ problems.push(`${where}: an edit action is offered to a request that did not clear the edit rung`);
657
+ }
658
+ for (const key of [
659
+ 'route',
660
+ 'params',
661
+ 'prefill'
662
+ ]){
663
+ if (key in action) {
664
+ problems.push(`${where}: an edit action carries "${key}" — it applies ops on the open canvas and never navigates`);
665
+ }
666
+ }
667
+ const documents = (_action_documents = action.documents) != null ? _action_documents : [];
668
+ if (!documents.length || documents.some((kind)=>!ASSIST_EDIT_DOCUMENT_KINDS.includes(kind))) {
669
+ problems.push(`${where}: an edit action names a document the edit rung does not open on`);
670
+ }
671
+ continue;
672
+ }
673
+ if ('ops' in action) {
674
+ problems.push(`${where}: only an edit action carries ops`);
675
+ }
676
+ if (!action.route.startsWith('/')) {
677
+ problems.push(`${where}: route is not a root-relative console path`);
678
+ }
679
+ if (action.route.includes('/api/')) {
680
+ problems.push(`${where}: route points at an API endpoint`);
681
+ }
682
+ if (action.prefill && !PREFILL_READY_ROUTES.includes(action.route)) {
683
+ problems.push(`${where}: prefill:true but ${action.route} is not in PREFILL_READY_ROUTES — wire the page to read ${ASSIST_PREFILL_PREFIX}* params first`);
684
+ }
685
+ }
686
+ }
687
+ return problems;
688
+ }
689
+
690
+ //# sourceMappingURL=assist-view-context.js.map