@kinetis/vector-ui 0.12.4 → 0.13.0

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 (333) hide show
  1. package/CHANGELOG.md +97 -3
  2. package/README.md +13 -5
  3. package/app/components/Vx/Cell/Markdown.vue +1 -1
  4. package/app/components/Vx/Cell/RichText.vue +1 -1
  5. package/app/components/Vx/CommandPalette.vue +16 -2
  6. package/app/components/Vx/FieldsForm.vue +10 -2
  7. package/app/components/Vx/Input/KeyValue.vue +2 -2
  8. package/app/components/Vx/Input/Markdown.vue +5 -0
  9. package/app/components/Vx/Input/Money.vue +1 -1
  10. package/app/components/Vx/Input/RichText.vue +6 -1
  11. package/app/components/Vx/Input/Text.vue +18 -2
  12. package/app/components/Vx/Input/Textarea.vue +19 -2
  13. package/app/components/Vx/InputAddons.vue +45 -0
  14. package/app/components/Vx/Layout.vue +1 -1
  15. package/app/components/Vx/List/Pager.vue +1 -1
  16. package/app/components/Vx/List/ViewMenu.vue +1 -1
  17. package/app/components/Vx/Queues/Failed.vue +2 -2
  18. package/app/components/Vx/Queues/FailedDetail.vue +2 -2
  19. package/app/components/Vx/Queues/Metrics.vue +1 -1
  20. package/app/components/Vx/Queues/Overview.vue +2 -2
  21. package/app/components/Vx/Resource/Audit.vue +4 -0
  22. package/app/components/Vx/Resource/Form.vue +9 -1
  23. package/app/components/Vx/Resource/RelationPanel.vue +1 -1
  24. package/app/components/Vx/Resource/Table.vue +25 -2
  25. package/app/components/Vx/Widget/Card.vue +2 -2
  26. package/app/components/VxAi/ApprovalCard.vue +115 -0
  27. package/app/components/VxAi/Assistant.vue +190 -0
  28. package/app/components/VxAi/Credentials.vue +111 -0
  29. package/app/components/VxAi/FilterAsk.vue +176 -0
  30. package/app/components/VxAi/WritingAddon.vue +127 -0
  31. package/app/components/VxAi/WritingMenu.vue +91 -0
  32. package/app/components/VxAi/WritingResult.vue +48 -0
  33. package/app/components/VxAi/WritingToolbarItem.vue +189 -0
  34. package/app/composables/useConfirm.ts +1 -1
  35. package/app/composables/useVectorApi.ts +4 -4
  36. package/app/composables/useVectorAssistant.ts +318 -0
  37. package/app/composables/useVectorAuthStore.ts +1 -1
  38. package/app/composables/useVectorExtend.ts +157 -0
  39. package/app/composables/useVectorExtensions.ts +64 -6
  40. package/app/composables/useVectorFields.ts +1 -1
  41. package/app/composables/useVectorIdle.ts +1 -1
  42. package/app/composables/useVectorLocale.ts +2 -2
  43. package/app/composables/useVectorSchema.ts +1 -1
  44. package/app/composables/useVectorVersion.ts +2 -2
  45. package/app/composables/useVectorWriting.ts +72 -0
  46. package/app/i18n/ar/ai.ts +93 -0
  47. package/app/i18n/ar/index.ts +2 -1
  48. package/app/i18n/ar/record.ts +4 -0
  49. package/app/i18n/ar/shell.ts +1 -0
  50. package/app/i18n/de/ai.ts +93 -0
  51. package/app/i18n/de/index.ts +2 -1
  52. package/app/i18n/de/record.ts +4 -0
  53. package/app/i18n/de/shell.ts +1 -0
  54. package/app/i18n/en/ai.ts +93 -0
  55. package/app/i18n/en/index.ts +2 -1
  56. package/app/i18n/en/record.ts +4 -0
  57. package/app/i18n/en/shell.ts +1 -0
  58. package/app/i18n/es/ai.ts +93 -0
  59. package/app/i18n/es/index.ts +2 -1
  60. package/app/i18n/es/record.ts +4 -0
  61. package/app/i18n/es/shell.ts +1 -0
  62. package/app/i18n/fr/ai.ts +93 -0
  63. package/app/i18n/fr/index.ts +2 -1
  64. package/app/i18n/fr/record.ts +4 -0
  65. package/app/i18n/fr/shell.ts +1 -0
  66. package/app/i18n/he/ai.ts +93 -0
  67. package/app/i18n/he/index.ts +2 -1
  68. package/app/i18n/he/record.ts +4 -0
  69. package/app/i18n/he/shell.ts +1 -0
  70. package/app/i18n/index.ts +1 -1
  71. package/app/i18n/it/ai.ts +93 -0
  72. package/app/i18n/it/index.ts +2 -1
  73. package/app/i18n/it/record.ts +4 -0
  74. package/app/i18n/it/shell.ts +1 -0
  75. package/app/i18n/ja/ai.ts +93 -0
  76. package/app/i18n/ja/index.ts +2 -1
  77. package/app/i18n/ja/record.ts +4 -0
  78. package/app/i18n/ja/shell.ts +1 -0
  79. package/app/i18n/ko/ai.ts +93 -0
  80. package/app/i18n/ko/index.ts +2 -1
  81. package/app/i18n/ko/record.ts +4 -0
  82. package/app/i18n/ko/shell.ts +1 -0
  83. package/app/i18n/nl/ai.ts +93 -0
  84. package/app/i18n/nl/index.ts +2 -1
  85. package/app/i18n/nl/record.ts +4 -0
  86. package/app/i18n/nl/shell.ts +1 -0
  87. package/app/i18n/pl/ai.ts +93 -0
  88. package/app/i18n/pl/index.ts +2 -1
  89. package/app/i18n/pl/record.ts +4 -0
  90. package/app/i18n/pl/shell.ts +1 -0
  91. package/app/i18n/pt/ai.ts +93 -0
  92. package/app/i18n/pt/index.ts +2 -1
  93. package/app/i18n/pt/record.ts +4 -0
  94. package/app/i18n/pt/shell.ts +1 -0
  95. package/app/i18n/pt-BR/ai.ts +93 -0
  96. package/app/i18n/pt-BR/index.ts +2 -1
  97. package/app/i18n/pt-BR/record.ts +4 -0
  98. package/app/i18n/pt-BR/shell.ts +1 -0
  99. package/app/i18n/ru/ai.ts +93 -0
  100. package/app/i18n/ru/index.ts +2 -1
  101. package/app/i18n/ru/record.ts +4 -0
  102. package/app/i18n/ru/shell.ts +1 -0
  103. package/app/i18n/tr/ai.ts +93 -0
  104. package/app/i18n/tr/index.ts +2 -1
  105. package/app/i18n/tr/record.ts +4 -0
  106. package/app/i18n/tr/shell.ts +1 -0
  107. package/app/i18n/uk/ai.ts +93 -0
  108. package/app/i18n/uk/index.ts +2 -1
  109. package/app/i18n/uk/record.ts +4 -0
  110. package/app/i18n/uk/shell.ts +1 -0
  111. package/app/i18n/zh-Hans/ai.ts +93 -0
  112. package/app/i18n/zh-Hans/index.ts +2 -1
  113. package/app/i18n/zh-Hans/record.ts +4 -0
  114. package/app/i18n/zh-Hans/shell.ts +1 -0
  115. package/app/layouts/vector.vue +4 -1
  116. package/app/pages/settings.vue +7 -1
  117. package/app/plugins/vector-ai.client.ts +54 -0
  118. package/app/plugins/vector-extensions.client.ts +28 -37
  119. package/app/types/vector.ts +40 -3
  120. package/app/utils/aiAvailability.ts +55 -0
  121. package/app/utils/assistantBody.ts +69 -0
  122. package/app/utils/assistantStream.ts +133 -0
  123. package/app/utils/assistantTools.ts +45 -0
  124. package/app/utils/followScroll.ts +110 -0
  125. package/app/utils/format.ts +3 -3
  126. package/app/utils/internal/paths.ts +1 -1
  127. package/app/utils/queues.ts +1 -1
  128. package/app/utils/recordLinks.ts +45 -0
  129. package/app/utils/richtext.ts +3 -3
  130. package/app/utils/translate.ts +2 -2
  131. package/dist/static/200.html +1 -1
  132. package/dist/static/404.html +1 -1
  133. package/dist/static/_nuxt/-ksGenLl.js +1 -0
  134. package/dist/static/_nuxt/{DDJY3JL5.js → 0Q9tQaGZ.js} +1 -1
  135. package/dist/static/_nuxt/2mrvZCJz.js +3 -0
  136. package/dist/static/_nuxt/{C2PH7r9_.js → 2u7wMpR1.js} +1 -1
  137. package/dist/static/_nuxt/72BATg3-.js +1 -0
  138. package/dist/static/_nuxt/{BKtgreqG.js → 7hLwEPpo.js} +1 -1
  139. package/dist/static/_nuxt/{D5vg-NJ4.js → 7rwxDW6j.js} +1 -1
  140. package/dist/static/_nuxt/{Pj99sh0X.js → AbcTnLPe.js} +1 -1
  141. package/dist/static/_nuxt/B-b861aP.js +1 -0
  142. package/dist/static/_nuxt/{Cuw0JSbz.js → B2rZ5lwu.js} +1 -1
  143. package/dist/static/_nuxt/B4hfz7cN.js +1 -0
  144. package/dist/static/_nuxt/B65UlNtP.js +1 -0
  145. package/dist/static/_nuxt/{oThorgNS.js → B8JL5gwX.js} +1 -1
  146. package/dist/static/_nuxt/{D5Woe3YR.js → B8wNbnS0.js} +1 -1
  147. package/dist/static/_nuxt/{BDM1yKDf.js → B9FqenNL.js} +1 -1
  148. package/dist/static/_nuxt/{wLSd0d84.js → B9s6vEby.js} +1 -1
  149. package/dist/static/_nuxt/BE6e_jlD.js +1 -0
  150. package/dist/static/_nuxt/{Dx8sj9kP.js → BFZfZyte.js} +1 -1
  151. package/dist/static/_nuxt/{Dnl_Q9LX.js → BJSRjsBt.js} +1 -1
  152. package/dist/static/_nuxt/{lRmDd_Kx.js → BJh6qVAK.js} +1 -1
  153. package/dist/static/_nuxt/{DBmDhhWl.js → BJxaGigr.js} +1 -1
  154. package/dist/static/_nuxt/{CmoDOC5e.js → BL2SeM_r.js} +1 -1
  155. package/dist/static/_nuxt/BPT7yI6j.js +1 -0
  156. package/dist/static/_nuxt/BQ47h6Wh.js +1 -0
  157. package/dist/static/_nuxt/{CalcRVj7.js → BQitPbA5.js} +1 -1
  158. package/dist/static/_nuxt/{D9unnd4n.js → BSj4WTjT.js} +1 -1
  159. package/dist/static/_nuxt/{D3cKZbMy.js → BVrihF-G.js} +1 -1
  160. package/dist/static/_nuxt/BW9qBvMR.js +1 -0
  161. package/dist/static/_nuxt/{DU1KpHiJ.js → BWscDCZb.js} +1 -1
  162. package/dist/static/_nuxt/{JGAhx20W.js → BXnWvqRw.js} +1 -1
  163. package/dist/static/_nuxt/BcSEGymu.js +2 -0
  164. package/dist/static/_nuxt/Bj-QksVr.js +2 -0
  165. package/dist/static/_nuxt/{CvMhFq5K.js → Bl4F_9Di.js} +1 -1
  166. package/dist/static/_nuxt/{BRbbmSpl.js → BowgCQje.js} +1 -1
  167. package/dist/static/_nuxt/{DgVB5umK.js → BuTE4a2w.js} +1 -1
  168. package/dist/static/_nuxt/Bw6FrC2B.js +1 -0
  169. package/dist/static/_nuxt/{Cv0_BbF0.js → Byf6uyFv.js} +1 -1
  170. package/dist/static/_nuxt/Bzvft7RG.js +1 -0
  171. package/dist/static/_nuxt/C1y0neXX.js +1 -0
  172. package/dist/static/_nuxt/{BUF7Jq4U.js → C48zuAYh.js} +1 -1
  173. package/dist/static/_nuxt/{DJFQLDk5.js → C52FYB-5.js} +1 -1
  174. package/dist/static/_nuxt/CAXk9Oc1.js +1 -0
  175. package/dist/static/_nuxt/{C7fSyjDf.js → CD5zJmlk.js} +1 -1
  176. package/dist/static/_nuxt/CDnV5Q2S.js +2 -0
  177. package/dist/static/_nuxt/{CzTUD5Qk.js → CE5HzlKJ.js} +1 -1
  178. package/dist/static/_nuxt/{7K6MnLUx.js → CF_C4t63.js} +1 -1
  179. package/dist/static/_nuxt/CFuvN8kq.js +1 -0
  180. package/dist/static/_nuxt/{CqMf6Lsu.js → CHIGMs2v.js} +1 -1
  181. package/dist/static/_nuxt/CIcNJyjb.js +1 -0
  182. package/dist/static/_nuxt/{Dyz4VrUP.js → CLJSzUt5.js} +1 -1
  183. package/dist/static/_nuxt/CQvUQgZO.js +2 -0
  184. package/dist/static/_nuxt/{N6Uxr2YO.js → CRAHgjs4.js} +1 -1
  185. package/dist/static/_nuxt/{B6NDob-m.js → CSezMYzn.js} +1 -1
  186. package/dist/static/_nuxt/{B7CwuqHQ.js → CSgLLbCN.js} +1 -1
  187. package/dist/static/_nuxt/{1EmobxKy.js → CTHBH7-N.js} +1 -1
  188. package/dist/static/_nuxt/CVGEoUmj.js +1 -0
  189. package/dist/static/_nuxt/{bm6plv74.js → CVePRzEp.js} +1 -1
  190. package/dist/static/_nuxt/{R3rw3hPp.js → CWfptrnU.js} +1 -1
  191. package/dist/static/_nuxt/{C1djf5sc.js → CXSf4TOH.js} +1 -1
  192. package/dist/static/_nuxt/CbOoWXps.js +1 -0
  193. package/dist/static/_nuxt/Cf2NM87n.js +1 -0
  194. package/dist/static/_nuxt/{ycmL3bWs.js → CjYmnU-l.js} +1 -1
  195. package/dist/static/_nuxt/Ckm05LT2.js +1 -0
  196. package/dist/static/_nuxt/{DHtEcXUO.js → Cl2jXKkl.js} +1 -1
  197. package/dist/static/_nuxt/{CF1K6UXb.js → Clx69IQe.js} +1 -1
  198. package/dist/static/_nuxt/{BZDOVMsw.js → CmJ0ekjX.js} +1 -1
  199. package/dist/static/_nuxt/{Cjyh4OAN.js → Cpel4vlt.js} +1 -1
  200. package/dist/static/_nuxt/{CUAnR2FD.js → CrYfHi9E.js} +1 -1
  201. package/dist/static/_nuxt/CvTgOEOS.js +1 -0
  202. package/dist/static/_nuxt/CvVbTdaI.js +1 -0
  203. package/dist/static/_nuxt/{DoNlTJTo.js → D2ovGjnz.js} +1 -1
  204. package/dist/static/_nuxt/{BOHl_j0c.js → D3cIKCPa.js} +1 -1
  205. package/dist/static/_nuxt/{CvtjhXJ1.js → D3jC5ZAK.js} +1 -1
  206. package/dist/static/_nuxt/{FzhpMR1D.js → D3xofh1k.js} +1 -1
  207. package/dist/static/_nuxt/{BfuFZvSA.js → D7dC5VYH.js} +1 -1
  208. package/dist/static/_nuxt/{DfVLYfcR.js → D7eR_J9I.js} +1 -1
  209. package/dist/static/_nuxt/DAXm0JlI.js +1 -0
  210. package/dist/static/_nuxt/DDsQjoa8.js +1 -0
  211. package/dist/static/_nuxt/DFIqxsd4.js +1 -0
  212. package/dist/static/_nuxt/DGQrzV9s.js +1 -0
  213. package/dist/static/_nuxt/{1_Uuyt8D.js → DHNZ4ANp.js} +1 -1
  214. package/dist/static/_nuxt/{AXpHq_M6.js → DKOyYUi8.js} +1 -1
  215. package/dist/static/_nuxt/DOEj9Txc.js +1 -0
  216. package/dist/static/_nuxt/{CJepLjEa.js → DOq2YmIE.js} +1 -1
  217. package/dist/static/_nuxt/DOxWca9k.js +1 -0
  218. package/dist/static/_nuxt/{D7JW3pi_.js → DVyeIIya.js} +1 -1
  219. package/dist/static/_nuxt/{DT1zmKvw.js → DW3p59oX.js} +1 -1
  220. package/dist/static/_nuxt/{ERkvasWH.js → DXZAXwNd.js} +1 -1
  221. package/dist/static/_nuxt/{D11OKveI.js → DYPYEI74.js} +1 -1
  222. package/dist/static/_nuxt/D_hQWjK3.js +1 -0
  223. package/dist/static/_nuxt/{ZNfE-M4g.js → Dao3p0cp.js} +1 -1
  224. package/dist/static/_nuxt/{D3xqGGYp.js → DcC5rHQt.js} +1 -1
  225. package/dist/static/_nuxt/DdYMnBKs.js +1 -0
  226. package/dist/static/_nuxt/{DOOLWZFN.js → DeZyAt_3.js} +1 -1
  227. package/dist/static/_nuxt/DfApYreK.js +10 -0
  228. package/dist/static/_nuxt/{BEcvuouq.js → DjRWYJ_r.js} +1 -1
  229. package/dist/static/_nuxt/{DqVTouT1.js → DllQuWrz.js} +1 -1
  230. package/dist/static/_nuxt/DpWwaWd-.js +185 -0
  231. package/dist/static/_nuxt/DryMzf1V.js +1 -0
  232. package/dist/static/_nuxt/{BEu939QZ.js → DsLys5JK.js} +1 -1
  233. package/dist/static/_nuxt/DvEvjhbF.js +1 -0
  234. package/dist/static/_nuxt/{B1lIMV_o.js → Dw7WalTb.js} +1 -1
  235. package/dist/static/_nuxt/{Dqv1iAUt.js → DwpSsR4l.js} +1 -1
  236. package/dist/static/_nuxt/FfebEZGy.js +1 -0
  237. package/dist/static/_nuxt/{DPDZkh6Z.js → GdAHGVsW.js} +1 -1
  238. package/dist/static/_nuxt/{qFGHTGtX.js → HdAGfEVj.js} +1 -1
  239. package/dist/static/_nuxt/{CsakM5cG.js → IxgCkjBe.js} +1 -1
  240. package/dist/static/_nuxt/{BJiySRJW.js → Jl8QPdwt.js} +1 -1
  241. package/dist/static/_nuxt/{4_OCizmC.js → KWfizXHd.js} +1 -1
  242. package/dist/static/_nuxt/KeyValue.CWzmqYlQ.css +1 -0
  243. package/dist/static/_nuxt/Notifications.CAlaWnJg.css +1 -0
  244. package/dist/static/_nuxt/PqTF-5Vs.js +1 -0
  245. package/dist/static/_nuxt/SacKuioS.js +65 -0
  246. package/dist/static/_nuxt/TlyrWgih.js +1 -0
  247. package/dist/static/_nuxt/{oj_DzV60.js → WAarVmAq.js} +1 -1
  248. package/dist/static/_nuxt/{DcWEOxVe.js → XnbMqODk.js} +1 -1
  249. package/dist/static/_nuxt/{R_5D07UV.js → Y2iAEIYr.js} +1 -1
  250. package/dist/static/_nuxt/_resource_.Q2lVCG-n.css +1 -0
  251. package/dist/static/_nuxt/{BSj7_50x.js → b2bdl3qT.js} +1 -1
  252. package/dist/static/_nuxt/bNqxxQg2.js +1 -0
  253. package/dist/static/_nuxt/builds/latest.json +1 -1
  254. package/dist/static/_nuxt/builds/meta/f78103ad-2489-4aee-b300-160bb1a81e35.json +1 -0
  255. package/dist/static/_nuxt/{yO0LqdZ2.js → e2dpeiRT.js} +1 -1
  256. package/dist/static/_nuxt/{entry.DmwuXgFN.css → entry.CANiyyNa.css} +1 -1
  257. package/dist/static/_nuxt/error-404.D5YWHu6f.css +1 -0
  258. package/dist/static/_nuxt/error-500.BP1eYUQR.css +1 -0
  259. package/dist/static/_nuxt/{CB-gmtNU.js → fLsGnP3B.js} +1 -1
  260. package/dist/static/_nuxt/gYmJEXHP.js +1 -0
  261. package/dist/static/_nuxt/{B-nBg1Xv.js → jI4JB4sB.js} +1 -1
  262. package/dist/static/_nuxt/{DebXB2Xn.js → qoAbHCOq.js} +1 -1
  263. package/dist/static/_nuxt/rYfJ_RlJ.js +1 -0
  264. package/dist/static/_nuxt/{CrGsoVt3.js → tGXqY3hN.js} +1 -1
  265. package/dist/static/_nuxt/{Bk4XXIda.js → tv5vSe5Y.js} +1 -1
  266. package/dist/static/_nuxt/vector.NgmG3ZDn.css +1 -0
  267. package/dist/static/_nuxt/{BEX0oVSL.js → wSbLQ3i5.js} +2 -2
  268. package/dist/static/_nuxt/{0Vkqk5K3.js → y5gvPoD3.js} +1 -1
  269. package/dist/static/_nuxt/{DyweGZi4.js → yIw8BzU6.js} +1 -1
  270. package/dist/static/_nuxt/{NTQyXsYJ.js → zA0zNamO.js} +1 -1
  271. package/dist/static/index.html +1 -1
  272. package/dist/static/jobs/index.html +1 -1
  273. package/dist/static/login/index.html +1 -1
  274. package/dist/static/queues/index.html +1 -1
  275. package/dist/static/settings/index.html +1 -1
  276. package/dist/static/vector-bundle.json +148 -152
  277. package/package.json +19 -18
  278. package/dist/static/_nuxt/7dnGTtf6.js +0 -2
  279. package/dist/static/_nuxt/AfaX5CNR.js +0 -105
  280. package/dist/static/_nuxt/B-KA4dLI.js +0 -65
  281. package/dist/static/_nuxt/B6S9Z6WQ.js +0 -1
  282. package/dist/static/_nuxt/BDNMzG2s.js +0 -1
  283. package/dist/static/_nuxt/BJhRZpbP.js +0 -1
  284. package/dist/static/_nuxt/BPzr_ZFH.js +0 -1
  285. package/dist/static/_nuxt/BZXFBS4d.js +0 -1
  286. package/dist/static/_nuxt/Bp1wYuAu.js +0 -2
  287. package/dist/static/_nuxt/BpF7UbSy.js +0 -1
  288. package/dist/static/_nuxt/BqIYBnn1.js +0 -1
  289. package/dist/static/_nuxt/Brpk64DL.js +0 -1
  290. package/dist/static/_nuxt/BtZEn8rG.js +0 -1
  291. package/dist/static/_nuxt/BzcHWzF1.js +0 -1
  292. package/dist/static/_nuxt/C-dF6TjJ.js +0 -1
  293. package/dist/static/_nuxt/C0BqlrB-.js +0 -1
  294. package/dist/static/_nuxt/C6kvBrux.js +0 -1
  295. package/dist/static/_nuxt/C9pCrKWL.js +0 -1
  296. package/dist/static/_nuxt/CBIdPVBN.js +0 -1
  297. package/dist/static/_nuxt/CE4w7ySf.js +0 -1
  298. package/dist/static/_nuxt/CEq7Sdek.js +0 -1
  299. package/dist/static/_nuxt/CIIjiec-.js +0 -1
  300. package/dist/static/_nuxt/CL8kR7Jl.js +0 -1
  301. package/dist/static/_nuxt/CTqdSnzX.js +0 -1
  302. package/dist/static/_nuxt/CcarPq9D.js +0 -1
  303. package/dist/static/_nuxt/Cet_varq.js +0 -1
  304. package/dist/static/_nuxt/ChHwRItD.js +0 -1
  305. package/dist/static/_nuxt/ClGaGEq-.js +0 -1
  306. package/dist/static/_nuxt/CojXjKit.js +0 -1
  307. package/dist/static/_nuxt/CpCuvz_Q.js +0 -1
  308. package/dist/static/_nuxt/D-sMWl8f.js +0 -1
  309. package/dist/static/_nuxt/D1s1ZPEA.js +0 -2
  310. package/dist/static/_nuxt/D7UGFkhh.js +0 -1
  311. package/dist/static/_nuxt/D8p7N22I.js +0 -1
  312. package/dist/static/_nuxt/DBXnb1tR.js +0 -1
  313. package/dist/static/_nuxt/DL237dS3.js +0 -1
  314. package/dist/static/_nuxt/DRB_eN3w.js +0 -67
  315. package/dist/static/_nuxt/Djb5b_0H.js +0 -1
  316. package/dist/static/_nuxt/DlpIJgqB.js +0 -1
  317. package/dist/static/_nuxt/DrEHkKjX.js +0 -10
  318. package/dist/static/_nuxt/Dt7NqY56.js +0 -1
  319. package/dist/static/_nuxt/DuYZsH0p.js +0 -1
  320. package/dist/static/_nuxt/Dx-cZwBu.js +0 -2
  321. package/dist/static/_nuxt/IhWbQWqt.js +0 -1
  322. package/dist/static/_nuxt/JkGLG92w.js +0 -1
  323. package/dist/static/_nuxt/KeyValue.CczYMB-Q.css +0 -1
  324. package/dist/static/_nuxt/Notifications.AEytcgEO.css +0 -1
  325. package/dist/static/_nuxt/QTRQ5bvA.js +0 -1
  326. package/dist/static/_nuxt/UoJt16Vw.js +0 -1
  327. package/dist/static/_nuxt/VSpacer.DfbUir7X.css +0 -1
  328. package/dist/static/_nuxt/_resource_.CZ-hvn3L.css +0 -1
  329. package/dist/static/_nuxt/builds/meta/5f231028-949f-4f49-8f8d-307070c40687.json +0 -1
  330. package/dist/static/_nuxt/error-404.DIb-VIQ0.css +0 -1
  331. package/dist/static/_nuxt/error-500.BvRwBykK.css +0 -1
  332. package/dist/static/_nuxt/vector.ClRRJOjR.css +0 -1
  333. package/dist/static/_nuxt/wlpNGAAZ.js +0 -3
@@ -52,10 +52,18 @@ export interface VectorRelation {
52
52
 
53
53
  export type VectorOperator = 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'in' | 'nin' | 'like' | 'nlike' | 'between' | 'null' | 'nnull'
54
54
 
55
+ /**
56
+ * A resource's or field's metadata bag, as `#[Resource(meta: ...)]` and
57
+ * `Field::meta()` declared it: namespaced keys (`vendor.key`), scalar or
58
+ * list values. Vector publishes it and never reads it. Absent when empty.
59
+ */
60
+ export type VectorMeta = Record<string, string | number | boolean | null | (string | number | boolean | null)[]>
61
+
55
62
  export interface VectorField {
56
63
  name: string
57
64
  type: VectorFieldType
58
65
  label: string
66
+ meta?: VectorMeta
59
67
  sortable: boolean
60
68
  searchable: boolean
61
69
  filterable: boolean
@@ -286,6 +294,8 @@ export interface VectorAuditEntry {
286
294
  event: string
287
295
  actorId: string
288
296
  impersonatorId: string | null
297
+ /** The channel the write came through when it was not the admin's own hand, such as `assistant`; null or absent otherwise. */
298
+ origin?: string | null
289
299
  changes: Record<string, { from: unknown, to: unknown }>
290
300
  createdAt: string
291
301
  }
@@ -322,7 +332,7 @@ export type VectorFilterGroup = VectorFilters[]
322
332
 
323
333
  /**
324
334
  * The list grammar's whole filter object: field conditions, `trashed`,
325
- * and `or` / `and` holding more filter objects — `(a or b) and c` is
335
+ * and `or` / `and` holding more filter objects, `(a or b) and c` is
326
336
  * `{c: …, or: [{a: …}, {b: …}]}`.
327
337
  */
328
338
  export interface VectorFilterQuery {
@@ -422,6 +432,7 @@ export interface VectorResource {
422
432
  labelSingular: string
423
433
  group: string | null
424
434
  icon: string | null
435
+ meta?: VectorMeta
425
436
  primaryKey: { field: string, column?: string, type: 'int' | 'string' }
426
437
  titleField: string
427
438
  version: string | null
@@ -470,6 +481,30 @@ export interface VectorMenuGroup {
470
481
  resources: string[]
471
482
  }
472
483
 
484
+ /**
485
+ * `capabilities.ai` as GET /vector/schema publishes it for the signed-in
486
+ * user (kinetis/vector-ai's AiShellContributor): which AI features the
487
+ * admin offers them (each flag the very check its endpoint makes) and
488
+ * what is kept from the model.
489
+ */
490
+ export interface AiCapabilities {
491
+ filters?: boolean
492
+ assistant?: boolean
493
+ assistantWrites?: boolean
494
+ writing?: boolean
495
+ /** The resources kept from the model whole, `{slug: true}`. */
496
+ excluded?: Record<string, unknown>
497
+ /** The fields kept back of the others, `{slug: [field, …]}`. */
498
+ excludedFields?: Record<string, unknown>
499
+ /**
500
+ * The text fields writing help is not offered on, `{slug: [field, …]}`:
501
+ * kept back, a unique string (an identifier, such as a SKU), or a field
502
+ * with the `ai.writing` meta false. When absent, writing help is off
503
+ * only where something is kept back.
504
+ */
505
+ noWriting?: Record<string, unknown>
506
+ }
507
+
473
508
  export interface VectorSchema {
474
509
  version: number
475
510
  resources: Record<string, VectorResource>
@@ -477,12 +512,14 @@ export interface VectorSchema {
477
512
  settings: { name: string, label: string, icon: string | null }[]
478
513
  dashboards: { name: string, label: string, icon: string | null }[]
479
514
  /**
480
- * `exportFormats`: what the export menu offers — csv always, xlsx where the server can write it (in the queue).
515
+ * `exportFormats`: what the export menu offers, csv always, xlsx where the server can write it (in the queue).
481
516
  * `queues`: the queue dashboard is there for this user (a queue configured, the policy lets them view);
482
517
  * `failedJobs`: it shows failed jobs too (kinetis/queue-failed-jobs installed and wired). Absent is false.
483
518
  * `queueMetrics`: it shows the job metrics too (VECTOR_QUEUE_METRICS not turned off). Absent is false.
519
+ * `ai`: the AI features kinetis/vector-ai offers this user; absent where it is not installed.
520
+ * Any other key is a package's own, published by its #[ShellContributor] under its name: an object.
484
521
  */
485
- capabilities: { impersonation: boolean, queue: boolean, uploads?: boolean, exportFormats?: VectorExportFormat[], queues?: boolean, failedJobs?: boolean, queueMetrics?: boolean }
522
+ capabilities: { impersonation: boolean, queue: boolean, uploads?: boolean, exportFormats?: VectorExportFormat[], queues?: boolean, failedJobs?: boolean, queueMetrics?: boolean, ai?: AiCapabilities } & { [contributor: string]: unknown }
486
523
  branding: VectorBranding | null
487
524
  /** The language this descriptor is in, and the ones this user may switch to. */
488
525
  i18n?: VectorSchemaI18n
@@ -0,0 +1,55 @@
1
+ import type { AiCapabilities } from '../types/vector'
2
+
3
+ /** A feature `capabilities.ai` flags. */
4
+ export type AiFeature = 'filters' | 'assistant' | 'assistantWrites' | 'writing'
5
+
6
+ /** A descriptor's `capabilities.ai`: undefined before the descriptor, and where kinetis/vector-ai is not installed. */
7
+ export function aiCapabilities(schema: { capabilities?: { ai?: AiCapabilities, [key: string]: unknown } } | null | undefined): AiCapabilities | undefined {
8
+ return schema?.capabilities?.ai
9
+ }
10
+
11
+ /**
12
+ * Whether the admin offers $feature: the server's flag for this user and,
13
+ * when given, $resource not kept from the model and $field not one kept
14
+ * back of it, nor, for writing help, one of `noWriting`. The one check
15
+ * every AI part asks; the server refuses anything else anyway.
16
+ */
17
+ export function aiOffered(ai: AiCapabilities | undefined, feature: AiFeature, resource?: string, field?: string): boolean {
18
+ if (ai?.[feature] !== true) return false
19
+ if (resource === undefined) return true
20
+ if (ai.excluded?.[resource] !== undefined) return false
21
+ if (field === undefined) return true
22
+ const kept = ai.excludedFields?.[resource]
23
+ if (Array.isArray(kept) && kept.includes(field)) return false
24
+ const off = feature === 'writing' ? ai.noWriting?.[resource] : undefined
25
+ return !(Array.isArray(off) && off.includes(field))
26
+ }
27
+
28
+ /** The HTTP status of a failed API call. */
29
+ export function aiStatusOf(error: unknown): number | undefined {
30
+ const failed = error as { status?: number, statusCode?: number, response?: { status?: number } } | null
31
+ return failed?.status ?? failed?.statusCode ?? failed?.response?.status
32
+ }
33
+
34
+ /**
35
+ * A failed AI call in words. A spent daily budget (429) says when it
36
+ * renews, when Retry-After can be read (cross-origin, only when the
37
+ * API's CORS exposes it) and otherwise what the server said, or that it
38
+ * is spent. Any other failure is what the server said ($data's `error`,
39
+ * the response body by default), or $fallback.
40
+ */
41
+ export function aiFailureMessage(error: unknown, fallback: string, data: unknown = (error as { data?: unknown } | null)?.data): string {
42
+ const status = aiStatusOf(error)
43
+
44
+ if (status === 429) {
45
+ const seconds = Number((error as { response?: { headers?: Headers } } | null)?.response?.headers?.get('Retry-After') ?? Number.NaN)
46
+ if (Number.isFinite(seconds) && seconds > 0) {
47
+ const at = new Date(Date.now() + seconds * 1000)
48
+ return vt('ai.filters.budget', { time: at.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) })
49
+ }
50
+ }
51
+
52
+ const said = data !== null && typeof data === 'object' ? (data as { error?: unknown }).error : undefined
53
+ if (typeof said === 'string' && said !== '') return said
54
+ return status === 429 ? vt('ai.filters.budgetSpent') : fallback
55
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * The largest body POST /vector/ai/assistant takes, in bytes: the
3
+ * server's `AssistantController::MAX_BODY`, which refuses a larger one
4
+ * with a 422 `too_large`. The two must match; a test reads the PHP
5
+ * constant to keep them so.
6
+ */
7
+ export const ASSISTANT_MAX_BODY_BYTES = 65_536
8
+
9
+ /** The most messages one turn sends: the server's `AssistantController::MAX_MESSAGES`. */
10
+ export const ASSISTANT_MAX_MESSAGES = 40
11
+
12
+ /**
13
+ * The longest single message, in characters, Unicode code points, as
14
+ * the server's `mb_strlen` counts them, not UTF-16 units: the server's
15
+ * `AssistantController::MAX_MESSAGE`, which refuses a longer one with a
16
+ * 422. A test reads the PHP constant to keep the two equal.
17
+ */
18
+ export const ASSISTANT_MAX_MESSAGE_CHARS = 8000
19
+
20
+ /** What ends an answer cut to ASSISTANT_MAX_MESSAGE_CHARS. */
21
+ export const TRUNCATED_MARK = '…'
22
+
23
+ /** What a turn leaves unused under ASSISTANT_MAX_BODY_BYTES. */
24
+ export const ASSISTANT_BODY_HEADROOM = 1024
25
+
26
+ /** One message of the conversation as the server takes it. */
27
+ export type AssistantMessage = { role: 'user' | 'assistant', content: string } | { role: 'approval', id: string }
28
+
29
+ /** The bytes $value takes as the request body: its JSON, as UTF-8, what the fetch sends, not JavaScript's UTF-16 length. */
30
+ export function jsonBytes(value: unknown): number {
31
+ return new TextEncoder().encode(JSON.stringify(value)).length
32
+ }
33
+
34
+ /** The characters of $text as the server counts them (`mb_strlen`): Unicode code points, not UTF-16 units. */
35
+ export function messageChars(text: string): number {
36
+ return Array.from(text).length
37
+ }
38
+
39
+ /**
40
+ * $message within ASSISTANT_MAX_MESSAGE_CHARS: an assistant's answer
41
+ * longer than that (one near the model's output cap can be) is cut,
42
+ * ending with TRUNCATED_MARK, rather than dropped, so the conversation
43
+ * still alternates between the user and the assistant. Counted in code
44
+ * points, as the server counts them, and never cut inside a surrogate pair.
45
+ */
46
+ export function withinMessageLimit(message: AssistantMessage): AssistantMessage {
47
+ if (message.role !== 'assistant') return message
48
+ if (messageChars(message.content) <= ASSISTANT_MAX_MESSAGE_CHARS) return message
49
+ const chars = Array.from(message.content)
50
+ return { role: 'assistant', content: chars.slice(0, ASSISTANT_MAX_MESSAGE_CHARS - 1).join('') + TRUNCATED_MARK }
51
+ }
52
+
53
+ /**
54
+ * $messages, each assistant answer cut to ASSISTANT_MAX_MESSAGE_CHARS
55
+ * (withinMessageLimit), trimmed from the start until the body $body builds from them
56
+ * fits ASSISTANT_MAX_BODY_BYTES less ASSISTANT_BODY_HEADROOM, measured as
57
+ * the UTF-8 bytes sent (a Hebrew, Arabic or CJK character takes two or
58
+ * three) and then to a user's message: a conversation that opens with
59
+ * the assistant, or with an approval whose proposal was trimmed away, is
60
+ * refused by a provider such as Bedrock. The last message is always
61
+ * kept.
62
+ */
63
+ export function fitAssistantMessages<T>(messages: AssistantMessage[], body: (messages: AssistantMessage[]) => T): AssistantMessage[] {
64
+ const limit = ASSISTANT_MAX_BODY_BYTES - ASSISTANT_BODY_HEADROOM
65
+ let fitted = messages.slice(-ASSISTANT_MAX_MESSAGES).map(withinMessageLimit)
66
+ while (fitted.length > 1 && jsonBytes(body(fitted)) > limit) fitted = fitted.slice(1)
67
+ while (fitted.length > 1 && fitted[0]!.role !== 'user') fitted = fitted.slice(1)
68
+ return fitted
69
+ }
@@ -0,0 +1,133 @@
1
+ // The Vercel AI SDK data-stream protocol as POST /vector/ai/assistant
2
+ // writes it: Server-Sent Events, each `data: {"type": ..., ...}` and a
3
+ // blank line. Chunks arrive cut anywhere, a frame across two of them
4
+ // included; a frame that is not a JSON object with a string `type` is
5
+ // skipped.
6
+
7
+ /** One frame of the stream: `type` and the fields that type carries. */
8
+ export interface DataStreamFrame {
9
+ type: string
10
+ [field: string]: unknown
11
+ }
12
+
13
+ export interface DataStreamParser {
14
+ /** Takes the next chunk of text, emitting every frame it completes. */
15
+ push: (chunk: string) => void
16
+ /** Emits a last frame the stream ended without a blank line after. */
17
+ end: () => void
18
+ }
19
+
20
+ export function createDataStreamParser(onFrame: (frame: DataStreamFrame) => void): DataStreamParser {
21
+ let buffer = ''
22
+
23
+ function emit(event: string) {
24
+ for (const line of event.split('\n')) {
25
+ if (!line.startsWith('data:')) continue
26
+ const payload = line.slice(5).trimStart()
27
+ if (payload === '' || payload === '[DONE]') continue
28
+
29
+ let frame: unknown
30
+ try {
31
+ frame = JSON.parse(payload)
32
+ } catch {
33
+ continue
34
+ }
35
+
36
+ if (frame !== null && typeof frame === 'object' && !Array.isArray(frame) && typeof (frame as { type?: unknown }).type === 'string') {
37
+ onFrame(frame as DataStreamFrame)
38
+ }
39
+ }
40
+ }
41
+
42
+ return {
43
+ push(chunk) {
44
+ // CRLF is normalized on the whole buffer, so a pair split across two chunks is too
45
+ buffer = (buffer + chunk).replaceAll('\r\n', '\n')
46
+ let end = buffer.indexOf('\n\n')
47
+ while (end !== -1) {
48
+ emit(buffer.slice(0, end))
49
+ buffer = buffer.slice(end + 2)
50
+ end = buffer.indexOf('\n\n')
51
+ }
52
+ },
53
+ end() {
54
+ if (buffer.trim() !== '') emit(buffer)
55
+ buffer = ''
56
+ },
57
+ }
58
+ }
59
+
60
+ /** Reads a response body to its end, handing each frame to onFrame as it completes. */
61
+ export async function readDataStream(body: ReadableStream<Uint8Array>, onFrame: (frame: DataStreamFrame) => void): Promise<void> {
62
+ const parser = createDataStreamParser(onFrame)
63
+ const reader = body.getReader()
64
+ const decoder = new TextDecoder()
65
+
66
+ try {
67
+ for (;;) {
68
+ const { done, value } = await reader.read()
69
+ if (done) break
70
+ parser.push(decoder.decode(value, { stream: true }))
71
+ }
72
+ parser.push(decoder.decode())
73
+ parser.end()
74
+ } finally {
75
+ reader.releaseLock()
76
+ }
77
+ }
78
+
79
+ /**
80
+ * A change the assistant proposed, as the server announces it; a
81
+ * `data-approval` frame of the stream (the protocol's custom data part,
82
+ * its `data`), or an entry of the JSON answer's `approvals`. Everything
83
+ * the admin is shown of the change comes from here, never from the
84
+ * model's prose.
85
+ */
86
+ export interface ApprovalFrame {
87
+ type: 'approval'
88
+ /** `apr_` and 26 base32 characters. */
89
+ id: string
90
+ tool: string
91
+ arguments: Record<string, unknown>
92
+ resource: string | null
93
+ recordId: string | null
94
+ /** ISO 8601, UTC. */
95
+ expiresAt: string
96
+ }
97
+
98
+ const APPROVAL_ID = /^apr_[a-z2-7]{26}$/
99
+
100
+ function isRecord(value: unknown): value is Record<string, unknown> {
101
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
102
+ }
103
+
104
+ /** The approval a value describes (a frame's `data`, or a JSON answer's entry) or null when it is not one. */
105
+ export function approvalOf(value: unknown): ApprovalFrame | null {
106
+ if (!isRecord(value) || value.type !== 'approval') return null
107
+ const { id, tool, arguments: args, resource, recordId, expiresAt } = value
108
+ if (typeof id !== 'string' || !APPROVAL_ID.test(id) || typeof tool !== 'string' || !isRecord(args) || typeof expiresAt !== 'string') return null
109
+ if (resource !== null && typeof resource !== 'string') return null
110
+ if (recordId !== null && typeof recordId !== 'string') return null
111
+ return { type: 'approval', id, tool, arguments: args, resource, recordId, expiresAt }
112
+ }
113
+
114
+ /** The approval a stream frame announces: a `data-approval` frame's data, or null for any other frame. */
115
+ export function approvalFrame(frame: DataStreamFrame): ApprovalFrame | null {
116
+ return frame.type === 'data-approval' ? approvalOf(frame.data) : null
117
+ }
118
+
119
+ /**
120
+ * The record a `vector_get` tool result carries: the server sends the
121
+ * result after a one-line preamble, then `{data, permissions}` as JSON.
122
+ * Null for anything else.
123
+ */
124
+ export function recordOfToolOutput(output: unknown): Record<string, unknown> | null {
125
+ if (typeof output !== 'string') return null
126
+ const json = output.slice(output.indexOf('\n') + 1)
127
+ try {
128
+ const parsed: unknown = JSON.parse(json)
129
+ return isRecord(parsed) && isRecord(parsed.data) ? parsed.data : null
130
+ } catch {
131
+ return null
132
+ }
133
+ }
@@ -0,0 +1,45 @@
1
+ // The tools an assistant answer called, as its chips show them: only the
2
+ // calls that answered; a call that was a tool error (a `tool-output-error`
3
+ // frame, or `ok: false` in the whole answer's `toolCalls`) is the model's
4
+ // own detour, not something it read; each tool once, in the order first
5
+ // called, with how many times.
6
+
7
+ /** One tool call of an answer: its tool, and whether it answered; null while its outcome has not arrived. */
8
+ export interface AssistantToolCall {
9
+ /** The call's `toolCallId` in the stream; null in a whole answer. */
10
+ id: string | null
11
+ name: string
12
+ ok: boolean | null
13
+ }
14
+
15
+ /** One chip: a tool, and how many of its calls answered (or have not failed yet). */
16
+ export interface AssistantToolChip {
17
+ name: string
18
+ count: number
19
+ }
20
+
21
+ /**
22
+ * The whole answer's `toolCalls` as calls: each `{name, ok}`, or a bare
23
+ * name, taken as one that answered.
24
+ */
25
+ export function toolCallsOf(toolCalls: unknown): AssistantToolCall[] {
26
+ if (!Array.isArray(toolCalls)) return []
27
+ return toolCalls.flatMap((call: unknown): AssistantToolCall[] => {
28
+ if (typeof call === 'string') return [{ id: null, name: call, ok: true }]
29
+ if (call === null || typeof call !== 'object' || typeof (call as { name?: unknown }).name !== 'string') return []
30
+ const { name, ok } = call as { name: string, ok?: unknown }
31
+ return [{ id: null, name, ok: ok !== false }]
32
+ })
33
+ }
34
+
35
+ /** The chips of $calls: those that did not fail, by tool, in the order first called. */
36
+ export function toolChips(calls: readonly AssistantToolCall[]): AssistantToolChip[] {
37
+ const chips = new Map<string, AssistantToolChip>()
38
+ for (const call of calls) {
39
+ if (call.ok === false) continue
40
+ const chip = chips.get(call.name)
41
+ if (chip) chip.count++
42
+ else chips.set(call.name, { name: call.name, count: 1 })
43
+ }
44
+ return [...chips.values()]
45
+ }
@@ -0,0 +1,110 @@
1
+ /** How near the end counts as at it, in pixels. */
2
+ const AT_END = 4
3
+ /** The slowest and the fastest the view scrolls after the output, in pixels per second. */
4
+ const MIN_SPEED = 120
5
+ const MAX_SPEED = 900
6
+ /** Below MAX_SPEED, how many times the distance left a second covers: a long way scrolls faster, never at once. */
7
+ const CATCH_UP = 3
8
+
9
+ /** A scrolling view that follows output as it arrives. */
10
+ export interface FollowScroll {
11
+ /** Whether the view follows the output: false once the reader scrolled up, away from the end. */
12
+ readonly following: boolean
13
+ /** The output grew: scrolls to its end at a reading pace, when following. */
14
+ grew(): void
15
+ /** Follows the output again, from wherever the reader is: a new question, or a new answer. */
16
+ resume(): void
17
+ /** Stops scrolling and listening. */
18
+ stop(): void
19
+ }
20
+
21
+ interface Frames {
22
+ request: (callback: FrameRequestCallback) => number
23
+ cancel: (handle: number) => void
24
+ }
25
+
26
+ const browserFrames: Frames = {
27
+ request: callback => requestAnimationFrame(callback),
28
+ cancel: handle => cancelAnimationFrame(handle),
29
+ }
30
+
31
+ /**
32
+ * Keeps $el scrolled to the end of its output while the output arrives,
33
+ * gliding there rather than jumping when much arrives at once. Scrolling
34
+ * up, away from the end, stops following until resume(), or until the
35
+ * reader scrolls back to the end.
36
+ */
37
+ export function followScroll(
38
+ el: HTMLElement,
39
+ frames: Frames = browserFrames,
40
+ ): FollowScroll {
41
+ let following = true
42
+ /** Where the view was when last seen, to tell a reader scrolling up from the view's own scrolling. */
43
+ let last = el.scrollTop
44
+ /** Where the glide is, unrounded: scrollTop may round what it is given. */
45
+ let position = el.scrollTop
46
+ let frame: number | null = null
47
+ let then: number | null = null
48
+
49
+ const end = () => Math.max(0, el.scrollHeight - el.clientHeight)
50
+
51
+ function halt() {
52
+ if (frame !== null) frames.cancel(frame)
53
+ frame = null
54
+ then = null
55
+ }
56
+
57
+ function tick(now: number) {
58
+ frame = null
59
+ const left = end() - position
60
+ if (!following || left <= 0.5) {
61
+ then = null
62
+ return
63
+ }
64
+ const seconds = then === null ? 1 / 60 : Math.min((now - then) / 1000, 0.1)
65
+ then = now
66
+ const speed = Math.min(MAX_SPEED, Math.max(MIN_SPEED, left * CATCH_UP))
67
+ position = Math.min(end(), position + speed * seconds)
68
+ el.scrollTop = position
69
+ last = el.scrollTop
70
+ frame = frames.request(tick)
71
+ }
72
+
73
+ function grew() {
74
+ if (!following || frame !== null) return
75
+ position = el.scrollTop
76
+ last = position
77
+ frame = frames.request(tick)
78
+ }
79
+
80
+ function onScroll() {
81
+ const top = el.scrollTop
82
+ // the view's own scrolling, which already set where it is
83
+ if (Math.abs(top - last) <= 1) return
84
+ if (end() - top <= AT_END) following = true
85
+ else if (top < last) {
86
+ // the reader scrolled up, away from the end
87
+ following = false
88
+ halt()
89
+ }
90
+ last = top
91
+ position = top
92
+ }
93
+
94
+ el.addEventListener('scroll', onScroll, { passive: true })
95
+
96
+ return {
97
+ get following() {
98
+ return following
99
+ },
100
+ grew,
101
+ resume() {
102
+ following = true
103
+ grew()
104
+ },
105
+ stop() {
106
+ halt()
107
+ el.removeEventListener('scroll', onScroll)
108
+ },
109
+ }
110
+ }
@@ -15,8 +15,8 @@ export function setFormatLocale(locale: string | undefined): void {
15
15
  }
16
16
 
17
17
  // The server's ISO 4217 exponents for the codes that are not hundredths. The
18
- // server stores minor units, so its table — not the browser's CLDR data, which
19
- // differs for a few codes — decides where the decimal point goes.
18
+ // server stores minor units, so its table (not the browser's CLDR data, which
19
+ // differs for a few codes) decides where the decimal point goes.
20
20
  const minorUnitExceptions = new Map<string, number>()
21
21
 
22
22
  /** Takes the exponents the schema publishes. */
@@ -66,7 +66,7 @@ export function formatNumber(value: number, decimals?: number): string {
66
66
 
67
67
  /**
68
68
  * A money field's currency: its fixed one, or the one its currencyField
69
- * names in the record — through a relation for `order.currency`, whose
69
+ * names in the record, through a relation for `order.currency`, whose
70
70
  * value is the related record (or `{id, label, currency}`). Null when the
71
71
  * record does not say.
72
72
  */
@@ -4,7 +4,7 @@
4
4
  /**
5
5
  * A path of this admin, and nothing a browser would read as another
6
6
  * origin: one leading `/` not followed by `/` or `\` (`//host`, `/\host`),
7
- * no scheme, and no backslash, whitespace or control character anywhere —
7
+ * no scheme, and no backslash, whitespace or control character anywhere:
8
8
  * a browser strips tab, CR and LF from a URL, so `/\t/host` is `//host`.
9
9
  */
10
10
  export function isAdminPath(path: string): boolean {
@@ -52,7 +52,7 @@ export function compactQuery<T extends Record<string, QueueScalar>>(query: T): R
52
52
 
53
53
  /**
54
54
  * A `datetime-local` value in the browser's zone as RFC 3339 in whole seconds, UTC; '' when unset or invalid.
55
- * An invalid one must not reach it unnoticed — '' drops the filter — so a form checks queueLocalDateValid() first.
55
+ * An invalid one must not reach it unnoticed ('' drops the filter) so a form checks queueLocalDateValid() first.
56
56
  */
57
57
  export function toRfc3339(local: string): string {
58
58
  if (!local) return ''
@@ -0,0 +1,45 @@
1
+ // The assistant names every record it used as `resource#id`. In its
2
+ // answer, already rendered and sanitized, each such reference to a
3
+ // resource the descriptor knows becomes a link to that record's page; a
4
+ // slug the admin does not know stays text. Nothing inside a link is
5
+ // touched, and the links are built here, never parsed from the answer.
6
+
7
+ const REFERENCE = /(?<![\w-])([a-z0-9][a-z0-9-]*)#([A-Za-z0-9_-]+)/g
8
+
9
+ /**
10
+ * $html with every `slug#id` whose slug is in $slugs made a link to
11
+ * `{base}/r/{slug}/{id}`, marked `data-record-link`.
12
+ */
13
+ export function linkRecords(html: string, slugs: ReadonlySet<string>, base: string): string {
14
+ const template = document.createElement('template')
15
+ template.innerHTML = html
16
+ const walker = document.createTreeWalker(template.content, NodeFilter.SHOW_TEXT)
17
+ const texts: Text[] = []
18
+ while (walker.nextNode()) texts.push(walker.currentNode as Text)
19
+
20
+ for (const text of texts) {
21
+ if (text.parentElement?.closest('a')) continue
22
+ const value = text.nodeValue ?? ''
23
+ const fragment = document.createDocumentFragment()
24
+ let last = 0
25
+
26
+ for (const match of value.matchAll(REFERENCE)) {
27
+ const [whole, slug, id] = match as unknown as [string, string, string]
28
+ if (!slugs.has(slug)) continue
29
+ const at = match.index ?? 0
30
+ fragment.append(value.slice(last, at))
31
+ const link = document.createElement('a')
32
+ link.setAttribute('href', `${base}/r/${encodeURIComponent(slug)}/${encodeURIComponent(id)}`)
33
+ link.setAttribute('data-record-link', `${slug}#${id}`)
34
+ link.textContent = whole
35
+ fragment.append(link)
36
+ last = at + whole.length
37
+ }
38
+
39
+ if (last === 0) continue
40
+ fragment.append(value.slice(last))
41
+ text.replaceWith(fragment)
42
+ }
43
+
44
+ return template.innerHTML
45
+ }
@@ -10,15 +10,15 @@ import MarkdownIt from 'markdown-it'
10
10
 
11
11
  /**
12
12
  * The rich-text schema on the client: the Tiptap extensions a field's
13
- * `features` allow — the same node and mark types, with the same
14
- * attributes, the server's Document validates — and the sanitizer every
13
+ * `features` allow (the same node and mark types, with the same
14
+ * attributes, the server's Document validates) and the sanitizer every
15
15
  * generated HTML string passes before the one `v-html` that shows it.
16
16
  */
17
17
 
18
18
  /** Every feature a field may allow, as the server names them. */
19
19
  export const RICH_TEXT_FEATURES = ['bold', 'italic', 'underline', 'strike', 'code', 'heading', 'list', 'blockquote', 'codeBlock', 'horizontalRule', 'link', 'table', 'image', 'mention'] as const
20
20
 
21
- /** Links go to http(s), mailto or a relative place — the server's rule. */
21
+ /** Links go to http(s), mailto or a relative place; the server's rule. */
22
22
  export function allowedHref(href: string): boolean {
23
23
  // Control characters and spaces are what hide a scheme, so they are stripped on purpose.
24
24
  // eslint-disable-next-line no-control-regex
@@ -26,7 +26,7 @@ export function vt(key: string, params: Record<string, unknown> = {}, plural?: n
26
26
  /**
27
27
  * A resource label as it reads inside a sentence (`Create product`,
28
28
  * `Delete 3 products?`): lower-cased in the current language, except
29
- * where nouns keep their capital — German writes every noun with one.
29
+ * where nouns keep their capital, German writes every noun with one.
30
30
  */
31
31
  export function vnoun(label: string): string {
32
32
  const locale = instance ? String(instance.global.locale.value) : 'en'
@@ -35,7 +35,7 @@ export function vnoun(label: string): string {
35
35
 
36
36
  // `$vectorI18n` is declared here rather than left to Nuxt's generated plugin
37
37
  // types: NuxtApp inherits those from the type of every plugin module, a layer's
38
- // own plugins among them, and resolving that is circular — it leaves
38
+ // own plugins among them, and resolving that is circular; it leaves
39
39
  // `useNuxtApp().$vectorI18n` unknown. Kept out of the plugin module, which is one
40
40
  // of those bases itself.
41
41
  declare module '#app' {