@blokkli/editor 2.0.0-alpha.31 → 2.0.0-alpha.33
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/global/constants/index.d.ts +1 -0
- package/dist/global/constants/index.js +1 -0
- package/dist/global/types/blockOptions.d.ts +16 -0
- package/dist/global/types/features.d.ts +4 -0
- package/dist/module.d.mts +1 -24
- package/dist/module.json +1 -1
- package/dist/module.mjs +453 -10828
- package/dist/modules/agent/index.d.mts +64 -0
- package/dist/modules/agent/index.mjs +407 -0
- package/dist/modules/agent/runtime/app/composables/agentProvider.d.ts +55 -0
- package/dist/modules/agent/runtime/app/composables/agentProvider.js +875 -0
- package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentPrompt.d.ts +32 -0
- package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentPrompt.js +6 -0
- package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentTool.d.ts +65 -0
- package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentTool.js +6 -0
- package/dist/modules/agent/runtime/app/composables/index.d.ts +4 -0
- package/dist/modules/agent/runtime/app/composables/index.js +2 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Attachment/index.d.vue.ts +12 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Attachment/index.vue +62 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Attachment/index.vue.d.ts +12 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Assistant/index.d.vue.ts +9 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Assistant/index.vue +38 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Assistant/index.vue.d.ts +9 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Error/index.d.vue.ts +14 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Error/index.vue +68 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Error/index.vue.d.ts +14 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/ServerTool/index.d.vue.ts +10 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/ServerTool/index.vue +72 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/ServerTool/index.vue.d.ts +10 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Tool/index.d.vue.ts +13 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Tool/index.vue +37 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Tool/index.vue.d.ts +13 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Unknown/index.d.vue.ts +8 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Unknown/index.vue +17 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Unknown/index.vue.d.ts +8 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/User/index.d.vue.ts +11 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/User/index.vue +29 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/User/index.vue.d.ts +11 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/index.d.vue.ts +12 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/index.vue +30 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/index.vue.d.ts +12 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Thinking/index.d.vue.ts +3 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Thinking/index.vue +14 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Thinking/index.vue.d.ts +3 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/index.d.vue.ts +13 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/index.vue +46 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/index.vue.d.ts +13 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/ConversationList/index.d.vue.ts +15 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/ConversationList/index.vue +50 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/ConversationList/index.vue.d.ts +15 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/DebugGallery/index.d.vue.ts +3 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/DebugGallery/index.vue +160 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/DebugGallery/index.vue.d.ts +3 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/DropdownItem/index.d.vue.ts +12 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/DropdownItem/index.vue +15 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/DropdownItem/index.vue.d.ts +12 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/TokenUsage/index.d.vue.ts +7 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/TokenUsage/index.vue +67 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/TokenUsage/index.vue.d.ts +7 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.d.vue.ts +23 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue +109 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue.d.ts +23 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/index.d.vue.ts +45 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/index.vue +120 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/index.vue.d.ts +45 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/PendingMutation/index.d.vue.ts +15 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/PendingMutation/index.vue +47 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/PendingMutation/index.vue.d.ts +15 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Plan/index.d.vue.ts +14 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Plan/index.vue +55 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Plan/index.vue.d.ts +14 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/ToolCard/index.d.vue.ts +25 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/ToolCard/index.vue +36 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/ToolCard/index.vue.d.ts +25 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/de.md +19 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/en.md +18 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/index.d.vue.ts +10 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/index.vue +44 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/index.vue.d.ts +10 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/index.d.vue.ts +58 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/index.vue +274 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/index.vue.d.ts +58 -0
- package/dist/modules/agent/runtime/app/features/agent/index.d.vue.ts +3 -0
- package/dist/modules/agent/runtime/app/features/agent/index.vue +162 -0
- package/dist/modules/agent/runtime/app/features/agent/index.vue.d.ts +3 -0
- package/dist/modules/agent/runtime/app/features/agent/types.d.ts +58 -0
- package/dist/modules/agent/runtime/app/features/agent/types.js +0 -0
- package/dist/modules/agent/runtime/app/helpers/index.d.ts +55 -0
- package/dist/modules/agent/runtime/app/helpers/index.js +88 -0
- package/dist/modules/agent/runtime/app/helpers/pageStructure.d.ts +5 -0
- package/dist/modules/agent/runtime/app/helpers/pageStructure.js +106 -0
- package/dist/modules/agent/runtime/app/helpers/validation.d.ts +35 -0
- package/dist/modules/agent/runtime/app/helpers/validation.js +77 -0
- package/dist/modules/agent/runtime/app/tools/add_content_search_paragraph/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/add_content_search_paragraph/index.js +69 -0
- package/dist/modules/agent/runtime/app/tools/add_fragment/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/add_fragment/index.js +83 -0
- package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.js +62 -0
- package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.js +289 -0
- package/dist/modules/agent/runtime/app/tools/add_reusable_paragraph/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/add_reusable_paragraph/index.js +76 -0
- package/dist/modules/agent/runtime/app/tools/add_template/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/add_template/index.js +58 -0
- package/dist/modules/agent/runtime/app/tools/ask_question/Component.d.vue.ts +19 -0
- package/dist/modules/agent/runtime/app/tools/ask_question/Component.vue +113 -0
- package/dist/modules/agent/runtime/app/tools/ask_question/Component.vue.d.ts +19 -0
- package/dist/modules/agent/runtime/app/tools/ask_question/index.d.ts +17 -0
- package/dist/modules/agent/runtime/app/tools/ask_question/index.js +54 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/Component.d.vue.ts +29 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/Component.vue +190 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/Component.vue.d.ts +29 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/Item.d.vue.ts +20 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/Item.vue +90 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/Item.vue.d.ts +20 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/index.d.ts +18 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/index.js +55 -0
- package/dist/modules/agent/runtime/app/tools/delete_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/delete_paragraphs/index.js +47 -0
- package/dist/modules/agent/runtime/app/tools/detach_reusable_paragraph/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/detach_reusable_paragraph/index.js +47 -0
- package/dist/modules/agent/runtime/app/tools/duplicate_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/duplicate_paragraphs/index.js +144 -0
- package/dist/modules/agent/runtime/app/tools/find_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/find_paragraphs/index.js +180 -0
- package/dist/modules/agent/runtime/app/tools/get_all_fragments/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_all_fragments/index.js +33 -0
- package/dist/modules/agent/runtime/app/tools/get_all_page_content/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_all_page_content/index.js +93 -0
- package/dist/modules/agent/runtime/app/tools/get_available_bundles/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_available_bundles/index.js +104 -0
- package/dist/modules/agent/runtime/app/tools/get_child_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_child_paragraphs/index.js +108 -0
- package/dist/modules/agent/runtime/app/tools/get_content_fields/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_content_fields/index.js +192 -0
- package/dist/modules/agent/runtime/app/tools/get_mutation_history/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_mutation_history/index.js +102 -0
- package/dist/modules/agent/runtime/app/tools/get_page_structure/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_page_structure/index.js +113 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.js +275 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraph_options/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraph_options/index.js +63 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraphs_in_viewport/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraphs_in_viewport/index.js +180 -0
- package/dist/modules/agent/runtime/app/tools/get_selected_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_selected_paragraphs/index.js +46 -0
- package/dist/modules/agent/runtime/app/tools/go_to_history_index/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/go_to_history_index/index.js +54 -0
- package/dist/modules/agent/runtime/app/tools/move_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/move_paragraphs/index.js +69 -0
- package/dist/modules/agent/runtime/app/tools/rearrange_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/rearrange_paragraphs/index.js +95 -0
- package/dist/modules/agent/runtime/app/tools/replace_content_search_item/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/replace_content_search_item/index.js +80 -0
- package/dist/modules/agent/runtime/app/tools/replace_media_field/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/replace_media_field/index.js +85 -0
- package/dist/modules/agent/runtime/app/tools/schemas.d.ts +128 -0
- package/dist/modules/agent/runtime/app/tools/schemas.js +242 -0
- package/dist/modules/agent/runtime/app/tools/search_content/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/search_content/index.js +65 -0
- package/dist/modules/agent/runtime/app/tools/search_media/index.d.ts +14 -0
- package/dist/modules/agent/runtime/app/tools/search_media/index.js +60 -0
- package/dist/modules/agent/runtime/app/tools/search_reusable_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/search_reusable_paragraphs/index.js +75 -0
- package/dist/modules/agent/runtime/app/tools/search_templates/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/search_templates/index.js +51 -0
- package/dist/modules/agent/runtime/app/tools/search_text/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/search_text/index.js +114 -0
- package/dist/modules/agent/runtime/app/tools/select_media/Component.d.vue.ts +29 -0
- package/dist/modules/agent/runtime/app/tools/select_media/Component.vue +70 -0
- package/dist/modules/agent/runtime/app/tools/select_media/Component.vue.d.ts +29 -0
- package/dist/modules/agent/runtime/app/tools/select_media/index.d.ts +30 -0
- package/dist/modules/agent/runtime/app/tools/select_media/index.js +74 -0
- package/dist/modules/agent/runtime/app/tools/set_paragraph_options/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/set_paragraph_options/index.js +109 -0
- package/dist/modules/agent/runtime/app/tools/swap_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/swap_paragraphs/index.js +74 -0
- package/dist/modules/agent/runtime/app/tools/web_fetch/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/web_fetch/index.js +51 -0
- package/dist/modules/agent/runtime/app/types/index.d.ts +440 -0
- package/dist/modules/agent/runtime/app/types/index.js +51 -0
- package/dist/modules/agent/runtime/server/Session.d.ts +94 -0
- package/dist/modules/agent/runtime/server/Session.js +734 -0
- package/dist/modules/agent/runtime/server/SessionManager.d.ts +21 -0
- package/dist/modules/agent/runtime/server/SessionManager.js +80 -0
- package/dist/modules/agent/runtime/server/agent.d.ts +2 -0
- package/dist/modules/agent/runtime/server/agent.js +148 -0
- package/dist/modules/agent/runtime/server/agentPrompt.d.ts +22 -0
- package/dist/modules/agent/runtime/server/agentPrompt.js +53 -0
- package/dist/modules/agent/runtime/server/default-skills/adding-new-paragraphs.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-skills/adding-new-paragraphs.js +21 -0
- package/dist/modules/agent/runtime/server/default-skills/pageReview.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-skills/pageReview.js +28 -0
- package/dist/modules/agent/runtime/server/default-skills/reusable-paragraphs.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-skills/reusable-paragraphs.js +21 -0
- package/dist/modules/agent/runtime/server/default-skills/rewriteAndTranslate.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-skills/rewriteAndTranslate.js +14 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/architecture.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/architecture.js +39 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/available-skills.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/available-skills.js +18 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/available-tools.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/available-tools.js +18 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/fragments.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/fragments.js +19 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/important-rules.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/important-rules.js +22 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/interaction.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/interaction.js +20 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/introduction.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/introduction.js +14 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/page-context.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/page-context.js +60 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/paragraph-bundles.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/paragraph-bundles.js +37 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/plan-mode.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/plan-mode.js +36 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/security.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/security.js +27 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/workflow.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/workflow.js +22 -0
- package/dist/modules/agent/runtime/server/fetch.d.ts +2 -0
- package/dist/modules/agent/runtime/server/fetch.js +127 -0
- package/dist/modules/agent/runtime/server/helpers.d.ts +77 -0
- package/dist/modules/agent/runtime/server/helpers.js +352 -0
- package/dist/modules/agent/runtime/server/providers/anthropic.d.ts +12 -0
- package/dist/modules/agent/runtime/server/providers/anthropic.js +128 -0
- package/dist/modules/agent/runtime/server/providers/openai.d.ts +12 -0
- package/dist/modules/agent/runtime/server/providers/openai.js +165 -0
- package/dist/modules/agent/runtime/server/providers/types.d.ts +74 -0
- package/dist/modules/agent/runtime/server/providers/types.js +0 -0
- package/dist/modules/agent/runtime/server/server-tools/complete_plan_step/index.d.ts +3 -0
- package/dist/modules/agent/runtime/server/server-tools/complete_plan_step/index.js +79 -0
- package/dist/modules/agent/runtime/server/server-tools/create_plan/index.d.ts +9 -0
- package/dist/modules/agent/runtime/server/server-tools/create_plan/index.js +86 -0
- package/dist/modules/agent/runtime/server/server-tools/index.d.ts +86 -0
- package/dist/modules/agent/runtime/server/server-tools/index.js +30 -0
- package/dist/modules/agent/runtime/server/server-tools/load_skill/index.d.ts +7 -0
- package/dist/modules/agent/runtime/server/server-tools/load_skill/index.js +58 -0
- package/dist/modules/agent/runtime/server/server-tools/load_tools/index.d.ts +7 -0
- package/dist/modules/agent/runtime/server/server-tools/load_tools/index.js +43 -0
- package/dist/modules/agent/runtime/server/skills/defineBlokkliAgentSkill.d.ts +23 -0
- package/dist/modules/agent/runtime/server/skills/defineBlokkliAgentSkill.js +3 -0
- package/dist/modules/agent/runtime/server/skills/index.d.ts +2 -0
- package/dist/modules/agent/runtime/server/skills/index.js +1 -0
- package/dist/modules/agent/runtime/server/skills/types.d.ts +45 -0
- package/dist/modules/agent/runtime/server/skills/types.js +0 -0
- package/dist/modules/agent/runtime/server/system-prompts/defineBlokkliAgentSystemPrompt.d.ts +21 -0
- package/dist/modules/agent/runtime/server/system-prompts/defineBlokkliAgentSystemPrompt.js +3 -0
- package/dist/modules/agent/runtime/server/system-prompts/helpers.d.ts +20 -0
- package/dist/modules/agent/runtime/server/system-prompts/helpers.js +41 -0
- package/dist/modules/agent/runtime/server/system-prompts/index.d.ts +2 -0
- package/dist/modules/agent/runtime/server/system-prompts/index.js +1 -0
- package/dist/modules/agent/runtime/server/system-prompts/types.d.ts +49 -0
- package/dist/modules/agent/runtime/server/system-prompts/types.js +0 -0
- package/dist/modules/agent/runtime/shared/placeholders.d.ts +4 -0
- package/dist/modules/agent/runtime/shared/placeholders.js +1 -0
- package/dist/modules/agent/runtime/shared/types.d.ts +426 -0
- package/dist/modules/agent/runtime/shared/types.js +147 -0
- package/dist/modules/drupal/graphql/base/query.pbConfig.graphql +27 -2
- package/dist/modules/drupal/graphql/features/agent.graphql +69 -0
- package/dist/modules/drupal/graphql/features/search.graphql +5 -0
- package/dist/modules/drupal/graphql/features/templates.graphql +36 -2
- package/dist/modules/drupal/graphql/mutations/add_multiple.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/bulk_update_field_values.graphql +15 -0
- package/dist/modules/drupal/graphql/mutations/rearrange.graphql +23 -0
- package/dist/modules/drupal/graphql/mutations/replace_entity_reference.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/swap.graphql +16 -0
- package/dist/modules/drupal/index.d.mts +18 -2
- package/dist/modules/drupal/index.mjs +60 -12
- package/dist/modules/drupal/runtime/adapter/index.js +246 -21
- package/dist/modules/drupal/runtime/components/BlokkliDrupalEditTemplate/index.d.vue.ts +9 -0
- package/dist/modules/drupal/runtime/components/BlokkliDrupalEditTemplate/index.vue +26 -0
- package/dist/modules/drupal/runtime/components/BlokkliDrupalEditTemplate/index.vue.d.ts +9 -0
- package/dist/runtime/components/Blocks/Fragment/index.vue +11 -2
- package/dist/runtime/components/BlokkliItem.vue +3 -1
- package/dist/runtime/composables/defineBlokkli.js +1 -3
- package/dist/runtime/composables/defineBlokkliFeature.d.ts +5 -3
- package/dist/runtime/composables/defineBlokkliFeature.js +2 -1
- package/dist/runtime/composables/defineBlokkliProvider.js +1 -3
- package/dist/runtime/editor/adapter/index.d.ts +45 -4
- package/dist/runtime/editor/adapter/index.js +3 -0
- package/dist/runtime/editor/components/Actions/ItemDropdown.vue +6 -1
- package/dist/runtime/editor/components/Actions/index.vue +4 -1
- package/dist/runtime/editor/components/AddListItem/index.d.vue.ts +9 -1
- package/dist/runtime/editor/components/AddListItem/index.vue +36 -2
- package/dist/runtime/editor/components/AddListItem/index.vue.d.ts +9 -1
- package/dist/runtime/editor/components/AnimationCanvas/index.vue +17 -7
- package/dist/runtime/editor/components/ArtboardTooltip/index.d.vue.ts +3 -1
- package/dist/runtime/editor/components/ArtboardTooltip/index.vue +4 -3
- package/dist/runtime/editor/components/ArtboardTooltip/index.vue.d.ts +3 -1
- package/dist/runtime/editor/components/AutoHeight/index.d.vue.ts +16 -0
- package/dist/runtime/editor/components/AutoHeight/index.vue +32 -0
- package/dist/runtime/editor/components/AutoHeight/index.vue.d.ts +16 -0
- package/dist/runtime/editor/components/BlockPreviewItem/index.d.vue.ts +5 -1
- package/dist/runtime/editor/components/BlockPreviewItem/index.vue +10 -7
- package/dist/runtime/editor/components/BlockPreviewItem/index.vue.d.ts +5 -1
- package/dist/runtime/editor/components/DiffViewer/DiffValue.d.vue.ts +7 -0
- package/dist/runtime/editor/components/DiffViewer/DiffValue.vue +21 -0
- package/dist/runtime/editor/components/DiffViewer/DiffValue.vue.d.ts +7 -0
- package/dist/runtime/editor/components/DiffViewer/State.vue +4 -9
- package/dist/runtime/editor/components/EditProvider.vue +25 -4
- package/dist/runtime/editor/components/FeaturesRenderer/index.vue +26 -8
- package/dist/runtime/editor/components/FlexTextarea/index.d.vue.ts +31 -0
- package/dist/runtime/editor/components/FlexTextarea/index.vue +179 -0
- package/dist/runtime/editor/components/FlexTextarea/index.vue.d.ts +31 -0
- package/dist/runtime/editor/components/Form/Text/index.vue +23 -11
- package/dist/runtime/editor/components/Form/Toggle/index.d.vue.ts +1 -0
- package/dist/runtime/editor/components/Form/Toggle/index.vue +7 -3
- package/dist/runtime/editor/components/Form/Toggle/index.vue.d.ts +1 -0
- package/dist/runtime/editor/components/Icon/index.vue +3 -1
- package/dist/runtime/editor/components/Indicators/index.vue +20 -10
- package/dist/runtime/editor/components/ItemIcon/index.d.vue.ts +3 -0
- package/dist/runtime/editor/components/ItemIcon/index.vue +3 -2
- package/dist/runtime/editor/components/ItemIcon/index.vue.d.ts +3 -0
- package/dist/runtime/editor/components/ItemIconBox/index.vue +4 -1
- package/dist/runtime/editor/components/NestedEditorOverlay/index.d.vue.ts +3 -1
- package/dist/runtime/editor/components/NestedEditorOverlay/index.vue +150 -71
- package/dist/runtime/editor/components/NestedEditorOverlay/index.vue.d.ts +3 -1
- package/dist/runtime/editor/components/PluginConfigForm/index.vue +6 -2
- package/dist/runtime/editor/components/RelativeTime/index.d.vue.ts +3 -2
- package/dist/runtime/editor/components/RelativeTime/index.vue +21 -7
- package/dist/runtime/editor/components/RelativeTime/index.vue.d.ts +3 -2
- package/dist/runtime/editor/components/StatusIcon/index.d.vue.ts +9 -0
- package/dist/runtime/editor/components/StatusIcon/index.vue +31 -0
- package/dist/runtime/editor/components/StatusIcon/index.vue.d.ts +9 -0
- package/dist/runtime/editor/components/SystemRequirements/index.vue +5 -1
- package/dist/runtime/editor/components/Transition/Height.vue +3 -2
- package/dist/runtime/editor/components/Transition/index.d.vue.ts +1 -1
- package/dist/runtime/editor/components/Transition/index.vue +2 -1
- package/dist/runtime/editor/components/Transition/index.vue.d.ts +1 -1
- package/dist/runtime/editor/components/index.d.ts +10 -6
- package/dist/runtime/editor/components/index.js +19 -11
- package/dist/runtime/editor/composables/index.d.ts +2 -0
- package/dist/runtime/editor/composables/index.js +2 -0
- package/dist/runtime/editor/composables/onElementResize.d.ts +3 -0
- package/dist/runtime/editor/composables/onElementResize.js +37 -0
- package/dist/runtime/editor/composables/useEditableFieldOverride.d.ts +24 -0
- package/dist/runtime/editor/composables/useEditableFieldOverride.js +130 -0
- package/dist/runtime/editor/composables/useStickyToolbar.d.ts +4 -3
- package/dist/runtime/editor/composables/useStickyToolbar.js +26 -10
- package/dist/runtime/editor/css/output.css +1 -1
- package/dist/runtime/editor/events/index.d.ts +31 -0
- package/dist/runtime/editor/features/add-list/Actions/Action.d.vue.ts +8 -1
- package/dist/runtime/editor/features/add-list/Actions/Action.vue +7 -1
- package/dist/runtime/editor/features/add-list/Actions/Action.vue.d.ts +8 -1
- package/dist/runtime/editor/features/add-list/Actions/index.d.vue.ts +11 -1
- package/dist/runtime/editor/features/add-list/Actions/index.vue +30 -10
- package/dist/runtime/editor/features/add-list/Actions/index.vue.d.ts +11 -1
- package/dist/runtime/editor/features/add-list/Blocks/index.d.vue.ts +11 -2
- package/dist/runtime/editor/features/add-list/Blocks/index.vue +27 -1
- package/dist/runtime/editor/features/add-list/Blocks/index.vue.d.ts +11 -2
- package/dist/runtime/editor/features/add-list/Help/Item.d.vue.ts +12 -0
- package/dist/runtime/editor/features/add-list/Help/Item.vue +186 -0
- package/dist/runtime/editor/features/add-list/Help/Item.vue.d.ts +12 -0
- package/dist/runtime/editor/features/add-list/Help/index.d.vue.ts +13 -0
- package/dist/runtime/editor/features/add-list/Help/index.vue +127 -0
- package/dist/runtime/editor/features/add-list/Help/index.vue.d.ts +13 -0
- package/dist/runtime/editor/features/add-list/docs.md +2 -2
- package/dist/runtime/editor/features/add-list/index.vue +108 -9
- package/dist/runtime/editor/features/add-list/types.d.ts +5 -0
- package/dist/runtime/editor/features/analyze/Main.vue +4 -1
- package/dist/runtime/editor/features/analyze/Summary/Chart.vue +9 -9
- package/dist/runtime/editor/features/analyze/index.vue +2 -14
- package/dist/runtime/editor/features/analyze/types.d.ts +4 -1
- package/dist/runtime/editor/features/artboard/Renderer.vue +43 -0
- package/dist/runtime/editor/features/assistant/docs.md +5 -5
- package/dist/runtime/editor/features/breadcrumbs/index.vue +4 -1
- package/dist/runtime/editor/features/clipboard/index.vue +6 -2
- package/dist/runtime/editor/features/comments/index.vue +1 -0
- package/dist/runtime/editor/features/comments/types.d.ts +6 -0
- package/dist/runtime/editor/features/dragging-overlay/DragItems/DragItem.d.vue.ts +1 -0
- package/dist/runtime/editor/features/dragging-overlay/DragItems/DragItem.vue +6 -31
- package/dist/runtime/editor/features/dragging-overlay/DragItems/DragItem.vue.d.ts +1 -0
- package/dist/runtime/editor/features/dragging-overlay/DragItems/index.d.vue.ts +2 -1
- package/dist/runtime/editor/features/dragging-overlay/DragItems/index.vue +42 -18
- package/dist/runtime/editor/features/dragging-overlay/DragItems/index.vue.d.ts +2 -1
- package/dist/runtime/editor/features/dragging-overlay/Renderer/fragment.glsl +77 -2
- package/dist/runtime/editor/features/dragging-overlay/Renderer/index.d.vue.ts +1 -0
- package/dist/runtime/editor/features/dragging-overlay/Renderer/index.vue +143 -52
- package/dist/runtime/editor/features/dragging-overlay/Renderer/index.vue.d.ts +1 -0
- package/dist/runtime/editor/features/dragging-overlay/Renderer/vertex.glsl +84 -31
- package/dist/runtime/editor/features/dragging-overlay/index.vue +3 -2
- package/dist/runtime/editor/features/edit/index.vue +7 -1
- package/dist/runtime/editor/features/editable-field/Overlay/Plaintext/index.vue +13 -23
- package/dist/runtime/editor/features/editable-field/Overlay/index.vue +10 -102
- package/dist/runtime/editor/features/editable-field/types.d.ts +12 -2
- package/dist/runtime/editor/features/entity-title/index.vue +7 -7
- package/dist/runtime/editor/features/fragments/index.vue +1 -1
- package/dist/runtime/editor/features/import-existing/Dialog/index.vue +8 -13
- package/dist/runtime/editor/features/library/ReusableDialog/index.vue +6 -1
- package/dist/runtime/editor/features/library/index.vue +14 -5
- package/dist/runtime/editor/features/library/types.d.ts +6 -0
- package/dist/runtime/editor/features/media-library/Library/Item.d.vue.ts +2 -2
- package/dist/runtime/editor/features/media-library/Library/Item.vue +17 -1
- package/dist/runtime/editor/features/media-library/Library/Item.vue.d.ts +2 -2
- package/dist/runtime/editor/features/media-library/Library/index.vue +6 -1
- package/dist/runtime/editor/features/media-library/index.vue +4 -4
- package/dist/runtime/editor/features/options/Form/index.vue +11 -43
- package/dist/runtime/editor/features/ownership/Banner/index.d.vue.ts +6 -3
- package/dist/runtime/editor/features/ownership/Banner/index.vue +10 -1
- package/dist/runtime/editor/features/ownership/Banner/index.vue.d.ts +6 -3
- package/dist/runtime/editor/features/ownership/index.vue +18 -6
- package/dist/runtime/editor/features/ownership/types.d.ts +5 -0
- package/dist/runtime/editor/features/publish/index.vue +5 -1
- package/dist/runtime/editor/features/search/Overlay/index.vue +5 -2
- package/dist/runtime/editor/features/search/index.vue +64 -3
- package/dist/runtime/editor/features/search/types.d.ts +16 -1
- package/dist/runtime/editor/features/selection/AddButtons/Renderer/index.vue +1 -3
- package/dist/runtime/editor/features/selection/AddButtons/index.vue +24 -4
- package/dist/runtime/editor/features/selection/Renderer/index.vue +5 -1
- package/dist/runtime/editor/features/selection/index.vue +5 -1
- package/dist/runtime/editor/features/settings/Dialog/index.vue +3 -1
- package/dist/runtime/editor/features/settings/index.vue +4 -1
- package/dist/runtime/editor/features/templates/CreateDialog/index.vue +21 -2
- package/dist/runtime/editor/features/templates/Dialog/Item/index.d.vue.ts +1 -1
- package/dist/runtime/editor/features/templates/Dialog/Item/index.vue +3 -3
- package/dist/runtime/editor/features/templates/Dialog/Item/index.vue.d.ts +1 -1
- package/dist/runtime/editor/features/templates/Dialog/index.vue +21 -5
- package/dist/runtime/editor/features/templates/ManageDialog/Item.d.vue.ts +8 -0
- package/dist/runtime/editor/features/templates/ManageDialog/Item.vue +147 -0
- package/dist/runtime/editor/features/templates/ManageDialog/Item.vue.d.ts +8 -0
- package/dist/runtime/editor/features/templates/ManageDialog/index.vue +30 -107
- package/dist/runtime/editor/features/templates/index.vue +7 -5
- package/dist/runtime/editor/features/templates/types.d.ts +11 -2
- package/dist/runtime/editor/features/transform/Dialog/index.vue +6 -1
- package/dist/runtime/editor/features/transform/index.vue +25 -20
- package/dist/runtime/editor/features/transform/types.d.ts +6 -4
- package/dist/runtime/editor/features/validations/index.vue +6 -1
- package/dist/runtime/editor/helpers/date/index.d.ts +1 -0
- package/dist/runtime/editor/helpers/date/index.js +3 -0
- package/dist/runtime/editor/helpers/options/index.d.ts +20 -0
- package/dist/runtime/editor/helpers/options/index.js +60 -0
- package/dist/runtime/editor/helpers/webgl/index.d.ts +5 -1
- package/dist/runtime/editor/helpers/webgl/index.js +45 -13
- package/dist/runtime/editor/icons/svg/stars.svg +1 -0
- package/dist/runtime/editor/plugins/Sidebar/Detached/index.d.vue.ts +1 -1
- package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue +13 -10
- package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue.d.ts +1 -1
- package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +3 -1
- package/dist/runtime/editor/plugins/Sidebar/index.vue +14 -2
- package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +3 -1
- package/dist/runtime/editor/providers/adapters.d.ts +33 -0
- package/dist/runtime/editor/providers/adapters.js +88 -0
- package/dist/runtime/editor/providers/animation.js +3 -0
- package/dist/runtime/editor/providers/definition.d.ts +8 -1
- package/dist/runtime/editor/providers/definition.js +7 -3
- package/dist/runtime/editor/providers/dom.d.ts +7 -0
- package/dist/runtime/editor/providers/dom.js +12 -0
- package/dist/runtime/editor/providers/permissions.d.ts +6 -0
- package/dist/runtime/editor/providers/permissions.js +9 -0
- package/dist/runtime/editor/providers/plugin.d.ts +1 -0
- package/dist/runtime/editor/providers/state.js +1 -0
- package/dist/runtime/editor/providers/texts.js +20 -6
- package/dist/runtime/editor/providers/types.d.ts +7 -0
- package/dist/runtime/editor/providers/types.js +4 -0
- package/dist/runtime/editor/providers/ui.d.ts +40 -0
- package/dist/runtime/editor/providers/ui.js +27 -1
- package/dist/runtime/editor/translations/de.json +2738 -0
- package/dist/runtime/editor/translations/fr.json +2738 -0
- package/dist/runtime/editor/translations/gsw_CH.json +2738 -0
- package/dist/runtime/editor/translations/it.json +2738 -0
- package/dist/runtime/editor/types/app.d.ts +9 -2
- package/dist/runtime/editor/types/definitions.d.ts +5 -0
- package/dist/runtime/editor/types/features.d.ts +3 -1
- package/dist/runtime/editor/types/permissions.d.ts +17 -0
- package/dist/runtime/editor/types/permissions.js +0 -0
- package/dist/runtime/helpers/runtimeHelpers/index.d.ts +2 -1
- package/dist/runtime/helpers/runtimeHelpers/index.js +44 -6
- package/dist/runtime/types/index.d.ts +6 -0
- package/dist/shared/editor.CGf7C_0M.mjs +10 -0
- package/dist/shared/editor.DMFfaLVE.mjs +175 -0
- package/dist/shared/{editor.BKQCh70G.d.mts → editor.Iax3GCvt.d.mts} +94 -40
- package/dist/types.d.mts +7 -1
- package/package.json +29 -7
- package/dist/runtime/css/output.css +0 -1
- package/dist/runtime/material-icons/index.d.ts +0 -12
- package/dist/runtime/material-icons/index.js +0 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ToolCard
|
|
3
|
+
v-if="params.requireApproval !== false"
|
|
4
|
+
icon="bk_mdi_edit"
|
|
5
|
+
:title="
|
|
6
|
+
$t('aiAgentBatchRewriteTitle', 'Rewrite @count fields').replace(
|
|
7
|
+
'@count',
|
|
8
|
+
String(items.length)
|
|
9
|
+
)
|
|
10
|
+
"
|
|
11
|
+
@cancel="rejectAll"
|
|
12
|
+
>
|
|
13
|
+
<div
|
|
14
|
+
v-if="!isApplying"
|
|
15
|
+
class="bk-batch-rewrite-list"
|
|
16
|
+
@mouseleave="onMouseLeave"
|
|
17
|
+
>
|
|
18
|
+
<ItemComponent
|
|
19
|
+
v-for="item in items"
|
|
20
|
+
:key="item.id"
|
|
21
|
+
v-model:selected="selected[item.id]"
|
|
22
|
+
v-model:reason="reasons[item.id]"
|
|
23
|
+
:uuid="item.uuid"
|
|
24
|
+
:field-name="item.fieldName"
|
|
25
|
+
:field-label="item.fieldLabel"
|
|
26
|
+
:new-value="item.value"
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<template #actions>
|
|
31
|
+
<button
|
|
32
|
+
class="bk-button bk-is-small bk-is-lime bk-is-fullwidth"
|
|
33
|
+
@click="applySelected"
|
|
34
|
+
>
|
|
35
|
+
<Icon name="bk_mdi_check" />
|
|
36
|
+
<span>{{ applyLabel }}</span>
|
|
37
|
+
</button>
|
|
38
|
+
</template>
|
|
39
|
+
</ToolCard>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script setup>
|
|
43
|
+
import { computed, useBlokkli, ref, reactive, onMounted } from "#imports";
|
|
44
|
+
import { Icon } from "#blokkli/editor/components";
|
|
45
|
+
import ToolCard from "../../features/agent/Panel/ToolCard/index.vue";
|
|
46
|
+
import ItemComponent from "./Item.vue";
|
|
47
|
+
import { itemEntityType } from "#blokkli-build/config";
|
|
48
|
+
const props = defineProps({
|
|
49
|
+
context: { type: null, required: true },
|
|
50
|
+
params: { type: null, required: true }
|
|
51
|
+
});
|
|
52
|
+
const emit = defineEmits(["done"]);
|
|
53
|
+
const {
|
|
54
|
+
$t,
|
|
55
|
+
state,
|
|
56
|
+
blocks,
|
|
57
|
+
context: editorContext,
|
|
58
|
+
types,
|
|
59
|
+
eventBus
|
|
60
|
+
} = useBlokkli();
|
|
61
|
+
const isApplying = ref(false);
|
|
62
|
+
onMounted(() => {
|
|
63
|
+
if (props.params.requireApproval === false) {
|
|
64
|
+
applySelected();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
function resolveFieldLabel(uuid, fieldName) {
|
|
68
|
+
let entityType;
|
|
69
|
+
let bundle;
|
|
70
|
+
if (uuid === editorContext.value.entityUuid) {
|
|
71
|
+
entityType = editorContext.value.entityType;
|
|
72
|
+
bundle = editorContext.value.entityBundle;
|
|
73
|
+
} else {
|
|
74
|
+
const block = blocks.getBlock(uuid);
|
|
75
|
+
if (!block) {
|
|
76
|
+
return fieldName;
|
|
77
|
+
}
|
|
78
|
+
entityType = itemEntityType;
|
|
79
|
+
bundle = block.bundle;
|
|
80
|
+
}
|
|
81
|
+
const config = types.editableFieldConfig.forName(
|
|
82
|
+
entityType,
|
|
83
|
+
bundle,
|
|
84
|
+
fieldName
|
|
85
|
+
);
|
|
86
|
+
return config?.label || fieldName;
|
|
87
|
+
}
|
|
88
|
+
let idCounter = 0;
|
|
89
|
+
const items = Object.entries(props.params.uuids).flatMap(
|
|
90
|
+
([uuid, fields]) => Object.entries(fields).map(([fieldName, value]) => ({
|
|
91
|
+
id: idCounter++,
|
|
92
|
+
uuid,
|
|
93
|
+
fieldName,
|
|
94
|
+
fieldLabel: resolveFieldLabel(uuid, fieldName),
|
|
95
|
+
value
|
|
96
|
+
}))
|
|
97
|
+
);
|
|
98
|
+
const selected = reactive(
|
|
99
|
+
Object.fromEntries(items.map((item) => [item.id, true]))
|
|
100
|
+
);
|
|
101
|
+
const reasons = reactive(
|
|
102
|
+
Object.fromEntries(items.map((item) => [item.id, ""]))
|
|
103
|
+
);
|
|
104
|
+
const selectedCount = computed(
|
|
105
|
+
() => items.filter((item) => selected[item.id]).length
|
|
106
|
+
);
|
|
107
|
+
function onMouseLeave() {
|
|
108
|
+
eventBus.emit("highlight", null);
|
|
109
|
+
}
|
|
110
|
+
async function applySelected() {
|
|
111
|
+
const rejectedByUser = {};
|
|
112
|
+
const entityUuid = editorContext.value.entityUuid;
|
|
113
|
+
const batchItems = [];
|
|
114
|
+
const entityItems = [];
|
|
115
|
+
for (const item of items) {
|
|
116
|
+
if (!selected[item.id]) {
|
|
117
|
+
const fields = rejectedByUser[item.uuid] ?? {};
|
|
118
|
+
fields[item.fieldName] = { reasonForRejection: reasons[item.id] || "" };
|
|
119
|
+
rejectedByUser[item.uuid] = fields;
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (item.uuid === entityUuid) {
|
|
123
|
+
entityItems.push({
|
|
124
|
+
fieldName: item.fieldName,
|
|
125
|
+
fieldValue: item.value
|
|
126
|
+
});
|
|
127
|
+
} else {
|
|
128
|
+
batchItems.push({
|
|
129
|
+
uuid: item.uuid,
|
|
130
|
+
fieldName: item.fieldName,
|
|
131
|
+
fieldValue: item.value
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
isApplying.value = true;
|
|
136
|
+
await state.mutateWithLoadingState(
|
|
137
|
+
() => props.context.adapter.updateFieldValueBatched({
|
|
138
|
+
items: batchItems,
|
|
139
|
+
entityItems
|
|
140
|
+
})
|
|
141
|
+
);
|
|
142
|
+
const acceptedCount = batchItems.length + entityItems.length;
|
|
143
|
+
const label = acceptedCount === items.length ? $t(
|
|
144
|
+
"aiAgentBatchRewriteAllApplied",
|
|
145
|
+
"All @count changes applied"
|
|
146
|
+
).replace("@count", String(acceptedCount)) : $t(
|
|
147
|
+
"aiAgentBatchRewriteSomeApplied",
|
|
148
|
+
"@applied of @total changes applied"
|
|
149
|
+
).replace("@applied", String(acceptedCount)).replace("@total", String(items.length));
|
|
150
|
+
const rejectedWithoutReason = [];
|
|
151
|
+
for (const [uuid, fields] of Object.entries(rejectedByUser)) {
|
|
152
|
+
for (const [fieldName, v] of Object.entries(fields)) {
|
|
153
|
+
if (!v?.reasonForRejection) {
|
|
154
|
+
rejectedWithoutReason.push({ uuid, fieldName });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
let agentMessage;
|
|
159
|
+
if (rejectedWithoutReason.length === 1 || rejectedWithoutReason.length === 2) {
|
|
160
|
+
const fieldList = rejectedWithoutReason.map((r) => `"${r.fieldName}" of paragraph ${r.uuid}`).join(" and ");
|
|
161
|
+
agentMessage = `The user rejected ${fieldList} without a reason. Use the ask_question tool to present the user with 2 or more alternative texts for each rejected field.`;
|
|
162
|
+
} else if (rejectedWithoutReason.length > 2) {
|
|
163
|
+
agentMessage = "Some changes were rejected without a reason. Ask the user what they would like to change instead.";
|
|
164
|
+
}
|
|
165
|
+
emit("done", {
|
|
166
|
+
acceptedCount,
|
|
167
|
+
rejectedByUser,
|
|
168
|
+
label,
|
|
169
|
+
agentMessage,
|
|
170
|
+
historyIndex: state.currentMutationIndex.value
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function rejectAll() {
|
|
174
|
+
const rejectedByUser = {};
|
|
175
|
+
for (const item of items) {
|
|
176
|
+
const fields = rejectedByUser[item.uuid] ?? {};
|
|
177
|
+
fields[item.fieldName] = { reasonForRejection: "" };
|
|
178
|
+
rejectedByUser[item.uuid] = fields;
|
|
179
|
+
}
|
|
180
|
+
emit("done", {
|
|
181
|
+
acceptedCount: 0,
|
|
182
|
+
rejectedByUser,
|
|
183
|
+
label: $t("aiAgentBatchRewriteAllRejected", "All changes rejected"),
|
|
184
|
+
agentMessage: "All changes were rejected by the user. Ask the user what they would like to change instead."
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
const applyLabel = computed(() => {
|
|
188
|
+
return $t("aiAgentBatchRewriteApply", "Apply @count of @total").replace("@count", selectedCount.value.toString()).replace("@total", items.length.toString());
|
|
189
|
+
});
|
|
190
|
+
</script>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { McpToolContext } from '#blokkli/agent/app/types';
|
|
2
|
+
import type { BatchRewriteParams } from './index.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
context: McpToolContext;
|
|
5
|
+
params: BatchRewriteParams;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
|
+
done: (result: {
|
|
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: {
|
|
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,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
uuid: string;
|
|
3
|
+
fieldName: string;
|
|
4
|
+
fieldLabel: string;
|
|
5
|
+
newValue: string;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_ModelProps = {
|
|
8
|
+
'selected'?: boolean;
|
|
9
|
+
'reason'?: string;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
"update:selected": (value: boolean) => any;
|
|
14
|
+
"update:reason": (value: string) => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
16
|
+
"onUpdate:selected"?: ((value: boolean) => any) | undefined;
|
|
17
|
+
"onUpdate:reason"?: ((value: string) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="bk-batch-rewrite-item"
|
|
4
|
+
:class="{ 'bk-is-deselected': !selected }"
|
|
5
|
+
@mouseenter="onMouseEnter"
|
|
6
|
+
>
|
|
7
|
+
<label class="bk-checkbox">
|
|
8
|
+
<input type="checkbox" :checked="selected" @change="onChange" />
|
|
9
|
+
<span>{{ fieldLabel }}</span>
|
|
10
|
+
</label>
|
|
11
|
+
<div class="bk-batch-rewrite-change">
|
|
12
|
+
<div @click.prevent="onChange">
|
|
13
|
+
<DiffValue :before="override.originalValue" :after="newValue" />
|
|
14
|
+
</div>
|
|
15
|
+
<div v-if="!selected" class="bk-batch-rewrite-reason">
|
|
16
|
+
<FlexTextarea
|
|
17
|
+
v-model="reason"
|
|
18
|
+
textarea-class
|
|
19
|
+
:max-height="100"
|
|
20
|
+
:min-height="42"
|
|
21
|
+
:placeholder="
|
|
22
|
+
$t(
|
|
23
|
+
'aiAgentBatchRewriteReasonPlaceholder',
|
|
24
|
+
'Reason for rejection (optional)'
|
|
25
|
+
)
|
|
26
|
+
"
|
|
27
|
+
@click.prevent
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script setup>
|
|
35
|
+
import { watch, onBeforeUnmount, useBlokkli, nextTick } from "#imports";
|
|
36
|
+
import { DiffValue, FlexTextarea } from "#blokkli/editor/components";
|
|
37
|
+
import { useEditableFieldOverride } from "#blokkli/editor/composables";
|
|
38
|
+
import { itemEntityType } from "#blokkli-build/config";
|
|
39
|
+
const props = defineProps({
|
|
40
|
+
uuid: { type: String, required: true },
|
|
41
|
+
fieldName: { type: String, required: true },
|
|
42
|
+
fieldLabel: { type: String, required: true },
|
|
43
|
+
newValue: { type: String, required: true }
|
|
44
|
+
});
|
|
45
|
+
const selected = defineModel("selected", { type: Boolean, ...{ default: false } });
|
|
46
|
+
const reason = defineModel("reason", { type: String, ...{ default: "" } });
|
|
47
|
+
const { blocks, context, eventBus, $t } = useBlokkli();
|
|
48
|
+
function resolveHost() {
|
|
49
|
+
if (props.uuid === context.value.entityUuid) {
|
|
50
|
+
return {
|
|
51
|
+
type: context.value.entityType,
|
|
52
|
+
bundle: context.value.entityBundle,
|
|
53
|
+
uuid: props.uuid
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const block = blocks.getBlock(props.uuid);
|
|
57
|
+
return {
|
|
58
|
+
type: itemEntityType,
|
|
59
|
+
bundle: block?.bundle || "",
|
|
60
|
+
uuid: props.uuid
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const host = resolveHost();
|
|
64
|
+
const override = useEditableFieldOverride(props.fieldName, host);
|
|
65
|
+
function onMouseEnter() {
|
|
66
|
+
if (override.element) {
|
|
67
|
+
eventBus.emit("highlight", override.element);
|
|
68
|
+
eventBus.emit("scrollIntoView", {
|
|
69
|
+
element: override.element,
|
|
70
|
+
immediate: true
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
override.setValue(props.newValue);
|
|
75
|
+
async function onChange() {
|
|
76
|
+
selected.value = !selected.value;
|
|
77
|
+
await nextTick();
|
|
78
|
+
onMouseEnter();
|
|
79
|
+
}
|
|
80
|
+
watch(selected, (isSelected) => {
|
|
81
|
+
if (isSelected) {
|
|
82
|
+
override.setValue(props.newValue);
|
|
83
|
+
} else {
|
|
84
|
+
override.restore();
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
onBeforeUnmount(() => {
|
|
88
|
+
override.restore();
|
|
89
|
+
});
|
|
90
|
+
</script>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
uuid: string;
|
|
3
|
+
fieldName: string;
|
|
4
|
+
fieldLabel: string;
|
|
5
|
+
newValue: string;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_ModelProps = {
|
|
8
|
+
'selected'?: boolean;
|
|
9
|
+
'reason'?: string;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
"update:selected": (value: boolean) => any;
|
|
14
|
+
"update:reason": (value: string) => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
16
|
+
"onUpdate:selected"?: ((value: boolean) => any) | undefined;
|
|
17
|
+
"onUpdate:reason"?: ((value: string) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const paramsSchema: z.ZodObject<{
|
|
3
|
+
uuids: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
4
|
+
requireApproval: z.ZodOptional<z.ZodBoolean>;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
declare const resultSchema: z.ZodObject<{
|
|
7
|
+
acceptedCount: z.ZodNumber;
|
|
8
|
+
rejectedByUser: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
9
|
+
reasonForRejection: z.ZodString;
|
|
10
|
+
}, z.core.$strip>>>;
|
|
11
|
+
label: z.ZodString;
|
|
12
|
+
agentMessage: z.ZodOptional<z.ZodString>;
|
|
13
|
+
historyIndex: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export type BatchRewriteParams = z.infer<typeof paramsSchema>;
|
|
16
|
+
export type BatchRewriteResult = z.infer<typeof resultSchema>;
|
|
17
|
+
declare const _default: any;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
import Component from "./Component.vue";
|
|
4
|
+
const paramsSchema = z.object({
|
|
5
|
+
uuids: z.record(z.string(), z.record(z.string(), z.string())).describe(
|
|
6
|
+
"A map of uuids containing a map of field names to field values."
|
|
7
|
+
),
|
|
8
|
+
requireApproval: z.boolean().optional().describe("Whether to show the approval UI.")
|
|
9
|
+
});
|
|
10
|
+
const resultSchema = z.object({
|
|
11
|
+
acceptedCount: z.number().describe("Number of changes accepted by the user"),
|
|
12
|
+
rejectedByUser: z.record(
|
|
13
|
+
z.string(),
|
|
14
|
+
z.record(
|
|
15
|
+
z.string(),
|
|
16
|
+
z.object({
|
|
17
|
+
reasonForRejection: z.string().describe(
|
|
18
|
+
"Reason provided by the user for rejecting, empty if no reason given"
|
|
19
|
+
)
|
|
20
|
+
})
|
|
21
|
+
)
|
|
22
|
+
).describe(
|
|
23
|
+
"Map of rejected paragraph UUID to field name to rejection details"
|
|
24
|
+
),
|
|
25
|
+
label: z.string().describe("Human-readable summary shown in the UI"),
|
|
26
|
+
agentMessage: z.string().optional().describe(
|
|
27
|
+
"Detailed message for the agent, replaces label in the LLM context"
|
|
28
|
+
),
|
|
29
|
+
historyIndex: z.number().optional().describe("The mutation history index after applying changes")
|
|
30
|
+
});
|
|
31
|
+
export default defineBlokkliAgentTool({
|
|
32
|
+
name: "batch_rewrite_text",
|
|
33
|
+
description: 'Rewrite text content in multiple content fields at once. Set requireApproval to true when the user should confirm the changes first. EXAMPLE: { "uuids": { "<UUID>": { "title": "New title", "text": "New text" } } }',
|
|
34
|
+
category: "mutation",
|
|
35
|
+
prunedSummary: (r) => `${r.acceptedCount || 0} accepted, ${Object.keys(r.rejectedByUser || {}).length} rejected`,
|
|
36
|
+
modes: ["editing", "translating"],
|
|
37
|
+
label($t) {
|
|
38
|
+
return $t("aiAgentBatchRewriteTextRunning", "Rewriting multiple texts...");
|
|
39
|
+
},
|
|
40
|
+
paramsSchema,
|
|
41
|
+
resultSchema,
|
|
42
|
+
requiredAdapterMethods: ["updateFieldValueBatched"],
|
|
43
|
+
component: Component,
|
|
44
|
+
execute(_ctx, params) {
|
|
45
|
+
return params;
|
|
46
|
+
},
|
|
47
|
+
mockParams: () => ({
|
|
48
|
+
uuids: {
|
|
49
|
+
"mock-1": { title: "Updated Title Text" },
|
|
50
|
+
"mock-2": { body: "This is the new body content with some changes." },
|
|
51
|
+
"mock-3": { subtitle: "A fresh subtitle here" }
|
|
52
|
+
},
|
|
53
|
+
requireApproval: true
|
|
54
|
+
})
|
|
55
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
import { mutationResultSchema } from "../schemas.js";
|
|
4
|
+
const paramsSchema = z.object({
|
|
5
|
+
uuids: z.array(z.string()).describe("The UUIDs of the paragraphs to delete")
|
|
6
|
+
});
|
|
7
|
+
export default defineBlokkliAgentTool({
|
|
8
|
+
name: "delete_paragraphs",
|
|
9
|
+
description: "Delete one or more paragraphs from the page. Requires user approval before the paragraphs are actually deleted.",
|
|
10
|
+
category: "mutation",
|
|
11
|
+
prunedSummary: (r) => r.success ? "deleted paragraphs" : "rejected",
|
|
12
|
+
modes: ["editing"],
|
|
13
|
+
label($t) {
|
|
14
|
+
return $t("aiAgentDeleteBlocksRunning", "Deleting blocks...");
|
|
15
|
+
},
|
|
16
|
+
paramsSchema,
|
|
17
|
+
resultSchema: mutationResultSchema,
|
|
18
|
+
requiredAdapterMethods: ["deleteBlocks"],
|
|
19
|
+
execute(ctx, params) {
|
|
20
|
+
const { blocks, types } = ctx.app;
|
|
21
|
+
if (params.uuids.length === 0) {
|
|
22
|
+
return { error: "No paragraph UUIDs provided" };
|
|
23
|
+
}
|
|
24
|
+
const validBlocks = [];
|
|
25
|
+
for (const uuid of params.uuids) {
|
|
26
|
+
const block = blocks.getBlock(uuid);
|
|
27
|
+
if (!block) {
|
|
28
|
+
return { error: `Paragraph not found: ${uuid}` };
|
|
29
|
+
}
|
|
30
|
+
validBlocks.push({ uuid, bundle: block.bundle });
|
|
31
|
+
}
|
|
32
|
+
const { $t } = ctx.app;
|
|
33
|
+
const firstBlock = validBlocks[0];
|
|
34
|
+
const label = validBlocks.length === 1 && firstBlock ? $t("aiAgentDeleteBlockDone", "Deleted @bundle").replace(
|
|
35
|
+
"@bundle",
|
|
36
|
+
types.getBlockLabel(firstBlock.bundle)
|
|
37
|
+
) : $t("aiAgentDeleteBlocksDone", "Deleted @count blocks").replace(
|
|
38
|
+
"@count",
|
|
39
|
+
String(validBlocks.length)
|
|
40
|
+
);
|
|
41
|
+
return {
|
|
42
|
+
type: "delete",
|
|
43
|
+
label,
|
|
44
|
+
apply: (adapter) => adapter.deleteBlocks(params.uuids)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
import { mutationResultSchema } from "../schemas.js";
|
|
4
|
+
import { fromLibraryBlockBundle } from "#blokkli-build/config";
|
|
5
|
+
const paramsSchema = z.object({
|
|
6
|
+
uuids: z.array(z.string()).describe("UUIDs of library paragraphs to detach")
|
|
7
|
+
});
|
|
8
|
+
export default defineBlokkliAgentTool({
|
|
9
|
+
name: "detach_reusable_paragraph",
|
|
10
|
+
description: "Detach one or more library paragraphs to create editable copies. IMPORTANT: The original library paragraph UUIDs will no longer exist after detaching. The result includes newParagraphs containing the UUIDs and bundles of the newly created editable paragraph. Use these new UUIDs for any subsequent operations.",
|
|
11
|
+
category: "mutation",
|
|
12
|
+
prunedSummary: (r) => r.success ? `detached ${r.newParagraphs?.length || 0} paragraphs` : "rejected",
|
|
13
|
+
lazy: true,
|
|
14
|
+
modes: ["editing"],
|
|
15
|
+
label($t) {
|
|
16
|
+
return $t("aiAgentDetachLibraryBlockRunning", "Detaching library block...");
|
|
17
|
+
},
|
|
18
|
+
paramsSchema,
|
|
19
|
+
resultSchema: mutationResultSchema,
|
|
20
|
+
requiredAdapterMethods: ["detachReusableBlock"],
|
|
21
|
+
execute(ctx, params) {
|
|
22
|
+
const { blocks, $t } = ctx.app;
|
|
23
|
+
if (params.uuids.length === 0) {
|
|
24
|
+
return { error: "No paragraph UUIDs provided" };
|
|
25
|
+
}
|
|
26
|
+
for (const uuid of params.uuids) {
|
|
27
|
+
const block = blocks.getBlock(uuid);
|
|
28
|
+
if (!block) {
|
|
29
|
+
return { error: `Paragraph not found: ${uuid}` };
|
|
30
|
+
}
|
|
31
|
+
if (block.bundle !== fromLibraryBlockBundle) {
|
|
32
|
+
return {
|
|
33
|
+
error: `Paragraph ${uuid} is not a library paragraph (bundle: ${block.bundle}). Only ${fromLibraryBlockBundle} paragraphs can be detached.`
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const label = params.uuids.length === 1 ? $t("aiAgentDetachLibraryBlockDone", "Detached library block") : $t(
|
|
38
|
+
"aiAgentDetachLibraryBlocksDone",
|
|
39
|
+
"Detached @count library blocks"
|
|
40
|
+
).replace("@count", String(params.uuids.length));
|
|
41
|
+
return {
|
|
42
|
+
type: "rewrite",
|
|
43
|
+
label,
|
|
44
|
+
apply: (adapter) => adapter.detachReusableBlock({ uuids: params.uuids })
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
import {
|
|
4
|
+
mutationResultSchema,
|
|
5
|
+
parentSchema,
|
|
6
|
+
positionSchema,
|
|
7
|
+
resolvePosition
|
|
8
|
+
} from "../schemas.js";
|
|
9
|
+
import {
|
|
10
|
+
validateBlocksExist,
|
|
11
|
+
validateSameField,
|
|
12
|
+
validateFieldCardinality,
|
|
13
|
+
validateBundlesAllowed
|
|
14
|
+
} from "../../helpers/validation.js";
|
|
15
|
+
import { getFieldKey } from "#blokkli/helpers";
|
|
16
|
+
import { itemEntityType } from "#blokkli-build/config";
|
|
17
|
+
const paramsSchema = z.object({
|
|
18
|
+
uuids: z.array(z.string()).min(1).describe("Paragraph UUIDs to duplicate"),
|
|
19
|
+
parent: parentSchema.optional().describe("Target parent field. If omitted, duplicates in same field."),
|
|
20
|
+
position: positionSchema.describe(
|
|
21
|
+
'Where to place the duplicated paragraphs (only when parent is provided). Defaults to "end".'
|
|
22
|
+
)
|
|
23
|
+
});
|
|
24
|
+
export default defineBlokkliAgentTool({
|
|
25
|
+
name: "duplicate_paragraphs",
|
|
26
|
+
description: "Duplicate one or more paragraphs, with ALL their child paragraphs. Without parent parameter, duplicates in the same field. With parent parameter, duplicates to a different field.",
|
|
27
|
+
category: "mutation",
|
|
28
|
+
prunedSummary: (r) => r.success ? `duplicated ${r.newParagraphs?.length || 0} paragraphs` : "rejected",
|
|
29
|
+
modes: ["editing"],
|
|
30
|
+
lazy: true,
|
|
31
|
+
label($t) {
|
|
32
|
+
return $t("aiAgentDuplicateBlocksRunning", "Duplicating blocks...");
|
|
33
|
+
},
|
|
34
|
+
paramsSchema,
|
|
35
|
+
resultSchema: mutationResultSchema,
|
|
36
|
+
requiredAdapterMethods: ["duplicateBlocks"],
|
|
37
|
+
execute(ctx, params) {
|
|
38
|
+
const { $t, types, context, blocks } = ctx.app;
|
|
39
|
+
const blocksResult = validateBlocksExist(ctx.app, params.uuids);
|
|
40
|
+
if ("error" in blocksResult) return blocksResult;
|
|
41
|
+
if (params.parent) {
|
|
42
|
+
if (!ctx.adapter.pasteExistingBlocks) {
|
|
43
|
+
return {
|
|
44
|
+
error: "Duplicating to another field is not supported by this adapter"
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const isRootEntity = params.parent.uuid === context.value.entityUuid;
|
|
48
|
+
const entityType = isRootEntity ? context.value.entityType : itemEntityType;
|
|
49
|
+
const targetBundle = isRootEntity ? context.value.entityBundle : blocks.getBlock(params.parent.uuid)?.bundle;
|
|
50
|
+
if (!targetBundle) {
|
|
51
|
+
return { error: "Target parent not found." };
|
|
52
|
+
}
|
|
53
|
+
const fieldConfig = types.getFieldConfig(
|
|
54
|
+
entityType,
|
|
55
|
+
targetBundle,
|
|
56
|
+
params.parent.field
|
|
57
|
+
);
|
|
58
|
+
if (!fieldConfig) {
|
|
59
|
+
return {
|
|
60
|
+
error: `Field "${params.parent.field}" not found on target parent.`
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const bundles2 = blocksResult.blocks.map((b) => b.bundle);
|
|
64
|
+
if (fieldConfig.allowedBundles.length) {
|
|
65
|
+
const disallowed = bundles2.filter(
|
|
66
|
+
(b) => !fieldConfig.allowedBundles.includes(b)
|
|
67
|
+
);
|
|
68
|
+
if (disallowed.length > 0) {
|
|
69
|
+
return {
|
|
70
|
+
error: `Bundle(s) "${disallowed.join(", ")}" not allowed in field "${params.parent.field}". Allowed: ${fieldConfig.allowedBundles.join(", ")}`
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const fieldKey = getFieldKey(params.parent.uuid, params.parent.field);
|
|
75
|
+
if (fieldConfig.cardinality !== -1) {
|
|
76
|
+
const currentCount = ctx.app.state.getFieldBlockCount(fieldKey);
|
|
77
|
+
if (currentCount + params.uuids.length > fieldConfig.cardinality) {
|
|
78
|
+
return {
|
|
79
|
+
error: `Field "${params.parent.field}" can only hold ${fieldConfig.cardinality} paragraphs (currently has ${currentCount}, trying to add ${params.uuids.length})`
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const label2 = params.uuids.length === 1 ? $t(
|
|
84
|
+
"aiAgentDuplicateBlockToFieldDone",
|
|
85
|
+
"Duplicated @bundle to @field"
|
|
86
|
+
).replace(
|
|
87
|
+
"@bundle",
|
|
88
|
+
types.getBlockLabel(blocksResult.blocks[0].bundle)
|
|
89
|
+
).replace("@field", params.parent.field) : $t(
|
|
90
|
+
"aiAgentDuplicateBlocksToFieldDone",
|
|
91
|
+
"Duplicated @count blocks to @field"
|
|
92
|
+
).replace("@count", String(params.uuids.length)).replace("@field", params.parent.field);
|
|
93
|
+
const resolved = resolvePosition(
|
|
94
|
+
ctx.app,
|
|
95
|
+
params.parent.uuid,
|
|
96
|
+
params.parent.field,
|
|
97
|
+
params.position
|
|
98
|
+
);
|
|
99
|
+
if ("error" in resolved) return resolved;
|
|
100
|
+
return {
|
|
101
|
+
type: "add",
|
|
102
|
+
label: label2,
|
|
103
|
+
apply: (adapter) => adapter.pasteExistingBlocks({
|
|
104
|
+
uuids: params.uuids,
|
|
105
|
+
host: {
|
|
106
|
+
type: params.parent.type,
|
|
107
|
+
uuid: params.parent.uuid,
|
|
108
|
+
fieldName: params.parent.field
|
|
109
|
+
},
|
|
110
|
+
preceedingUuid: resolved.afterUuid
|
|
111
|
+
})
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const fieldResult = validateSameField(blocksResult.blocks);
|
|
115
|
+
if ("error" in fieldResult) return fieldResult;
|
|
116
|
+
const cardinalityResult = validateFieldCardinality(
|
|
117
|
+
ctx.app,
|
|
118
|
+
fieldResult.host,
|
|
119
|
+
fieldResult.fieldKey,
|
|
120
|
+
params.uuids.length
|
|
121
|
+
);
|
|
122
|
+
if (!cardinalityResult.valid) return { error: cardinalityResult.error };
|
|
123
|
+
const bundles = blocksResult.blocks.map((b) => b.bundle);
|
|
124
|
+
const bundlesResult = validateBundlesAllowed(
|
|
125
|
+
ctx.app,
|
|
126
|
+
fieldResult.host,
|
|
127
|
+
bundles
|
|
128
|
+
);
|
|
129
|
+
if (!bundlesResult.valid) return { error: bundlesResult.error };
|
|
130
|
+
const label = params.uuids.length === 1 ? $t("aiAgentDuplicateBlockDone", "Duplicated @bundle").replace(
|
|
131
|
+
"@bundle",
|
|
132
|
+
types.getBlockLabel(blocksResult.blocks[0].bundle)
|
|
133
|
+
) : $t("aiAgentDuplicateBlocksDone", "Duplicated @count blocks").replace(
|
|
134
|
+
"@count",
|
|
135
|
+
String(params.uuids.length)
|
|
136
|
+
);
|
|
137
|
+
return {
|
|
138
|
+
type: "add",
|
|
139
|
+
// duplicating adds blocks
|
|
140
|
+
label,
|
|
141
|
+
apply: (adapter) => adapter.duplicateBlocks(params.uuids)
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
});
|