@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
@@ -4,11 +4,8 @@ import {
4
4
  getAvailableOptions,
5
5
  optionValueToStorable
6
6
  } from "#blokkli/editor/helpers/options";
7
- import {
8
- mutationResultSchema,
9
- optionValueSchema,
10
- validateOptionValue
11
- } from "../schemas.js";
7
+ import { mutationResultSchema, optionValueSchema } from "../schemas.js";
8
+ import { validateOptionValue } from "../helpers.js";
12
9
  import { onlyUnique } from "#blokkli/helpers";
13
10
  const paragraphOptionsSchema = z.object({
14
11
  uuid: z.string().describe("The paragraph UUID"),
@@ -200,67 +200,6 @@ export type McpToolDefinition<TParamsSchema extends z.ZodType = z.ZodType, TResu
200
200
  */
201
201
  mockParamsVariants?: () => z.infer<TParamsSchema>[];
202
202
  };
203
- /**
204
- * A tool definition with a relaxed execute signature.
205
- *
206
- * Used as the return type for factory resolve callbacks. Preserves structural
207
- * checking on all other properties (catches typos and excess properties) while
208
- * allowing each tool to have its own specific execute signature via
209
- * defineBlokkliAgentTool().
210
- */
211
- export type FactoryResolvedTool = {
212
- name: string;
213
- description: string;
214
- icon?: string;
215
- category: McpToolCategory;
216
- label: ($t: TranslationFunction) => string;
217
- paramsSchema: z.ZodType;
218
- resultSchema: z.ZodType;
219
- requiredAdapterMethods?: readonly AdapterMethods[];
220
- modes: EditMode[];
221
- component?: Component;
222
- requiresApproval?: boolean;
223
- lazy?: boolean;
224
- volatile?: boolean;
225
- prunedSummary?: (result: any) => string;
226
- execute: (...args: any[]) => any;
227
- mockParams?: () => any;
228
- mockParamsVariants?: () => any[];
229
- };
230
- /**
231
- * Input for a tool factory that dynamically creates tools at runtime.
232
- *
233
- * Instead of defining a single static tool, a factory uses a `resolve` callback
234
- * that is called when the agent connects. The callback returns an array of
235
- * McpToolDefinition objects, allowing tools to be created based on runtime state
236
- * (e.g., available content search tabs from the adapter).
237
- */
238
- export type McpToolFactoryInput = {
239
- /**
240
- * Called once when the agent connects. Returns an array of tool definitions
241
- * that are registered as if they were statically defined.
242
- *
243
- * Each returned tool is a full McpToolDefinition with its own
244
- * requiredAdapterMethods, execute function, and schemas. Use
245
- * defineBlokkliAgentTool() for each tool to get full type inference.
246
- *
247
- * The context provides access to the app and adapter so the factory can
248
- * query runtime state (e.g., available content search tabs) to decide
249
- * which tools to create. If adapter methods are optional, check for their
250
- * existence before calling them (or return an empty array).
251
- */
252
- resolve: (context: McpToolContext) => Promise<FactoryResolvedTool[]> | FactoryResolvedTool[];
253
- };
254
- /**
255
- * A tool factory with the __factory marker for runtime identification.
256
- */
257
- export type McpToolFactory = McpToolFactoryInput & {
258
- __factory: true;
259
- };
260
- /**
261
- * A tool item is either a static tool definition or a factory that produces tools.
262
- */
263
- export type McpToolItem = McpToolDefinition | McpToolFactory;
264
203
  /**
265
204
  * A pre-defined agent prompt that users can select.
266
205
  */
@@ -1,5 +1,5 @@
1
1
  import type { Peer } from 'crossws';
2
- import type { PageContext, ClientToolDefinition, ConversationStateSnapshot, GenericMessage } from '../shared/types.js';
2
+ import type { PageContext, ClientToolDefinition, ServerToolMetadata, ConversationStateSnapshot, GenericMessage } from '../shared/types.js';
3
3
  import type { ServerPlan } from './server-tools/index.js';
4
4
  export declare class Session {
5
5
  messages: GenericMessage[];
@@ -12,10 +12,10 @@ export declare class Session {
12
12
  }>;
13
13
  abortController: AbortController | null;
14
14
  isProcessing: boolean;
15
- /** Eager tools sent to the LLM on every turn */
16
- tools: ClientToolDefinition[];
17
- /** Lazy tools held back until activated via load_tools */
18
- lazyTools: ClientToolDefinition[];
15
+ /** Names of eager tools sent to the LLM on every turn */
16
+ toolNames: string[];
17
+ /** Names of lazy tools held back until activated via load_tools */
18
+ lazyToolNames: string[];
19
19
  /** Names of lazy tools that have been activated via load_tools */
20
20
  activatedLazyTools: Set<string>;
21
21
  /** Names of skills that have been loaded via load_skill */
@@ -28,9 +28,30 @@ export declare class Session {
28
28
  pendingPlanApproval: {
29
29
  resolve: (approved: boolean) => void;
30
30
  } | null;
31
- /** Last tools payload sent to the provider (for transcript debugging) */
32
- private lastProviderTools;
33
- init(tools: ClientToolDefinition[], pageContext: PageContext): void;
31
+ /** Pre-pruned messages snapshot for transcript (captured before pruneMessages) */
32
+ private unprunedMessages;
33
+ /** Last generic tool definitions for transcript */
34
+ private lastTools;
35
+ /** Bundled tool metadata map for server-side resolution */
36
+ private bundledToolMap;
37
+ /** Cache for resolved JSON Schemas (Zod→JSON Schema is deterministic) */
38
+ private jsonSchemaCache;
39
+ constructor(toolDefinitions: ServerToolMetadata[]);
40
+ /**
41
+ * Resolve a single tool name into a ClientToolDefinition.
42
+ * Resolves from bundled metadata. Caches the JSON Schema conversion.
43
+ */
44
+ resolveToolDefinition(name: string): ClientToolDefinition | undefined;
45
+ /**
46
+ * Resolve multiple tool names into ClientToolDefinition objects.
47
+ * Skips names that cannot be resolved.
48
+ */
49
+ resolveToolDefinitions(names: string[]): ClientToolDefinition[];
50
+ /**
51
+ * Look up name + description for a tool.
52
+ */
53
+ private getToolSummary;
54
+ init(toolNames: string[], pageContext: PageContext): void;
34
55
  start(peer: Peer, prompt: string, apiKey: string, authSecret: string, selectedUuids?: string[]): void;
35
56
  resolveToolResult(callId: string, result: {
36
57
  result: unknown;
@@ -1,4 +1,5 @@
1
- import { buildSystemPrompt, buildSystemPromptText } from "./agentPrompt.js";
1
+ import { z } from "zod";
2
+ import { buildSystemPrompt, buildSystemPromptEntries } from "./agentPrompt.js";
2
3
  import { provider, models } from "#blokkli-build/agent-server";
3
4
  import {
4
5
  send,
@@ -12,7 +13,7 @@ import {
12
13
  verifyStateHash,
13
14
  validateMessages
14
15
  } from "./helpers.js";
15
- import { buildDefinition } from "./server-tools/index.js";
16
+ import { buildDefinition, stripSchemaOverhead } from "./server-tools/index.js";
16
17
  import loadSkillTool from "./server-tools/load_skill/index.js";
17
18
  import loadToolsTool from "./server-tools/load_tools/index.js";
18
19
  import createPlanTool from "./server-tools/create_plan/index.js";
@@ -28,10 +29,10 @@ export class Session {
28
29
  pendingToolCalls = /* @__PURE__ */ new Map();
29
30
  abortController = null;
30
31
  isProcessing = false;
31
- /** Eager tools sent to the LLM on every turn */
32
- tools = [];
33
- /** Lazy tools held back until activated via load_tools */
34
- lazyTools = [];
32
+ /** Names of eager tools sent to the LLM on every turn */
33
+ toolNames = [];
34
+ /** Names of lazy tools held back until activated via load_tools */
35
+ lazyToolNames = [];
35
36
  /** Names of lazy tools that have been activated via load_tools */
36
37
  activatedLazyTools = /* @__PURE__ */ new Set();
37
38
  /** Names of skills that have been loaded via load_skill */
@@ -42,14 +43,77 @@ export class Session {
42
43
  plan = null;
43
44
  /** Pending plan approval promise resolver */
44
45
  pendingPlanApproval = null;
45
- /** Last tools payload sent to the provider (for transcript debugging) */
46
- lastProviderTools = null;
46
+ /** Pre-pruned messages snapshot for transcript (captured before pruneMessages) */
47
+ unprunedMessages = [];
48
+ /** Last generic tool definitions for transcript */
49
+ lastTools = [];
50
+ /** Bundled tool metadata map for server-side resolution */
51
+ bundledToolMap;
52
+ /** Cache for resolved JSON Schemas (Zod→JSON Schema is deterministic) */
53
+ jsonSchemaCache = /* @__PURE__ */ new Map();
54
+ constructor(toolDefinitions) {
55
+ this.bundledToolMap = new Map(toolDefinitions.map((t) => [t.name, t]));
56
+ }
57
+ /**
58
+ * Resolve a single tool name into a ClientToolDefinition.
59
+ * Resolves from bundled metadata. Caches the JSON Schema conversion.
60
+ */
61
+ resolveToolDefinition(name) {
62
+ const bundled = this.bundledToolMap.get(name);
63
+ if (!bundled) return void 0;
64
+ let inputSchema = this.jsonSchemaCache.get(name);
65
+ if (!inputSchema) {
66
+ inputSchema = stripSchemaOverhead(
67
+ z.toJSONSchema(bundled.paramsSchema)
68
+ );
69
+ this.jsonSchemaCache.set(name, inputSchema);
70
+ }
71
+ return {
72
+ name: bundled.name,
73
+ description: bundled.description,
74
+ input_schema: inputSchema,
75
+ ...bundled.lazy ? { lazy: true } : {},
76
+ category: bundled.category,
77
+ ...bundled.volatile ? { volatile: true } : {}
78
+ };
79
+ }
80
+ /**
81
+ * Resolve multiple tool names into ClientToolDefinition objects.
82
+ * Skips names that cannot be resolved.
83
+ */
84
+ resolveToolDefinitions(names) {
85
+ const result = [];
86
+ for (const name of names) {
87
+ const def = this.resolveToolDefinition(name);
88
+ if (def) {
89
+ result.push(def);
90
+ }
91
+ }
92
+ return result;
93
+ }
94
+ /**
95
+ * Look up name + description for a tool.
96
+ */
97
+ getToolSummary(name) {
98
+ const bundled = this.bundledToolMap.get(name);
99
+ if (!bundled) return void 0;
100
+ return { name: bundled.name, description: bundled.description };
101
+ }
47
102
  // --------------------------------------------------------------------------
48
103
  // Public methods
49
104
  // --------------------------------------------------------------------------
50
- init(tools, pageContext) {
51
- this.tools = tools.filter((t) => !t.lazy);
52
- this.lazyTools = tools.filter((t) => !!t.lazy);
105
+ init(toolNames, pageContext) {
106
+ this.toolNames = [];
107
+ this.lazyToolNames = [];
108
+ for (const name of toolNames) {
109
+ const bundled = this.bundledToolMap.get(name);
110
+ const isLazy = bundled?.lazy ?? false;
111
+ if (isLazy) {
112
+ this.lazyToolNames.push(name);
113
+ } else {
114
+ this.toolNames.push(name);
115
+ }
116
+ }
53
117
  this.activatedLazyTools = /* @__PURE__ */ new Set();
54
118
  this.loadedSkills = /* @__PURE__ */ new Set();
55
119
  this.pageContext = pageContext;
@@ -110,12 +174,14 @@ export class Session {
110
174
  getTranscript(peer) {
111
175
  send(peer, {
112
176
  type: "transcript",
113
- content: this.buildTranscript()
177
+ transcript: this.buildTranscript()
114
178
  });
115
179
  }
116
180
  newConversation(peer, authSecret) {
117
181
  this.abortController?.abort();
118
182
  this.messages = [];
183
+ this.unprunedMessages = [];
184
+ this.lastTools = [];
119
185
  this.activatedLazyTools.clear();
120
186
  this.loadedSkills.clear();
121
187
  this.plan = null;
@@ -138,8 +204,8 @@ export class Session {
138
204
  }
139
205
  this.plan = null;
140
206
  this.messages = [];
141
- this.tools = [];
142
- this.lazyTools = [];
207
+ this.toolNames = [];
208
+ this.lazyToolNames = [];
143
209
  this.activatedLazyTools.clear();
144
210
  this.loadedSkills.clear();
145
211
  this.pageContext = void 0;
@@ -182,7 +248,9 @@ export class Session {
182
248
  return { success: false, reason: "Invalid message structure" };
183
249
  }
184
250
  this.messages = state.messages;
185
- const validLazyToolNames = new Set(this.lazyTools.map((t) => t.name));
251
+ this.unprunedMessages = [];
252
+ this.lastTools = [];
253
+ const validLazyToolNames = new Set(this.lazyToolNames);
186
254
  this.activatedLazyTools = new Set(
187
255
  state.activatedLazyTools.filter((name) => validLazyToolNames.has(name))
188
256
  );
@@ -234,7 +302,7 @@ export class Session {
234
302
  });
235
303
  }
236
304
  async runAgentLoop(peer, prompt, apiKey, authSecret, selectedUuids) {
237
- if (this.tools.length === 0) {
305
+ if (this.toolNames.length === 0) {
238
306
  send(peer, {
239
307
  type: "error",
240
308
  errorType: "bad_request",
@@ -251,10 +319,9 @@ export class Session {
251
319
  return;
252
320
  }
253
321
  const resolvedSkills = resolveSkills(this.pageContext);
254
- const lazyToolSummaries = this.lazyTools.map((t) => ({
255
- name: t.name,
256
- description: t.description
257
- }));
322
+ const lazyToolSummaries = this.lazyToolNames.map((name) => this.getToolSummary(name)).filter(
323
+ (s) => s !== void 0
324
+ );
258
325
  const userParts = [];
259
326
  if (selectedUuids?.length) {
260
327
  userParts.push(
@@ -273,6 +340,9 @@ export class Session {
273
340
  let planRetryCount = 0;
274
341
  let streamRetryCount = 0;
275
342
  const MAX_STREAM_RETRIES = 1;
343
+ let lastToolCallKey = "";
344
+ let consecutiveIdenticalCalls = 0;
345
+ const MAX_IDENTICAL_CALLS = 2;
276
346
  try {
277
347
  while (true) {
278
348
  if (this.abortController.signal.aborted) {
@@ -286,11 +356,16 @@ export class Session {
286
356
  let currentToolUse = null;
287
357
  let currentTextContent = "";
288
358
  let inTextBlock = false;
289
- const activatedTools = this.lazyTools.filter(
290
- (t) => this.activatedLazyTools.has(t.name)
359
+ const eagerTools = this.resolveToolDefinitions(this.toolNames);
360
+ const activatedToolNames = this.lazyToolNames.filter(
361
+ (name) => this.activatedLazyTools.has(name)
362
+ );
363
+ const activatedTools = this.resolveToolDefinitions(activatedToolNames);
364
+ const unloadedLazyToolNames = this.lazyToolNames.filter(
365
+ (name) => !this.activatedLazyTools.has(name)
291
366
  );
292
- const unloadedLazyTools = this.lazyTools.filter(
293
- (t) => !this.activatedLazyTools.has(t.name)
367
+ const unloadedLazyTools = unloadedLazyToolNames.map((name) => this.getToolSummary(name)).filter(
368
+ (s) => s !== void 0
294
369
  );
295
370
  const defCtx = {
296
371
  resolvedSkills,
@@ -298,7 +373,8 @@ export class Session {
298
373
  unloadedLazyTools
299
374
  };
300
375
  const serverToolDefs = serverTools.map((t) => buildDefinition(t, defCtx)).filter((d) => d !== null);
301
- const allTools = [...serverToolDefs, ...this.tools, ...activatedTools];
376
+ const allTools = [...serverToolDefs, ...eagerTools, ...activatedTools];
377
+ this.lastTools = allTools;
302
378
  const systemPrompt = buildSystemPrompt(
303
379
  this.pageContext,
304
380
  resolvedSkills,
@@ -326,7 +402,6 @@ export class Session {
326
402
  }
327
403
  switch (event.type) {
328
404
  case "debug_request":
329
- this.lastProviderTools = event.tools;
330
405
  break;
331
406
  case "text_start":
332
407
  inTextBlock = true;
@@ -392,6 +467,25 @@ export class Session {
392
467
  name: currentToolUse.name,
393
468
  input
394
469
  });
470
+ const toolCallKey = currentToolUse.name + ":" + currentToolUse.inputJson;
471
+ if (toolCallKey === lastToolCallKey) {
472
+ consecutiveIdenticalCalls++;
473
+ } else {
474
+ lastToolCallKey = toolCallKey;
475
+ consecutiveIdenticalCalls = 1;
476
+ }
477
+ if (consecutiveIdenticalCalls > MAX_IDENTICAL_CALLS) {
478
+ toolResults.push({
479
+ type: "tool_result",
480
+ tool_use_id: currentToolUse.id,
481
+ content: JSON.stringify({
482
+ error: `You have called "${currentToolUse.name}" ${consecutiveIdenticalCalls} times in a row with identical parameters and received the same result each time. Stop repeating this call. Use the information you already have or try a different approach.`
483
+ }),
484
+ is_error: true
485
+ });
486
+ currentToolUse = null;
487
+ break;
488
+ }
395
489
  const matchedServerTool = serverTools.find(
396
490
  (t) => t.name === currentToolUse.name
397
491
  );
@@ -412,7 +506,7 @@ export class Session {
412
506
  toolUseId: currentToolUse.id,
413
507
  send: (msg) => send(peer, msg),
414
508
  resolvedSkills,
415
- lazyTools: this.lazyTools,
509
+ lazyToolNames: this.lazyToolNames,
416
510
  activatedLazyTools: this.activatedLazyTools,
417
511
  loadedSkills: this.loadedSkills,
418
512
  plan: this.plan,
@@ -448,7 +542,20 @@ export class Session {
448
542
  }
449
543
  };
450
544
  try {
451
- const parsed = matchedServerTool.inputSchema(defCtx).parse(input);
545
+ const coercedInput = {};
546
+ for (const key of Object.keys(input)) {
547
+ const value = input[key];
548
+ if (typeof value === "string" && (value[0] === "[" || value[0] === "{")) {
549
+ try {
550
+ coercedInput[key] = JSON.parse(value);
551
+ } catch {
552
+ coercedInput[key] = value;
553
+ }
554
+ } else {
555
+ coercedInput[key] = value;
556
+ }
557
+ }
558
+ const parsed = matchedServerTool.inputSchema(defCtx).parse(coercedInput);
452
559
  const result = await matchedServerTool.handle(
453
560
  handlerCtx,
454
561
  parsed
@@ -600,6 +707,7 @@ export class Session {
600
707
  } finally {
601
708
  this.isProcessing = false;
602
709
  this.abortController = null;
710
+ this.unprunedMessages = structuredClone(this.messages);
603
711
  pruneMessages(
604
712
  this.messages,
605
713
  KEEP_RECENT_TURNS,
@@ -666,69 +774,44 @@ export class Session {
666
774
  */
667
775
  buildToolMetadataMap() {
668
776
  const map = /* @__PURE__ */ new Map();
669
- for (const tool of [...this.tools, ...this.lazyTools]) {
670
- if (tool.volatile) {
671
- map.set(tool.name, { volatile: true });
777
+ for (const name of [...this.toolNames, ...this.lazyToolNames]) {
778
+ const bundled = this.bundledToolMap.get(name);
779
+ if (bundled?.volatile) {
780
+ map.set(name, { volatile: true });
672
781
  }
673
782
  }
674
783
  return map;
675
784
  }
676
785
  buildTranscript() {
677
- const lines = [];
678
- let systemPrompt = "(No page context available)";
679
- if (this.pageContext) {
680
- const resolvedSkills = resolveSkills(this.pageContext);
681
- const lazyToolSummaries = this.lazyTools.map((t) => ({
682
- name: t.name,
683
- description: t.description
684
- }));
685
- systemPrompt = buildSystemPromptText(
686
- this.pageContext,
687
- resolvedSkills,
688
- lazyToolSummaries,
689
- this.getActivePlanContext()
690
- );
691
- }
692
- lines.push("=".repeat(80));
693
- lines.push("SYSTEM PROMPT");
694
- lines.push("=".repeat(80));
695
- lines.push(systemPrompt);
696
- lines.push("");
697
- if (this.lastProviderTools) {
698
- lines.push("=".repeat(80));
699
- lines.push("TOOLS (exact payload sent to provider)");
700
- lines.push("=".repeat(80));
701
- lines.push(JSON.stringify(this.lastProviderTools, null, 2));
702
- lines.push("");
703
- }
704
- for (const message of this.messages) {
705
- lines.push("=".repeat(80));
706
- lines.push(`${message.role.toUpperCase()}`);
707
- lines.push("=".repeat(80));
708
- if (typeof message.content === "string") {
709
- lines.push(message.content);
710
- } else if (Array.isArray(message.content)) {
711
- for (const block of message.content) {
712
- if (block.type === "text") {
713
- lines.push(block.text);
714
- } else if (block.type === "skill") {
715
- lines.push(`[Skill: ${block.name}]`);
716
- lines.push(block.text);
717
- } else if (block.type === "tool_use") {
718
- lines.push(`[Tool Call: ${block.name}]`);
719
- lines.push(JSON.stringify(block.input, null, 2));
720
- } else if (block.type === "tool_result") {
721
- lines.push(`[Tool Result: ${block.tool_use_id}]`);
722
- try {
723
- lines.push(JSON.stringify(JSON.parse(block.content), null, 2));
724
- } catch {
725
- lines.push(block.content);
726
- }
727
- }
786
+ const system = this.pageContext ? buildSystemPromptEntries(
787
+ this.pageContext,
788
+ resolveSkills(this.pageContext),
789
+ this.lazyToolNames.map((name) => this.getToolSummary(name)).filter(
790
+ (s) => s !== void 0
791
+ ),
792
+ this.getActivePlanContext(),
793
+ this.loadedSkills
794
+ ) : [];
795
+ const messages = this.messages.map((msg, i) => {
796
+ const entry = {
797
+ type: msg.role === "assistant" ? "agent" : "user",
798
+ seen: msg.content
799
+ };
800
+ const unpruned = this.unprunedMessages[i];
801
+ if (unpruned) {
802
+ const seenJson = JSON.stringify(msg.content);
803
+ const fullJson = JSON.stringify(unpruned.content);
804
+ if (seenJson !== fullJson) {
805
+ entry.full = unpruned.content;
728
806
  }
729
807
  }
730
- lines.push("");
731
- }
732
- return lines.join("\n");
808
+ return entry;
809
+ });
810
+ const tools = this.lastTools.map((t) => ({
811
+ name: t.name,
812
+ description: t.description,
813
+ input_schema: t.input_schema
814
+ }));
815
+ return { system, messages, tools };
733
816
  }
734
817
  }
@@ -1,9 +1,12 @@
1
1
  import { Session } from './Session.js';
2
+ import type { ServerToolMetadata } from '../shared/types.js';
2
3
  export declare class SessionManager {
4
+ private toolDefinitions;
3
5
  private sessions;
4
6
  /** Maps used token strings to their embedded timestamp (seconds). */
5
7
  private usedTokens;
6
8
  private pruneTimer;
9
+ constructor(toolDefinitions: ServerToolMetadata[]);
7
10
  create(peerId: string): Session;
8
11
  get(peerId: string): Session | undefined;
9
12
  /**
@@ -3,6 +3,9 @@ import { Session } from "./Session.js";
3
3
  const TOKEN_EXPIRY_SECONDS = 300;
4
4
  const SESSION_IDLE_TIMEOUT_MS = 5 * 60 * 1e3;
5
5
  export class SessionManager {
6
+ constructor(toolDefinitions) {
7
+ this.toolDefinitions = toolDefinitions;
8
+ }
6
9
  sessions = /* @__PURE__ */ new Map();
7
10
  /** Maps used token strings to their embedded timestamp (seconds). */
8
11
  usedTokens = /* @__PURE__ */ new Map();
@@ -11,7 +14,7 @@ export class SessionManager {
11
14
  this.pruneTokens();
12
15
  }, 6e4);
13
16
  create(peerId) {
14
- const session = new Session();
17
+ const session = new Session(this.toolDefinitions);
15
18
  this.sessions.set(peerId, { session, lastActivity: Date.now() });
16
19
  return session;
17
20
  }
@@ -2,7 +2,8 @@ import { defineWebSocketHandler, useRuntimeConfig } from "#imports";
2
2
  import { clientMessageSchema } from "../shared/types.js";
3
3
  import { SessionManager } from "./SessionManager.js";
4
4
  import { send } from "./helpers.js";
5
- const sessionManager = new SessionManager();
5
+ import { toolDefinitions } from "#blokkli-build/agent-server";
6
+ const sessionManager = new SessionManager(toolDefinitions);
6
7
  const config = useRuntimeConfig();
7
8
  const authSecret = config.blokkli?.agent?.authSecret || "";
8
9
  const apiKey = config.blokkli?.agent?.apiKey || "";
@@ -69,7 +70,7 @@ export default defineWebSocketHandler({
69
70
  }
70
71
  switch (data.type) {
71
72
  case "init":
72
- session.init(data.tools, data.pageContext);
73
+ session.init(data.toolNames, data.pageContext);
73
74
  break;
74
75
  case "start":
75
76
  if (!apiKey) {
@@ -1,4 +1,4 @@
1
- import type { PageContext } from '../shared/types.js';
1
+ import type { PageContext, TranscriptSystemPrompt } from '../shared/types.js';
2
2
  import type { ResolvedSkill } from './skills/types.js';
3
3
  import type { ActivePlanContext, SystemPromptBlock } from './system-prompts/types.js';
4
4
  /**
@@ -20,3 +20,11 @@ export declare function buildSystemPromptText(context: PageContext, resolvedSkil
20
20
  name: string;
21
21
  description: string;
22
22
  }[], activePlan?: ActivePlanContext, loadedSkills?: ReadonlySet<string>): string;
23
+ /**
24
+ * Build structured system prompt entries for the transcript.
25
+ * Returns one entry per prompt definition with id, name, and content.
26
+ */
27
+ export declare function buildSystemPromptEntries(context: PageContext, resolvedSkills: ResolvedSkill[], lazyTools?: {
28
+ name: string;
29
+ description: string;
30
+ }[], activePlan?: ActivePlanContext, loadedSkills?: ReadonlySet<string>): TranscriptSystemPrompt[];
@@ -51,3 +51,29 @@ export function buildSystemPromptText(context, resolvedSkills, lazyTools = [], a
51
51
  loadedSkills
52
52
  ).map((b) => b.text).join("\n\n");
53
53
  }
54
+ export function buildSystemPromptEntries(context, resolvedSkills, lazyTools = [], activePlan, loadedSkills = /* @__PURE__ */ new Set()) {
55
+ const promptContext = {
56
+ pageContext: context,
57
+ resolvedSkills,
58
+ lazyTools,
59
+ isDebugMode: !!(import.meta.dev && debugPrompt),
60
+ activePlan,
61
+ loadedSkills
62
+ };
63
+ const sorted = systemPrompts.filter((sp) => !sp.modes?.length || sp.modes.includes(context.editMode)).sort((a, b) => {
64
+ const groupDiff = getCacheGroupOrder(a) - getCacheGroupOrder(b);
65
+ if (groupDiff !== 0) return groupDiff;
66
+ return a.weight - b.weight;
67
+ });
68
+ const entries = [];
69
+ for (const sp of sorted) {
70
+ const text = sp.getPrompt(promptContext)?.trim();
71
+ if (!text) continue;
72
+ entries.push({
73
+ id: sp.id,
74
+ name: sp.title,
75
+ content: text
76
+ });
77
+ }
78
+ return entries;
79
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: import("../skills/index.js").SkillDefinition;
2
+ export default _default;