@blokkli/editor 2.0.0-alpha.35 → 2.0.0-alpha.37

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 (320) hide show
  1. package/dist/global/types/blockOptions.d.ts +10 -2
  2. package/dist/global/types/definitions.d.ts +12 -5
  3. package/dist/module.d.mts +2 -2
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +126 -7
  6. package/dist/modules/agent/index.d.mts +1 -1
  7. package/dist/modules/agent/index.mjs +273 -25
  8. package/dist/modules/agent/runtime/app/composables/agentProvider.d.ts +2 -2
  9. package/dist/modules/agent/runtime/app/composables/agentProvider.js +34 -17
  10. package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentTool.d.ts +2 -20
  11. package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentTool.js +0 -3
  12. package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Assistant/index.vue +2 -2
  13. package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/User/index.vue +1 -2
  14. package/dist/modules/agent/runtime/app/features/agent/Panel/DebugGallery/index.vue +1 -2
  15. package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.d.vue.ts +1 -0
  16. package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue +67 -86
  17. package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue.d.ts +1 -0
  18. package/dist/modules/agent/runtime/app/features/agent/Panel/Input/index.vue +10 -12
  19. package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/de.md +2 -2
  20. package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/en.md +2 -2
  21. package/dist/modules/agent/runtime/app/features/agent/Panel/index.vue +1 -5
  22. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.d.vue.ts +8 -0
  23. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue +138 -0
  24. package/dist/modules/agent/runtime/app/features/agent/Transcript/index.vue.d.ts +8 -0
  25. package/dist/modules/agent/runtime/app/features/agent/index.vue +94 -38
  26. package/dist/modules/agent/runtime/app/helpers/index.d.ts +16 -19
  27. package/dist/modules/agent/runtime/app/helpers/index.js +22 -46
  28. package/dist/modules/agent/runtime/app/helpers/pageStructure.js +1 -1
  29. package/dist/modules/agent/runtime/app/tools/add_content_search_paragraph/index.js +5 -9
  30. package/dist/modules/agent/runtime/app/tools/add_fragment/index.js +2 -6
  31. package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.js +2 -6
  32. package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.js +2 -3
  33. package/dist/modules/agent/runtime/app/tools/add_reusable_paragraph/index.js +2 -6
  34. package/dist/modules/agent/runtime/app/tools/add_template/index.js +2 -6
  35. package/dist/modules/agent/runtime/app/tools/analyze_content/index.js +120 -0
  36. package/dist/modules/agent/runtime/app/tools/check_readability/index.d.ts +2 -0
  37. package/dist/modules/agent/runtime/app/tools/check_readability/index.js +57 -0
  38. package/dist/modules/agent/runtime/app/tools/duplicate_paragraphs/index.js +2 -6
  39. package/dist/modules/agent/runtime/app/tools/get_all_page_content/index.js +1 -1
  40. package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.d.ts +2 -0
  41. package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.js +176 -0
  42. package/dist/modules/agent/runtime/app/tools/get_content_fields/index.js +1 -1
  43. package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.js +7 -5
  44. package/dist/modules/agent/runtime/app/tools/get_paragraph_options/index.js +2 -1
  45. package/dist/modules/agent/runtime/app/tools/get_selected_paragraphs/index.js +2 -3
  46. package/dist/modules/agent/runtime/app/tools/helpers.d.ts +53 -0
  47. package/dist/modules/agent/runtime/app/tools/helpers.js +187 -0
  48. package/dist/modules/agent/runtime/app/tools/move_paragraphs/index.js +2 -6
  49. package/dist/modules/agent/runtime/app/tools/schemas.d.ts +1 -44
  50. package/dist/modules/agent/runtime/app/tools/schemas.js +0 -174
  51. package/dist/modules/agent/runtime/app/tools/search_content/index.js +40 -47
  52. package/dist/modules/agent/runtime/app/tools/set_paragraph_options/index.js +2 -5
  53. package/dist/modules/agent/runtime/app/types/index.d.ts +0 -61
  54. package/dist/modules/agent/runtime/server/Session.d.ts +29 -8
  55. package/dist/modules/agent/runtime/server/Session.js +168 -85
  56. package/dist/modules/agent/runtime/server/SessionManager.d.ts +3 -0
  57. package/dist/modules/agent/runtime/server/SessionManager.js +4 -1
  58. package/dist/modules/agent/runtime/server/agent.js +3 -2
  59. package/dist/modules/agent/runtime/server/agentPrompt.d.ts +9 -1
  60. package/dist/modules/agent/runtime/server/agentPrompt.js +26 -0
  61. package/dist/modules/agent/runtime/server/default-skills/fixReadability.d.ts +2 -0
  62. package/dist/modules/agent/runtime/server/default-skills/fixReadability.js +69 -0
  63. package/dist/modules/agent/runtime/server/default-system-prompts/page-context.js +28 -0
  64. package/dist/modules/agent/runtime/server/server-tools/index.d.ts +10 -2
  65. package/dist/modules/agent/runtime/server/server-tools/index.js +1 -1
  66. package/dist/modules/agent/runtime/server/server-tools/load_tools/index.js +1 -1
  67. package/dist/modules/agent/runtime/shared/types.d.ts +81 -12
  68. package/dist/modules/agent/runtime/shared/types.js +22 -10
  69. package/dist/modules/charts/index.d.mts +35 -0
  70. package/dist/modules/charts/index.mjs +57 -0
  71. package/dist/modules/charts/runtime/blokkli/skills/charts.d.ts +2 -0
  72. package/dist/modules/charts/runtime/blokkli/skills/charts.js +42 -0
  73. package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.d.ts +86 -0
  74. package/dist/modules/charts/runtime/blokkli/tools/chart_schemas.js +136 -0
  75. package/dist/modules/charts/runtime/blokkli/tools/create_chart/index.d.ts +2 -0
  76. package/dist/modules/charts/runtime/blokkli/tools/create_chart/index.js +93 -0
  77. package/dist/modules/charts/runtime/blokkli/tools/get_chart_data/index.d.ts +2 -0
  78. package/dist/modules/charts/runtime/blokkli/tools/get_chart_data/index.js +66 -0
  79. package/dist/modules/charts/runtime/blokkli/tools/get_chart_type_options/index.d.ts +2 -0
  80. package/dist/modules/charts/runtime/blokkli/tools/get_chart_type_options/index.js +40 -0
  81. package/dist/modules/charts/runtime/blokkli/tools/update_chart/index.d.ts +2 -0
  82. package/dist/modules/charts/runtime/blokkli/tools/update_chart/index.js +89 -0
  83. package/dist/modules/charts/runtime/chartTypes/area.d.ts +7 -0
  84. package/dist/modules/charts/runtime/chartTypes/area.js +68 -0
  85. package/dist/modules/charts/runtime/chartTypes/bar.d.ts +8 -0
  86. package/dist/modules/charts/runtime/chartTypes/bar.js +76 -0
  87. package/dist/modules/charts/runtime/chartTypes/define.d.ts +2 -0
  88. package/dist/modules/charts/runtime/chartTypes/define.js +3 -0
  89. package/dist/modules/charts/runtime/chartTypes/donut.d.ts +6 -0
  90. package/dist/modules/charts/runtime/chartTypes/donut.js +45 -0
  91. package/dist/modules/charts/runtime/chartTypes/heatmap.d.ts +4 -0
  92. package/dist/modules/charts/runtime/chartTypes/heatmap.js +54 -0
  93. package/dist/modules/charts/runtime/chartTypes/index.d.ts +39 -0
  94. package/dist/modules/charts/runtime/chartTypes/index.js +47 -0
  95. package/dist/modules/charts/runtime/chartTypes/line.d.ts +7 -0
  96. package/dist/modules/charts/runtime/chartTypes/line.js +68 -0
  97. package/dist/modules/charts/runtime/chartTypes/pie.d.ts +5 -0
  98. package/dist/modules/charts/runtime/chartTypes/pie.js +28 -0
  99. package/dist/modules/charts/runtime/chartTypes/radar.d.ts +7 -0
  100. package/dist/modules/charts/runtime/chartTypes/radar.js +52 -0
  101. package/dist/modules/charts/runtime/chartTypes/radialBar.d.ts +6 -0
  102. package/dist/modules/charts/runtime/chartTypes/radialBar.js +44 -0
  103. package/dist/modules/charts/runtime/chartTypes/shared.d.ts +67 -0
  104. package/dist/modules/charts/runtime/chartTypes/shared.js +103 -0
  105. package/dist/modules/charts/runtime/chartTypes/types.d.ts +29 -0
  106. package/dist/modules/charts/runtime/chartTypes/types.js +0 -0
  107. package/dist/modules/charts/runtime/components/ChartRenderer/index.d.vue.ts +147 -0
  108. package/dist/modules/charts/runtime/components/ChartRenderer/index.vue +120 -0
  109. package/dist/modules/charts/runtime/components/ChartRenderer/index.vue.d.ts +147 -0
  110. package/dist/modules/charts/runtime/components/index.d.ts +1 -0
  111. package/dist/modules/charts/runtime/components/index.js +1 -0
  112. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.d.vue.ts +16 -0
  113. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.vue +97 -0
  114. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypeOptions/index.vue.d.ts +16 -0
  115. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.d.vue.ts +11 -0
  116. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.vue +34 -0
  117. package/dist/modules/charts/runtime/features/charts/Editor/ChartTypePicker/index.vue.d.ts +11 -0
  118. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.d.vue.ts +12 -0
  119. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue +49 -0
  120. package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue.d.ts +12 -0
  121. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.d.vue.ts +19 -0
  122. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.vue +89 -0
  123. package/dist/modules/charts/runtime/features/charts/Editor/CsvImport/index.vue.d.ts +19 -0
  124. package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.d.vue.ts +23 -0
  125. package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.vue +224 -0
  126. package/dist/modules/charts/runtime/features/charts/Editor/DataTable/index.vue.d.ts +23 -0
  127. package/dist/{runtime/editor/features/clipboard/List → modules/charts/runtime/features/charts/Editor/FootnoteEditor}/index.d.vue.ts +4 -5
  128. package/dist/modules/charts/runtime/features/charts/Editor/FootnoteEditor/index.vue +61 -0
  129. package/dist/{runtime/editor/features/clipboard/List → modules/charts/runtime/features/charts/Editor/FootnoteEditor}/index.vue.d.ts +4 -5
  130. package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.d.vue.ts +10 -0
  131. package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue +45 -0
  132. package/dist/modules/charts/runtime/features/charts/Editor/Preview/index.vue.d.ts +10 -0
  133. package/dist/modules/charts/runtime/features/charts/Editor/index.d.vue.ts +11 -0
  134. package/dist/modules/charts/runtime/features/charts/Editor/index.vue +249 -0
  135. package/dist/modules/charts/runtime/features/charts/Editor/index.vue.d.ts +11 -0
  136. package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.d.ts +17 -0
  137. package/dist/modules/charts/runtime/features/charts/Editor/useChartEditorState.js +90 -0
  138. package/dist/modules/charts/runtime/features/charts/index.d.vue.ts +3 -0
  139. package/dist/modules/charts/runtime/features/charts/index.vue +72 -0
  140. package/dist/modules/charts/runtime/features/charts/index.vue.d.ts +3 -0
  141. package/dist/modules/charts/runtime/helpers/index.d.ts +26 -0
  142. package/dist/modules/charts/runtime/helpers/index.js +80 -0
  143. package/dist/modules/charts/runtime/types.d.ts +33 -0
  144. package/dist/modules/charts/runtime/types.js +0 -0
  145. package/dist/modules/drupal/graphql/features/fragments.graphql +2 -0
  146. package/dist/modules/drupal/index.d.mts +1 -1
  147. package/dist/modules/drupal/runtime/adapter/index.d.ts +3 -1
  148. package/dist/modules/drupal/runtime/adapter/index.js +16 -12
  149. package/dist/modules/table-of-contents/index.d.mts +11 -0
  150. package/dist/modules/table-of-contents/index.mjs +24 -0
  151. package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.d.vue.ts +44 -0
  152. package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.vue +43 -0
  153. package/dist/modules/table-of-contents/runtime/components/BlokkliTableOfContents/index.vue.d.ts +44 -0
  154. package/dist/modules/table-of-contents/runtime/types/index.d.ts +4 -0
  155. package/dist/modules/table-of-contents/runtime/types/index.js +0 -0
  156. package/dist/runtime/components/Blocks/Fragment/index.vue +6 -2
  157. package/dist/runtime/components/BlokkliItem.vue +9 -4
  158. package/dist/runtime/components/BlokkliProvider.d.vue.ts +7 -0
  159. package/dist/runtime/components/BlokkliProvider.vue +7 -1
  160. package/dist/runtime/components/BlokkliProvider.vue.d.ts +7 -0
  161. package/dist/runtime/composables/defineBlokkli.js +1 -1
  162. package/dist/runtime/composables/useBlokkliHelper.js +4 -2
  163. package/dist/runtime/editor/components/AnimationCanvas/index.vue +17 -27
  164. package/dist/runtime/editor/components/Banner/index.d.vue.ts +13 -2
  165. package/dist/runtime/editor/components/Banner/index.vue +4 -2
  166. package/dist/runtime/editor/components/Banner/index.vue.d.ts +13 -2
  167. package/dist/runtime/editor/components/Dropdown/index.d.vue.ts +27 -0
  168. package/dist/runtime/editor/components/Dropdown/index.vue +107 -0
  169. package/dist/runtime/editor/components/Dropdown/index.vue.d.ts +27 -0
  170. package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.d.vue.ts +1 -0
  171. package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue +3 -2
  172. package/dist/{modules/agent/runtime/app/features/agent/Panel/Input/Actions → runtime/editor/components}/DropdownItem/index.vue.d.ts +1 -0
  173. package/dist/runtime/editor/components/EditProvider.d.vue.ts +2 -0
  174. package/dist/runtime/editor/components/EditProvider.vue +11 -7
  175. package/dist/runtime/editor/components/EditProvider.vue.d.ts +2 -0
  176. package/dist/runtime/editor/components/FlexTextarea/index.d.vue.ts +5 -1
  177. package/dist/runtime/editor/components/FlexTextarea/index.vue +24 -101
  178. package/dist/runtime/editor/components/FlexTextarea/index.vue.d.ts +5 -1
  179. package/dist/runtime/editor/components/Form/Radio/index.d.vue.ts +1 -0
  180. package/dist/runtime/editor/components/Form/Radio/index.vue +3 -2
  181. package/dist/runtime/editor/components/Form/Radio/index.vue.d.ts +1 -0
  182. package/dist/runtime/editor/components/ItemIcon/index.vue +10 -2
  183. package/dist/runtime/editor/components/NestedEditorOverlay/index.d.vue.ts +13 -3
  184. package/dist/runtime/editor/components/NestedEditorOverlay/index.vue +43 -16
  185. package/dist/runtime/editor/components/NestedEditorOverlay/index.vue.d.ts +13 -3
  186. package/dist/runtime/editor/components/Popup/index.d.vue.ts +30 -0
  187. package/dist/runtime/editor/components/Popup/index.vue +82 -0
  188. package/dist/runtime/editor/components/Popup/index.vue.d.ts +30 -0
  189. package/dist/runtime/editor/components/PreviewProvider.d.vue.ts +2 -0
  190. package/dist/runtime/editor/components/PreviewProvider.vue +3 -2
  191. package/dist/runtime/editor/components/PreviewProvider.vue.d.ts +2 -0
  192. package/dist/runtime/editor/components/Resizable/index.vue +4 -1
  193. package/dist/runtime/editor/components/ShortcutIndicator/index.vue +1 -1
  194. package/dist/runtime/editor/components/Toolbar/index.vue +107 -6
  195. package/dist/runtime/editor/components/index.d.ts +4 -1
  196. package/dist/runtime/editor/components/index.js +6 -0
  197. package/dist/runtime/editor/composables/defineDropAreas.js +3 -3
  198. package/dist/runtime/editor/composables/defineDropHandler.d.ts +3 -0
  199. package/dist/runtime/editor/composables/defineDropHandler.js +10 -0
  200. package/dist/runtime/editor/composables/index.d.ts +1 -0
  201. package/dist/runtime/editor/composables/index.js +1 -0
  202. package/dist/runtime/editor/composables/onElementResize.js +0 -1
  203. package/dist/runtime/editor/composables/useEditableFieldOverride.js +4 -5
  204. package/dist/runtime/editor/css/output.css +1 -1
  205. package/dist/runtime/editor/events/index.d.ts +16 -0
  206. package/dist/runtime/editor/features/add-list/Help/Item.vue +5 -2
  207. package/dist/runtime/editor/features/add-list/index.vue +58 -1
  208. package/dist/runtime/editor/features/analyze/Main.d.vue.ts +3 -2
  209. package/dist/runtime/editor/features/analyze/Main.vue +28 -44
  210. package/dist/runtime/editor/features/analyze/Main.vue.d.ts +3 -2
  211. package/dist/runtime/editor/features/analyze/analyzers/readability.js +65 -0
  212. package/dist/runtime/editor/features/analyze/analyzers/types.d.ts +19 -0
  213. package/dist/runtime/editor/features/analyze/index.vue +18 -15
  214. package/dist/runtime/editor/features/artboard/Renderer.vue +1 -1
  215. package/dist/runtime/editor/features/clipboard/DropElement/Video.d.vue.ts +8 -0
  216. package/dist/runtime/editor/features/clipboard/{List/Item → DropElement}/Video.vue +1 -5
  217. package/dist/runtime/editor/features/clipboard/DropElement/Video.vue.d.ts +8 -0
  218. package/dist/runtime/editor/features/clipboard/DropElement/helpers.d.ts +1 -0
  219. package/dist/runtime/editor/features/clipboard/DropElement/helpers.js +14 -0
  220. package/dist/runtime/editor/features/clipboard/DropElement/index.d.vue.ts +16 -0
  221. package/dist/runtime/editor/features/clipboard/DropElement/index.vue +97 -0
  222. package/dist/runtime/editor/features/clipboard/DropElement/index.vue.d.ts +16 -0
  223. package/dist/runtime/editor/features/clipboard/helpers.d.ts +15 -0
  224. package/dist/runtime/editor/features/clipboard/helpers.js +62 -0
  225. package/dist/runtime/editor/features/clipboard/index.vue +586 -338
  226. package/dist/runtime/editor/features/clipboard/types.d.ts +14 -2
  227. package/dist/runtime/editor/features/debug/index.vue +1 -1
  228. package/dist/runtime/editor/features/dev-mode/index.vue +86 -2
  229. package/dist/runtime/editor/features/dragging-overlay/DragItems/index.vue +17 -5
  230. package/dist/runtime/editor/features/dragging-overlay/Renderer/index.vue +2 -2
  231. package/dist/runtime/editor/features/dragging-overlay/index.vue +125 -219
  232. package/dist/runtime/editor/features/edit/index.vue +20 -0
  233. package/dist/runtime/editor/features/editable-field/Overlay/Plaintext/index.vue +4 -4
  234. package/dist/runtime/editor/features/editable-field/Overlay/index.vue +6 -0
  235. package/dist/runtime/editor/features/fragments/types.d.ts +1 -0
  236. package/dist/runtime/editor/features/hover/Renderer/index.vue +30 -3
  237. package/dist/runtime/editor/features/hover/index.vue +1 -1
  238. package/dist/runtime/editor/features/library/index.vue +14 -0
  239. package/dist/runtime/editor/features/media-library/index.vue +32 -1
  240. package/dist/runtime/editor/features/options/Form/Checkbox/index.d.vue.ts +2 -2
  241. package/dist/runtime/editor/features/options/Form/Checkbox/index.vue +3 -3
  242. package/dist/runtime/editor/features/options/Form/Checkbox/index.vue.d.ts +2 -2
  243. package/dist/runtime/editor/features/options/Form/Checkboxes/index.d.vue.ts +2 -2
  244. package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue +5 -5
  245. package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue.d.ts +2 -2
  246. package/dist/runtime/editor/features/options/Form/ComplexType/index.d.vue.ts +11 -0
  247. package/dist/runtime/editor/features/options/Form/ComplexType/index.vue +36 -0
  248. package/dist/runtime/editor/features/options/Form/ComplexType/index.vue.d.ts +11 -0
  249. package/dist/runtime/editor/features/options/Form/Item.d.vue.ts +5 -4
  250. package/dist/runtime/editor/features/options/Form/Item.vue +24 -50
  251. package/dist/runtime/editor/features/options/Form/Item.vue.d.ts +5 -4
  252. package/dist/runtime/editor/features/options/Form/Number/index.d.vue.ts +3 -3
  253. package/dist/runtime/editor/features/options/Form/Number/index.vue +7 -17
  254. package/dist/runtime/editor/features/options/Form/Number/index.vue.d.ts +3 -3
  255. package/dist/runtime/editor/features/options/Form/Range/index.d.vue.ts +2 -2
  256. package/dist/runtime/editor/features/options/Form/Range/index.vue +4 -4
  257. package/dist/runtime/editor/features/options/Form/Range/index.vue.d.ts +2 -2
  258. package/dist/runtime/editor/features/options/Form/index.vue +15 -5
  259. package/dist/runtime/editor/features/search/index.vue +25 -1
  260. package/dist/runtime/editor/features/selection/index.vue +2 -2
  261. package/dist/runtime/editor/features/structure/index.vue +25 -1
  262. package/dist/runtime/editor/features/tour/index.vue +22 -12
  263. package/dist/runtime/editor/features/transform/index.vue +1 -3
  264. package/dist/runtime/editor/helpers/clipboardData/index.d.ts +11 -0
  265. package/dist/runtime/editor/helpers/clipboardData/index.js +157 -0
  266. package/dist/runtime/editor/helpers/options/index.js +5 -0
  267. package/dist/runtime/editor/icons/svg/stars.svg +5 -1
  268. package/dist/runtime/editor/plugins/Sidebar/Detached/index.d.vue.ts +1 -1
  269. package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue.d.ts +1 -1
  270. package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +15 -4
  271. package/dist/runtime/editor/plugins/Sidebar/index.vue +4 -2
  272. package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +15 -4
  273. package/dist/runtime/editor/providers/analyze.d.ts +43 -0
  274. package/dist/runtime/editor/providers/analyze.js +78 -0
  275. package/dist/runtime/editor/providers/animation.d.ts +4 -0
  276. package/dist/runtime/editor/providers/animation.js +6 -0
  277. package/dist/runtime/editor/providers/definition.d.ts +2 -2
  278. package/dist/runtime/editor/providers/definition.js +7 -1
  279. package/dist/runtime/editor/providers/dom.d.ts +5 -0
  280. package/dist/runtime/editor/providers/dom.js +11 -2
  281. package/dist/runtime/editor/providers/dragdrop.d.ts +55 -0
  282. package/dist/runtime/editor/providers/dragdrop.js +37 -0
  283. package/dist/runtime/editor/providers/fields.d.ts +19 -1
  284. package/dist/runtime/editor/providers/fields.js +54 -2
  285. package/dist/runtime/editor/providers/storage.js +15 -0
  286. package/dist/runtime/editor/providers/ui.d.ts +6 -0
  287. package/dist/runtime/editor/providers/ui.js +19 -0
  288. package/dist/runtime/editor/translations/de.json +338 -58
  289. package/dist/runtime/editor/translations/fr.json +331 -51
  290. package/dist/runtime/editor/translations/gsw_CH.json +336 -56
  291. package/dist/runtime/editor/translations/it.json +331 -51
  292. package/dist/runtime/editor/types/app.d.ts +4 -2
  293. package/dist/runtime/editor/types/draggable.d.ts +1 -0
  294. package/dist/runtime/editor/types/ui.d.ts +1 -1
  295. package/dist/runtime/helpers/imports/index.d.ts +8 -1
  296. package/dist/runtime/helpers/imports/index.js +15 -6
  297. package/dist/runtime/helpers/injections.d.ts +6 -2
  298. package/dist/runtime/helpers/injections.js +3 -0
  299. package/dist/runtime/helpers/runtimeHelpers/index.js +14 -0
  300. package/dist/runtime/types/blockOptions.d.ts +2 -1
  301. package/dist/runtime/types/definitions.d.ts +12 -5
  302. package/dist/runtime/types/provider.d.ts +2 -0
  303. package/dist/shared/editor.6D5vApr0.mjs +30 -0
  304. package/dist/shared/{editor.DMFfaLVE.mjs → editor.BFIzNSQM.mjs} +1 -30
  305. package/dist/shared/{editor.Iax3GCvt.d.mts → editor.BdBm1Z7C.d.mts} +34 -0
  306. package/dist/types.d.mts +1 -1
  307. package/package.json +21 -3
  308. package/dist/modules/agent/runtime/app/tools/get_available_bundles/index.js +0 -104
  309. package/dist/runtime/editor/features/clipboard/List/Item/File.d.vue.ts +0 -4
  310. package/dist/runtime/editor/features/clipboard/List/Item/File.vue +0 -60
  311. package/dist/runtime/editor/features/clipboard/List/Item/File.vue.d.ts +0 -4
  312. package/dist/runtime/editor/features/clipboard/List/Item/Video.d.vue.ts +0 -4
  313. package/dist/runtime/editor/features/clipboard/List/Item/Video.vue.d.ts +0 -4
  314. package/dist/runtime/editor/features/clipboard/List/index.vue +0 -72
  315. package/dist/runtime/editor/features/tour/Popup/index.d.vue.ts +0 -9
  316. package/dist/runtime/editor/features/tour/Popup/index.vue +0 -34
  317. package/dist/runtime/editor/features/tour/Popup/index.vue.d.ts +0 -9
  318. package/dist/runtime/editor/providers/dropArea.d.ts +0 -48
  319. package/dist/runtime/editor/providers/dropArea.js +0 -22
  320. /package/dist/modules/agent/runtime/app/tools/{get_available_bundles → analyze_content}/index.d.ts +0 -0
@@ -1,5 +1,4 @@
1
- import type { McpToolDefinition, McpToolFactory, McpToolItem, McpToolContext, McpToolCategory, MutationAction, QueryResult, ToolError } from '#blokkli/agent/app/types';
2
- import type { ClientToolDefinition } from '#blokkli/agent/shared/types';
1
+ import type { McpToolDefinition, McpToolContext, McpToolCategory, MutationAction, QueryResult, ToolError } from '#blokkli/agent/app/types';
3
2
  import type { BlokkliAdapter } from '#blokkli/editor/adapter';
4
3
  import type { EditMode } from '#blokkli/editor/types/state';
5
4
  /**
@@ -7,10 +6,20 @@ import type { EditMode } from '#blokkli/editor/types/state';
7
6
  */
8
7
  export declare function createToolMap(tools: McpToolDefinition[]): Record<string, McpToolDefinition>;
9
8
  /**
10
- * Get tools formatted for the server with JSON schemas.
9
+ * Get tool names for the server.
11
10
  * Filters by edit mode and adapter methods if provided.
11
+ * All tools are static and resolved from bundled metadata on the server.
12
12
  */
13
- export declare function getToolsForServer(tools: McpToolDefinition[], editMode: EditMode, adapter?: BlokkliAdapter<unknown>): ClientToolDefinition[];
13
+ export declare function getToolInfoForServer(tools: McpToolDefinition[], editMode: EditMode, adapter?: BlokkliAdapter<unknown>): string[];
14
+ /**
15
+ * Coerce stringified JSON values back to their actual types.
16
+ *
17
+ * LLMs sometimes double-serialize array or object parameters, sending e.g.
18
+ * `"[\"readability\"]"` (a string) instead of `["readability"]` (an array).
19
+ * This walks the params and attempts JSON.parse on any string that looks like
20
+ * a JSON array or object.
21
+ */
22
+ export declare function coerceStringifiedParams(params: Record<string, unknown>): Record<string, unknown>;
14
23
  /**
15
24
  * Execute a tool by name with the given context and parameters.
16
25
  * Validates parameters with Zod before executing.
@@ -37,19 +46,7 @@ export declare function isQueryResult(result: unknown): result is QueryResult;
37
46
  */
38
47
  export declare function isToolError(result: unknown): result is ToolError;
39
48
  /**
40
- * Check if a tool item is a factory (produces tools dynamically at runtime).
41
- */
42
- export declare function isToolFactory(item: McpToolItem): item is McpToolFactory;
43
- /**
44
- * Check if a tool item is a static tool definition (not a factory).
45
- */
46
- export declare function isToolDefinition(item: McpToolItem): item is McpToolDefinition;
47
- /**
48
- * Resolve an array of tool items (static definitions + factories) into
49
- * a flat array of McpToolDefinition objects.
50
- *
51
- * Each factory's resolve callback is called to produce tools. The individual
52
- * tools returned by factories have their own requiredAdapterMethods, which
53
- * are checked later by getToolsForServer.
49
+ * Resolve an array of tool definitions into a flat array.
50
+ * All tools are now static — no factory resolution needed.
54
51
  */
55
- export declare function resolveTools(tools: McpToolItem[], context: McpToolContext): Promise<McpToolDefinition[]>;
52
+ export declare function resolveTools(tools: McpToolDefinition[], _context: McpToolContext): Promise<McpToolDefinition[]>;
@@ -1,24 +1,7 @@
1
- import { z } from "zod";
2
1
  export function createToolMap(tools) {
3
2
  return Object.fromEntries(tools.map((t) => [t.name, t]));
4
3
  }
5
- function stripSchemaOverhead(obj) {
6
- if (Array.isArray(obj)) {
7
- return obj.map(stripSchemaOverhead);
8
- }
9
- if (typeof obj === "object" && obj !== null) {
10
- const result = {};
11
- for (const [key, value] of Object.entries(obj)) {
12
- if (key === "$schema") continue;
13
- if (key === "additionalProperties" && value === false) continue;
14
- if (key === "propertyNames") continue;
15
- result[key] = stripSchemaOverhead(value);
16
- }
17
- return result;
18
- }
19
- return obj;
20
- }
21
- export function getToolsForServer(tools, editMode, adapter) {
4
+ export function getToolInfoForServer(tools, editMode, adapter) {
22
5
  return tools.filter((tool) => {
23
6
  if (!tool.modes.includes(editMode)) return false;
24
7
  if (!tool.requiredAdapterMethods) return true;
@@ -26,23 +9,31 @@ export function getToolsForServer(tools, editMode, adapter) {
26
9
  return tool.requiredAdapterMethods.every(
27
10
  (method) => typeof adapter[method] === "function"
28
11
  );
29
- }).map((tool) => ({
30
- name: tool.name,
31
- description: tool.description,
32
- input_schema: stripSchemaOverhead(
33
- z.toJSONSchema(tool.paramsSchema)
34
- ),
35
- ...tool.lazy ? { lazy: true } : {},
36
- category: tool.category,
37
- ...tool.volatile ? { volatile: true } : {}
38
- }));
12
+ }).map((t) => t.name);
13
+ }
14
+ export function coerceStringifiedParams(params) {
15
+ const result = {};
16
+ for (const key of Object.keys(params)) {
17
+ const value = params[key];
18
+ if (typeof value === "string" && (value[0] === "[" || value[0] === "{")) {
19
+ try {
20
+ result[key] = JSON.parse(value);
21
+ } catch {
22
+ result[key] = value;
23
+ }
24
+ } else {
25
+ result[key] = value;
26
+ }
27
+ }
28
+ return result;
39
29
  }
40
30
  export async function executeTool(toolMap, name, context, params) {
41
31
  const tool = toolMap[name];
42
32
  if (!tool) {
43
33
  throw new Error(`Unknown tool: ${name}`);
44
34
  }
45
- const validatedParams = tool.paramsSchema.parse(params);
35
+ const coerced = coerceStringifiedParams(params);
36
+ const validatedParams = tool.paramsSchema.parse(coerced);
46
37
  return tool.execute(context, validatedParams);
47
38
  }
48
39
  export function getToolCategory(toolMap, name) {
@@ -68,21 +59,6 @@ export function isQueryResult(result) {
68
59
  export function isToolError(result) {
69
60
  return typeof result === "object" && result !== null && "error" in result && typeof result.error === "string";
70
61
  }
71
- export function isToolFactory(item) {
72
- return "__factory" in item && item.__factory === true;
73
- }
74
- export function isToolDefinition(item) {
75
- return !isToolFactory(item);
76
- }
77
- export async function resolveTools(tools, context) {
78
- const resolved = [];
79
- for (const tool of tools) {
80
- if (isToolFactory(tool)) {
81
- const factoryTools = await tool.resolve(context);
82
- resolved.push(...factoryTools);
83
- } else {
84
- resolved.push(tool);
85
- }
86
- }
87
- return resolved;
62
+ export async function resolveTools(tools, _context) {
63
+ return tools;
88
64
  }
@@ -2,7 +2,7 @@ import {
2
2
  getFieldType,
3
3
  getEditableValue,
4
4
  getParagraphChildren
5
- } from "#blokkli/agent/app/tools/schemas";
5
+ } from "#blokkli/agent/app/tools/helpers";
6
6
  import { itemEntityType } from "#blokkli-build/config";
7
7
  const MAX_CONTENT_LENGTH = 150;
8
8
  function stripHtml(html) {
@@ -1,24 +1,20 @@
1
1
  import { z } from "zod";
2
2
  import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
- import {
4
- mutationResultSchema,
5
- parentSchema,
6
- positionSchema,
7
- resolvePosition
8
- } from "../schemas.js";
3
+ import { mutationResultSchema, parentSchema, positionSchema } from "../schemas.js";
4
+ import { resolvePosition } from "../helpers.js";
9
5
  const paramsSchema = z.object({
10
- itemId: z.string().describe("Content item ID from search_content_* results"),
6
+ itemId: z.string().describe("Content item ID from search_content results"),
11
7
  itemEntityType: z.string().describe("Entity type of the content item"),
12
8
  itemEntityBundle: z.string().describe("Entity bundle of the content item"),
13
9
  targetBundle: z.string().describe(
14
- "Paragraph bundle to create (from targetBundles in search_content_* results)"
10
+ "Paragraph bundle to create (from targetBundles in search_content results)"
15
11
  ),
16
12
  parent: parentSchema.describe("The parent entity to add the paragraph to"),
17
13
  position: positionSchema
18
14
  });
19
15
  export default defineBlokkliAgentTool({
20
16
  name: "add_content_search_paragraphs",
21
- description: "Add a paragraph using a content item from search results. Use search_content_* first to find content items, then use this tool to add one to the page. Requires user approval.",
17
+ description: "Add a paragraph using a content item from search results. Use search_content first to find content items, then use this tool to add one to the page. Requires user approval.",
22
18
  category: "mutation",
23
19
  prunedSummary: (r) => r.success ? "added content paragraph" : "rejected",
24
20
  modes: ["editing"],
@@ -1,11 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
- import {
4
- mutationResultSchema,
5
- parentSchema,
6
- positionSchema,
7
- resolvePosition
8
- } from "../schemas.js";
3
+ import { mutationResultSchema, parentSchema, positionSchema } from "../schemas.js";
4
+ import { resolvePosition } from "../helpers.js";
9
5
  const paramsSchema = z.object({
10
6
  name: z.string().describe("The fragment name to add"),
11
7
  parent: parentSchema.describe("The parent entity to add the fragment to"),
@@ -1,11 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
- import {
4
- mutationResultSchema,
5
- parentSchema,
6
- positionSchema,
7
- resolvePosition
8
- } from "../schemas.js";
3
+ import { mutationResultSchema, parentSchema, positionSchema } from "../schemas.js";
4
+ import { resolvePosition } from "../helpers.js";
9
5
  const paramsSchema = z.object({
10
6
  mediaId: z.string().describe("Media item ID from search_media results"),
11
7
  mediaBundle: z.string().describe('Media bundle type (e.g., "image")'),
@@ -5,10 +5,9 @@ import {
5
5
  mutationResultSchema,
6
6
  parentSchema,
7
7
  positionSchema,
8
- resolvePosition,
9
- optionValueSchema,
10
- validateOptionValue
8
+ optionValueSchema
11
9
  } from "../schemas.js";
10
+ import { resolvePosition, validateOptionValue } from "../helpers.js";
12
11
  import { itemEntityType } from "#blokkli-build/config";
13
12
  import {
14
13
  getAvailableOptions,
@@ -1,11 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
- import {
4
- mutationResultSchema,
5
- parentSchema,
6
- positionSchema,
7
- resolvePosition
8
- } from "../schemas.js";
3
+ import { mutationResultSchema, parentSchema, positionSchema } from "../schemas.js";
4
+ import { resolvePosition } from "../helpers.js";
9
5
  import { fromLibraryBlockBundle, itemEntityType } from "#blokkli-build/config";
10
6
  const paramsSchema = z.object({
11
7
  libraryItemUuid: z.string().describe(
@@ -1,11 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
- import {
4
- mutationResultSchema,
5
- parentSchema,
6
- positionSchema,
7
- resolvePosition
8
- } from "../schemas.js";
3
+ import { mutationResultSchema, parentSchema, positionSchema } from "../schemas.js";
4
+ import { resolvePosition } from "../helpers.js";
9
5
  const paramsSchema = z.object({
10
6
  templateUuid: z.string().describe(
11
7
  "The UUID of the template to add (from search_templates results)"
@@ -0,0 +1,120 @@
1
+ import { z } from "zod";
2
+ import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
+ const issueSchema = z.object({
4
+ text: z.string(),
5
+ impact: z.string().optional(),
6
+ scores: z.record(z.string(), z.number()).optional()
7
+ });
8
+ const fieldResultSchema = z.object({
9
+ fieldValue: z.string().optional(),
10
+ issues: z.array(issueSchema)
11
+ });
12
+ const paramsSchema = z.object({});
13
+ const resultSchema = z.record(
14
+ z.string(),
15
+ z.record(z.string(), fieldResultSchema)
16
+ );
17
+ function resolveTargetInfo(target) {
18
+ const blockEl = target.closest("[data-bk-uuid]");
19
+ const paragraphUuid = blockEl?.getAttribute("data-bk-uuid") ?? void 0;
20
+ let fieldName;
21
+ let fieldEl;
22
+ let el = target;
23
+ while (el && el !== blockEl) {
24
+ if (el.dataset.blokkliEditableField) {
25
+ fieldName = el.dataset.blokkliEditableField;
26
+ fieldEl = el;
27
+ break;
28
+ }
29
+ el = el.parentElement;
30
+ }
31
+ const fieldText = fieldEl?.textContent?.trim() || void 0;
32
+ return { paragraphUuid, fieldName, fieldText };
33
+ }
34
+ export default defineBlokkliAgentTool({
35
+ name: "get_readability_issues",
36
+ description: "Run all readability analyzers against the full page. Returns an object keyed by paragraph UUID and field name, with the current field value and a list of issues. Each issue contains the flagged text segment, impact, and scores. Use the result to call batch_rewrite_text directly.",
37
+ category: "query",
38
+ volatile: true,
39
+ lazy: true,
40
+ modes: ["readonly", "editing", "translating", "review"],
41
+ requiredAdapterMethods: ["getAnalyzers"],
42
+ label($t) {
43
+ return $t("aiAgentAnalyzeContentRunning", "Analyzing content...");
44
+ },
45
+ prunedSummary: (r) => {
46
+ let count = 0;
47
+ for (const fields of Object.values(r)) {
48
+ for (const field of Object.values(fields)) {
49
+ count += field.issues.length;
50
+ }
51
+ }
52
+ return `found ${count} issues`;
53
+ },
54
+ paramsSchema,
55
+ resultSchema,
56
+ async execute(ctx) {
57
+ const { analyze, ui, $t } = ctx.app;
58
+ await analyze.ensureInitialized();
59
+ const readabilityAnalyzers = analyze.analyzers.value.filter(
60
+ (a) => a.type === "readability" && !a.requireRawPage
61
+ );
62
+ if (readabilityAnalyzers.length === 0) {
63
+ return {
64
+ label: $t(
65
+ "aiAgentAnalyzeContentDone",
66
+ "Analyzed @count results"
67
+ ).replace("@count", "0"),
68
+ result: {}
69
+ };
70
+ }
71
+ const analyzerCtx = analyze.createContext(ui.providerElement);
72
+ const result = {};
73
+ for (const analyzer of readabilityAnalyzers) {
74
+ const rawResults = await analyze.runAnalyzer(analyzer, analyzerCtx);
75
+ for (const r of rawResults) {
76
+ const rawNodes = Array.isArray(r.nodes) ? r.nodes : [r.nodes];
77
+ for (const node of rawNodes) {
78
+ const targets = Array.isArray(node.targets) ? node.targets : [node.targets];
79
+ for (const target of targets) {
80
+ if (!(target instanceof HTMLElement)) continue;
81
+ const info = resolveTargetInfo(target);
82
+ if (!info.paragraphUuid || !info.fieldName) continue;
83
+ const targetText = target.textContent?.trim();
84
+ if (!targetText) continue;
85
+ const uuid = info.paragraphUuid;
86
+ const field = info.fieldName;
87
+ if (!result[uuid]) {
88
+ result[uuid] = {};
89
+ }
90
+ if (!result[uuid][field]) {
91
+ result[uuid][field] = {
92
+ fieldValue: info.fieldText,
93
+ issues: []
94
+ };
95
+ }
96
+ result[uuid][field].issues.push({
97
+ text: targetText,
98
+ impact: node.impact,
99
+ scores: node.scores
100
+ });
101
+ break;
102
+ }
103
+ }
104
+ }
105
+ }
106
+ let issueCount = 0;
107
+ for (const fields of Object.values(result)) {
108
+ for (const field of Object.values(fields)) {
109
+ issueCount += field.issues.length;
110
+ }
111
+ }
112
+ return {
113
+ label: $t("aiAgentAnalyzeContentDone", "Analyzed @count results").replace(
114
+ "@count",
115
+ String(issueCount)
116
+ ),
117
+ result
118
+ };
119
+ }
120
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,57 @@
1
+ import { z } from "zod";
2
+ import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
+ const nodeSchema = z.object({
4
+ description: z.string().optional(),
5
+ impact: z.string().optional(),
6
+ scores: z.record(z.string(), z.number()).optional()
7
+ });
8
+ const textResultSchema = z.object({
9
+ text: z.string(),
10
+ nodes: z.array(nodeSchema)
11
+ });
12
+ const paramsSchema = z.object({
13
+ texts: z.array(z.string()).describe(
14
+ "Text strings to check for readability. Each string is analyzed independently."
15
+ )
16
+ });
17
+ const resultSchema = z.object({
18
+ results: z.array(textResultSchema)
19
+ });
20
+ export default defineBlokkliAgentTool({
21
+ name: "check_readability_for_texts",
22
+ description: "Check readability scores for one or more text strings. Returns readability metrics (LIX, CLI, ARI) for each text. Use this to evaluate whether a rewritten text has better readability before applying it.",
23
+ category: "query",
24
+ lazy: true,
25
+ modes: ["readonly", "editing", "translating", "review"],
26
+ requiredAdapterMethods: ["getAnalyzers"],
27
+ label($t) {
28
+ return $t("aiAgentCheckReadabilityRunning", "Checking readability...");
29
+ },
30
+ prunedSummary: (r) => {
31
+ return `checked readability for ${r.results.length} texts`;
32
+ },
33
+ paramsSchema,
34
+ resultSchema,
35
+ async execute(ctx, params) {
36
+ const { analyze, $t } = ctx.app;
37
+ await analyze.ensureInitialized();
38
+ const rawResults = await analyze.runOnTexts(params.texts, "readability");
39
+ const results = rawResults.map(
40
+ (tr) => ({
41
+ text: tr.text,
42
+ nodes: tr.nodes.map((node) => ({
43
+ description: node.description,
44
+ impact: node.impact,
45
+ scores: node.scores
46
+ }))
47
+ })
48
+ );
49
+ return {
50
+ label: $t(
51
+ "aiAgentCheckReadabilityDone",
52
+ "Checked readability for @count texts"
53
+ ).replace("@count", String(results.length)),
54
+ result: { results }
55
+ };
56
+ }
57
+ });
@@ -1,11 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
- import {
4
- mutationResultSchema,
5
- parentSchema,
6
- positionSchema,
7
- resolvePosition
8
- } from "../schemas.js";
3
+ import { mutationResultSchema, parentSchema, positionSchema } from "../schemas.js";
4
+ import { resolvePosition } from "../helpers.js";
9
5
  import {
10
6
  validateBlocksExist,
11
7
  validateSameField,
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
- import { getFieldType, getEditableValue } from "../schemas.js";
3
+ import { getFieldType, getEditableValue } from "../helpers.js";
4
4
  const paramsSchema = z.object({});
5
5
  const blockContentSchema = z.object({
6
6
  uuid: z.string().describe("The paragraph UUID"),
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,176 @@
1
+ import { z } from "zod";
2
+ import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
+ import { getAvailableOptions } from "#blokkli/editor/helpers/options";
4
+ import { getRuntimeOptionValue } from "#blokkli/runtime-helpers";
5
+ import { blockOptionsMapSchema } from "../schemas.js";
6
+ import { extractOptionLabels } from "../helpers.js";
7
+ const paramsSchema = z.object({
8
+ parentUuid: z.string().describe("The parent entity UUID"),
9
+ field: z.string().describe("The field name"),
10
+ bundles: z.array(z.string()).optional().describe(
11
+ "Optional list of bundle names to filter by. If omitted, returns all allowed bundles."
12
+ )
13
+ });
14
+ const bundleSchema = z.object({
15
+ bundle: z.string().describe("The paragraph type identifier"),
16
+ label: z.string().describe("Human-readable label"),
17
+ description: z.string().optional().describe("Bundle description if available"),
18
+ contentFields: z.record(
19
+ z.string(),
20
+ z.object({
21
+ type: z.string().describe("Field type: plain, markup, reference, or link")
22
+ })
23
+ ).describe(
24
+ "Content fields (text, media, links) on this bundle, keyed by field name"
25
+ ),
26
+ paragraphFields: z.record(
27
+ z.string(),
28
+ z.object({
29
+ label: z.string().describe("Human-readable label"),
30
+ allowedBundles: z.array(z.string()).describe("Paragraph types allowed in this field"),
31
+ cardinality: z.number().describe("Max paragraphs allowed (-1 = unlimited)")
32
+ })
33
+ ).describe(
34
+ "Paragraph fields (for nested paragraphs) on this bundle, keyed by field name"
35
+ ),
36
+ options: blockOptionsMapSchema.optional().describe(
37
+ "Available options for this bundle with their default values (only included when few bundles are returned)"
38
+ )
39
+ });
40
+ const resultSchema = z.object({
41
+ fieldLabel: z.string().describe("Human-readable field label"),
42
+ cardinality: z.number().describe("Max paragraphs allowed (-1 = unlimited)"),
43
+ currentCount: z.number().describe("Current number of paragraphs in the field"),
44
+ bundles: z.array(bundleSchema).describe("Available paragraph types"),
45
+ nestingInfo: z.string().optional().describe(
46
+ "Summary of which bundles have paragraph fields for nested paragraphs. Use get_child_paragraphs after adding these bundles to populate their nested fields."
47
+ )
48
+ });
49
+ export default defineBlokkliAgentTool({
50
+ name: "get_bundle_info",
51
+ description: "Get detailed information about which paragraph types can be added to a specific field, including their content fields and paragraph fields (for nested paragraphs).",
52
+ category: "query",
53
+ modes: ["readonly", "editing", "translating", "review"],
54
+ label($t) {
55
+ return $t("aiAgentGetBundleInfoRunning", "Getting bundle info...");
56
+ },
57
+ paramsSchema,
58
+ resultSchema,
59
+ execute(ctx, params) {
60
+ const { fields, types, state, definitions, $t } = ctx.app;
61
+ const label = $t(
62
+ "aiAgentGetBundleInfoDone",
63
+ "Got bundle info for @field"
64
+ ).replace("@field", params.field);
65
+ const field = fields.find(params.parentUuid, params.field);
66
+ if (!field) {
67
+ return {
68
+ label,
69
+ result: {
70
+ fieldLabel: params.field,
71
+ cardinality: -1,
72
+ currentCount: 0,
73
+ bundles: []
74
+ }
75
+ };
76
+ }
77
+ const fieldKey = `${params.parentUuid}:${params.field}`;
78
+ const currentCount = state.getFieldBlockCount(fieldKey);
79
+ const allowedBundles = params.bundles ? field.allowedBundles.filter((b) => params.bundles.includes(b)) : field.allowedBundles;
80
+ const includeOptions = allowedBundles.length < 3;
81
+ const bundles = allowedBundles.map((bundle) => {
82
+ const bundleDefinition = types.getBlockBundleDefinition(bundle);
83
+ const contentFields = {};
84
+ for (const c of types.editableFieldConfig.forEntityTypeAndBundle(ctx.itemEntityType, bundle).filter((c2) => c2.type !== "table")) {
85
+ contentFields[c.name] = {
86
+ type: c.type === "frame" || c.type === "markup" ? "markup" : "plain"
87
+ };
88
+ }
89
+ for (const c of types.droppableFieldConfig.forEntityTypeAndBundle(
90
+ ctx.itemEntityType,
91
+ bundle
92
+ )) {
93
+ contentFields[c.name] = { type: c.type };
94
+ }
95
+ const paragraphFields = {};
96
+ for (const c of types.fieldConfig.forEntityTypeAndBundle(
97
+ ctx.itemEntityType,
98
+ bundle
99
+ )) {
100
+ paragraphFields[c.name] = {
101
+ label: c.label,
102
+ allowedBundles: c.allowedBundles,
103
+ cardinality: c.cardinality
104
+ };
105
+ }
106
+ let options;
107
+ if (includeOptions) {
108
+ const definition = definitions.getBlockDefinition(bundle, "default");
109
+ if (definition) {
110
+ const availableOptions = getAvailableOptions(
111
+ definition.options,
112
+ definition.globalOptions,
113
+ definitions.globalOptions.value
114
+ );
115
+ if (availableOptions.length > 0) {
116
+ options = {};
117
+ for (const opt of availableOptions) {
118
+ const currentValue = getRuntimeOptionValue(
119
+ opt.option,
120
+ opt.option.default
121
+ );
122
+ const entry = {
123
+ type: opt.option.type,
124
+ label: opt.option.label,
125
+ currentValue
126
+ };
127
+ if (opt.option.description) {
128
+ entry.description = opt.option.description;
129
+ }
130
+ const labels = extractOptionLabels(opt.option);
131
+ if (labels) {
132
+ entry.options = labels;
133
+ }
134
+ if ("min" in opt.option) {
135
+ entry.min = opt.option.min;
136
+ }
137
+ if ("max" in opt.option) {
138
+ entry.max = opt.option.max;
139
+ }
140
+ if ("step" in opt.option && opt.option.type === "range") {
141
+ entry.step = opt.option.step;
142
+ }
143
+ options[opt.property] = entry;
144
+ }
145
+ }
146
+ }
147
+ }
148
+ return {
149
+ bundle,
150
+ label: bundleDefinition?.label ?? bundle,
151
+ description: bundleDefinition?.description,
152
+ contentFields,
153
+ paragraphFields,
154
+ options
155
+ };
156
+ });
157
+ const nestingBundles = bundles.filter(
158
+ (b) => Object.keys(b.paragraphFields).length > 0
159
+ );
160
+ const nestingInfo = nestingBundles.length ? nestingBundles.map(
161
+ (b) => `${b.bundle} has paragraph fields: ${Object.entries(
162
+ b.paragraphFields
163
+ ).map(([name, f]) => `${name} (${f.allowedBundles.join(", ")})`).join(", ")}`
164
+ ).join("; ") : void 0;
165
+ return {
166
+ label,
167
+ result: {
168
+ fieldLabel: field.label,
169
+ cardinality: field.cardinality,
170
+ currentCount,
171
+ bundles,
172
+ nestingInfo
173
+ }
174
+ };
175
+ }
176
+ });
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
3
- import { getFieldType, getEditableValue } from "../schemas.js";
3
+ import { getFieldType, getEditableValue } from "../helpers.js";
4
4
  const paramsSchema = z.object({
5
5
  uuids: z.array(z.string()).describe(
6
6
  "One or more paragraph UUIDs (or the page UUID to get page-level fields)"