@kinetis/vector-ui 0.13.0 → 0.15.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 (241) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/app/components/Vx/Cell/BooleanGroup.vue +20 -0
  3. package/app/components/Vx/Cell/Country.vue +13 -0
  4. package/app/components/Vx/Cell/Json.vue +2 -8
  5. package/app/components/Vx/Cell/Repeater.vue +64 -0
  6. package/app/components/Vx/Cell/Select.vue +26 -0
  7. package/app/components/Vx/Cell/Tag.vue +15 -0
  8. package/app/components/Vx/CommandPalette.vue +5 -2
  9. package/app/components/Vx/Import/Dialog.vue +2 -1
  10. package/app/components/Vx/Input/BooleanGroup.vue +39 -0
  11. package/app/components/Vx/Input/Country.vue +14 -0
  12. package/app/components/Vx/Input/Json.vue +63 -0
  13. package/app/components/Vx/Input/Repeater.vue +142 -35
  14. package/app/components/Vx/Input/Select.vue +31 -0
  15. package/app/components/Vx/Input/Tag.vue +47 -0
  16. package/app/components/Vx/Input/Textarea.vue +0 -1
  17. package/app/components/Vx/Layout.vue +1 -1
  18. package/app/components/Vx/List/BulkEdit.vue +2 -1
  19. package/app/components/Vx/List/FilterBar.vue +25 -5
  20. package/app/components/Vx/Resource/Audit.vue +2 -1
  21. package/app/components/Vx/Resource/Form.vue +13 -10
  22. package/app/components/VxAi/ApprovalCard.vue +2 -2
  23. package/app/components/VxAi/Assistant.vue +6 -7
  24. package/app/composables/useVectorAssistant.ts +64 -40
  25. package/app/composables/useVectorCountryNames.ts +38 -0
  26. package/app/composables/useVectorFields.ts +5 -1
  27. package/app/composables/useVectorForm.ts +27 -3
  28. package/app/composables/useVectorInputs.ts +7 -5
  29. package/app/i18n/ar/fields.ts +15 -0
  30. package/app/i18n/ar/list.ts +2 -0
  31. package/app/i18n/de/fields.ts +15 -0
  32. package/app/i18n/de/list.ts +2 -0
  33. package/app/i18n/en/fields.ts +15 -0
  34. package/app/i18n/en/list.ts +2 -0
  35. package/app/i18n/es/fields.ts +15 -0
  36. package/app/i18n/es/list.ts +2 -0
  37. package/app/i18n/fr/fields.ts +15 -0
  38. package/app/i18n/fr/list.ts +2 -0
  39. package/app/i18n/he/fields.ts +15 -0
  40. package/app/i18n/he/list.ts +2 -0
  41. package/app/i18n/it/fields.ts +15 -0
  42. package/app/i18n/it/list.ts +2 -0
  43. package/app/i18n/ja/fields.ts +15 -0
  44. package/app/i18n/ja/list.ts +2 -0
  45. package/app/i18n/ko/fields.ts +15 -0
  46. package/app/i18n/ko/list.ts +2 -0
  47. package/app/i18n/nl/fields.ts +15 -0
  48. package/app/i18n/nl/list.ts +2 -0
  49. package/app/i18n/pl/fields.ts +15 -0
  50. package/app/i18n/pl/list.ts +2 -0
  51. package/app/i18n/pt/fields.ts +15 -0
  52. package/app/i18n/pt/list.ts +2 -0
  53. package/app/i18n/pt-BR/fields.ts +15 -0
  54. package/app/i18n/pt-BR/list.ts +2 -0
  55. package/app/i18n/ru/fields.ts +15 -0
  56. package/app/i18n/ru/list.ts +2 -0
  57. package/app/i18n/tr/fields.ts +15 -0
  58. package/app/i18n/tr/list.ts +2 -0
  59. package/app/i18n/uk/fields.ts +15 -0
  60. package/app/i18n/uk/list.ts +2 -0
  61. package/app/i18n/zh-Hans/fields.ts +15 -0
  62. package/app/i18n/zh-Hans/list.ts +2 -0
  63. package/app/types/vector.ts +47 -8
  64. package/app/utils/countries/ar.ts +252 -0
  65. package/app/utils/countries/de.ts +252 -0
  66. package/app/utils/countries/en.ts +252 -0
  67. package/app/utils/countries/es.ts +252 -0
  68. package/app/utils/countries/fr.ts +252 -0
  69. package/app/utils/countries/he.ts +252 -0
  70. package/app/utils/countries/index.ts +44 -0
  71. package/app/utils/countries/it.ts +252 -0
  72. package/app/utils/countries/ja.ts +252 -0
  73. package/app/utils/countries/ko.ts +252 -0
  74. package/app/utils/countries/nl.ts +252 -0
  75. package/app/utils/countries/pl.ts +252 -0
  76. package/app/utils/countries/pt-BR.ts +252 -0
  77. package/app/utils/countries/pt.ts +252 -0
  78. package/app/utils/countries/ru.ts +252 -0
  79. package/app/utils/countries/tr.ts +252 -0
  80. package/app/utils/countries/uk.ts +252 -0
  81. package/app/utils/countries/zh-Hans.ts +252 -0
  82. package/app/utils/internal/repeater.ts +26 -0
  83. package/app/utils/recordLinks.ts +1 -1
  84. package/app/utils/rules.ts +7 -4
  85. package/dist/static/200.html +1 -1
  86. package/dist/static/404.html +1 -1
  87. package/dist/static/_nuxt/{CVGEoUmj.js → 1608Z87P.js} +1 -1
  88. package/dist/static/_nuxt/26EG815s.js +1 -0
  89. package/dist/static/_nuxt/{y5gvPoD3.js → 5DQbzGzQ.js} +1 -1
  90. package/dist/static/_nuxt/6LnFMZ9h.js +1 -0
  91. package/dist/static/_nuxt/{B65UlNtP.js → 81b_JWVP.js} +1 -1
  92. package/dist/static/_nuxt/951AFxTF.js +1 -0
  93. package/dist/static/_nuxt/{DDsQjoa8.js → B-3DkDEW.js} +1 -1
  94. package/dist/static/_nuxt/{BSj4WTjT.js → B-OK38pz.js} +1 -1
  95. package/dist/static/_nuxt/B4lOfJ_0.js +1 -0
  96. package/dist/static/_nuxt/{DwpSsR4l.js → B5Jt7Eqg.js} +1 -1
  97. package/dist/static/_nuxt/{CWfptrnU.js → B9JchbmS.js} +1 -1
  98. package/dist/static/_nuxt/{Dao3p0cp.js → BAH3b61H.js} +1 -1
  99. package/dist/static/_nuxt/BAkfhUIC.js +1 -0
  100. package/dist/static/_nuxt/BAz8wQLD.js +1 -0
  101. package/dist/static/_nuxt/BDoRuUKE.js +1 -0
  102. package/dist/static/_nuxt/{DOEj9Txc.js → BHK5j1Wx.js} +1 -1
  103. package/dist/static/_nuxt/{B-b861aP.js → BJ0_qGcm.js} +1 -1
  104. package/dist/static/_nuxt/BLF1JZGX.js +1 -0
  105. package/dist/static/_nuxt/BLZaIPT-.js +1 -0
  106. package/dist/static/_nuxt/BPF07eww.js +1 -0
  107. package/dist/static/_nuxt/{DGQrzV9s.js → BPXec4rF.js} +1 -1
  108. package/dist/static/_nuxt/BRKbRioI.js +1 -0
  109. package/dist/static/_nuxt/{B2rZ5lwu.js → BRRBOyND.js} +1 -1
  110. package/dist/static/_nuxt/{DHNZ4ANp.js → BTJZEoE6.js} +1 -1
  111. package/dist/static/_nuxt/{XnbMqODk.js → BU7J96HZ.js} +1 -1
  112. package/dist/static/_nuxt/{CE5HzlKJ.js → BUzE9uBK.js} +1 -1
  113. package/dist/static/_nuxt/BV8jrBHa.js +1 -0
  114. package/dist/static/_nuxt/BVtNJY11.js +1 -0
  115. package/dist/static/_nuxt/BW2cAI58.js +1 -0
  116. package/dist/static/_nuxt/{B9s6vEby.js → BXXQNvGc.js} +1 -1
  117. package/dist/static/_nuxt/{DdYMnBKs.js → B_CsPjDm.js} +1 -1
  118. package/dist/static/_nuxt/{CLJSzUt5.js → B_VpcKtj.js} +1 -1
  119. package/dist/static/_nuxt/BaztYiAl.js +1 -0
  120. package/dist/static/_nuxt/{DYPYEI74.js → BfkrLuli.js} +1 -1
  121. package/dist/static/_nuxt/{BQitPbA5.js → Bg7Wm7qC.js} +1 -1
  122. package/dist/static/_nuxt/{B8JL5gwX.js → Bk8atvdO.js} +1 -1
  123. package/dist/static/_nuxt/BklrzIIE.js +1 -0
  124. package/dist/static/_nuxt/Bl60DsIN.js +1 -0
  125. package/dist/static/_nuxt/{Clx69IQe.js → BoceWX8_.js} +1 -1
  126. package/dist/static/_nuxt/BooleanGroup.Ctn8QJv3.css +1 -0
  127. package/dist/static/_nuxt/BqdQqPGG.js +1 -0
  128. package/dist/static/_nuxt/{CFuvN8kq.js → BsHddetz.js} +1 -1
  129. package/dist/static/_nuxt/BtBn_mmM.js +1 -0
  130. package/dist/static/_nuxt/BtWvh8h-.js +1 -0
  131. package/dist/static/_nuxt/ByM6U2Qe.js +1 -0
  132. package/dist/static/_nuxt/C2ZWScju.js +1 -0
  133. package/dist/static/_nuxt/C6doA815.js +1 -0
  134. package/dist/static/_nuxt/CALBeSnc.js +1 -0
  135. package/dist/static/_nuxt/CB2gkR4K.js +1 -0
  136. package/dist/static/_nuxt/CCXHWF63.js +1 -0
  137. package/dist/static/_nuxt/CCnG_04Y.js +1 -0
  138. package/dist/static/_nuxt/CDzeC03e.js +1 -0
  139. package/dist/static/_nuxt/{BJxaGigr.js → CFgMeWCA.js} +1 -1
  140. package/dist/static/_nuxt/CG1HFqc_.js +1 -0
  141. package/dist/static/_nuxt/CGdWq8l5.js +1 -0
  142. package/dist/static/_nuxt/{CSgLLbCN.js → CJCWDpGq.js} +1 -1
  143. package/dist/static/_nuxt/{DcC5rHQt.js → CKfr82y9.js} +1 -1
  144. package/dist/static/_nuxt/CMc4sXE8.js +1 -0
  145. package/dist/static/_nuxt/CMqJrosi.js +1 -0
  146. package/dist/static/_nuxt/{CF_C4t63.js → CRKTuX5e.js} +1 -1
  147. package/dist/static/_nuxt/{tv5vSe5Y.js → CS--aGS9.js} +1 -1
  148. package/dist/static/_nuxt/{BJh6qVAK.js → CVQf7G1i.js} +1 -1
  149. package/dist/static/_nuxt/CVnTGJCS.js +1 -0
  150. package/dist/static/_nuxt/{DpWwaWd-.js → CXfD1O41.js} +12 -12
  151. package/dist/static/_nuxt/{DAXm0JlI.js → CZJzNdT8.js} +1 -1
  152. package/dist/static/_nuxt/Cdge5zAy.js +1 -0
  153. package/dist/static/_nuxt/CghQmIiQ.js +2 -0
  154. package/dist/static/_nuxt/{2u7wMpR1.js → Ci8knhX0.js} +1 -1
  155. package/dist/static/_nuxt/CjX9KrPv.js +1 -0
  156. package/dist/static/_nuxt/{Bw6FrC2B.js → CkYhLHis.js} +1 -1
  157. package/dist/static/_nuxt/{Dw7WalTb.js → CrHibPfx.js} +1 -1
  158. package/dist/static/_nuxt/CrVTXZp1.js +2 -0
  159. package/dist/static/_nuxt/CuOAA5sP.js +1 -0
  160. package/dist/static/_nuxt/{Bl4F_9Di.js → CuW09Pf9.js} +1 -1
  161. package/dist/static/_nuxt/D4MxxnmM.js +1 -0
  162. package/dist/static/_nuxt/D52PLnR1.js +1 -0
  163. package/dist/static/_nuxt/DFM4TY5F.js +1 -0
  164. package/dist/static/_nuxt/DG9iSq1o.js +1 -0
  165. package/dist/static/_nuxt/{CRAHgjs4.js → DK-FyJq0.js} +1 -1
  166. package/dist/static/_nuxt/{AbcTnLPe.js → DL-Y-SrR.js} +1 -1
  167. package/dist/static/_nuxt/DMsb54_5.js +2 -0
  168. package/dist/static/_nuxt/{CD5zJmlk.js → DPDKc2ix.js} +1 -1
  169. package/dist/static/_nuxt/DSzAMcFx.js +1 -0
  170. package/dist/static/_nuxt/DTacXreK.js +1 -0
  171. package/dist/static/_nuxt/DXCyzcMc.js +2 -0
  172. package/dist/static/_nuxt/DaThP9To.js +1 -0
  173. package/dist/static/_nuxt/{DryMzf1V.js → DoBDwz9i.js} +1 -1
  174. package/dist/static/_nuxt/{CIcNJyjb.js → Doofu92H.js} +1 -1
  175. package/dist/static/_nuxt/{SacKuioS.js → DvUd-qQE.js} +1 -1
  176. package/dist/static/_nuxt/ETG88Leh.js +1 -0
  177. package/dist/static/_nuxt/{WAarVmAq.js → IeIjl2of.js} +1 -1
  178. package/dist/static/_nuxt/MCKoiB3E.js +1 -0
  179. package/dist/static/_nuxt/{CjYmnU-l.js → NWmnUlHT.js} +1 -1
  180. package/dist/static/_nuxt/QPvezGDN.js +1 -0
  181. package/dist/static/_nuxt/QfM1ukFT.js +1 -0
  182. package/dist/static/_nuxt/RHss5Znh.js +1 -0
  183. package/dist/static/_nuxt/Repeater.Dt7fQjxv.css +1 -0
  184. package/dist/static/_nuxt/Rvt5jKoB.js +1 -0
  185. package/dist/static/_nuxt/{BowgCQje.js → UOMH3sKh.js} +1 -1
  186. package/dist/static/_nuxt/VCombobox.xsOJFBr8.css +1 -0
  187. package/dist/static/_nuxt/Yxj3clqu.js +1 -0
  188. package/dist/static/_nuxt/ZgjlRAd9.js +1 -0
  189. package/dist/static/_nuxt/{_resource_.Q2lVCG-n.css → _resource_.DiGLdv9u.css} +1 -1
  190. package/dist/static/_nuxt/builds/latest.json +1 -1
  191. package/dist/static/_nuxt/builds/meta/691bfc1d-4be7-4e21-9e24-735eb94ef678.json +1 -0
  192. package/dist/static/_nuxt/{entry.CANiyyNa.css → entry.B2UXd7Ey.css} +1 -1
  193. package/dist/static/_nuxt/{CHIGMs2v.js → jFK8N1q6.js} +1 -1
  194. package/dist/static/_nuxt/{DOq2YmIE.js → k4v9WOKm.js} +1 -1
  195. package/dist/static/_nuxt/{yIw8BzU6.js → lSAJcvgX.js} +1 -1
  196. package/dist/static/_nuxt/{B8wNbnS0.js → nJa3B-VU.js} +1 -1
  197. package/dist/static/_nuxt/{Cpel4vlt.js → sjOc3hy9.js} +1 -1
  198. package/dist/static/_nuxt/wFK8Gpv4.js +1 -0
  199. package/dist/static/_nuxt/{HdAGfEVj.js → xCL8Cexv.js} +1 -1
  200. package/dist/static/_nuxt/yks44VUO.js +1 -0
  201. package/dist/static/_nuxt/ypCgn3lo.js +1 -0
  202. package/dist/static/_nuxt/zY76lC6C.js +1 -0
  203. package/dist/static/index.html +1 -1
  204. package/dist/static/jobs/index.html +1 -1
  205. package/dist/static/login/index.html +1 -1
  206. package/dist/static/queues/index.html +1 -1
  207. package/dist/static/settings/index.html +1 -1
  208. package/dist/static/vector-bundle.json +125 -92
  209. package/package.json +1 -1
  210. package/app/components/Vx/Cell/Enum.vue +0 -14
  211. package/app/components/Vx/Input/Enum.vue +0 -21
  212. package/dist/static/_nuxt/-ksGenLl.js +0 -1
  213. package/dist/static/_nuxt/0Q9tQaGZ.js +0 -1
  214. package/dist/static/_nuxt/7hLwEPpo.js +0 -1
  215. package/dist/static/_nuxt/B4hfz7cN.js +0 -1
  216. package/dist/static/_nuxt/BE6e_jlD.js +0 -1
  217. package/dist/static/_nuxt/BFZfZyte.js +0 -1
  218. package/dist/static/_nuxt/BW9qBvMR.js +0 -1
  219. package/dist/static/_nuxt/BWscDCZb.js +0 -1
  220. package/dist/static/_nuxt/BXnWvqRw.js +0 -1
  221. package/dist/static/_nuxt/BcSEGymu.js +0 -2
  222. package/dist/static/_nuxt/Bj-QksVr.js +0 -2
  223. package/dist/static/_nuxt/BuTE4a2w.js +0 -1
  224. package/dist/static/_nuxt/C1y0neXX.js +0 -1
  225. package/dist/static/_nuxt/C52FYB-5.js +0 -1
  226. package/dist/static/_nuxt/CAXk9Oc1.js +0 -1
  227. package/dist/static/_nuxt/CQvUQgZO.js +0 -2
  228. package/dist/static/_nuxt/CXSf4TOH.js +0 -1
  229. package/dist/static/_nuxt/Cf2NM87n.js +0 -1
  230. package/dist/static/_nuxt/D3cIKCPa.js +0 -1
  231. package/dist/static/_nuxt/D3jC5ZAK.js +0 -1
  232. package/dist/static/_nuxt/D3xofh1k.js +0 -1
  233. package/dist/static/_nuxt/DOxWca9k.js +0 -1
  234. package/dist/static/_nuxt/DllQuWrz.js +0 -1
  235. package/dist/static/_nuxt/DvEvjhbF.js +0 -1
  236. package/dist/static/_nuxt/FfebEZGy.js +0 -1
  237. package/dist/static/_nuxt/PqTF-5Vs.js +0 -1
  238. package/dist/static/_nuxt/Repeater.CLIPcHKX.css +0 -1
  239. package/dist/static/_nuxt/bNqxxQg2.js +0 -1
  240. package/dist/static/_nuxt/builds/meta/f78103ad-2489-4aee-b300-160bb1a81e35.json +0 -1
  241. package/dist/static/_nuxt/rYfJ_RlJ.js +0 -1
@@ -77,6 +77,62 @@ function newId(): string {
77
77
  return crypto.randomUUID()
78
78
  }
79
79
 
80
+ /** A proposal's card, pending, with the record as the run read it, when it did. */
81
+ function card(frame: ApprovalFrame, reads: RunReads | null): ApprovalCard {
82
+ const before = frame.resource !== null && frame.recordId !== null ? reads?.records.get(`${frame.resource}#${frame.recordId}`) ?? null : null
83
+ return { frame, before, state: 'pending', result: null, error: null }
84
+ }
85
+
86
+ /**
87
+ * Applies a frame of a tool call (its start, its input as it streams,
88
+ * its output or its error) to the reply and the run's reads; false when
89
+ * $frame is none of those, or lacks what it needs.
90
+ */
91
+ function applyToolFrame(reply: AssistantTurn, frame: DataStreamFrame, reads: RunReads, callId: string | null): boolean {
92
+ if (frame.type === 'tool-input-start' && typeof frame.toolName === 'string') {
93
+ reply.tools.push({ id: callId, name: frame.toolName, ok: null })
94
+ if (callId !== null) reads.calls.set(callId, { tool: frame.toolName, input: '' })
95
+ return true
96
+ }
97
+ if (frame.type === 'tool-input-delta' && callId !== null && typeof frame.inputTextDelta === 'string') {
98
+ const call = reads.calls.get(callId)
99
+ if (call) call.input += frame.inputTextDelta
100
+ return true
101
+ }
102
+ if (frame.type === 'tool-output-available' && callId !== null) {
103
+ settle(reply, callId, true)
104
+ remember(reads, callId, frame.output)
105
+ return true
106
+ }
107
+ if (frame.type === 'tool-output-error' && callId !== null) {
108
+ settle(reply, callId, false)
109
+ return true
110
+ }
111
+ return false
112
+ }
113
+
114
+ /** Whether call $callId of the reply answered ($ok), or was a tool error. */
115
+ function settle(reply: AssistantTurn, callId: string, ok: boolean) {
116
+ const call = reply.tools.find(tool => tool.id === callId)
117
+ if (call) call.ok = ok
118
+ }
119
+
120
+ /** What a `vector_get` of the run read, by `resource#id`, for a later proposal's "before". */
121
+ function remember(reads: RunReads, callId: string, output: unknown) {
122
+ const call = reads.calls.get(callId)
123
+ if (call?.tool !== 'vector_get') return
124
+ let input: { resource?: unknown, id?: unknown }
125
+ try {
126
+ input = JSON.parse(call.input) as { resource?: unknown, id?: unknown }
127
+ } catch {
128
+ return
129
+ }
130
+ const record = recordOfToolOutput(output)
131
+ if (record !== null && typeof input.resource === 'string' && (typeof input.id === 'string' || typeof input.id === 'number')) {
132
+ reads.records.set(`${input.resource}#${input.id}`, record)
133
+ }
134
+ }
135
+
80
136
  /**
81
137
  * The assistant's conversation: the browser's own, replayed to POST
82
138
  * /vector/ai/assistant on every turn (the user's and the assistant's text
@@ -113,51 +169,19 @@ export function useVectorAssistant() {
113
169
  : { role: turn.role, content: turn.content.trim() === '' ? PROPOSED_ONLY : turn.content })
114
170
  }
115
171
 
116
- function card(frame: ApprovalFrame, reads: RunReads | null): ApprovalCard {
117
- const before = frame.resource !== null && frame.recordId !== null ? reads?.records.get(`${frame.resource}#${frame.recordId}`) ?? null : null
118
- return { frame, before, state: 'pending', result: null, error: null }
119
- }
120
-
121
172
  function apply(reply: AssistantTurn, frame: DataStreamFrame, reads: RunReads) {
122
173
  const callId = typeof frame.toolCallId === 'string' ? frame.toolCallId : null
123
- if (frame.type === 'text-delta' && typeof frame.delta === 'string') reply.content += frame.delta
124
- else if (frame.type === 'tool-input-start' && typeof frame.toolName === 'string') {
125
- reply.tools.push({ id: callId, name: frame.toolName, ok: null })
126
- if (callId !== null) reads.calls.set(callId, { tool: frame.toolName, input: '' })
127
- } else if (frame.type === 'tool-input-delta' && callId !== null && typeof frame.inputTextDelta === 'string') {
128
- const call = reads.calls.get(callId)
129
- if (call) call.input += frame.inputTextDelta
130
- } else if (frame.type === 'tool-output-available' && callId !== null) {
131
- settle(reply, callId, true)
132
- remember(reads, callId, frame.output)
133
- } else if (frame.type === 'tool-output-error' && callId !== null) settle(reply, callId, false)
134
- else if (frame.type === 'error') reply.failed = typeof frame.errorText === 'string' ? frame.errorText : t('ai.assistant.failed')
135
- else {
136
- const approval = approvalFrame(frame)
137
- if (approval !== null) reply.approvals.push(card(approval, reads))
138
- }
139
- }
140
-
141
- /** Whether call $callId of the reply answered ($ok), or was a tool error. */
142
- function settle(reply: AssistantTurn, callId: string, ok: boolean) {
143
- const call = reply.tools.find(tool => tool.id === callId)
144
- if (call) call.ok = ok
145
- }
146
-
147
- /** What a `vector_get` of the run read, by `resource#id`, for a later proposal's "before". */
148
- function remember(reads: RunReads, callId: string, output: unknown) {
149
- const call = reads.calls.get(callId)
150
- if (call?.tool !== 'vector_get') return
151
- let input: { resource?: unknown, id?: unknown }
152
- try {
153
- input = JSON.parse(call.input) as { resource?: unknown, id?: unknown }
154
- } catch {
174
+ if (frame.type === 'text-delta' && typeof frame.delta === 'string') {
175
+ reply.content += frame.delta
155
176
  return
156
177
  }
157
- const record = recordOfToolOutput(output)
158
- if (record !== null && typeof input.resource === 'string' && (typeof input.id === 'string' || typeof input.id === 'number')) {
159
- reads.records.set(`${input.resource}#${input.id}`, record)
178
+ if (applyToolFrame(reply, frame, reads, callId)) return
179
+ if (frame.type === 'error') {
180
+ reply.failed = typeof frame.errorText === 'string' ? frame.errorText : t('ai.assistant.failed')
181
+ return
160
182
  }
183
+ const approval = approvalFrame(frame)
184
+ if (approval !== null) reply.approvals.push(card(approval, reads))
161
185
  }
162
186
 
163
187
  async function run() {
@@ -0,0 +1,38 @@
1
+ import type { Ref } from 'vue'
2
+ import type { VectorField } from '#vector/app/types/vector'
3
+ import { loadCountryNames } from '#vector/app/utils/countries'
4
+
5
+ // The static names never change, so one load per locale serves every component.
6
+ const loaded = new Map<string, Record<string, string>>()
7
+
8
+ /**
9
+ * The country names of the UI's language, keyed by ISO 3166-1 alpha-2
10
+ * code, empty until they load; follows a change of language.
11
+ */
12
+ export function useVectorCountryNames(): Ref<Record<string, string>> {
13
+ const { locale } = useVectorT()
14
+ const names = ref<Record<string, string>>(loaded.get(locale.value) ?? {})
15
+
16
+ watch(locale, async (code) => {
17
+ let found = loaded.get(code)
18
+ if (found === undefined) {
19
+ // A chunk that fails to load leaves the names as they are (the
20
+ // server's English labels until a load succeeds), and the next
21
+ // change of language tries again.
22
+ try {
23
+ found = await loadCountryNames(code)
24
+ } catch {
25
+ return
26
+ }
27
+ }
28
+ loaded.set(code, found)
29
+ if (locale.value === code) names.value = found
30
+ }, { immediate: true })
31
+
32
+ return names
33
+ }
34
+
35
+ /** A country field with each option named in the UI's language, or by the server's English name until the names load. */
36
+ export function withCountryNames(field: VectorField, names: Record<string, string>): VectorField {
37
+ return { ...field, options: (field.options ?? []).map(option => ({ ...option, label: names[String(option.value)] ?? option.label })) }
38
+ }
@@ -20,7 +20,9 @@ const cells: Record<string, Component> = {
20
20
  number: defineAsyncComponent(() => import('#vector/app/components/Vx/Cell/Number.vue')),
21
21
  money: defineAsyncComponent(() => import('#vector/app/components/Vx/Cell/Money.vue')),
22
22
  boolean: defineAsyncComponent(() => import('#vector/app/components/Vx/Cell/Boolean.vue')),
23
- enum: defineAsyncComponent(() => import('#vector/app/components/Vx/Cell/Enum.vue')),
23
+ select: defineAsyncComponent(() => import('#vector/app/components/Vx/Cell/Select.vue')),
24
+ country: defineAsyncComponent(() => import('#vector/app/components/Vx/Cell/Country.vue')),
25
+ booleanGroup: defineAsyncComponent(() => import('#vector/app/components/Vx/Cell/BooleanGroup.vue')),
24
26
  date: defineAsyncComponent(() => import('#vector/app/components/Vx/Cell/Date.vue')),
25
27
  datetime: defineAsyncComponent(() => import('#vector/app/components/Vx/Cell/DateTime.vue')),
26
28
  email: defineAsyncComponent(() => import('#vector/app/components/Vx/Cell/Email.vue')),
@@ -36,6 +38,8 @@ const cells: Record<string, Component> = {
36
38
  hasOne: defineAsyncComponent(() => import('#vector/app/components/Vx/Cell/Relation.vue')),
37
39
  hasMany: defineAsyncComponent(() => import('#vector/app/components/Vx/Cell/Count.vue')),
38
40
  manyToMany: defineAsyncComponent(() => import('#vector/app/components/Vx/Cell/Count.vue')),
41
+ repeater: defineAsyncComponent(() => import('#vector/app/components/Vx/Cell/Repeater.vue')),
42
+ tag: defineAsyncComponent(() => import('#vector/app/components/Vx/Cell/Tag.vue')),
39
43
  }
40
44
 
41
45
  /** The cell type a computed field is shown as: what it is computed as, text as a string. */
@@ -3,18 +3,42 @@ import { violationsOf } from '#vector/app/utils/internal/violations'
3
3
 
4
4
  /** The value a fresh input holds: the field's default, or the type's empty value. */
5
5
  export function initialValue(field: VectorField): unknown {
6
+ if (field.type === 'booleanGroup') return flagsStart(field, true)
6
7
  if (field.hasDefault) return field.default
7
8
  if (field.type === 'boolean') return false
8
9
  if (field.type === 'manyToMany') return []
10
+ if (field.type === 'tag' || field.type === 'repeater') return []
9
11
  return null
10
12
  }
11
13
 
14
+ /**
15
+ * What a flag group starts with: every option key false, with the keys a
16
+ * declared default names over them ($withDefault), so a form with no box
17
+ * ticked still sends every flag. A nullable group (one JSON column that
18
+ * may hold null) without a default starts empty instead, as null.
19
+ */
20
+ export function flagsStart(field: VectorField, withDefault: boolean): Record<string, boolean> | null {
21
+ const declared = withDefault && field.hasDefault ? field.default : undefined
22
+
23
+ if ((declared === undefined || declared === null) && field.nullable === true) return null
24
+
25
+ const flags: Record<string, boolean> = Object.fromEntries((field.options ?? []).map(option => [String(option.value), false]))
26
+
27
+ if (declared !== null && typeof declared === 'object' && !Array.isArray(declared)) {
28
+ for (const [key, on] of Object.entries(declared)) {
29
+ if (key in flags) flags[key] = on === true
30
+ }
31
+ }
32
+
33
+ return flags
34
+ }
35
+
12
36
  /**
13
37
  * Maps the framework's 422 document onto field names; returns the
14
38
  * message that names no field, if any. A violation deeper in a value
15
- * (`tags.2`) shows on its field: the loose field lists this serves
16
- * (settings, bulk edit, action dialogs) hold no repeater, the one input
17
- * that takes a deeper key (`Vx/Resource/Form.vue` maps those).
39
+ * (`tags.2`, or a JSON repeater's `specs.1.label` in bulk edit) shows on
40
+ * its field as a whole: only `Vx/Resource/Form.vue` maps a repeater's
41
+ * row errors onto their row.
18
42
  */
19
43
  export function applyViolations(error: unknown, values: Record<string, unknown>, serverErrors: Record<string, string[]>): string | null {
20
44
  const failure = error as { status?: number, statusCode?: number, data?: { errors?: unknown } } | null
@@ -18,24 +18,26 @@ const inputs: Record<string, Component> = {
18
18
  text: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Textarea.vue')),
19
19
  markdown: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Markdown.vue')),
20
20
  richtext: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/RichText.vue')),
21
- json: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Textarea.vue')),
21
+ json: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Json.vue')),
22
22
  keyValue: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/KeyValue.vue')),
23
23
  number: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Number.vue')),
24
24
  money: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Money.vue')),
25
25
  boolean: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Boolean.vue')),
26
- enum: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Enum.vue')),
26
+ select: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Select.vue')),
27
+ country: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Country.vue')),
28
+ booleanGroup: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/BooleanGroup.vue')),
27
29
  currency: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Currency.vue')),
28
30
  date: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/DateTime.vue')),
29
31
  datetime: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/DateTime.vue')),
30
32
  belongsTo: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Relation.vue')),
31
33
  manyToMany: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Relation.vue')),
32
- hasMany: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Repeater.vue')),
34
+ repeater: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Repeater.vue')),
35
+ tag: defineAsyncComponent(() => import('#vector/app/components/Vx/Input/Tag.vue')),
33
36
  }
34
37
 
35
38
  /** Whether a field is edited in this operation at all. */
36
39
  function editable(field: VectorField, operation: 'create' | 'update'): boolean {
37
- if (field.type === 'hasMany') return !!field.repeater && field.views.includes(operation)
38
- return !field.readonly && field.views.includes(operation) && !['id', 'hasOne'].includes(field.type)
40
+ return !field.readonly && field.views.includes(operation) && !['id', 'hasOne', 'hasMany'].includes(field.type)
39
41
  }
40
42
 
41
43
  export function useVectorInputs() {
@@ -3,6 +3,9 @@ export default {
3
3
  cell: {
4
4
  loading: 'جارٍ تحميل {label}',
5
5
  },
6
+ json: {
7
+ invalid: 'يُرجى إدخال كائن JSON أو مصفوفة JSON صالحة.',
8
+ },
6
9
  keyValue: {
7
10
  key: 'المفتاح',
8
11
  value: 'القيمة',
@@ -74,4 +77,16 @@ export default {
74
77
  invalidFormat: 'تنسيق غير صالح',
75
78
  notAllowed: 'قيمة غير مسموح بها',
76
79
  },
80
+ rows: {
81
+ add: 'إضافة صف',
82
+ remove: 'إزالة الصف {n}',
83
+ row: 'الصف {n}',
84
+ drag: 'نقل الصف {n}: اسحبه أو استخدم مفاتيح الأسهم',
85
+ moved: 'نُقل الصف {from} إلى الموضع {to}',
86
+ none: 'لا توجد صفوف',
87
+ },
88
+ tags: {
89
+ hint: 'اكتب وسمًا واضغط Enter',
90
+ tooMany: '{max} وسمًا كحد أقصى',
91
+ },
77
92
  }
@@ -104,6 +104,8 @@ export default {
104
104
  like: 'يحتوي على',
105
105
  nlike: 'لا يحتوي على',
106
106
  between: 'بين',
107
+ any: 'يتضمن أيًّا من',
108
+ all: 'يتضمن كلًّا من',
107
109
  null: 'فارغ',
108
110
  nnull: 'غير فارغ',
109
111
  },
@@ -3,6 +3,9 @@ export default {
3
3
  cell: {
4
4
  loading: '{label} wird geladen',
5
5
  },
6
+ json: {
7
+ invalid: 'Geben Sie ein gültiges JSON-Objekt oder -Array ein.',
8
+ },
6
9
  keyValue: {
7
10
  key: 'Schlüssel',
8
11
  value: 'Wert',
@@ -74,4 +77,16 @@ export default {
74
77
  invalidFormat: 'Ungültiges Format',
75
78
  notAllowed: 'Kein zulässiger Wert',
76
79
  },
80
+ rows: {
81
+ add: 'Zeile hinzufügen',
82
+ remove: 'Zeile {n} entfernen',
83
+ row: 'Zeile {n}',
84
+ drag: 'Zeile {n} verschieben: ziehen oder die Pfeiltasten verwenden',
85
+ moved: 'Zeile {from} an Position {to} verschoben',
86
+ none: 'Keine Zeilen',
87
+ },
88
+ tags: {
89
+ hint: 'Schlagwort eingeben und Enter drücken',
90
+ tooMany: 'Höchstens {max} Schlagwörter',
91
+ },
77
92
  }
@@ -104,6 +104,8 @@ export default {
104
104
  like: 'enthält',
105
105
  nlike: 'enthält nicht',
106
106
  between: 'liegt zwischen',
107
+ any: 'enthält eines von',
108
+ all: 'enthält alle von',
107
109
  null: 'ist leer',
108
110
  nnull: 'ist nicht leer',
109
111
  },
@@ -3,6 +3,9 @@ export default {
3
3
  cell: {
4
4
  loading: 'Loading {label}',
5
5
  },
6
+ json: {
7
+ invalid: 'Enter a valid JSON object or array.',
8
+ },
6
9
  keyValue: {
7
10
  key: 'Key',
8
11
  value: 'Value',
@@ -74,4 +77,16 @@ export default {
74
77
  invalidFormat: 'Invalid format',
75
78
  notAllowed: 'Not an allowed value',
76
79
  },
80
+ rows: {
81
+ add: 'Add row',
82
+ remove: 'Remove row {n}',
83
+ row: 'Row {n}',
84
+ drag: 'Move row {n}: drag it, or use the arrow keys',
85
+ moved: 'Row {from} moved to position {to}',
86
+ none: 'No rows',
87
+ },
88
+ tags: {
89
+ hint: 'Type a tag and press Enter',
90
+ tooMany: 'At most {max} tags',
91
+ },
77
92
  }
@@ -104,6 +104,8 @@ export default {
104
104
  like: 'contains',
105
105
  nlike: 'does not contain',
106
106
  between: 'is between',
107
+ any: 'has any of',
108
+ all: 'has all of',
107
109
  null: 'is empty',
108
110
  nnull: 'is not empty',
109
111
  },
@@ -3,6 +3,9 @@ export default {
3
3
  cell: {
4
4
  loading: 'Cargando {label}',
5
5
  },
6
+ json: {
7
+ invalid: 'Introduzca un objeto o una matriz JSON válidos.',
8
+ },
6
9
  keyValue: {
7
10
  key: 'Clave',
8
11
  value: 'Valor',
@@ -74,4 +77,16 @@ export default {
74
77
  invalidFormat: 'Formato no válido',
75
78
  notAllowed: 'Valor no permitido',
76
79
  },
80
+ rows: {
81
+ add: 'Añadir fila',
82
+ remove: 'Quitar la fila {n}',
83
+ row: 'Fila {n}',
84
+ drag: 'Mover la fila {n}: arrástrela o use las flechas del teclado',
85
+ moved: 'Fila {from} movida a la posición {to}',
86
+ none: 'Sin filas',
87
+ },
88
+ tags: {
89
+ hint: 'Escriba una etiqueta y pulse Intro',
90
+ tooMany: 'Como máximo {max} etiquetas',
91
+ },
77
92
  }
@@ -104,6 +104,8 @@ export default {
104
104
  like: 'contiene',
105
105
  nlike: 'no contiene',
106
106
  between: 'está entre',
107
+ any: 'incluye alguno de',
108
+ all: 'incluye todos',
107
109
  null: 'está vacío',
108
110
  nnull: 'no está vacío',
109
111
  },
@@ -3,6 +3,9 @@ export default {
3
3
  cell: {
4
4
  loading: 'Chargement de {label}',
5
5
  },
6
+ json: {
7
+ invalid: 'Saisissez un objet ou un tableau JSON valide.',
8
+ },
6
9
  keyValue: {
7
10
  key: 'Clé',
8
11
  value: 'Valeur',
@@ -74,4 +77,16 @@ export default {
74
77
  invalidFormat: 'Format non valide',
75
78
  notAllowed: 'Valeur non autorisée',
76
79
  },
80
+ rows: {
81
+ add: 'Ajouter une ligne',
82
+ remove: 'Supprimer la ligne {n}',
83
+ row: 'Ligne {n}',
84
+ drag: 'Déplacer la ligne {n} : faites-la glisser ou utilisez les flèches',
85
+ moved: 'Ligne {from} déplacée en position {to}',
86
+ none: 'Aucune ligne',
87
+ },
88
+ tags: {
89
+ hint: 'Saisissez un mot-clé et appuyez sur Entrée',
90
+ tooMany: '{max} mots-clés au maximum',
91
+ },
77
92
  }
@@ -104,6 +104,8 @@ export default {
104
104
  like: 'contient',
105
105
  nlike: 'ne contient pas',
106
106
  between: 'est entre',
107
+ any: 'contient l’un de',
108
+ all: 'contient tous',
107
109
  null: 'est vide',
108
110
  nnull: 'n’est pas vide',
109
111
  },
@@ -3,6 +3,9 @@ export default {
3
3
  cell: {
4
4
  loading: 'טוען את {label}',
5
5
  },
6
+ json: {
7
+ invalid: 'יש להזין אובייקט JSON או מערך JSON תקינים.',
8
+ },
6
9
  keyValue: {
7
10
  key: 'מפתח',
8
11
  value: 'ערך',
@@ -74,4 +77,16 @@ export default {
74
77
  invalidFormat: 'תבנית לא תקינה',
75
78
  notAllowed: 'ערך לא מותר',
76
79
  },
80
+ rows: {
81
+ add: 'הוספת שורה',
82
+ remove: 'הסרת שורה {n}',
83
+ row: 'שורה {n}',
84
+ drag: 'הזזת שורה {n}: יש לגרור אותה או להשתמש במקשי החצים',
85
+ moved: 'שורה {from} הועברה למקום {to}',
86
+ none: 'אין שורות',
87
+ },
88
+ tags: {
89
+ hint: 'יש להקליד תגית וללחוץ Enter',
90
+ tooMany: '{max} תגיות לכל היותר',
91
+ },
77
92
  }
@@ -104,6 +104,8 @@ export default {
104
104
  like: 'מכיל',
105
105
  nlike: 'אינו מכיל',
106
106
  between: 'בין',
107
+ any: 'כולל אחד מתוך',
108
+ all: 'כולל את כל',
107
109
  null: 'ריק',
108
110
  nnull: 'אינו ריק',
109
111
  },
@@ -3,6 +3,9 @@ export default {
3
3
  cell: {
4
4
  loading: 'Caricamento di {label}',
5
5
  },
6
+ json: {
7
+ invalid: 'Inserisci un oggetto o un array JSON valido.',
8
+ },
6
9
  keyValue: {
7
10
  key: 'Chiave',
8
11
  value: 'Valore',
@@ -74,4 +77,16 @@ export default {
74
77
  invalidFormat: 'Formato non valido',
75
78
  notAllowed: 'Valore non consentito',
76
79
  },
80
+ rows: {
81
+ add: 'Aggiungi riga',
82
+ remove: 'Rimuovi la riga {n}',
83
+ row: 'Riga {n}',
84
+ drag: 'Sposta la riga {n}: trascinala o usa i tasti freccia',
85
+ moved: 'Riga {from} spostata in posizione {to}',
86
+ none: 'Nessuna riga',
87
+ },
88
+ tags: {
89
+ hint: 'Digita un tag e premi Invio',
90
+ tooMany: 'Al massimo {max} tag',
91
+ },
77
92
  }
@@ -104,6 +104,8 @@ export default {
104
104
  like: 'contiene',
105
105
  nlike: 'non contiene',
106
106
  between: 'è compreso tra',
107
+ any: 'include uno di',
108
+ all: 'include tutti',
107
109
  null: 'è vuoto',
108
110
  nnull: 'non è vuoto',
109
111
  },
@@ -3,6 +3,9 @@ export default {
3
3
  cell: {
4
4
  loading: '{label} を読み込み中',
5
5
  },
6
+ json: {
7
+ invalid: '有効な JSON オブジェクトまたは配列を入力してください。',
8
+ },
6
9
  keyValue: {
7
10
  key: 'キー',
8
11
  value: '値',
@@ -74,4 +77,16 @@ export default {
74
77
  invalidFormat: '形式が正しくありません',
75
78
  notAllowed: '許可されていない値です',
76
79
  },
80
+ rows: {
81
+ add: '行を追加',
82
+ remove: '行 {n} を削除',
83
+ row: '行 {n}',
84
+ drag: '行 {n} を移動: ドラッグするか矢印キーを使用',
85
+ moved: '行 {from} を位置 {to} に移動しました',
86
+ none: '行がありません',
87
+ },
88
+ tags: {
89
+ hint: 'タグを入力して Enter を押してください',
90
+ tooMany: 'タグは最大 {max} 個まで',
91
+ },
77
92
  }
@@ -104,6 +104,8 @@ export default {
104
104
  like: '含む',
105
105
  nlike: '含まない',
106
106
  between: '範囲内',
107
+ any: 'いずれかを含む',
108
+ all: 'すべてを含む',
107
109
  null: '空',
108
110
  nnull: '空ではない',
109
111
  },
@@ -3,6 +3,9 @@ export default {
3
3
  cell: {
4
4
  loading: '{label} 불러오는 중',
5
5
  },
6
+ json: {
7
+ invalid: '올바른 JSON 객체 또는 배열을 입력하세요.',
8
+ },
6
9
  keyValue: {
7
10
  key: '키',
8
11
  value: '값',
@@ -74,4 +77,16 @@ export default {
74
77
  invalidFormat: '잘못된 형식',
75
78
  notAllowed: '허용되지 않는 값',
76
79
  },
80
+ rows: {
81
+ add: '행 추가',
82
+ remove: '{n}행 제거',
83
+ row: '{n}행',
84
+ drag: '{n}행 이동: 끌어 놓거나 화살표 키를 사용하세요',
85
+ moved: '{from}행을 {to}번째 위치로 옮겼습니다',
86
+ none: '행이 없습니다',
87
+ },
88
+ tags: {
89
+ hint: '태그를 입력하고 Enter 키를 누르세요',
90
+ tooMany: '태그는 최대 {max}개',
91
+ },
77
92
  }
@@ -104,6 +104,8 @@ export default {
104
104
  like: '포함',
105
105
  nlike: '포함하지 않음',
106
106
  between: '범위 내',
107
+ any: '다음 중 하나를 포함',
108
+ all: '다음을 모두 포함',
107
109
  null: '비어 있음',
108
110
  nnull: '비어 있지 않음',
109
111
  },
@@ -3,6 +3,9 @@ export default {
3
3
  cell: {
4
4
  loading: '{label} laden',
5
5
  },
6
+ json: {
7
+ invalid: 'Voer een geldig JSON-object of -array in.',
8
+ },
6
9
  keyValue: {
7
10
  key: 'Sleutel',
8
11
  value: 'Waarde',
@@ -74,4 +77,16 @@ export default {
74
77
  invalidFormat: 'Ongeldige notatie',
75
78
  notAllowed: 'Geen toegestane waarde',
76
79
  },
80
+ rows: {
81
+ add: 'Rij toevoegen',
82
+ remove: 'Rij {n} verwijderen',
83
+ row: 'Rij {n}',
84
+ drag: 'Rij {n} verplaatsen: sleep de rij of gebruik de pijltjestoetsen',
85
+ moved: 'Rij {from} verplaatst naar positie {to}',
86
+ none: 'Geen rijen',
87
+ },
88
+ tags: {
89
+ hint: 'Typ een tag en druk op Enter',
90
+ tooMany: 'Hoogstens {max} tags',
91
+ },
77
92
  }
@@ -104,6 +104,8 @@ export default {
104
104
  like: 'bevat',
105
105
  nlike: 'bevat niet',
106
106
  between: 'ligt tussen',
107
+ any: 'bevat een van',
108
+ all: 'bevat alle',
107
109
  null: 'is leeg',
108
110
  nnull: 'is niet leeg',
109
111
  },