@blokkli/editor 2.0.0-alpha.59 → 2.0.0-alpha.61
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.
- package/dist/module.json +1 -1
- package/dist/module.mjs +28 -11
- package/dist/modules/agent/index.mjs +2 -5
- package/dist/modules/agent/runtime/app/features/agent/Container.vue +3 -3
- package/dist/modules/agent/runtime/app/features/agent/Panel/index.vue +15 -3
- package/dist/modules/agent/runtime/app/features/agent/index.vue +5 -1
- package/dist/modules/agent/runtime/app/features/agent/types.d.ts +2 -1
- package/dist/modules/agent/runtime/app/helpers/mutationResult.d.ts +38 -0
- package/dist/modules/agent/runtime/app/helpers/mutationResult.js +49 -0
- package/dist/modules/agent/runtime/app/prompts/fixReadability.js +3 -3
- package/dist/modules/agent/runtime/app/providers/agentProvider.d.ts +2 -1
- package/dist/modules/agent/runtime/app/providers/agentProvider.js +6 -6
- package/dist/modules/agent/runtime/app/providers/toolsProvider.js +3 -13
- package/dist/modules/agent/runtime/app/tools/add_content_search_paragraphs/index.d.ts +25 -0
- package/dist/modules/agent/runtime/app/tools/add_content_search_paragraphs/index.js +3 -2
- package/dist/modules/agent/runtime/app/tools/add_fragment/index.d.ts +22 -0
- package/dist/modules/agent/runtime/app/tools/add_fragment/index.js +3 -2
- package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.d.ts +24 -0
- package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.js +3 -2
- package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.d.ts +32 -0
- package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.js +6 -4
- package/dist/modules/agent/runtime/app/tools/add_reusable_paragraph/index.d.ts +22 -0
- package/dist/modules/agent/runtime/app/tools/add_reusable_paragraph/index.js +3 -2
- package/dist/modules/agent/runtime/app/tools/add_template/index.d.ts +22 -0
- package/dist/modules/agent/runtime/app/tools/add_template/index.js +5 -3
- package/dist/modules/agent/runtime/app/tools/ask_question/index.d.ts +3 -3
- package/dist/modules/agent/runtime/app/tools/ask_question/index.js +7 -6
- package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/Component.d.vue.ts +29 -0
- package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/Component.vue +172 -0
- package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/Component.vue.d.ts +29 -0
- package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/index.d.ts +28 -0
- package/dist/modules/agent/runtime/app/tools/auto_translate_paragraphs/index.js +80 -0
- package/dist/modules/agent/runtime/app/tools/check_readability_for_texts/index.d.ts +17 -0
- package/dist/modules/agent/runtime/app/tools/check_readability_for_texts/index.js +2 -2
- package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Component.vue +16 -0
- package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/index.d.ts +10 -1
- package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/index.js +3 -2
- package/dist/modules/agent/runtime/app/tools/delete_paragraphs/index.d.ts +16 -0
- package/dist/modules/agent/runtime/app/tools/delete_paragraphs/index.js +3 -2
- package/dist/modules/agent/runtime/app/tools/detach_reusable_paragraph/index.d.ts +16 -0
- package/dist/modules/agent/runtime/app/tools/detach_reusable_paragraph/index.js +3 -2
- package/dist/modules/agent/runtime/app/tools/duplicate_paragraphs/index.d.ts +22 -0
- package/dist/modules/agent/runtime/app/tools/duplicate_paragraphs/index.js +5 -3
- package/dist/modules/agent/runtime/app/tools/find_paragraphs/index.d.ts +31 -0
- package/dist/modules/agent/runtime/app/tools/find_paragraphs/index.js +7 -7
- package/dist/modules/agent/runtime/app/tools/get_all_fragments/index.d.ts +7 -0
- package/dist/modules/agent/runtime/app/tools/get_all_fragments/index.js +2 -2
- package/dist/modules/agent/runtime/app/tools/get_all_page_content/index.d.ts +10 -0
- package/dist/modules/agent/runtime/app/tools/get_all_page_content/index.js +3 -3
- package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.d.ts +35 -0
- package/dist/modules/agent/runtime/app/tools/get_bundle_info/index.js +2 -2
- package/dist/modules/agent/runtime/app/tools/get_child_paragraphs/index.d.ts +20 -0
- package/dist/modules/agent/runtime/app/tools/get_child_paragraphs/index.js +2 -2
- package/dist/modules/agent/runtime/app/tools/get_content_fields/index.d.ts +30 -0
- package/dist/modules/agent/runtime/app/tools/get_content_fields/index.js +15 -11
- package/dist/modules/agent/runtime/app/tools/get_mutation_history/index.d.ts +25 -0
- package/dist/modules/agent/runtime/app/tools/get_mutation_history/index.js +2 -2
- package/dist/modules/agent/runtime/app/tools/get_page_structure/index.d.ts +8 -0
- package/dist/modules/agent/runtime/app/tools/get_page_structure/index.js +2 -2
- package/dist/modules/agent/runtime/app/tools/get_page_text/index.d.ts +8 -0
- package/dist/modules/agent/runtime/app/tools/get_page_text/index.js +65 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.d.ts +81 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.js +20 -12
- package/dist/modules/agent/runtime/app/tools/get_paragraph_options/index.d.ts +14 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraph_options/index.js +2 -2
- package/dist/modules/agent/runtime/app/tools/get_paragraphs_in_viewport/index.d.ts +38 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraphs_in_viewport/index.js +7 -6
- package/dist/modules/agent/runtime/app/tools/get_readability_issues/index.d.ts +12 -0
- package/dist/modules/agent/runtime/app/tools/get_readability_issues/index.js +2 -2
- package/dist/modules/agent/runtime/app/tools/get_referenced_entities/index.d.ts +16 -0
- package/dist/modules/agent/runtime/app/tools/get_referenced_entities/index.js +62 -0
- package/dist/modules/agent/runtime/app/tools/get_selected_paragraphs/index.d.ts +9 -0
- package/dist/modules/agent/runtime/app/tools/get_selected_paragraphs/index.js +2 -2
- package/dist/modules/agent/runtime/app/tools/go_to_history_index/index.d.ts +16 -0
- package/dist/modules/agent/runtime/app/tools/go_to_history_index/index.js +3 -2
- package/dist/modules/agent/runtime/app/tools/helpers.d.ts +8 -2
- package/dist/modules/agent/runtime/app/tools/helpers.js +9 -9
- package/dist/modules/agent/runtime/app/tools/move_paragraphs/index.d.ts +22 -0
- package/dist/modules/agent/runtime/app/tools/move_paragraphs/index.js +3 -2
- package/dist/modules/agent/runtime/app/tools/rearrange_paragraphs/index.d.ts +21 -0
- package/dist/modules/agent/runtime/app/tools/rearrange_paragraphs/index.js +3 -2
- package/dist/modules/agent/runtime/app/tools/replace_content_search_item/index.d.ts +20 -0
- package/dist/modules/agent/runtime/app/tools/replace_content_search_item/index.js +3 -2
- package/dist/modules/agent/runtime/app/tools/replace_media_field/index.d.ts +19 -0
- package/dist/modules/agent/runtime/app/tools/replace_media_field/index.js +3 -2
- package/dist/modules/agent/runtime/app/tools/schemas.d.ts +25 -5
- package/dist/modules/agent/runtime/app/tools/schemas.js +37 -10
- package/dist/modules/agent/runtime/app/tools/search_content/index.d.ts +15 -0
- package/dist/modules/agent/runtime/app/tools/search_content/index.js +8 -7
- package/dist/modules/agent/runtime/app/tools/search_media/index.d.ts +5 -1
- package/dist/modules/agent/runtime/app/tools/search_media/index.js +3 -3
- package/dist/modules/agent/runtime/app/tools/search_reusable_paragraphs/index.d.ts +16 -0
- package/dist/modules/agent/runtime/app/tools/search_reusable_paragraphs/index.js +2 -2
- package/dist/modules/agent/runtime/app/tools/search_templates/index.d.ts +13 -0
- package/dist/modules/agent/runtime/app/tools/search_templates/index.js +2 -2
- package/dist/modules/agent/runtime/app/tools/search_text/index.d.ts +15 -0
- package/dist/modules/agent/runtime/app/tools/search_text/index.js +2 -2
- package/dist/modules/agent/runtime/app/tools/select_media/Component.vue +1 -1
- package/dist/modules/agent/runtime/app/tools/select_media/index.d.ts +2 -2
- package/dist/modules/agent/runtime/app/tools/select_media/index.js +2 -2
- package/dist/modules/agent/runtime/app/tools/set_paragraph_options/index.d.ts +19 -0
- package/dist/modules/agent/runtime/app/tools/set_paragraph_options/index.js +3 -2
- package/dist/modules/agent/runtime/app/tools/swap_paragraphs/index.d.ts +17 -0
- package/dist/modules/agent/runtime/app/tools/swap_paragraphs/index.js +3 -2
- package/dist/modules/agent/runtime/app/tools/update_text_fields/index.d.ts +13 -4
- package/dist/modules/agent/runtime/app/tools/update_text_fields/index.js +8 -7
- package/dist/modules/agent/runtime/app/tools/web_fetch/index.d.ts +17 -0
- package/dist/modules/agent/runtime/app/tools/web_fetch/index.js +2 -2
- package/dist/modules/agent/runtime/app/types/index.d.ts +6 -9
- package/dist/modules/agent/runtime/app/types/index.js +4 -3
- package/dist/modules/agent/runtime/server/agent.js +1 -2
- package/dist/modules/agent/runtime/server/classes/Session/index.d.ts +2 -2
- package/dist/modules/agent/runtime/server/classes/Session/index.js +10 -5
- package/dist/modules/agent/runtime/server/default-system-prompts/important-rules.js +2 -1
- package/dist/modules/agent/runtime/shared/toolParams.d.ts +19 -0
- package/dist/modules/agent/runtime/shared/toolParams.js +6 -0
- package/dist/modules/agent/runtime/shared/toolResult.d.ts +4 -0
- package/dist/modules/agent/runtime/shared/toolResult.js +5 -0
- package/dist/modules/agent/runtime/shared/types.d.ts +23 -4
- package/dist/modules/agent/runtime/shared/types.js +6 -1
- package/dist/modules/charts/runtime/features/charts/Editor/ColorDropdown/index.vue +4 -13
- package/dist/modules/drupal/graphql/features/notifications.graphql +39 -0
- package/dist/modules/drupal/index.mjs +6 -1
- package/dist/modules/drupal/runtime/adapter/index.js +38 -0
- package/dist/runtime/editor/components/Actions/ItemDropdown/Item.vue +0 -1
- package/dist/runtime/editor/components/Actions/ScrollArrow/index.d.vue.ts +13 -0
- package/dist/runtime/editor/components/Actions/ScrollArrow/index.vue +52 -0
- package/dist/runtime/editor/components/Actions/ScrollArrow/index.vue.d.ts +13 -0
- package/dist/runtime/editor/components/Actions/Title/index.vue +9 -8
- package/dist/runtime/editor/components/Actions/index.vue +47 -7
- package/dist/runtime/editor/components/Actions/useToolbarScroll.d.ts +25 -0
- package/dist/runtime/editor/components/Actions/useToolbarScroll.js +125 -0
- package/dist/runtime/editor/components/AddListItem/index.vue +0 -2
- package/dist/runtime/editor/components/AppMenu/MenuButton.vue +1 -3
- package/dist/runtime/editor/components/ArtboardTooltip/index.vue +4 -1
- package/dist/runtime/editor/components/Avatar/index.vue +0 -1
- package/dist/runtime/editor/components/BlockPreviewRenderer/index.d.vue.ts +1 -1
- package/dist/runtime/editor/components/BlockPreviewRenderer/index.vue.d.ts +1 -1
- package/dist/runtime/editor/components/BundleSelector/index.vue +0 -4
- package/dist/runtime/editor/components/Dialog/index.d.vue.ts +2 -2
- package/dist/runtime/editor/components/Dialog/index.vue +1 -3
- package/dist/runtime/editor/components/Dialog/index.vue.d.ts +2 -2
- package/dist/runtime/editor/components/DiffApproval/Highlight/Item.d.vue.ts +8 -0
- package/dist/runtime/editor/components/DiffApproval/Highlight/Item.vue +12 -2
- package/dist/runtime/editor/components/DiffApproval/Highlight/Item.vue.d.ts +8 -0
- package/dist/runtime/editor/components/DiffApproval/Highlight/index.d.vue.ts +8 -0
- package/dist/runtime/editor/components/DiffApproval/Highlight/index.vue +14 -2
- package/dist/runtime/editor/components/DiffApproval/Highlight/index.vue.d.ts +8 -0
- package/dist/runtime/editor/components/DiffApproval/Toolbar/index.d.vue.ts +2 -2
- package/dist/runtime/editor/components/DiffApproval/Toolbar/index.vue +0 -2
- package/dist/runtime/editor/components/DiffApproval/Toolbar/index.vue.d.ts +2 -2
- package/dist/runtime/editor/components/DiffApproval/index.vue +3 -2
- package/dist/runtime/editor/components/Dropdown/index.vue +0 -39
- package/dist/runtime/editor/components/DropdownItem/index.d.vue.ts +12 -2
- package/dist/runtime/editor/components/DropdownItem/index.vue +46 -2
- package/dist/runtime/editor/components/DropdownItem/index.vue.d.ts +12 -2
- package/dist/runtime/editor/components/FlexTextarea/index.d.vue.ts +1 -1
- package/dist/runtime/editor/components/FlexTextarea/index.vue.d.ts +1 -1
- package/dist/runtime/editor/components/Form/Datepicker/index.vue +0 -1
- package/dist/runtime/editor/components/Form/TextDark/index.vue +0 -1
- package/dist/runtime/editor/components/Form/Textarea/index.vue +0 -1
- package/dist/runtime/editor/components/Form/Toggle/index.d.vue.ts +1 -0
- package/dist/runtime/editor/components/Form/Toggle/index.vue +9 -2
- package/dist/runtime/editor/components/Form/Toggle/index.vue.d.ts +1 -0
- package/dist/runtime/editor/components/FormOverlay/index.vue +0 -1
- package/dist/runtime/editor/components/Icon/index.vue +0 -2
- package/dist/runtime/editor/components/Messages/Item/index.vue +4 -1
- package/dist/runtime/editor/components/Messages/index.vue +3 -0
- package/dist/runtime/editor/components/Panel/Sheet/index.vue +1 -1
- package/dist/runtime/editor/components/Popup/index.vue +0 -2
- package/dist/runtime/editor/components/RichText/Editor/index.d.vue.ts +1 -1
- package/dist/runtime/editor/components/RichText/Editor/index.vue.d.ts +1 -1
- package/dist/runtime/editor/components/ScheduleDate/index.vue +1 -3
- package/dist/runtime/editor/components/SearchOverlay/index.d.vue.ts +1 -1
- package/dist/runtime/editor/components/SearchOverlay/index.vue.d.ts +1 -1
- package/dist/runtime/editor/components/Toolbar/ViewOptions/List/Button/index.d.vue.ts +3 -0
- package/dist/runtime/editor/components/Toolbar/ViewOptions/List/Button/index.vue +74 -0
- package/dist/runtime/editor/components/Toolbar/ViewOptions/List/Button/index.vue.d.ts +3 -0
- package/dist/runtime/editor/components/Toolbar/ViewOptions/List/index.d.vue.ts +7 -0
- package/dist/runtime/editor/components/Toolbar/ViewOptions/List/index.vue +16 -0
- package/dist/runtime/editor/components/Toolbar/ViewOptions/List/index.vue.d.ts +7 -0
- package/dist/runtime/editor/components/Toolbar/ViewOptions/index.d.vue.ts +3 -0
- package/dist/runtime/editor/components/Toolbar/ViewOptions/index.vue +57 -0
- package/dist/runtime/editor/components/Toolbar/ViewOptions/index.vue.d.ts +3 -0
- package/dist/runtime/editor/components/Toolbar/index.vue +3 -56
- package/dist/runtime/editor/components/ToolbarDropdown/index.d.vue.ts +21 -0
- package/dist/runtime/editor/components/ToolbarDropdown/index.vue +36 -0
- package/dist/runtime/editor/components/ToolbarDropdown/index.vue.d.ts +21 -0
- package/dist/runtime/editor/components/Tooltip/Context.vue +3 -1
- package/dist/runtime/editor/components/Tooltip/index.d.vue.ts +1 -1
- package/dist/runtime/editor/components/Tooltip/index.vue +4 -1
- package/dist/runtime/editor/components/Tooltip/index.vue.d.ts +1 -1
- package/dist/runtime/editor/components/index.d.ts +1 -0
- package/dist/runtime/editor/components/index.js +1 -0
- package/dist/runtime/editor/composables/defineViewOption.d.ts +5 -0
- package/dist/runtime/editor/composables/defineViewOption.js +10 -0
- package/dist/runtime/editor/composables/index.d.ts +3 -0
- package/dist/runtime/editor/composables/index.js +2 -0
- package/dist/runtime/editor/composables/useDismiss.d.ts +30 -0
- package/dist/runtime/editor/composables/useDismiss.js +43 -0
- package/dist/runtime/editor/composables/useGlobalBlokkliObject.d.ts +3 -3
- package/dist/runtime/editor/css/output.css +1 -1
- package/dist/runtime/editor/events/index.d.ts +23 -0
- package/dist/runtime/editor/features/add-list/Actions/index.vue +0 -1
- package/dist/runtime/editor/features/add-list/Blocks/index.vue +0 -1
- package/dist/runtime/editor/features/add-list/Help/Item.vue +2 -7
- package/dist/runtime/editor/features/add-list/Help/index.vue +1 -1
- package/dist/runtime/editor/features/add-list/index.vue +0 -2
- package/dist/runtime/editor/features/anchors/index.vue +11 -11
- package/dist/runtime/editor/features/anchors/types.d.ts +1 -0
- package/dist/runtime/editor/features/anchors/types.js +1 -0
- package/dist/runtime/editor/features/artboard/Renderer.vue +30 -28
- package/dist/runtime/editor/features/block-scheduler/Dialog/ScheduleSection.vue +0 -3
- package/dist/runtime/editor/features/block-scheduler/index.vue +0 -1
- package/dist/runtime/editor/features/block-transfer/SummaryDialog/index.vue +0 -4
- package/dist/runtime/editor/features/breadcrumbs/Crumb/index.vue +0 -5
- package/dist/runtime/editor/features/changelog/changelog.json +16 -0
- package/dist/runtime/editor/features/command-palette/Palette/Item/index.vue +0 -3
- package/dist/runtime/editor/features/command-palette/Palette/index.vue +0 -1
- package/dist/runtime/editor/features/comments/AddForm/index.vue +0 -1
- package/dist/runtime/editor/features/comments/Comment/Actions/index.vue +0 -4
- package/dist/runtime/editor/features/comments/Comment/index.d.vue.ts +14 -0
- package/dist/runtime/editor/features/comments/Comment/index.vue +29 -8
- package/dist/runtime/editor/features/comments/Comment/index.vue.d.ts +14 -0
- package/dist/runtime/editor/features/comments/CommentInput/index.d.vue.ts +1 -1
- package/dist/runtime/editor/features/comments/CommentInput/index.vue +0 -3
- package/dist/runtime/editor/features/comments/CommentInput/index.vue.d.ts +1 -1
- package/dist/runtime/editor/features/comments/Sidebar/AddForm/index.vue +0 -1
- package/dist/runtime/editor/features/comments/Sidebar/index.d.vue.ts +16 -0
- package/dist/runtime/editor/features/comments/Sidebar/index.vue +13 -8
- package/dist/runtime/editor/features/comments/Sidebar/index.vue.d.ts +16 -0
- package/dist/runtime/editor/features/comments/Thread/ReplyForm/index.vue +0 -1
- package/dist/runtime/editor/features/comments/Thread/index.d.vue.ts +16 -0
- package/dist/runtime/editor/features/comments/Thread/index.vue +26 -6
- package/dist/runtime/editor/features/comments/Thread/index.vue.d.ts +16 -0
- package/dist/runtime/editor/features/comments/index.vue +28 -3
- package/dist/runtime/editor/features/delete/types.d.ts +1 -0
- package/dist/runtime/editor/features/delete/types.js +1 -0
- package/dist/runtime/editor/features/dev-mode/index.vue +17 -15
- package/dist/runtime/editor/features/dragging-overlay/DragItems/index.vue +1 -0
- package/dist/runtime/editor/features/duplicate/types.d.ts +1 -0
- package/dist/runtime/editor/features/duplicate/types.js +1 -0
- package/dist/runtime/editor/features/editable-field/Overlay/Frame/index.vue +0 -2
- package/dist/runtime/editor/features/editable-field/Overlay/Plaintext/index.vue +0 -1
- package/dist/runtime/editor/features/editable-field/Overlay/ReadabilityIndicator/index.vue +0 -5
- package/dist/runtime/editor/features/editable-field/Overlay/index.vue +0 -5
- package/dist/runtime/editor/features/editable-mask/index.vue +21 -20
- package/dist/runtime/editor/features/entity-title/index.vue +0 -4
- package/dist/runtime/editor/features/fragments/Dialog/index.vue +0 -4
- package/dist/runtime/editor/features/grid/index.vue +16 -15
- package/dist/runtime/editor/features/grid/types.d.ts +1 -0
- package/dist/runtime/editor/features/grid/types.js +1 -0
- package/dist/runtime/editor/features/help/Dialog/index.d.vue.ts +7 -0
- package/dist/runtime/editor/features/help/Dialog/index.vue +57 -0
- package/dist/runtime/editor/features/help/Dialog/index.vue.d.ts +7 -0
- package/dist/runtime/editor/features/help/index.vue +52 -47
- package/dist/runtime/editor/features/history/List/index.vue +2 -9
- package/dist/runtime/editor/features/history/types.d.ts +1 -0
- package/dist/runtime/editor/features/history/types.js +1 -0
- package/dist/runtime/editor/features/notifications/Item/index.d.vue.ts +4 -0
- package/dist/runtime/editor/features/notifications/Item/index.vue +96 -0
- package/dist/runtime/editor/features/notifications/Item/index.vue.d.ts +4 -0
- package/dist/runtime/editor/features/notifications/List/index.d.vue.ts +11 -0
- package/dist/runtime/editor/features/notifications/List/index.vue +126 -0
- package/dist/runtime/editor/features/notifications/List/index.vue.d.ts +11 -0
- package/dist/runtime/editor/features/notifications/docs.md +12 -0
- package/dist/runtime/editor/features/notifications/index.d.vue.ts +3 -0
- package/dist/runtime/editor/features/notifications/index.vue +123 -0
- package/dist/runtime/editor/features/notifications/index.vue.d.ts +3 -0
- package/dist/runtime/editor/features/notifications/types.d.ts +132 -0
- package/dist/runtime/editor/features/notifications/types.js +20 -0
- package/dist/runtime/editor/features/options/Form/Checkbox/index.vue +6 -2
- package/dist/runtime/editor/features/options/Form/Checkboxes/index.vue +14 -4
- package/dist/runtime/editor/features/options/Form/Color/index.vue +1 -1
- package/dist/runtime/editor/features/options/Form/ComplexType/index.vue +0 -1
- package/dist/runtime/editor/features/options/Form/DateTimeLocal/index.vue +0 -1
- package/dist/runtime/editor/features/options/Form/Group.vue +3 -1
- package/dist/runtime/editor/features/options/Form/Item.vue +1 -2
- package/dist/runtime/editor/features/options/Form/Number/index.vue +9 -3
- package/dist/runtime/editor/features/options/Form/Radios/index.vue +3 -2
- package/dist/runtime/editor/features/options/Form/Range/index.vue +8 -2
- package/dist/runtime/editor/features/options/Form/Text/index.vue +6 -2
- package/dist/runtime/editor/features/options/index.vue +7 -1
- package/dist/runtime/editor/features/ownership/Banner/index.vue +3 -1
- package/dist/runtime/editor/features/ownership/types.d.ts +1 -0
- package/dist/runtime/editor/features/ownership/types.js +1 -0
- package/dist/runtime/editor/features/preview-grant/types.d.ts +1 -0
- package/dist/runtime/editor/features/preview-grant/types.js +1 -0
- package/dist/runtime/editor/features/proxy-view/index.vue +24 -21
- package/dist/runtime/editor/features/publish/Dialog/PublishOption.vue +0 -2
- package/dist/runtime/editor/features/publish/Dialog/index.vue +1 -2
- package/dist/runtime/editor/features/responsive-preview/Frame/index.vue +0 -1
- package/dist/runtime/editor/features/revert/types.d.ts +1 -0
- package/dist/runtime/editor/features/revert/types.js +1 -0
- package/dist/runtime/editor/features/settings/Dialog/FeatureSetting/index.vue +18 -8
- package/dist/runtime/editor/features/swap/types.d.ts +1 -0
- package/dist/runtime/editor/features/swap/types.js +1 -0
- package/dist/runtime/editor/features/translations/Banner/index.vue +4 -1
- package/dist/runtime/editor/features/translations/CsvDialog/Import/index.vue +4 -1
- package/dist/runtime/editor/features/translations/TranslateDialog/index.vue +7 -2
- package/dist/runtime/editor/plugins/BlockIndicator/index.vue +0 -2
- package/dist/runtime/editor/plugins/ContextMenu/Menu/index.vue +4 -36
- package/dist/runtime/editor/plugins/ItemAction/index.vue +0 -1
- package/dist/runtime/editor/plugins/Sidebar/Detached/index.d.vue.ts +1 -1
- package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue.d.ts +1 -1
- package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +2 -2
- package/dist/runtime/editor/plugins/Sidebar/index.vue +7 -50
- package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +2 -2
- package/dist/runtime/editor/plugins/ToolbarButton/index.d.vue.ts +8 -2
- package/dist/runtime/editor/plugins/ToolbarButton/index.vue +122 -28
- package/dist/runtime/editor/plugins/ToolbarButton/index.vue.d.ts +8 -2
- package/dist/runtime/editor/plugins/index.d.ts +1 -2
- package/dist/runtime/editor/plugins/index.js +1 -3
- package/dist/runtime/editor/providers/fieldValue.js +11 -13
- package/dist/runtime/editor/providers/plugin.d.ts +12 -0
- package/dist/runtime/editor/providers/plugin.js +9 -0
- package/dist/runtime/editor/translations/de.json +53 -19
- package/dist/runtime/editor/translations/fr.json +16 -4
- package/dist/runtime/editor/translations/gsw_CH.json +53 -19
- package/dist/runtime/editor/translations/it.json +16 -4
- package/package.json +6 -6
- package/dist/runtime/editor/plugins/ViewOption/index.d.vue.ts +0 -139
- package/dist/runtime/editor/plugins/ViewOption/index.vue +0 -99
- package/dist/runtime/editor/plugins/ViewOption/index.vue.d.ts +0 -139
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
import { validateFieldCardinality } from "../../helpers/validation.js";
|
|
17
17
|
import { getFieldKey } from "#blokkli/helpers";
|
|
18
18
|
import { optionValueToStorable } from "#blokkli/editor/helpers/options";
|
|
19
|
+
import { countNewParagraphs } from "#blokkli/agent/app/helpers/mutationResult";
|
|
19
20
|
const contentFieldValueSchema = z.union([
|
|
20
21
|
z.string().describe(
|
|
21
22
|
"Text value for plain/markup content fields, or a URL string (starting with http) for link content fields"
|
|
@@ -46,7 +47,7 @@ const blockSchema = z.object({
|
|
|
46
47
|
"Nested child paragraphs keyed by paragraph field name. Recursive \u2014 children can also have children."
|
|
47
48
|
)
|
|
48
49
|
});
|
|
49
|
-
const paramsSchema = z.object({
|
|
50
|
+
export const paramsSchema = z.object({
|
|
50
51
|
paragraphs: z.array(blockSchema).min(1).describe("Array of paragraphs to add, in order"),
|
|
51
52
|
parent: parentSchema.describe("The parent entity to add the paragraphs to"),
|
|
52
53
|
position: positionSchema
|
|
@@ -225,18 +226,19 @@ function collectAllUuids(blocks) {
|
|
|
225
226
|
}
|
|
226
227
|
return uuids;
|
|
227
228
|
}
|
|
229
|
+
export const resultSchema = mutationResultSchema;
|
|
228
230
|
export default defineBlokkliAgentTool({
|
|
229
231
|
name: "add_paragraphs",
|
|
230
|
-
description: "Add one or more new paragraphs to the page. Supports nested structures via the `children` property \u2014 define entire paragraph trees in a single call. IMPORTANT: Always provide content field values (text, media/entity references) directly via contentFields, instead of adding empty paragraphs! For reference content fields (media), set the value to { entityType, entityId } from search_media results. NOTE: You can ONLY provide content fields, NOT paragraph fields! For nested paragraphs, use the `children` property keyed by paragraph field name. You can also set paragraph options inline via the `options` property (key-value pairs).",
|
|
232
|
+
description: "Add one or more new paragraphs to the page. Supports nested structures via the `children` property \u2014 define entire paragraph trees in a single call. IMPORTANT: Always provide content field values (text, media/entity references) directly via contentFields, instead of adding empty paragraphs! For reference content fields (media), set the value to { entityType, entityId } from search_media results. NOTE: You can ONLY provide content fields, NOT paragraph fields! For nested paragraphs, use the `children` property keyed by paragraph field name. You can also set paragraph options inline via the `options` property (key-value pairs). The success result mirrors the input shape: each top-level entry in `newParagraphs` includes its own `children` keyed by paragraph field, so the structure round-trips and a nested child does NOT appear as a sibling \u2014 treat the tree as the source of truth instead of guessing from order.",
|
|
231
233
|
category: "mutation",
|
|
232
234
|
lazy: false,
|
|
233
|
-
prunedSummary: (r) => r.success ? `added ${r.newParagraphs
|
|
235
|
+
prunedSummary: (r) => r.success ? `added ${countNewParagraphs(r.newParagraphs ?? [])} paragraphs` : "rejected",
|
|
234
236
|
modes: ["editing"],
|
|
235
237
|
label($t) {
|
|
236
238
|
return $t("aiAgentAddBlocksRunning", "Adding blocks", { more: true });
|
|
237
239
|
},
|
|
238
240
|
paramsSchema,
|
|
239
|
-
resultSchema
|
|
241
|
+
resultSchema,
|
|
240
242
|
requiredAdapterMethods: ["addNewBlocks"],
|
|
241
243
|
execute(ctx, params) {
|
|
242
244
|
const { types } = ctx.app;
|
|
@@ -1,2 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const paramsSchema: z.ZodObject<{
|
|
3
|
+
libraryItemUuid: z.ZodString;
|
|
4
|
+
parent: z.ZodObject<{
|
|
5
|
+
type: z.ZodString;
|
|
6
|
+
uuid: z.ZodString;
|
|
7
|
+
field: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
position: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare const resultSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
12
|
+
type: z.ZodEnum<{
|
|
13
|
+
rewrite: "rewrite";
|
|
14
|
+
delete: "delete";
|
|
15
|
+
add: "add";
|
|
16
|
+
move: "move";
|
|
17
|
+
options: "options";
|
|
18
|
+
}>;
|
|
19
|
+
label: z.ZodString;
|
|
20
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
21
|
+
error: z.ZodString;
|
|
22
|
+
}, z.core.$strip>]>;
|
|
1
23
|
declare const _default: any;
|
|
2
24
|
export default _default;
|
|
@@ -4,7 +4,7 @@ import { mutationResultSchema, parentSchema, positionSchema } from "../schemas.j
|
|
|
4
4
|
import { resolvePosition, resolveHost } from "../helpers.js";
|
|
5
5
|
import { requireBundlePermission } from "../../helpers/validation.js";
|
|
6
6
|
import { fromLibraryBlockBundle } from "#blokkli-build/config";
|
|
7
|
-
const paramsSchema = z.object({
|
|
7
|
+
export const paramsSchema = z.object({
|
|
8
8
|
libraryItemUuid: z.string().describe(
|
|
9
9
|
"The UUID of the reusable paragraph to add (from search_reusable_paragraphs results)"
|
|
10
10
|
),
|
|
@@ -13,6 +13,7 @@ const paramsSchema = z.object({
|
|
|
13
13
|
),
|
|
14
14
|
position: positionSchema
|
|
15
15
|
});
|
|
16
|
+
export const resultSchema = mutationResultSchema;
|
|
16
17
|
export default defineBlokkliAgentTool({
|
|
17
18
|
name: "add_reusable_paragraph",
|
|
18
19
|
description: "Add a reusable paragraph to the page. Reusable paragraphs stay linked to the original: edits to the paragraph are reflected everywhere it is used. Use search_reusable_paragraphs first to find available paragraphs.",
|
|
@@ -26,7 +27,7 @@ export default defineBlokkliAgentTool({
|
|
|
26
27
|
});
|
|
27
28
|
},
|
|
28
29
|
paramsSchema,
|
|
29
|
-
resultSchema
|
|
30
|
+
resultSchema,
|
|
30
31
|
requiredAdapterMethods: ["addLibraryItem"],
|
|
31
32
|
execute(ctx, params) {
|
|
32
33
|
const denied = requireBundlePermission(
|
|
@@ -1,2 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const paramsSchema: z.ZodObject<{
|
|
3
|
+
templateUuid: z.ZodString;
|
|
4
|
+
parent: z.ZodObject<{
|
|
5
|
+
type: z.ZodString;
|
|
6
|
+
uuid: z.ZodString;
|
|
7
|
+
field: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
position: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare const resultSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
12
|
+
type: z.ZodEnum<{
|
|
13
|
+
rewrite: "rewrite";
|
|
14
|
+
delete: "delete";
|
|
15
|
+
add: "add";
|
|
16
|
+
move: "move";
|
|
17
|
+
options: "options";
|
|
18
|
+
}>;
|
|
19
|
+
label: z.ZodString;
|
|
20
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
21
|
+
error: z.ZodString;
|
|
22
|
+
}, z.core.$strip>]>;
|
|
1
23
|
declare const _default: any;
|
|
2
24
|
export default _default;
|
|
@@ -2,25 +2,27 @@ import { z } from "zod";
|
|
|
2
2
|
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
3
|
import { mutationResultSchema, parentSchema, positionSchema } from "../schemas.js";
|
|
4
4
|
import { resolvePosition } from "../helpers.js";
|
|
5
|
-
|
|
5
|
+
import { countNewParagraphs } from "#blokkli/agent/app/helpers/mutationResult";
|
|
6
|
+
export const paramsSchema = z.object({
|
|
6
7
|
templateUuid: z.string().describe(
|
|
7
8
|
"The UUID of the template to add (from search_templates results)"
|
|
8
9
|
),
|
|
9
10
|
parent: parentSchema.describe("The parent entity to add the template to"),
|
|
10
11
|
position: positionSchema
|
|
11
12
|
});
|
|
13
|
+
export const resultSchema = mutationResultSchema;
|
|
12
14
|
export default defineBlokkliAgentTool({
|
|
13
15
|
name: "add_template",
|
|
14
16
|
description: "Add a template to the page. Templates are copied when added, so changes to the added paragraphs won't affect other pages using the same template.",
|
|
15
17
|
category: "mutation",
|
|
16
|
-
prunedSummary: (r) => r.success ? `added template (${r.newParagraphs
|
|
18
|
+
prunedSummary: (r) => r.success ? `added template (${countNewParagraphs(r.newParagraphs ?? [])} paragraphs)` : "rejected",
|
|
17
19
|
lazy: true,
|
|
18
20
|
modes: ["editing"],
|
|
19
21
|
label($t) {
|
|
20
22
|
return $t("aiAgentAddTemplateRunning", "Adding template", { more: true });
|
|
21
23
|
},
|
|
22
24
|
paramsSchema,
|
|
23
|
-
resultSchema
|
|
25
|
+
resultSchema,
|
|
24
26
|
requiredAdapterMethods: ["templatesAdd"],
|
|
25
27
|
execute(ctx, params) {
|
|
26
28
|
const { fields, $t } = ctx.app;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
declare const paramsSchema: z.ZodObject<{
|
|
2
|
+
export declare const paramsSchema: z.ZodObject<{
|
|
3
3
|
question: z.ZodString;
|
|
4
4
|
options: z.ZodArray<z.ZodObject<{
|
|
5
5
|
value: z.ZodString;
|
|
6
6
|
label: z.ZodString;
|
|
7
7
|
}, z.core.$strip>>;
|
|
8
|
-
multiSelect:
|
|
8
|
+
multiSelect: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodBoolean>>>;
|
|
9
9
|
paragraphUuids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
10
10
|
}, z.core.$strip>;
|
|
11
|
-
declare const resultSchema: z.ZodObject<{
|
|
11
|
+
export declare const resultSchema: z.ZodObject<{
|
|
12
12
|
selected: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
13
13
|
label: z.ZodOptional<z.ZodString>;
|
|
14
14
|
}, z.core.$strip>;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
-
import {
|
|
3
|
+
import { booleanParamWithDefault } from "../../../shared/toolParams.js";
|
|
4
4
|
import Component from "./Component.vue";
|
|
5
5
|
const optionSchema = z.object({
|
|
6
6
|
value: z.string().describe("The option value"),
|
|
7
7
|
label: z.string().describe("The display label")
|
|
8
8
|
});
|
|
9
|
-
const paramsSchema = z.object({
|
|
9
|
+
export const paramsSchema = z.object({
|
|
10
10
|
question: z.string().describe("The question to ask the user"),
|
|
11
11
|
options: z.array(optionSchema).describe("Available options to choose from"),
|
|
12
|
-
multiSelect:
|
|
13
|
-
`Allow selecting multiple options. If false, the user has the option to enter a custom option if none of the options are good
|
|
14
|
-
|
|
12
|
+
multiSelect: booleanParamWithDefault(
|
|
13
|
+
`Allow selecting multiple options. If false, the user has the option to enter a custom option if none of the options are good.`,
|
|
14
|
+
false
|
|
15
|
+
),
|
|
15
16
|
paragraphUuids: z.array(z.string()).optional().describe(
|
|
16
17
|
"Optional UUIDs of paragraphs this question relates to. When provided, these paragraphs will be highlighted on the page."
|
|
17
18
|
)
|
|
18
19
|
});
|
|
19
|
-
const resultSchema = z.object({
|
|
20
|
+
export const resultSchema = z.object({
|
|
20
21
|
selected: z.union([z.string(), z.array(z.string())]).nullable().describe("Selected value(s), or null if cancelled"),
|
|
21
22
|
label: z.string().optional().describe("Human-readable label of what was selected (for UI display)")
|
|
22
23
|
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { McpToolContext } from '#blokkli/agent/app/types';
|
|
2
|
+
import type { ComponentParams } from './index.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
context: McpToolContext;
|
|
5
|
+
params: ComponentParams;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
|
+
done: (result: ComponentToolResult<{
|
|
9
|
+
acceptedCount: number;
|
|
10
|
+
rejectedByUser: Record<string, Record<string, {
|
|
11
|
+
reasonForRejection: string;
|
|
12
|
+
}>>;
|
|
13
|
+
label: string;
|
|
14
|
+
agentMessage?: string | undefined;
|
|
15
|
+
historyIndex?: number | undefined;
|
|
16
|
+
}>) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
|
+
onDone?: ((result: ComponentToolResult<{
|
|
19
|
+
acceptedCount: number;
|
|
20
|
+
rejectedByUser: Record<string, Record<string, {
|
|
21
|
+
reasonForRejection: string;
|
|
22
|
+
}>>;
|
|
23
|
+
label: string;
|
|
24
|
+
agentMessage?: string | undefined;
|
|
25
|
+
historyIndex?: number | undefined;
|
|
26
|
+
}>) => any) | undefined;
|
|
27
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const _default: typeof __VLS_export;
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DiffApproval
|
|
3
|
+
v-if="phase === 'approving' && approvalItems.length > 0"
|
|
4
|
+
:items="approvalItems"
|
|
5
|
+
insertions-only
|
|
6
|
+
show-reason
|
|
7
|
+
@apply="onApply"
|
|
8
|
+
@cancel="onCancel"
|
|
9
|
+
/>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script setup>
|
|
13
|
+
import { useBlokkli, ref, onMounted } from "#imports";
|
|
14
|
+
import { DiffApproval } from "#blokkli/editor/components";
|
|
15
|
+
import {
|
|
16
|
+
skippedFieldsMessage,
|
|
17
|
+
appendAgentNote,
|
|
18
|
+
rejectedWithoutReasonMessage
|
|
19
|
+
} from "../fieldDiffApproval";
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
context: { type: null, required: true },
|
|
22
|
+
params: { type: Object, required: true }
|
|
23
|
+
});
|
|
24
|
+
const emit = defineEmits(["done"]);
|
|
25
|
+
const blokkli = useBlokkli();
|
|
26
|
+
const { $t, state, context: entityContext, types } = blokkli;
|
|
27
|
+
const phase = ref("loading");
|
|
28
|
+
const approvalItems = ref([]);
|
|
29
|
+
const adapter = props.context.adapter;
|
|
30
|
+
const skippedNote = skippedFieldsMessage(props.params.skipped);
|
|
31
|
+
function emitDone(result) {
|
|
32
|
+
emit("done", {
|
|
33
|
+
...result,
|
|
34
|
+
agentMessage: appendAgentNote(result.agentMessage, skippedNote)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function resolveFieldLabel(entityType, bundle, fieldName) {
|
|
38
|
+
const config = types.editableFieldConfig.forName(
|
|
39
|
+
entityType,
|
|
40
|
+
bundle,
|
|
41
|
+
fieldName
|
|
42
|
+
);
|
|
43
|
+
return config?.label || fieldName;
|
|
44
|
+
}
|
|
45
|
+
onMounted(async () => {
|
|
46
|
+
const sourceLanguage = state.translation.value.sourceLanguage || "";
|
|
47
|
+
const targetLanguage = entityContext.value.language;
|
|
48
|
+
if (!sourceLanguage) {
|
|
49
|
+
emitDone({
|
|
50
|
+
acceptedCount: 0,
|
|
51
|
+
rejectedByUser: {},
|
|
52
|
+
label: $t("aiAgentAutoTranslateNoSource", "No source language available"),
|
|
53
|
+
agentMessage: "The host entity has no source language configured, so there is nothing to auto-translate from."
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const requestedUuids = new Set(props.params.uuids);
|
|
58
|
+
const sourceValues = await adapter.loadTextFieldValuesForLanguage(sourceLanguage);
|
|
59
|
+
const toTranslate = sourceValues.filter(
|
|
60
|
+
(v) => requestedUuids.has(v.uuid) && v.value.trim().length > 0
|
|
61
|
+
);
|
|
62
|
+
if (!toTranslate.length) {
|
|
63
|
+
emitDone({
|
|
64
|
+
acceptedCount: 0,
|
|
65
|
+
rejectedByUser: {},
|
|
66
|
+
label: $t("aiAgentAutoTranslateNoFields", "No text fields to translate"),
|
|
67
|
+
agentMessage: "No text fields were found on the requested paragraphs in the source language. Use get_page_structure or get_content_fields to inspect what is editable."
|
|
68
|
+
});
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const byKey = new Map(
|
|
72
|
+
toTranslate.map((v) => [`${v.uuid}:${v.fieldName}`, v])
|
|
73
|
+
);
|
|
74
|
+
const response = await adapter.requestTranslation(
|
|
75
|
+
toTranslate.map((v) => ({
|
|
76
|
+
key: `${v.uuid}:${v.fieldName}`,
|
|
77
|
+
text: v.value,
|
|
78
|
+
isHtml: v.fieldType === "markup",
|
|
79
|
+
sourceLanguage,
|
|
80
|
+
targetLanguage
|
|
81
|
+
}))
|
|
82
|
+
);
|
|
83
|
+
if (!response.success || !response.data.length) {
|
|
84
|
+
emitDone({
|
|
85
|
+
acceptedCount: 0,
|
|
86
|
+
rejectedByUser: {},
|
|
87
|
+
label: $t("aiAgentAutoTranslateFailed", "Translation request failed"),
|
|
88
|
+
agentMessage: 'The backend translation service returned no results. Inform the user \u2014 they may need to retry, or use delegate_text_rewrite with template "translate" instead.'
|
|
89
|
+
});
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
let id = 0;
|
|
93
|
+
approvalItems.value = response.data.map((result) => {
|
|
94
|
+
const separatorIndex = result.key.indexOf(":");
|
|
95
|
+
const uuid = result.key.substring(0, separatorIndex);
|
|
96
|
+
const fieldName = result.key.substring(separatorIndex + 1);
|
|
97
|
+
const source = byKey.get(result.key);
|
|
98
|
+
return {
|
|
99
|
+
id: id++,
|
|
100
|
+
uuid,
|
|
101
|
+
fieldName,
|
|
102
|
+
fieldLabel: source ? resolveFieldLabel(source.entityType, source.entityBundle, fieldName) : fieldName,
|
|
103
|
+
value: result.translatedText
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
phase.value = "approving";
|
|
107
|
+
});
|
|
108
|
+
async function onApply(data) {
|
|
109
|
+
const targetLanguage = entityContext.value.language;
|
|
110
|
+
const items = approvalItems.value;
|
|
111
|
+
const rejectedByUser = {};
|
|
112
|
+
const accepted = [];
|
|
113
|
+
for (const item of items) {
|
|
114
|
+
if (data.selected[item.id]) {
|
|
115
|
+
accepted.push(item);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const fields = rejectedByUser[item.uuid] ?? {};
|
|
119
|
+
fields[item.fieldName] = {
|
|
120
|
+
reasonForRejection: data.reasons[item.id] || ""
|
|
121
|
+
};
|
|
122
|
+
rejectedByUser[item.uuid] = fields;
|
|
123
|
+
}
|
|
124
|
+
if (accepted.length) {
|
|
125
|
+
await state.mutateWithLoadingState(
|
|
126
|
+
() => adapter.importTranslationsBatched({
|
|
127
|
+
items: accepted.map((item) => ({
|
|
128
|
+
langcode: targetLanguage,
|
|
129
|
+
uuid: item.uuid,
|
|
130
|
+
fieldName: item.fieldName,
|
|
131
|
+
fieldValue: item.value
|
|
132
|
+
}))
|
|
133
|
+
})
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
const acceptedCount = accepted.length;
|
|
137
|
+
const label = acceptedCount === items.length ? $t(
|
|
138
|
+
"aiAgentAutoTranslateAllApplied",
|
|
139
|
+
"All @count translations applied"
|
|
140
|
+
).replace("@count", String(acceptedCount)) : $t(
|
|
141
|
+
"aiAgentAutoTranslateSomeApplied",
|
|
142
|
+
"@applied of @total translations applied"
|
|
143
|
+
).replace("@applied", String(acceptedCount)).replace("@total", String(items.length));
|
|
144
|
+
const _details = accepted.map((item) => ({
|
|
145
|
+
fieldLabel: item.fieldLabel,
|
|
146
|
+
before: "",
|
|
147
|
+
after: item.value
|
|
148
|
+
}));
|
|
149
|
+
emitDone({
|
|
150
|
+
acceptedCount,
|
|
151
|
+
rejectedByUser,
|
|
152
|
+
label,
|
|
153
|
+
agentMessage: rejectedWithoutReasonMessage(rejectedByUser),
|
|
154
|
+
historyIndex: state.currentMutationIndex.value,
|
|
155
|
+
_details
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function onCancel() {
|
|
159
|
+
const rejectedByUser = {};
|
|
160
|
+
for (const item of approvalItems.value) {
|
|
161
|
+
const fields = rejectedByUser[item.uuid] ?? {};
|
|
162
|
+
fields[item.fieldName] = { reasonForRejection: "" };
|
|
163
|
+
rejectedByUser[item.uuid] = fields;
|
|
164
|
+
}
|
|
165
|
+
emitDone({
|
|
166
|
+
acceptedCount: 0,
|
|
167
|
+
rejectedByUser,
|
|
168
|
+
label: $t("aiAgentAutoTranslateAllRejected", "All translations rejected"),
|
|
169
|
+
agentMessage: "All translations were rejected by the user. Ask what they would like instead before retrying."
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
</script>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { McpToolContext } from '#blokkli/agent/app/types';
|
|
2
|
+
import type { ComponentParams } from './index.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
context: McpToolContext;
|
|
5
|
+
params: ComponentParams;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
|
+
done: (result: ComponentToolResult<{
|
|
9
|
+
acceptedCount: number;
|
|
10
|
+
rejectedByUser: Record<string, Record<string, {
|
|
11
|
+
reasonForRejection: string;
|
|
12
|
+
}>>;
|
|
13
|
+
label: string;
|
|
14
|
+
agentMessage?: string | undefined;
|
|
15
|
+
historyIndex?: number | undefined;
|
|
16
|
+
}>) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
|
+
onDone?: ((result: ComponentToolResult<{
|
|
19
|
+
acceptedCount: number;
|
|
20
|
+
rejectedByUser: Record<string, Record<string, {
|
|
21
|
+
reasonForRejection: string;
|
|
22
|
+
}>>;
|
|
23
|
+
label: string;
|
|
24
|
+
agentMessage?: string | undefined;
|
|
25
|
+
historyIndex?: number | undefined;
|
|
26
|
+
}>) => any) | undefined;
|
|
27
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const _default: typeof __VLS_export;
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { fieldDiffResultSchema } from '../schemas.js';
|
|
3
|
+
import { type SkippedField } from '../fieldDiffApproval.js';
|
|
4
|
+
export declare const paramsSchema: z.ZodObject<{
|
|
5
|
+
uuids: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodArray<z.ZodString>>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type AutoTranslateParams = z.infer<typeof paramsSchema>;
|
|
8
|
+
export type AutoTranslateResult = z.infer<typeof fieldDiffResultSchema>;
|
|
9
|
+
/**
|
|
10
|
+
* Resolved params handed to the Component after `execute` has validated the
|
|
11
|
+
* UUIDs. `uuids` only contains paragraphs that exist; `skipped` lists the
|
|
12
|
+
* dropped references so the Component can report them back to the agent.
|
|
13
|
+
*/
|
|
14
|
+
export type ComponentParams = {
|
|
15
|
+
uuids: string[];
|
|
16
|
+
skipped: SkippedField[];
|
|
17
|
+
};
|
|
18
|
+
export declare const resultSchema: z.ZodObject<{
|
|
19
|
+
acceptedCount: z.ZodNumber;
|
|
20
|
+
rejectedByUser: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
21
|
+
reasonForRejection: z.ZodString;
|
|
22
|
+
}, z.core.$strip>>>;
|
|
23
|
+
label: z.ZodString;
|
|
24
|
+
agentMessage: z.ZodOptional<z.ZodString>;
|
|
25
|
+
historyIndex: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
declare const _default: any;
|
|
28
|
+
export default _default;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
import {
|
|
4
|
+
requireBundlePermission,
|
|
5
|
+
requireNoRestrictedAncestor
|
|
6
|
+
} from "../../helpers/validation.js";
|
|
7
|
+
import { onlyUnique } from "#blokkli/helpers";
|
|
8
|
+
import { fieldDiffResultSchema, stringArrayParam } from "../schemas.js";
|
|
9
|
+
import { resolveHost } from "../helpers.js";
|
|
10
|
+
import { skippedFieldsMessage } from "../fieldDiffApproval.js";
|
|
11
|
+
import Component from "./Component.vue";
|
|
12
|
+
import DetailsComponent from "../../components/FieldDiffDetails/index.vue";
|
|
13
|
+
export const paramsSchema = z.object({
|
|
14
|
+
uuids: stringArrayParam(
|
|
15
|
+
"UUIDs of paragraphs to auto-translate. Every editable text field on each paragraph is sent to the backend's translation service. The user reviews and accepts/rejects each translation before it is applied. The source language is always the host entity's source language; the target language is the currently-edited language."
|
|
16
|
+
)
|
|
17
|
+
});
|
|
18
|
+
export const resultSchema = fieldDiffResultSchema;
|
|
19
|
+
export default defineBlokkliAgentTool({
|
|
20
|
+
name: "auto_translate_paragraphs",
|
|
21
|
+
description: "Translate every editable text field of one or more paragraphs into the currently-edited language using the backend's configured translation service (e.g. DeepL via Drupal) \u2014 not the agent's own LLM. The user reviews each translation in a diff approval UI before it is applied. Only available in translating mode and only when the adapter exposes a translation service. Prefer this when the user asks for an automatic translation; use `delegate_text_rewrite` with `template: 'translate'` only when the user specifically wants the agent to do the translation, or when no backend translation service is configured.",
|
|
22
|
+
category: "mutation",
|
|
23
|
+
lazy: false,
|
|
24
|
+
modes: ["translating"],
|
|
25
|
+
prunedSummary: (r) => `${r.acceptedCount || 0} accepted, ${Object.keys(r.rejectedByUser || {}).length} rejected`,
|
|
26
|
+
label($t) {
|
|
27
|
+
return $t("aiAgentAutoTranslateRunning", "Auto-translating", {
|
|
28
|
+
more: true
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
paramsSchema,
|
|
32
|
+
resultSchema,
|
|
33
|
+
requiredAdapterMethods: [
|
|
34
|
+
"loadTextFieldValuesForLanguage",
|
|
35
|
+
"requestTranslation",
|
|
36
|
+
"importTranslationsBatched"
|
|
37
|
+
],
|
|
38
|
+
component: Component,
|
|
39
|
+
detailsComponent: DetailsComponent,
|
|
40
|
+
buildDetails: (result) => result,
|
|
41
|
+
execute(ctx, params) {
|
|
42
|
+
if (ctx.app.state.editMode.value !== "translating") {
|
|
43
|
+
return {
|
|
44
|
+
error: "auto_translate_paragraphs is only available when the editor is in translating mode."
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const skipped = [];
|
|
48
|
+
const keptUuids = [];
|
|
49
|
+
for (const uuid of params.uuids) {
|
|
50
|
+
const host = resolveHost(ctx.app, uuid);
|
|
51
|
+
if (!host) {
|
|
52
|
+
skipped.push({ uuid, fieldName: "*", reason: "paragraph not found" });
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
keptUuids.push(uuid);
|
|
56
|
+
}
|
|
57
|
+
if (!keptUuids.length) {
|
|
58
|
+
return {
|
|
59
|
+
error: skippedFieldsMessage(skipped) ?? "No paragraph UUIDs were provided."
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const bundles = keptUuids.map((uuid) => ctx.app.blocks.getBlock(uuid)?.bundle).filter((b) => !!b).filter(onlyUnique);
|
|
63
|
+
if (bundles.length) {
|
|
64
|
+
const denied = requireBundlePermission(ctx.app, bundles, "edit");
|
|
65
|
+
if (denied) return denied;
|
|
66
|
+
}
|
|
67
|
+
const ancestorDenied = requireNoRestrictedAncestor(ctx.app, keptUuids);
|
|
68
|
+
if (ancestorDenied) return ancestorDenied;
|
|
69
|
+
return {
|
|
70
|
+
uuids: keptUuids,
|
|
71
|
+
skipped
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
mockParams: () => ({
|
|
75
|
+
uuids: [
|
|
76
|
+
"4526d2d0-f122-4093-902f-e2f00a433981",
|
|
77
|
+
"9485812c-0ecd-4699-85b2-3a031d47a0a1"
|
|
78
|
+
]
|
|
79
|
+
})
|
|
80
|
+
});
|
|
@@ -1,2 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const paramsSchema: z.ZodObject<{
|
|
3
|
+
texts: z.ZodArray<z.ZodString>;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare const resultSchema: z.ZodObject<{
|
|
6
|
+
results: z.ZodArray<z.ZodObject<{
|
|
7
|
+
text: z.ZodString;
|
|
8
|
+
level: z.ZodEnum<{
|
|
9
|
+
unknown: "unknown";
|
|
10
|
+
ok: "ok";
|
|
11
|
+
good: "good";
|
|
12
|
+
hard: "hard";
|
|
13
|
+
}>;
|
|
14
|
+
score: z.ZodNullable<z.ZodNumber>;
|
|
15
|
+
note: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>>;
|
|
17
|
+
}, z.core.$strip>;
|
|
1
18
|
declare const _default: any;
|
|
2
19
|
export default _default;
|
|
@@ -7,12 +7,12 @@ const textResultSchema = z.object({
|
|
|
7
7
|
score: z.number().nullable(),
|
|
8
8
|
note: z.string().optional()
|
|
9
9
|
});
|
|
10
|
-
const paramsSchema = z.object({
|
|
10
|
+
export const paramsSchema = z.object({
|
|
11
11
|
texts: z.array(z.string()).describe(
|
|
12
12
|
"Text strings to check for readability. Each string is analyzed independently."
|
|
13
13
|
)
|
|
14
14
|
});
|
|
15
|
-
const resultSchema = z.object({
|
|
15
|
+
export const resultSchema = z.object({
|
|
16
16
|
results: z.array(textResultSchema)
|
|
17
17
|
});
|
|
18
18
|
export default defineBlokkliAgentTool({
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
:items="completedItems"
|
|
37
37
|
show-reason
|
|
38
38
|
@apply="applySelected"
|
|
39
|
+
@cancel="rejectAllFromApproval"
|
|
39
40
|
/>
|
|
40
41
|
|
|
41
42
|
<ToolCard
|
|
@@ -154,6 +155,21 @@ function finishWithError() {
|
|
|
154
155
|
_usage: streamUsage.value
|
|
155
156
|
});
|
|
156
157
|
}
|
|
158
|
+
function rejectAllFromApproval() {
|
|
159
|
+
const rejectedByUser = {};
|
|
160
|
+
for (const item of completedItems.value) {
|
|
161
|
+
const fields = rejectedByUser[item.uuid] ?? {};
|
|
162
|
+
fields[item.fieldName] = { reasonForRejection: "" };
|
|
163
|
+
rejectedByUser[item.uuid] = fields;
|
|
164
|
+
}
|
|
165
|
+
emitDone({
|
|
166
|
+
acceptedCount: 0,
|
|
167
|
+
rejectedByUser,
|
|
168
|
+
label: $t("aiAgentDelegateRewriteAllRejected", "All changes rejected"),
|
|
169
|
+
agentMessage: "All proposed changes were rejected by the user. Ask the user what they would like to change instead.",
|
|
170
|
+
_usage: streamUsage.value
|
|
171
|
+
});
|
|
172
|
+
}
|
|
157
173
|
async function applySelected(data) {
|
|
158
174
|
const { selected, reasons } = data;
|
|
159
175
|
const { acceptedCount, rejectedByUser, label } = await applyFieldDiffs(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { fieldDiffResultSchema } from '../schemas.js';
|
|
3
3
|
import { type SkippedField } from '../fieldDiffApproval.js';
|
|
4
|
-
declare const paramsSchema: z.ZodObject<{
|
|
4
|
+
export declare const paramsSchema: z.ZodObject<{
|
|
5
5
|
request: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
6
6
|
template: z.ZodLiteral<"fix_readability">;
|
|
7
7
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -37,5 +37,14 @@ export type ComponentParams = {
|
|
|
37
37
|
/** Field references dropped because the paragraph/field doesn't exist. */
|
|
38
38
|
skipped: SkippedField[];
|
|
39
39
|
};
|
|
40
|
+
export declare const resultSchema: z.ZodObject<{
|
|
41
|
+
acceptedCount: z.ZodNumber;
|
|
42
|
+
rejectedByUser: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
43
|
+
reasonForRejection: z.ZodString;
|
|
44
|
+
}, z.core.$strip>>>;
|
|
45
|
+
label: z.ZodString;
|
|
46
|
+
agentMessage: z.ZodOptional<z.ZodString>;
|
|
47
|
+
historyIndex: z.ZodOptional<z.ZodNumber>;
|
|
48
|
+
}, z.core.$strip>;
|
|
40
49
|
declare const _default: any;
|
|
41
50
|
export default _default;
|
|
@@ -39,10 +39,11 @@ const requestSchema = z.discriminatedUnion("template", [
|
|
|
39
39
|
]).describe(
|
|
40
40
|
"The transform to perform. Pick a template and provide its parameters:\n- fix_readability: fix flagged readability issues (no extra params \u2014 issues are resolved automatically).\n- translate: translate all fields into `targetLanguage`.\n- rewrite: general-purpose rewrite using `instruction`.\n- generate_content: write new content using `instruction` (optional `context`)."
|
|
41
41
|
);
|
|
42
|
-
const paramsSchema = z.object({
|
|
42
|
+
export const paramsSchema = z.object({
|
|
43
43
|
request: requestSchema,
|
|
44
44
|
fields: z.array(fieldSchema).describe("The fields to transform (UUIDs and field names only)")
|
|
45
45
|
});
|
|
46
|
+
export const resultSchema = fieldDiffResultSchema;
|
|
46
47
|
export default defineBlokkliAgentTool({
|
|
47
48
|
name: "delegate_text_rewrite",
|
|
48
49
|
description: "Rewrite, translate, fix readability, or generate text fields with live streaming preview. Set `request` to the chosen template and its parameters (see the request field). The content will be streamed live into the page for immediate visual feedback.",
|
|
@@ -56,7 +57,7 @@ export default defineBlokkliAgentTool({
|
|
|
56
57
|
});
|
|
57
58
|
},
|
|
58
59
|
paramsSchema,
|
|
59
|
-
resultSchema
|
|
60
|
+
resultSchema,
|
|
60
61
|
requiredAdapterMethods: ["updateFieldValueBatched"],
|
|
61
62
|
component: Component,
|
|
62
63
|
detailsComponent: DetailsComponent,
|