@kinetis/vector-ui 0.12.5 → 0.14.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 +98 -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 +189 -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 +342 -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/{DkCRR-Zt.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/{5VLAMAEq.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/DryMzf1V.js +1 -0
  231. package/dist/static/_nuxt/{BEu939QZ.js → DsLys5JK.js} +1 -1
  232. package/dist/static/_nuxt/DvEvjhbF.js +1 -0
  233. package/dist/static/_nuxt/{B1lIMV_o.js → Dw7WalTb.js} +1 -1
  234. package/dist/static/_nuxt/{DYm7SUSn.js → DwpSsR4l.js} +1 -1
  235. package/dist/static/_nuxt/FfebEZGy.js +1 -0
  236. package/dist/static/_nuxt/{DPDZkh6Z.js → GdAHGVsW.js} +1 -1
  237. package/dist/static/_nuxt/{qFGHTGtX.js → HdAGfEVj.js} +1 -1
  238. package/dist/static/_nuxt/{CsakM5cG.js → IxgCkjBe.js} +1 -1
  239. package/dist/static/_nuxt/{BJiySRJW.js → Jl8QPdwt.js} +1 -1
  240. package/dist/static/_nuxt/{4_OCizmC.js → KWfizXHd.js} +1 -1
  241. package/dist/static/_nuxt/KeyValue.CWzmqYlQ.css +1 -0
  242. package/dist/static/_nuxt/Notifications.CAlaWnJg.css +1 -0
  243. package/dist/static/_nuxt/PqTF-5Vs.js +1 -0
  244. package/dist/static/_nuxt/SacKuioS.js +65 -0
  245. package/dist/static/_nuxt/TlyrWgih.js +1 -0
  246. package/dist/static/_nuxt/{oj_DzV60.js → WAarVmAq.js} +1 -1
  247. package/dist/static/_nuxt/{DcWEOxVe.js → XnbMqODk.js} +1 -1
  248. package/dist/static/_nuxt/{R_5D07UV.js → Y2iAEIYr.js} +1 -1
  249. package/dist/static/_nuxt/_resource_.Q2lVCG-n.css +1 -0
  250. package/dist/static/_nuxt/{BSj7_50x.js → b2bdl3qT.js} +1 -1
  251. package/dist/static/_nuxt/bNqxxQg2.js +1 -0
  252. package/dist/static/_nuxt/builds/latest.json +1 -1
  253. package/dist/static/_nuxt/builds/meta/febd0fe3-67f9-4afd-94c3-97178a3ef2b1.json +1 -0
  254. package/dist/static/_nuxt/{yO0LqdZ2.js → e2dpeiRT.js} +1 -1
  255. package/dist/static/_nuxt/{entry.DmwuXgFN.css → entry.B2UXd7Ey.css} +1 -1
  256. package/dist/static/_nuxt/error-404.D5YWHu6f.css +1 -0
  257. package/dist/static/_nuxt/error-500.BP1eYUQR.css +1 -0
  258. package/dist/static/_nuxt/{CB-gmtNU.js → fLsGnP3B.js} +1 -1
  259. package/dist/static/_nuxt/gYmJEXHP.js +1 -0
  260. package/dist/static/_nuxt/{B-nBg1Xv.js → jI4JB4sB.js} +1 -1
  261. package/dist/static/_nuxt/{DebXB2Xn.js → qoAbHCOq.js} +1 -1
  262. package/dist/static/_nuxt/rYfJ_RlJ.js +1 -0
  263. package/dist/static/_nuxt/{CrGsoVt3.js → tGXqY3hN.js} +1 -1
  264. package/dist/static/_nuxt/{Bk4XXIda.js → tv5vSe5Y.js} +1 -1
  265. package/dist/static/_nuxt/vbxP0T99.js +185 -0
  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/B6S9Z6WQ.js +0 -1
  279. package/dist/static/_nuxt/BDNMzG2s.js +0 -1
  280. package/dist/static/_nuxt/BDhmmehP.js +0 -2
  281. package/dist/static/_nuxt/BJhRZpbP.js +0 -1
  282. package/dist/static/_nuxt/BZXFBS4d.js +0 -1
  283. package/dist/static/_nuxt/Baf8k6rK.js +0 -1
  284. package/dist/static/_nuxt/BlcK9t0n.js +0 -1
  285. package/dist/static/_nuxt/Bp1wYuAu.js +0 -2
  286. package/dist/static/_nuxt/BqIYBnn1.js +0 -1
  287. package/dist/static/_nuxt/BzcHWzF1.js +0 -1
  288. package/dist/static/_nuxt/C-dF6TjJ.js +0 -1
  289. package/dist/static/_nuxt/C0BqlrB-.js +0 -1
  290. package/dist/static/_nuxt/C5lrJzwj.js +0 -67
  291. package/dist/static/_nuxt/C6kvBrux.js +0 -1
  292. package/dist/static/_nuxt/C9pCrKWL.js +0 -1
  293. package/dist/static/_nuxt/CBIdPVBN.js +0 -1
  294. package/dist/static/_nuxt/CE4w7ySf.js +0 -1
  295. package/dist/static/_nuxt/CIIjiec-.js +0 -1
  296. package/dist/static/_nuxt/CJUKNdMD.js +0 -1
  297. package/dist/static/_nuxt/CL8kR7Jl.js +0 -1
  298. package/dist/static/_nuxt/CTQUNAVB.js +0 -1
  299. package/dist/static/_nuxt/CTqdSnzX.js +0 -1
  300. package/dist/static/_nuxt/ChHwRItD.js +0 -1
  301. package/dist/static/_nuxt/ClGaGEq-.js +0 -1
  302. package/dist/static/_nuxt/ClTuaRRz.js +0 -1
  303. package/dist/static/_nuxt/CojXjKit.js +0 -1
  304. package/dist/static/_nuxt/CpCuvz_Q.js +0 -1
  305. package/dist/static/_nuxt/Cv4Z1VpR.js +0 -65
  306. package/dist/static/_nuxt/D1s1ZPEA.js +0 -2
  307. package/dist/static/_nuxt/D8p7N22I.js +0 -1
  308. package/dist/static/_nuxt/DBXnb1tR.js +0 -1
  309. package/dist/static/_nuxt/DCZnllp3.js +0 -1
  310. package/dist/static/_nuxt/DL237dS3.js +0 -1
  311. package/dist/static/_nuxt/DPH3RfAz.js +0 -1
  312. package/dist/static/_nuxt/DVKVuUv9.js +0 -1
  313. package/dist/static/_nuxt/Djb5b_0H.js +0 -1
  314. package/dist/static/_nuxt/DlpIJgqB.js +0 -1
  315. package/dist/static/_nuxt/DrEHkKjX.js +0 -10
  316. package/dist/static/_nuxt/DuYZsH0p.js +0 -1
  317. package/dist/static/_nuxt/DujOg9oz.js +0 -2
  318. package/dist/static/_nuxt/IhWbQWqt.js +0 -1
  319. package/dist/static/_nuxt/KeyValue.CczYMB-Q.css +0 -1
  320. package/dist/static/_nuxt/NOtHifBs.js +0 -105
  321. package/dist/static/_nuxt/Notifications.AEytcgEO.css +0 -1
  322. package/dist/static/_nuxt/OyqHv1Hk.js +0 -1
  323. package/dist/static/_nuxt/Pe8cg_oY.js +0 -1
  324. package/dist/static/_nuxt/QTRQ5bvA.js +0 -1
  325. package/dist/static/_nuxt/Un35xD_q.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/3c8a90b7-4dbd-4b44-8b52-44303c3d88d5.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
@@ -3,8 +3,8 @@ import { fieldProps, type VectorAction, type VectorExportFormat, type VectorFiel
3
3
  import type { VectorPageStep } from '#vector/app/composables/useVectorCursorPager'
4
4
  import { type Violation, violationsOf } from '#vector/app/utils/internal/violations'
5
5
 
6
- // The list view: a server-driven table whose every option — page, size,
7
- // sort, filters, search, grouping, columns — becomes one list request,
6
+ // The list view: a server-driven table whose every option (page, size,
7
+ // sort, filters, search, grouping, columns) becomes one list request,
8
8
  // with saved views, per-user column state, summaries, bulk operations,
9
9
  // actions and export on top.
10
10
  const props = defineProps<{ resource: VectorResource }>()
@@ -27,6 +27,7 @@ const counted = computed(() => !byCursor.value && props.resource.table.withoutCo
27
27
  const columns = ref<string[]>(preferences.get<string[]>(`columns.${props.resource.slug}`)?.filter(c => props.resource.table.columns.includes(c)) ?? [...props.resource.table.columns])
28
28
  // The filter: conditions that must all hold, "any of" groups of
29
29
  // alternatives, and whatever a saved view holds that the bar cannot edit.
30
+ const { listToolbar } = useVectorExtensions()
30
31
  const filters = ref<VectorFilters>({})
31
32
  const groups = ref<VectorFilterGroup[]>([])
32
33
  const advanced = ref<VectorFilterQuery[]>([])
@@ -169,6 +170,12 @@ function onOptions() {
169
170
  void load()
170
171
  }
171
172
 
173
+ // refreshNuxtData('vector.list.<slug>'), or with no keys, reloads the page shown, as it does a useAsyncData page
174
+ const stopRefresh = useNuxtApp().hook('app:data:refresh', async (keys) => {
175
+ if (!keys || keys.includes(`vector.list.${props.resource.slug}`)) await load()
176
+ })
177
+ onBeforeUnmount(stopRefresh)
178
+
172
179
  // The table resets the page it pages itself on a new sort; an uncounted list pages here, so this does, before the table reports the sort
173
180
  watch(sortBy, () => { if (!counted.value) firstPage() }, { deep: true, flush: 'sync' })
174
181
 
@@ -485,6 +492,22 @@ onBeforeUnmount(() => window.removeEventListener('beforeunload', warnBeforeUnloa
485
492
  <VxListViewMenu ref="viewMenu" :resource="resource" :current="state" :active-id="activeView" @apply="applyView" @update:active-id="(id: number | null) => activeView = id" />
486
493
  <v-select v-if="resource.table.groupable.length && !byCursor" v-model="group" :items="[{ title: t('list.noGrouping'), value: null }, ...resource.table.groupable.map(g => ({ title: resource.fields.find(f => f.name === g)?.label ?? g, value: g }))]" :label="t('list.groupBy')" density="compact" hide-details style="max-width: 200px" />
487
494
  <v-select v-if="resource.softDelete" v-model="trashed" :items="[{ title: t('list.trash.active'), value: 'without' }, { title: t('list.trash.only'), value: 'only' }, { title: t('list.trash.with'), value: 'with' }]" density="compact" hide-details :aria-label="t('list.trash.label')" style="max-width: 180px" prepend-inner-icon="mdi-delete-clock-outline" />
495
+ <!-- list-toolbar items extensions and layers registered (defineListToolbarItem): the list's own models, two-way -->
496
+ <component
497
+ :is="item"
498
+ v-for="[name, item] in listToolbar"
499
+ :key="name"
500
+ :data-list-toolbar-item="name"
501
+ :resource="resource"
502
+ :filters="filters"
503
+ :groups="groups"
504
+ :advanced="advanced"
505
+ :search="search"
506
+ @update:filters="(v: VectorFilters) => filters = v"
507
+ @update:groups="(v: VectorFilterGroup[]) => groups = v"
508
+ @update:advanced="(v: VectorFilterQuery[]) => advanced = v"
509
+ @update:search="(v: string | null) => search = v"
510
+ />
488
511
  <v-spacer />
489
512
  <v-btn v-for="action in standaloneActions" :key="action.name" size="small" variant="tonal" :prepend-icon="action.icon ?? undefined" @click="dialogAction = action">{{ action.label }}</v-btn>
490
513
  <template v-if="resource.permissions.export">
@@ -1,8 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  import type { VectorWidget, VectorWidgetData } from '#vector/app/types/vector'
3
3
 
4
- // One widget card: loads its data for the selected range — and again in a
5
- // new language, whose labels the server translates — and renders the shape
4
+ // One widget card: loads its data for the selected range (and again in a
5
+ // new language, whose labels the server translates) and renders the shape
6
6
  // its type declares. A consuming app replaces a type through
7
7
  // app.config.vector.widgets, like fields and inputs.
8
8
  const props = defineProps<{
@@ -0,0 +1,115 @@
1
+ <script setup lang="ts">
2
+ import type { ApprovalCard } from '../../composables/useVectorAssistant'
3
+
4
+ // One change the assistant proposed, for the admin to approve or reject.
5
+ // Everything it shows is the server's structured proposal (the tool, the
6
+ // resource, the record and each argument field by field, with the value
7
+ // before the change where a vector_get of the same run read the record)
8
+ // and never the model's prose about it. Approving runs the server's own
9
+ // stored arguments; the card only says which.
10
+
11
+ const props = defineProps<{ approval: ApprovalCard, busy: boolean }>()
12
+ const emit = defineEmits<{ approve: [], reject: [] }>()
13
+
14
+ const host = useVectorHost()
15
+ const { t } = useVectorT()
16
+
17
+ /** Arguments shown in their own rows rather than as the change's fields. */
18
+ const NAMED = new Set(['resource', 'id', 'values'])
19
+
20
+ const frame = computed(() => props.approval.frame)
21
+ const resource = computed(() => frame.value.resource === null ? undefined : host.schema.value?.resources?.[frame.value.resource])
22
+
23
+ /** What the change is to: the resource as the admin names it, and the record. */
24
+ const target = computed(() => {
25
+ const label = resource.value?.labelSingular ?? resource.value?.label ?? frame.value.resource ?? ''
26
+ return frame.value.recordId === null ? label : `${label} #${frame.value.recordId}`
27
+ })
28
+
29
+ const title = computed(() => {
30
+ const known = ['vector_create', 'vector_update', 'vector_delete', 'vector_run_action']
31
+ return known.includes(frame.value.tool)
32
+ ? t(`ai.assistant.approval.title.${frame.value.tool}`, { target: target.value })
33
+ : t('ai.assistant.approval.title.other', { tool: frame.value.tool, target: target.value })
34
+ })
35
+
36
+ interface Row { name: string, label: string, before: string | null, after: string }
37
+
38
+ function show(value: unknown): string {
39
+ return value === null || value === undefined ? t('common.none') : displayValue(value)
40
+ }
41
+
42
+ /** Each field the change writes, with its value before where the run read the record. */
43
+ const changes = computed<Row[]>(() => {
44
+ const values = frame.value.arguments.values
45
+ if (values === null || typeof values !== 'object' || Array.isArray(values)) return []
46
+ const before = props.approval.before
47
+ return Object.entries(values as Record<string, unknown>).map(([name, value]) => ({
48
+ name,
49
+ label: resource.value?.fields.find(f => f.name === name)?.label ?? name,
50
+ before: before !== null && name in before ? show(before[name]) : null,
51
+ after: show(value),
52
+ }))
53
+ })
54
+
55
+ /** The call's other arguments (an action's name and ids, a delete's force, a version), as they are. */
56
+ const others = computed(() => Object.entries(frame.value.arguments)
57
+ .filter(([name]) => !NAMED.has(name))
58
+ .map(([name, value]) => ({ name, value: show(value) })))
59
+
60
+ const expires = computed(() => formatDateTime(frame.value.expiresAt))
61
+
62
+ const reason = computed(() => {
63
+ const result = props.approval.result
64
+ const error = result !== null && typeof result === 'object' ? (result as { error?: unknown }).error : undefined
65
+ return typeof error === 'string' && error !== '' ? error : t('ai.assistant.approval.unknownReason')
66
+ })
67
+
68
+ const decidable = computed(() => props.approval.state === 'pending' || props.approval.state === 'deciding')
69
+ </script>
70
+
71
+ <template>
72
+ <v-card variant="outlined" class="mt-2" data-ai-approval :data-ai-approval-id="frame.id" :data-ai-approval-state="approval.state">
73
+ <v-card-item>
74
+ <v-card-title class="text-subtitle-2 text-wrap" data-ai-approval-title>
75
+ <v-icon icon="mdi-shield-check-outline" size="small" class="me-1" />{{ title }}
76
+ </v-card-title>
77
+ <v-card-subtitle v-if="decidable" class="text-wrap" data-ai-approval-expires>{{ t('ai.assistant.approval.expires', { time: expires }) }}</v-card-subtitle>
78
+ </v-card-item>
79
+ <v-card-text class="pt-0">
80
+ <v-table v-if="changes.length" density="compact" class="text-caption" data-ai-approval-changes>
81
+ <thead>
82
+ <tr>
83
+ <th scope="col">{{ t('ai.assistant.approval.field') }}</th>
84
+ <th v-if="approval.before !== null" scope="col">{{ t('ai.assistant.approval.from') }}</th>
85
+ <th scope="col">{{ t('ai.assistant.approval.to') }}</th>
86
+ </tr>
87
+ </thead>
88
+ <tbody>
89
+ <tr v-for="row in changes" :key="row.name" :data-ai-approval-field="row.name">
90
+ <td>{{ row.label }}</td>
91
+ <td v-if="approval.before !== null" data-ai-approval-from>{{ row.before ?? t('common.none') }}</td>
92
+ <td data-ai-approval-to>{{ row.after }}</td>
93
+ </tr>
94
+ </tbody>
95
+ </v-table>
96
+ <dl v-if="others.length" class="text-caption mt-1" data-ai-approval-arguments>
97
+ <template v-for="arg in others" :key="arg.name">
98
+ <dt class="text-medium-emphasis">{{ arg.name }}</dt>
99
+ <dd class="ms-2" :data-ai-approval-argument="arg.name">{{ arg.value }}</dd>
100
+ </template>
101
+ </dl>
102
+ <v-alert v-if="approval.state === 'executed'" type="success" variant="tonal" density="compact" class="mt-2" data-ai-approval-outcome>{{ t('ai.assistant.approval.executed') }}</v-alert>
103
+ <v-alert v-else-if="approval.state === 'failed'" type="error" variant="tonal" density="compact" class="mt-2" data-ai-approval-outcome>{{ t('ai.assistant.approval.failed', { reason }) }}</v-alert>
104
+ <v-alert v-else-if="approval.state === 'rejected'" type="info" variant="tonal" density="compact" class="mt-2" data-ai-approval-outcome>{{ t('ai.assistant.approval.rejected') }}</v-alert>
105
+ <v-alert v-else-if="approval.state === 'expired'" type="warning" variant="tonal" density="compact" class="mt-2" data-ai-approval-outcome>{{ t('ai.assistant.approval.expired') }}</v-alert>
106
+ <v-alert v-else-if="approval.state === 'gone'" type="warning" variant="tonal" density="compact" class="mt-2" data-ai-approval-outcome>{{ t('ai.assistant.approval.gone') }}</v-alert>
107
+ <v-alert v-if="approval.error" type="error" variant="tonal" density="compact" class="mt-2" data-ai-approval-error>{{ approval.error }}</v-alert>
108
+ </v-card-text>
109
+ <v-card-actions v-if="decidable">
110
+ <v-spacer />
111
+ <v-btn variant="text" :disabled="busy || approval.state === 'deciding'" data-ai-approval-reject @click="emit('reject')">{{ t('ai.assistant.approval.reject') }}</v-btn>
112
+ <v-btn color="primary" variant="flat" :disabled="busy" :loading="approval.state === 'deciding'" data-ai-approval-approve @click="emit('approve')">{{ t('ai.assistant.approval.approve') }}</v-btn>
113
+ </v-card-actions>
114
+ </v-card>
115
+ </template>
@@ -0,0 +1,189 @@
1
+ <script setup lang="ts">
2
+ import { linkRecords } from '../../utils/recordLinks'
3
+ import { toolChips } from '../../utils/assistantTools'
4
+ import { followScroll, type FollowScroll } from '../../utils/followScroll'
5
+ import ApprovalCard from './ApprovalCard.vue'
6
+
7
+ // The assistant: a sparkle button in the app bar (a shell action) and the
8
+ // end-side drawer it opens, holding the conversation, a composer, "New
9
+ // conversation" and a line saying which page the questions are about.
10
+ // Shell actions belong to the layout, so the drawer and its conversation
11
+ // survive navigation. An answer is Markdown, rendered and sanitized as the
12
+ // admin renders a markdown field, its `resource#id` references made links
13
+ // to the records. A change the assistant proposed (capabilities.ai.assistantWrites)
14
+ // shows as an approval card under its answer: approving or rejecting it
15
+ // sends the decision, and the assistant then says what happened. Above an
16
+ // answer, a chip for each tool it read or proposed with, a repeated one
17
+ // once with how many times; a call that was a tool error has none. The
18
+ // conversation scrolls after an answer as it arrives, gliding rather than
19
+ // jumping when much arrives at once; scrolling up stops that until the next
20
+ // question or answer, or until the reader is back at the end. ⌘J
21
+ // (Ctrl+J elsewhere) opens or closes the drawer from anywhere, its own
22
+ // input included; nothing on screen says so. Shown, and the shortcut
23
+ // heard, only when capabilities.ai.assistant is on.
24
+
25
+ /** The tools that only propose a change. */
26
+ const PROPOSING = new Set(['vector_create', 'vector_update', 'vector_delete', 'vector_run_action'])
27
+
28
+ // the layout's own attributes (data-shell-action) go on the button: the drawer is elsewhere
29
+ defineOptions({ inheritAttrs: false })
30
+
31
+ const host = useVectorHost()
32
+ const appConfig = useAppConfig()
33
+ const router = useRouter()
34
+ const { t } = useVectorT()
35
+ const { open, draft, turns, busy, refused, send, retry, reset, decide } = useVectorAssistant()
36
+
37
+ const shown = computed(() => aiOffered(aiCapabilities(host.schema.value), 'assistant'))
38
+ const writes = computed(() => aiOffered(aiCapabilities(host.schema.value), 'assistantWrites'))
39
+ /** The turns the drawer shows: a decision on a proposal is told by its card, not as a message. */
40
+ const shownTurns = computed(() => turns.value.filter(turn => turn.role !== 'approval'))
41
+ const slugs = computed(() => new Set(Object.keys(host.schema.value?.resources ?? {})))
42
+
43
+ /** Which page the questions are about, in words. */
44
+ const contextLine = computed(() => {
45
+ // follows navigation: host.context() reads the router's current route
46
+ const ctx = host.context()
47
+ const resource = ctx.resource === undefined ? undefined : host.schema.value?.resources?.[ctx.resource]
48
+ if (resource === undefined) return ctx.path === '/' ? t('shell.home.title') : t('ai.assistant.context.page', { path: ctx.path })
49
+ return ctx.recordId === undefined
50
+ ? t('ai.assistant.context.list', { label: resource.label })
51
+ : t('ai.assistant.context.record', { label: resource.labelSingular ?? resource.label, id: ctx.recordId })
52
+ })
53
+
54
+ /** Where the admin's pages are as a link outside the router opens them: under the app's base URL (`/vector/ui` hosted). */
55
+ const linkBase = computed(() => router.resolve(appConfig.vector.basePath || '/').href.replace(/\/$/, ''))
56
+
57
+ function html(content: string): string {
58
+ return linkRecords(host.markdownHtml(content), slugs.value, linkBase.value)
59
+ }
60
+
61
+ /** A record link in an answer navigates inside the admin, rather than reloading it. */
62
+ function follow(event: MouseEvent) {
63
+ const link = (event.target as Element | null)?.closest<HTMLElement>('a[data-record-link]')
64
+ if (!link || event.metaKey || event.ctrlKey || event.shiftKey || event.button !== 0) return
65
+ event.preventDefault()
66
+ const [slug = '', id = ''] = (link.dataset.recordLink ?? '').split('#')
67
+ void navigateTo(`${appConfig.vector.basePath}/r/${encodeURIComponent(slug)}/${encodeURIComponent(id)}`)
68
+ }
69
+
70
+ function onKeydown(event: KeyboardEvent) {
71
+ if (event.key === 'Enter' && !event.shiftKey && !event.isComposing) {
72
+ event.preventDefault()
73
+ void send(draft.value)
74
+ }
75
+ }
76
+
77
+ /** The chip of a tool, with how many times when more than once. */
78
+ function chipLabel(name: string, count: number): string {
79
+ const proposing = PROPOSING.has(name)
80
+ if (count === 1) return t(proposing ? 'ai.assistant.proposingTool' : 'ai.assistant.tool', { name })
81
+ return t(proposing ? 'ai.assistant.proposingToolTimes' : 'ai.assistant.toolTimes', { name, count })
82
+ }
83
+
84
+ /** ⌘J, or Ctrl+J: opens or closes the drawer, unless something else already handled the keypress. */
85
+ function onShortcut(event: KeyboardEvent) {
86
+ if (!shown.value || event.defaultPrevented || !(event.metaKey || event.ctrlKey) || event.shiftKey || event.altKey || event.key.toLowerCase() !== 'j') return
87
+ event.preventDefault()
88
+ open.value = !open.value
89
+ }
90
+
91
+ // the conversation follows the answer as it arrives, unless the reader scrolled up;
92
+ // a new question or a new answer follows it again
93
+ const conversation = ref<HTMLElement | null>(null)
94
+ let scroller: FollowScroll | null = null
95
+ watch(conversation, (el) => {
96
+ scroller?.stop()
97
+ scroller = el === null ? null : followScroll(el)
98
+ }, { flush: 'post' })
99
+ watch(() => turns.value.at(-1)?.id, () => scroller?.resume(), { flush: 'post' })
100
+ watch(turns, () => scroller?.grew(), { deep: true, flush: 'post' })
101
+
102
+ // the drawer lives in the application's layout, beside the page, wherever the shell action is rendered
103
+ const target = ref<string | null>(null)
104
+ onMounted(() => {
105
+ target.value = document.querySelector('.v-application') ? '.v-application' : null
106
+ window.addEventListener('keydown', onShortcut)
107
+ })
108
+ onBeforeUnmount(() => {
109
+ window.removeEventListener('keydown', onShortcut)
110
+ scroller?.stop()
111
+ })
112
+ </script>
113
+
114
+ <template>
115
+ <template v-if="shown">
116
+ <v-btn v-bind="$attrs" icon="mdi-creation-outline" variant="text" :aria-label="t('ai.assistant.open')" :aria-expanded="open" data-ai-assistant-toggle @click="open = !open" />
117
+ <Teleport :to="target ?? 'body'" :disabled="target === null">
118
+ <v-navigation-drawer v-model="open" location="end" width="400" class="vx-ai-assistant" data-ai-assistant>
119
+ <div class="d-flex flex-column fill-height">
120
+ <v-toolbar density="compact" color="transparent" :title="t('ai.assistant.title')">
121
+ <v-btn size="small" variant="text" prepend-icon="mdi-plus" :disabled="busy" data-ai-assistant-new @click="reset">{{ t('ai.assistant.new') }}</v-btn>
122
+ <v-btn icon="mdi-close" size="small" variant="text" :aria-label="t('ai.assistant.close')" @click="open = false" />
123
+ </v-toolbar>
124
+ <p class="text-caption text-medium-emphasis px-4 mb-2" data-ai-assistant-context>
125
+ <v-icon icon="mdi-bookmark-outline" size="x-small" class="me-1" />{{ contextLine }}
126
+ </p>
127
+ <v-divider />
128
+ <div ref="conversation" class="flex-grow-1 overflow-y-auto pa-3" aria-live="polite" data-ai-assistant-conversation>
129
+ <p v-if="turns.length === 0" class="text-body-2 text-medium-emphasis" data-ai-assistant-empty>{{ t(writes ? 'ai.assistant.emptyWrites' : 'ai.assistant.empty') }}</p>
130
+ <div v-for="turn in shownTurns" :key="turn.id" class="mb-3" :data-ai-assistant-turn="turn.role">
131
+ <v-sheet v-if="turn.role === 'user'" color="primary" variant="tonal" rounded class="pa-2 ms-8 text-body-2 vx-ai-assistant__user">{{ turn.content }}</v-sheet>
132
+ <div v-else class="me-4">
133
+ <div v-if="toolChips(turn.tools).length" class="d-flex flex-wrap ga-1 mb-1" data-ai-assistant-tools>
134
+ <v-chip v-for="chip in toolChips(turn.tools)" :key="chip.name" size="x-small" variant="outlined" :prepend-icon="PROPOSING.has(chip.name) ? 'mdi-pencil-outline' : 'mdi-database-search-outline'" data-ai-assistant-tool>{{ chipLabel(chip.name, chip.count) }}</v-chip>
135
+ </div>
136
+ <!-- eslint-disable-next-line vue/no-v-html -- Markdown sanitized by the admin's own renderer; the record links are built, not parsed -->
137
+ <div v-if="turn.content" class="text-body-2 vx-ai-assistant__answer" data-ai-assistant-answer @click="follow" v-html="html(turn.content)" />
138
+ <ApprovalCard
139
+ v-for="approval in turn.approvals"
140
+ :key="approval.frame.id"
141
+ :approval="approval"
142
+ :busy="busy"
143
+ @approve="decide(approval, 'approve')"
144
+ @reject="decide(approval, 'reject')"
145
+ />
146
+ <v-progress-linear v-if="turn.streaming" indeterminate color="primary" class="mt-1" data-ai-assistant-streaming />
147
+ <v-alert v-if="turn.failed" type="warning" variant="tonal" density="compact" class="mt-1" data-ai-assistant-failure>
148
+ {{ turn.failed }}
149
+ <template #append>
150
+ <v-btn v-if="turn === turns[turns.length - 1]" size="small" variant="text" :disabled="busy" data-ai-assistant-retry @click="retry">{{ t('ai.assistant.retry') }}</v-btn>
151
+ </template>
152
+ </v-alert>
153
+ </div>
154
+ </div>
155
+ </div>
156
+ <v-divider />
157
+ <div class="pa-3">
158
+ <v-alert v-if="refused" type="warning" variant="tonal" density="compact" class="mb-2" data-ai-assistant-refused>
159
+ {{ refused }}
160
+ </v-alert>
161
+ <v-textarea
162
+ v-model="draft"
163
+ :placeholder="t('ai.assistant.placeholder')"
164
+ :aria-label="t('ai.assistant.placeholder')"
165
+ rows="2"
166
+ auto-grow
167
+ max-rows="6"
168
+ :maxlength="8000"
169
+ density="compact"
170
+ hide-details
171
+ data-ai-assistant-input
172
+ @keydown="onKeydown"
173
+ >
174
+ <template #append-inner>
175
+ <v-btn icon="mdi-send" size="small" variant="text" :loading="busy" :disabled="busy || draft.trim() === ''" :aria-label="t('ai.assistant.send')" data-ai-assistant-send @click="send(draft)" />
176
+ </template>
177
+ </v-textarea>
178
+ </div>
179
+ </div>
180
+ </v-navigation-drawer>
181
+ </Teleport>
182
+ </template>
183
+ </template>
184
+
185
+ <style scoped>
186
+ .vx-ai-assistant__user { white-space: pre-wrap; }
187
+ .vx-ai-assistant__answer :deep(p) { margin-bottom: 0.5em; }
188
+ .vx-ai-assistant__answer :deep(pre) { white-space: pre-wrap; }
189
+ </style>
@@ -0,0 +1,111 @@
1
+ <script setup lang="ts">
2
+ // The provider keys of the `ai` settings group: what is set, by whom and
3
+ // when, and which keys the environment manages. A key is entered here and
4
+ // sent once; the panel never shows a stored one, and no answer carries it.
5
+ // Nothing renders without the descriptor's `capabilities.ai`.
6
+
7
+ interface KeyStatus {
8
+ set: boolean
9
+ managedBy: 'environment' | 'admin' | null
10
+ storable: boolean
11
+ updatedAt?: string
12
+ updatedBy?: string
13
+ sealedWithAnotherKey?: boolean
14
+ // why a stored key cannot be used: sealed with another key, or no VECTOR_AI_KEY to open it
15
+ problem?: string
16
+ }
17
+
18
+ defineProps<{ group: string }>()
19
+
20
+ const { schema } = useVectorSchema()
21
+ const api = useVectorApi()
22
+ const notifications = useVectorNotifications()
23
+ const { t } = useVectorT()
24
+
25
+ const enabled = computed(() => schema.value?.capabilities?.ai !== undefined)
26
+ const statuses = ref<Record<string, KeyStatus> | null>(null)
27
+ const failure = ref<string | null>(null)
28
+ const entered = reactive<Record<string, string>>({})
29
+ const busy = ref<string | null>(null)
30
+
31
+ async function load() {
32
+ try {
33
+ statuses.value = await api<Record<string, KeyStatus>>('/vector/ai/credentials')
34
+ failure.value = null
35
+ } catch (error) {
36
+ failure.value = vectorErrorMessage(error)
37
+ }
38
+ }
39
+
40
+ watch(enabled, (on) => { if (on) void load() }, { immediate: true })
41
+
42
+ async function save(provider: string) {
43
+ const key = (entered[provider] ?? '').trim()
44
+ if (key === '' || statuses.value === null) return
45
+ busy.value = provider
46
+
47
+ try {
48
+ statuses.value[provider] = await api<KeyStatus>(`/vector/ai/credentials/${encodeURIComponent(provider)}`, { method: 'PUT', body: { key } })
49
+ notifications.success(t('ai.credentials.saved', { provider }))
50
+ } catch (error) {
51
+ notifications.error(vectorErrorMessage(error))
52
+ } finally {
53
+ // the key leaves the page either way
54
+ entered[provider] = ''
55
+ busy.value = null
56
+ }
57
+ }
58
+
59
+ async function remove(provider: string) {
60
+ if (statuses.value === null) return
61
+ busy.value = provider
62
+
63
+ try {
64
+ statuses.value[provider] = await api<KeyStatus>(`/vector/ai/credentials/${encodeURIComponent(provider)}`, { method: 'DELETE' })
65
+ notifications.success(t('ai.credentials.removed', { provider }))
66
+ } catch (error) {
67
+ notifications.error(vectorErrorMessage(error))
68
+ } finally {
69
+ busy.value = null
70
+ }
71
+ }
72
+ </script>
73
+
74
+ <template>
75
+ <v-card-text v-if="enabled" class="vx-ai-credentials" data-ai-credentials>
76
+ <h2 class="text-subtitle-1 font-weight-medium mb-1">{{ t('ai.credentials.title') }}</h2>
77
+ <p class="text-body-2 text-medium-emphasis mb-3">{{ t('ai.credentials.intro') }}</p>
78
+ <v-alert v-if="failure" type="error" variant="tonal" density="compact" :text="failure" />
79
+ <p v-else-if="statuses && Object.keys(statuses).length === 0" class="text-body-2" data-ai-no-provider>{{ t('ai.credentials.none') }}</p>
80
+ <v-list v-else-if="statuses" density="compact" lines="two">
81
+ <v-list-item v-for="(status, provider) in statuses" :key="provider" :data-ai-provider="provider">
82
+ <v-list-item-title class="d-flex align-center ga-2">
83
+ <strong>{{ provider }}</strong>
84
+ <v-chip v-if="status.managedBy === 'environment'" size="x-small" variant="tonal" data-ai-managed="environment">{{ t('ai.credentials.environment') }}</v-chip>
85
+ <v-chip v-else-if="status.managedBy === null" size="x-small" variant="tonal">{{ t('ai.credentials.noKey') }}</v-chip>
86
+ <v-chip v-else size="x-small" variant="tonal" :color="status.set && status.storable && !status.sealedWithAnotherKey ? 'success' : undefined" :data-ai-set="status.set">{{ status.set ? t('ai.credentials.set') : t('ai.credentials.unset') }}</v-chip>
87
+ </v-list-item-title>
88
+ <v-list-item-subtitle v-if="status.managedBy === 'admin'">
89
+ <span v-if="status.sealedWithAnotherKey" class="text-warning">{{ t('ai.credentials.sealedWithAnotherKey') }}</span>
90
+ <!-- without VECTOR_AI_KEY nothing is stored, and a key stored before cannot be opened -->
91
+ <span v-else-if="!status.storable" :class="{ 'text-warning': status.set }" data-ai-cannot-store>{{ t('ai.credentials.cannotStore') }}</span>
92
+ <span v-else-if="status.set && status.updatedAt">{{ t('ai.credentials.updated', { by: status.updatedBy ?? '?', at: formatDateTime(status.updatedAt) }) }}</span>
93
+ </v-list-item-subtitle>
94
+ <div v-if="status.managedBy === 'admin' && status.storable" class="d-flex align-center ga-2 mt-2">
95
+ <v-text-field
96
+ v-model="entered[provider]"
97
+ type="password"
98
+ autocomplete="off"
99
+ density="compact"
100
+ hide-details
101
+ :label="t('ai.credentials.enter', { provider })"
102
+ style="max-width: 360px"
103
+ @keydown.enter.prevent="save(String(provider))"
104
+ />
105
+ <v-btn size="small" color="primary" :loading="busy === provider" :disabled="!(entered[provider] ?? '').trim()" @click="save(String(provider))">{{ t('ai.credentials.save') }}</v-btn>
106
+ <v-btn v-if="status.set" size="small" variant="text" :disabled="busy === provider" @click="remove(String(provider))">{{ t('ai.credentials.remove') }}</v-btn>
107
+ </div>
108
+ </v-list-item>
109
+ </v-list>
110
+ </v-card-text>
111
+ </template>