@blokkli/editor 2.0.0-alpha.32 → 2.0.0-alpha.34
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/features.d.ts +4 -0
- package/dist/module.d.mts +5 -27
- package/dist/module.json +1 -1
- package/dist/module.mjs +430 -10823
- 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/defineBlokkliFeature.d.ts +5 -3
- package/dist/runtime/composables/defineBlokkliFeature.js +2 -1
- 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/BlockPreviewRenderer/index.d.vue.ts +1 -1
- package/dist/runtime/editor/components/BlockPreviewRenderer/index.vue.d.ts +1 -1
- package/dist/runtime/editor/components/Dialog/index.d.vue.ts +2 -2
- package/dist/runtime/editor/components/Dialog/index.vue.d.ts +2 -2
- 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 +29 -8
- 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/index.d.vue.ts +2 -1
- package/dist/runtime/editor/features/dragging-overlay/DragItems/index.vue +32 -13
- 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 +7 -0
- package/dist/runtime/editor/providers/definition.js +6 -0
- 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/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 +8 -2
- package/package.json +29 -7
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
const paramsSchema = z.object({
|
|
4
|
+
query: z.string().optional().describe("Search text to filter templates")
|
|
5
|
+
});
|
|
6
|
+
const templateSchema = z.object({
|
|
7
|
+
uuid: z.string().describe("The unique UUID of the template"),
|
|
8
|
+
label: z.string().describe("The display label"),
|
|
9
|
+
description: z.string().optional().describe("A short description of the template"),
|
|
10
|
+
itemBundles: z.array(z.string()).describe("Paragraph types contained in the template")
|
|
11
|
+
});
|
|
12
|
+
const resultSchema = z.object({
|
|
13
|
+
templates: z.array(templateSchema).describe("Matching templates"),
|
|
14
|
+
total: z.number().describe("Total number of matching templates")
|
|
15
|
+
});
|
|
16
|
+
export default defineBlokkliAgentTool({
|
|
17
|
+
name: "search_templates",
|
|
18
|
+
description: "Search for available templates. Templates are reusable paragraph collections created by users that can be added to the page.",
|
|
19
|
+
category: "query",
|
|
20
|
+
prunedSummary: (r) => `found ${r.total || 0} templates`,
|
|
21
|
+
modes: ["readonly", "editing", "translating", "review"],
|
|
22
|
+
lazy: true,
|
|
23
|
+
label($t) {
|
|
24
|
+
return $t("aiAgentSearchTemplatesRunning", "Searching templates...");
|
|
25
|
+
},
|
|
26
|
+
paramsSchema,
|
|
27
|
+
resultSchema,
|
|
28
|
+
requiredAdapterMethods: ["templatesSearch"],
|
|
29
|
+
async execute(ctx, params) {
|
|
30
|
+
const { $t } = ctx.app;
|
|
31
|
+
const apiResult = await ctx.adapter.templatesSearch({
|
|
32
|
+
filters: params.query ? { text: params.query } : {},
|
|
33
|
+
page: 0,
|
|
34
|
+
includeItems: false
|
|
35
|
+
});
|
|
36
|
+
const result = {
|
|
37
|
+
templates: apiResult.items.map((item) => ({
|
|
38
|
+
uuid: item.uuid,
|
|
39
|
+
label: item.label,
|
|
40
|
+
description: item.description,
|
|
41
|
+
itemBundles: item.itemBundles
|
|
42
|
+
})),
|
|
43
|
+
total: apiResult.total
|
|
44
|
+
};
|
|
45
|
+
const label = params.query ? $t(
|
|
46
|
+
"aiAgentSearchTemplatesDone",
|
|
47
|
+
"Searched templates for '@query'"
|
|
48
|
+
).replace("@query", params.query) : $t("aiAgentSearchTemplatesAllDone", "Searched all templates");
|
|
49
|
+
return { label, result };
|
|
50
|
+
}
|
|
51
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
const paramsSchema = z.object({
|
|
4
|
+
query: z.string().describe(
|
|
5
|
+
'The text to search for. For regex, use JavaScript regex literal format: /pattern/flags (e.g., "/hello|world/gi" to match either word case-insensitively). Plain text is matched case-insensitively by default.'
|
|
6
|
+
),
|
|
7
|
+
bundle: z.string().optional().describe("Optional: only search in paragraphs of this bundle type"),
|
|
8
|
+
limit: z.number().optional().default(20).describe("Maximum number of results to return (default: 20)")
|
|
9
|
+
});
|
|
10
|
+
const resultSchema = z.object({
|
|
11
|
+
matches: z.array(
|
|
12
|
+
z.object({
|
|
13
|
+
uuid: z.string().describe("The paragraph UUID"),
|
|
14
|
+
bundle: z.string().describe("The paragraph type"),
|
|
15
|
+
matchedText: z.string().describe("The text snippet containing the match"),
|
|
16
|
+
matchCount: z.number().describe("Number of times the query appears in this paragraph")
|
|
17
|
+
})
|
|
18
|
+
),
|
|
19
|
+
totalMatches: z.number().describe("Total number of paragraphs that matched")
|
|
20
|
+
});
|
|
21
|
+
export default defineBlokkliAgentTool({
|
|
22
|
+
name: "search_text",
|
|
23
|
+
description: 'Search for text in paragraph content. Returns paragraphs containing matches with text snippets. Only searches text directly in each paragraph, not in nested child paragraphs. For regex, use /pattern/flags format (e.g., "/hello|world/gi").',
|
|
24
|
+
category: "query",
|
|
25
|
+
volatile: true,
|
|
26
|
+
lazy: true,
|
|
27
|
+
prunedSummary: (r) => `${r.totalMatches || 0} paragraphs matched`,
|
|
28
|
+
modes: ["readonly", "editing", "translating", "review"],
|
|
29
|
+
label($t) {
|
|
30
|
+
return $t("aiAgentSearchTextRunning", "Searching text...");
|
|
31
|
+
},
|
|
32
|
+
paramsSchema,
|
|
33
|
+
resultSchema,
|
|
34
|
+
execute(ctx, params) {
|
|
35
|
+
const { blocks, dom, element, $t } = ctx.app;
|
|
36
|
+
const limit = params.limit ?? 20;
|
|
37
|
+
const regexLiteralMatch = params.query.match(/^\/(.+)\/([gimsuy]*)$/);
|
|
38
|
+
let regex;
|
|
39
|
+
try {
|
|
40
|
+
if (regexLiteralMatch && regexLiteralMatch[1]) {
|
|
41
|
+
const pattern = regexLiteralMatch[1];
|
|
42
|
+
const flags = regexLiteralMatch[2] || "gi";
|
|
43
|
+
regex = new RegExp(pattern, flags);
|
|
44
|
+
} else {
|
|
45
|
+
const escapedQuery = params.query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
46
|
+
regex = new RegExp(escapedQuery, "gi");
|
|
47
|
+
}
|
|
48
|
+
} catch {
|
|
49
|
+
return {
|
|
50
|
+
label: $t("aiAgentSearchTextError", "Invalid regex pattern"),
|
|
51
|
+
result: {
|
|
52
|
+
matches: [],
|
|
53
|
+
totalMatches: 0
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const getBlockOwnText = (el) => {
|
|
58
|
+
if (!el) return "";
|
|
59
|
+
const clone = el.cloneNode(true);
|
|
60
|
+
const nestedBlocks = clone.querySelectorAll("[data-item-bundle]");
|
|
61
|
+
nestedBlocks.forEach((nested) => nested.remove());
|
|
62
|
+
const altTexts = element.queryAll(clone, "img", "searchTextAlt", (img) => {
|
|
63
|
+
if (img instanceof HTMLImageElement) {
|
|
64
|
+
return [img.alt, img.title].filter(Boolean).join(" ");
|
|
65
|
+
}
|
|
66
|
+
}).join(" ");
|
|
67
|
+
return ((clone.textContent ?? "") + " " + altTexts).trim();
|
|
68
|
+
};
|
|
69
|
+
const getSnippet = (text, maxLength = 150) => {
|
|
70
|
+
const searchRegex = new RegExp(regex.source, regex.flags.replace("g", ""));
|
|
71
|
+
const match = text.match(searchRegex);
|
|
72
|
+
if (!match || match.index === void 0) {
|
|
73
|
+
return text.slice(0, maxLength);
|
|
74
|
+
}
|
|
75
|
+
const matchLength = match[0].length;
|
|
76
|
+
const start = Math.max(0, match.index - 50);
|
|
77
|
+
const end = Math.min(text.length, match.index + matchLength + 100);
|
|
78
|
+
let snippet = text.slice(start, end).trim();
|
|
79
|
+
if (start > 0) snippet = "..." + snippet;
|
|
80
|
+
if (end < text.length) snippet = snippet + "...";
|
|
81
|
+
return snippet;
|
|
82
|
+
};
|
|
83
|
+
const allBlocks = blocks.getAllBlocks();
|
|
84
|
+
const matches = [];
|
|
85
|
+
for (const block of allBlocks) {
|
|
86
|
+
if (params.bundle && block.bundle !== params.bundle) continue;
|
|
87
|
+
const el = dom.getDragElement(block);
|
|
88
|
+
const text = getBlockOwnText(el);
|
|
89
|
+
const matchArray = text.match(regex);
|
|
90
|
+
if (matchArray && matchArray.length > 0) {
|
|
91
|
+
matches.push({
|
|
92
|
+
uuid: block.uuid,
|
|
93
|
+
bundle: block.bundle,
|
|
94
|
+
matchedText: getSnippet(text),
|
|
95
|
+
matchCount: matchArray.length
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
matches.sort((a, b) => b.matchCount - a.matchCount);
|
|
100
|
+
const limitedMatches = matches.slice(0, limit);
|
|
101
|
+
const affectedUuids = matches.length === 1 ? [matches[0].uuid] : void 0;
|
|
102
|
+
return {
|
|
103
|
+
label: $t(
|
|
104
|
+
"aiAgentSearchTextDone",
|
|
105
|
+
"Found @count blocks matching '@query'"
|
|
106
|
+
).replace("@count", String(matches.length)).replace("@query", params.query),
|
|
107
|
+
result: {
|
|
108
|
+
matches: limitedMatches,
|
|
109
|
+
totalMatches: matches.length
|
|
110
|
+
},
|
|
111
|
+
affectedUuids
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { McpToolContext } from '#blokkli/agent/app/types';
|
|
2
|
+
import type { SelectMediaParams } from './index.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
context: McpToolContext;
|
|
5
|
+
params: SelectMediaParams;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
|
+
done: (result: {
|
|
9
|
+
selected: {
|
|
10
|
+
mediaId: string;
|
|
11
|
+
label: string;
|
|
12
|
+
mediaBundle: string;
|
|
13
|
+
thumbnail?: string | undefined;
|
|
14
|
+
} | null;
|
|
15
|
+
label?: string | undefined;
|
|
16
|
+
}) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
|
+
onDone?: ((result: {
|
|
19
|
+
selected: {
|
|
20
|
+
mediaId: string;
|
|
21
|
+
label: string;
|
|
22
|
+
mediaBundle: string;
|
|
23
|
+
thumbnail?: string | undefined;
|
|
24
|
+
} | null;
|
|
25
|
+
label?: string | 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,70 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ToolCard
|
|
3
|
+
icon="bk_mdi_image"
|
|
4
|
+
:title="params.prompt || $t('mediaSelectTitle', 'Select a media item')"
|
|
5
|
+
@cancel="cancel"
|
|
6
|
+
>
|
|
7
|
+
<div class="bk-media-select-list">
|
|
8
|
+
<button
|
|
9
|
+
v-for="item in params.items"
|
|
10
|
+
:key="item.mediaId"
|
|
11
|
+
type="button"
|
|
12
|
+
class="bk-media-select-item"
|
|
13
|
+
:class="{ 'bk-is-selected': selectedId === item.mediaId }"
|
|
14
|
+
@click="selectedId = item.mediaId"
|
|
15
|
+
>
|
|
16
|
+
<div class="bk-media-select-thumbnail">
|
|
17
|
+
<img v-if="item.thumbnail" :src="item.thumbnail" :alt="item.label" />
|
|
18
|
+
<Icon v-else name="bk_mdi_image" />
|
|
19
|
+
</div>
|
|
20
|
+
<div class="bk-media-select-label">{{ item.label }}</div>
|
|
21
|
+
</button>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<template #actions>
|
|
25
|
+
<button
|
|
26
|
+
class="bk-button bk-is-small bk-is-lime bk-is-fullwidth"
|
|
27
|
+
:disabled="!selectedId"
|
|
28
|
+
@click="confirm"
|
|
29
|
+
>
|
|
30
|
+
<Icon name="bk_mdi_check" />
|
|
31
|
+
{{ $t("mediaSelectConfirm", "Use selected") }}
|
|
32
|
+
</button>
|
|
33
|
+
</template>
|
|
34
|
+
</ToolCard>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script setup>
|
|
38
|
+
import { ref, useBlokkli } from "#imports";
|
|
39
|
+
import { Icon } from "#blokkli/editor/components";
|
|
40
|
+
import ToolCard from "../../features/agent/Panel/ToolCard/index.vue";
|
|
41
|
+
const props = defineProps({
|
|
42
|
+
context: { type: null, required: true },
|
|
43
|
+
params: { type: null, required: true }
|
|
44
|
+
});
|
|
45
|
+
const emit = defineEmits(["done"]);
|
|
46
|
+
const { $t } = useBlokkli();
|
|
47
|
+
const selectedId = ref(null);
|
|
48
|
+
function getSelectedItem() {
|
|
49
|
+
if (!selectedId.value) return null;
|
|
50
|
+
return props.params.items.find((item) => item.mediaId === selectedId.value) || null;
|
|
51
|
+
}
|
|
52
|
+
function confirm() {
|
|
53
|
+
const item = getSelectedItem();
|
|
54
|
+
if (item) {
|
|
55
|
+
const prompt = props.params.prompt || $t("mediaSelectTitle", "Select a media item");
|
|
56
|
+
emit("done", {
|
|
57
|
+
selected: {
|
|
58
|
+
mediaId: item.mediaId,
|
|
59
|
+
label: item.label,
|
|
60
|
+
mediaBundle: item.mediaBundle,
|
|
61
|
+
thumbnail: item.thumbnail
|
|
62
|
+
},
|
|
63
|
+
label: `${prompt} -> ${item.label}`
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function cancel() {
|
|
68
|
+
emit("done", { selected: null });
|
|
69
|
+
}
|
|
70
|
+
</script>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { McpToolContext } from '#blokkli/agent/app/types';
|
|
2
|
+
import type { SelectMediaParams } from './index.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
context: McpToolContext;
|
|
5
|
+
params: SelectMediaParams;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
|
+
done: (result: {
|
|
9
|
+
selected: {
|
|
10
|
+
mediaId: string;
|
|
11
|
+
label: string;
|
|
12
|
+
mediaBundle: string;
|
|
13
|
+
thumbnail?: string | undefined;
|
|
14
|
+
} | null;
|
|
15
|
+
label?: string | undefined;
|
|
16
|
+
}) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
18
|
+
onDone?: ((result: {
|
|
19
|
+
selected: {
|
|
20
|
+
mediaId: string;
|
|
21
|
+
label: string;
|
|
22
|
+
mediaBundle: string;
|
|
23
|
+
thumbnail?: string | undefined;
|
|
24
|
+
} | null;
|
|
25
|
+
label?: string | 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,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const mediaItemSchema: z.ZodObject<{
|
|
3
|
+
mediaId: z.ZodString;
|
|
4
|
+
label: z.ZodString;
|
|
5
|
+
mediaBundle: z.ZodString;
|
|
6
|
+
thumbnail: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
declare const paramsSchema: z.ZodObject<{
|
|
9
|
+
items: z.ZodArray<z.ZodObject<{
|
|
10
|
+
mediaId: z.ZodString;
|
|
11
|
+
label: z.ZodString;
|
|
12
|
+
mediaBundle: z.ZodString;
|
|
13
|
+
thumbnail: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
declare const resultSchema: z.ZodObject<{
|
|
18
|
+
selected: z.ZodNullable<z.ZodObject<{
|
|
19
|
+
mediaId: z.ZodString;
|
|
20
|
+
label: z.ZodString;
|
|
21
|
+
mediaBundle: z.ZodString;
|
|
22
|
+
thumbnail: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
label: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export type SelectMediaParams = z.infer<typeof paramsSchema>;
|
|
27
|
+
export type SelectMediaResult = z.infer<typeof resultSchema>;
|
|
28
|
+
export type SelectMediaItem = z.infer<typeof mediaItemSchema>;
|
|
29
|
+
declare const _default: any;
|
|
30
|
+
export default _default;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
import Component from "./Component.vue";
|
|
4
|
+
const mediaItemSchema = z.object({
|
|
5
|
+
mediaId: z.string().describe("The unique ID of the media item"),
|
|
6
|
+
label: z.string().describe("The display label/title of the media"),
|
|
7
|
+
mediaBundle: z.string().describe('The media type (e.g., "image", "video")'),
|
|
8
|
+
thumbnail: z.string().optional().describe("URL of the thumbnail image")
|
|
9
|
+
});
|
|
10
|
+
const paramsSchema = z.object({
|
|
11
|
+
items: z.array(mediaItemSchema).describe("Media items from search_media to display for selection"),
|
|
12
|
+
prompt: z.string().optional().describe("Optional message to show the user explaining what to select")
|
|
13
|
+
});
|
|
14
|
+
const resultSchema = z.object({
|
|
15
|
+
selected: mediaItemSchema.nullable().describe("The selected media item, or null if the user cancelled"),
|
|
16
|
+
label: z.string().optional().describe("Human-readable label of the prompt (for UI display)")
|
|
17
|
+
});
|
|
18
|
+
export default defineBlokkliAgentTool({
|
|
19
|
+
name: "select_media",
|
|
20
|
+
description: "Show a thumbnail grid of media items for the user to select from. Use this when search_media returns multiple results and you want the user to choose one.",
|
|
21
|
+
category: "query",
|
|
22
|
+
modes: ["readonly", "editing", "translating", "review"],
|
|
23
|
+
label($t) {
|
|
24
|
+
return $t("aiAgentSelectMediaRunning", "Selecting media...");
|
|
25
|
+
},
|
|
26
|
+
lazy: true,
|
|
27
|
+
paramsSchema,
|
|
28
|
+
resultSchema,
|
|
29
|
+
component: Component,
|
|
30
|
+
execute(_ctx, params) {
|
|
31
|
+
return params;
|
|
32
|
+
},
|
|
33
|
+
mockParams: () => ({
|
|
34
|
+
items: [
|
|
35
|
+
{
|
|
36
|
+
mediaId: "1",
|
|
37
|
+
label: "Sunset Beach",
|
|
38
|
+
mediaBundle: "image",
|
|
39
|
+
thumbnail: "https://picsum.photos/seed/1/200"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
mediaId: "2",
|
|
43
|
+
label: "Mountain View",
|
|
44
|
+
mediaBundle: "image",
|
|
45
|
+
thumbnail: "https://picsum.photos/seed/2/200"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
mediaId: "3",
|
|
49
|
+
label: "City Lights",
|
|
50
|
+
mediaBundle: "image",
|
|
51
|
+
thumbnail: "https://picsum.photos/seed/3/200"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
mediaId: "4",
|
|
55
|
+
label: "Forest Path",
|
|
56
|
+
mediaBundle: "image",
|
|
57
|
+
thumbnail: "https://picsum.photos/seed/4/200"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
mediaId: "5",
|
|
61
|
+
label: "Ocean Waves",
|
|
62
|
+
mediaBundle: "image",
|
|
63
|
+
thumbnail: "https://picsum.photos/seed/5/200"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
mediaId: "6",
|
|
67
|
+
label: "Desert Dunes",
|
|
68
|
+
mediaBundle: "image",
|
|
69
|
+
thumbnail: "https://picsum.photos/seed/6/200"
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
prompt: "Select an image for the hero section"
|
|
73
|
+
})
|
|
74
|
+
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
import {
|
|
4
|
+
getAvailableOptions,
|
|
5
|
+
optionValueToStorable
|
|
6
|
+
} from "#blokkli/editor/helpers/options";
|
|
7
|
+
import {
|
|
8
|
+
mutationResultSchema,
|
|
9
|
+
optionValueSchema,
|
|
10
|
+
validateOptionValue
|
|
11
|
+
} from "../schemas.js";
|
|
12
|
+
import { onlyUnique } from "#blokkli/helpers";
|
|
13
|
+
const paragraphOptionsSchema = z.object({
|
|
14
|
+
uuid: z.string().describe("The paragraph UUID"),
|
|
15
|
+
options: z.record(z.string(), optionValueSchema).describe("Options to set as key-value pairs")
|
|
16
|
+
});
|
|
17
|
+
const paramsSchema = z.object({
|
|
18
|
+
paragraphs: z.array(paragraphOptionsSchema).describe("Array of paragraphs with their options to set")
|
|
19
|
+
});
|
|
20
|
+
export default defineBlokkliAgentTool({
|
|
21
|
+
name: "set_paragraph_options",
|
|
22
|
+
description: "Set options on one or more paragraphs. Each paragraph entry contains a UUID and an options object with key-value pairs.",
|
|
23
|
+
category: "mutation",
|
|
24
|
+
prunedSummary: (r) => r.success ? "updated options" : "rejected",
|
|
25
|
+
modes: ["editing"],
|
|
26
|
+
label($t) {
|
|
27
|
+
return $t("aiAgentSetBlockOptionsRunning", "Setting block options...");
|
|
28
|
+
},
|
|
29
|
+
lazy: true,
|
|
30
|
+
paramsSchema,
|
|
31
|
+
resultSchema: mutationResultSchema,
|
|
32
|
+
requiredAdapterMethods: ["updateOptions"],
|
|
33
|
+
execute(ctx, params) {
|
|
34
|
+
const { blocks, definitions, selection } = ctx.app;
|
|
35
|
+
if (params.paragraphs.length === 0) {
|
|
36
|
+
return { error: "No paragraphs provided" };
|
|
37
|
+
}
|
|
38
|
+
const validatedOptions = [];
|
|
39
|
+
const updatedBlocks = /* @__PURE__ */ new Set();
|
|
40
|
+
for (const blockEntry of params.paragraphs) {
|
|
41
|
+
const optionEntries = Object.entries(blockEntry.options);
|
|
42
|
+
if (optionEntries.length === 0) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const block = blocks.getBlock(blockEntry.uuid);
|
|
46
|
+
if (!block) {
|
|
47
|
+
return { error: `Paragraph not found: ${blockEntry.uuid}` };
|
|
48
|
+
}
|
|
49
|
+
const bundle = block.library?.reusableBundle || block.bundle;
|
|
50
|
+
const selectionItem = selection.items.value.find(
|
|
51
|
+
(v) => v.uuid === blockEntry.uuid
|
|
52
|
+
);
|
|
53
|
+
const definition = definitions.getBlockDefinition(
|
|
54
|
+
bundle,
|
|
55
|
+
selectionItem?.fieldListType ?? "default",
|
|
56
|
+
selectionItem?.parentBlockBundle
|
|
57
|
+
);
|
|
58
|
+
if (!definition) {
|
|
59
|
+
return {
|
|
60
|
+
error: `Paragraph definition not found for bundle: ${bundle}`
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const availableOptions = getAvailableOptions(
|
|
64
|
+
definition.options,
|
|
65
|
+
definition.globalOptions,
|
|
66
|
+
definitions.globalOptions.value
|
|
67
|
+
);
|
|
68
|
+
for (const [key, value] of optionEntries) {
|
|
69
|
+
const optionDef = availableOptions.find((o) => o.property === key);
|
|
70
|
+
if (!optionDef) {
|
|
71
|
+
return {
|
|
72
|
+
error: `Option "${key}" is not available for paragraph type "${bundle}"`
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const valueError = validateOptionValue(key, value, optionDef);
|
|
76
|
+
if (valueError) {
|
|
77
|
+
return { error: valueError };
|
|
78
|
+
}
|
|
79
|
+
const storableValue = optionValueToStorable(optionDef.option, value);
|
|
80
|
+
validatedOptions.push({
|
|
81
|
+
uuid: blockEntry.uuid,
|
|
82
|
+
key,
|
|
83
|
+
value: storableValue
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
updatedBlocks.add(blockEntry.uuid);
|
|
87
|
+
}
|
|
88
|
+
if (validatedOptions.length === 0) {
|
|
89
|
+
return { error: "No options to update" };
|
|
90
|
+
}
|
|
91
|
+
const blockCount = updatedBlocks.size;
|
|
92
|
+
const optionCount = validatedOptions.length;
|
|
93
|
+
const { $t } = ctx.app;
|
|
94
|
+
const label = blockCount === 1 ? $t(
|
|
95
|
+
"aiAgentUpdateOptionsOnBlockDone",
|
|
96
|
+
"Updated @count option(s) on block"
|
|
97
|
+
).replace("@count", String(optionCount)) : $t(
|
|
98
|
+
"aiAgentUpdateOptionsOnBlocksDone",
|
|
99
|
+
"Updated @count option(s) on @blockCount blocks"
|
|
100
|
+
).replace("@count", String(optionCount)).replace("@blockCount", String(blockCount));
|
|
101
|
+
const affectedUuids = params.paragraphs.map((v) => v.uuid).filter(onlyUnique);
|
|
102
|
+
return {
|
|
103
|
+
type: "options",
|
|
104
|
+
label,
|
|
105
|
+
affectedUuids,
|
|
106
|
+
apply: (adapter) => adapter.updateOptions(validatedOptions)
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
uuidA: z.string().describe("First paragraph UUID"),
|
|
6
|
+
uuidB: z.string().describe("Second paragraph UUID")
|
|
7
|
+
});
|
|
8
|
+
export default defineBlokkliAgentTool({
|
|
9
|
+
name: "swap_paragraphs",
|
|
10
|
+
description: "Swap the positions of two paragraphs, either in the same field or different fields.",
|
|
11
|
+
category: "mutation",
|
|
12
|
+
prunedSummary: (r) => r.success ? "swapped paragraphs" : "rejected",
|
|
13
|
+
modes: ["editing"],
|
|
14
|
+
label($t) {
|
|
15
|
+
return $t("aiAgentSwapBlocksRunning", "Swapping blocks...");
|
|
16
|
+
},
|
|
17
|
+
lazy: true,
|
|
18
|
+
paramsSchema,
|
|
19
|
+
resultSchema: mutationResultSchema,
|
|
20
|
+
requiredAdapterMethods: ["swapBlocks"],
|
|
21
|
+
execute(ctx, params) {
|
|
22
|
+
const { blocks, types, $t } = ctx.app;
|
|
23
|
+
if (params.uuidA === params.uuidB) {
|
|
24
|
+
return { error: "Both UUIDs refer to the same paragraph" };
|
|
25
|
+
}
|
|
26
|
+
const blockA = blocks.getBlock(params.uuidA);
|
|
27
|
+
if (!blockA) {
|
|
28
|
+
return { error: `Paragraph not found: ${params.uuidA}` };
|
|
29
|
+
}
|
|
30
|
+
const blockB = blocks.getBlock(params.uuidB);
|
|
31
|
+
if (!blockB) {
|
|
32
|
+
return { error: `Paragraph not found: ${params.uuidB}` };
|
|
33
|
+
}
|
|
34
|
+
const fieldConfigA = types.getFieldConfig(
|
|
35
|
+
blockA.host.type,
|
|
36
|
+
blockA.host.bundle,
|
|
37
|
+
blockA.host.fieldName
|
|
38
|
+
);
|
|
39
|
+
if (!fieldConfigA) {
|
|
40
|
+
return {
|
|
41
|
+
error: `Could not find field config for paragraph A's parent field`
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const fieldConfigB = types.getFieldConfig(
|
|
45
|
+
blockB.host.type,
|
|
46
|
+
blockB.host.bundle,
|
|
47
|
+
blockB.host.fieldName
|
|
48
|
+
);
|
|
49
|
+
if (!fieldConfigB) {
|
|
50
|
+
return {
|
|
51
|
+
error: `Could not find field config for paragraph B's parent field`
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (!fieldConfigB.allowedBundles.includes(blockA.bundle)) {
|
|
55
|
+
return {
|
|
56
|
+
error: `Cannot swap: bundle "${blockA.bundle}" (uuid: ${params.uuidA}) is not allowed in field "${blockB.host.fieldName}" (parent: ${blockB.host.uuid}). Allowed bundles: ${fieldConfigB.allowedBundles.join(", ")}`
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (!fieldConfigA.allowedBundles.includes(blockB.bundle)) {
|
|
60
|
+
return {
|
|
61
|
+
error: `Cannot swap: bundle "${blockB.bundle}" (uuid: ${params.uuidB}) is not allowed in field "${blockA.host.fieldName}" (parent: ${blockA.host.uuid}). Allowed bundles: ${fieldConfigA.allowedBundles.join(", ")}`
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const labelA = types.getBlockLabel(blockA.bundle);
|
|
65
|
+
const labelB = types.getBlockLabel(blockB.bundle);
|
|
66
|
+
const label = $t("aiAgentSwapBlocksDone", "Swapped @bundleA and @bundleB").replace("@bundleA", labelA).replace("@bundleB", labelB);
|
|
67
|
+
return {
|
|
68
|
+
type: "move",
|
|
69
|
+
label,
|
|
70
|
+
affectedUuids: [params.uuidA, params.uuidB],
|
|
71
|
+
apply: (adapter) => adapter.swapBlocks(params.uuidA, params.uuidB)
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
const paramsSchema = z.object({
|
|
4
|
+
url: z.string().url().describe("The URL to fetch content from"),
|
|
5
|
+
format: z.enum(["markdown", "html"]).default("markdown").describe(
|
|
6
|
+
'Output format: "markdown" (default) converts HTML to readable Markdown preserving structure, "html" returns cleaned raw HTML'
|
|
7
|
+
)
|
|
8
|
+
});
|
|
9
|
+
const resultSchema = z.object({
|
|
10
|
+
content: z.string().describe("The page content in the requested format (markdown or html)"),
|
|
11
|
+
title: z.string().describe("The page title"),
|
|
12
|
+
format: z.enum(["markdown", "html"]).describe("The format of the content"),
|
|
13
|
+
url: z.string().describe("The final URL (may differ from input if redirected)")
|
|
14
|
+
});
|
|
15
|
+
export default defineBlokkliAgentTool({
|
|
16
|
+
name: "web_fetch",
|
|
17
|
+
description: 'Fetch and extract content from a web page. Only allowed origins can be fetched. By default returns Markdown which preserves document structure (headings, lists, links). Use format="html" if you need the raw HTML.',
|
|
18
|
+
category: "query",
|
|
19
|
+
lazy: true,
|
|
20
|
+
modes: ["readonly", "editing", "translating", "review"],
|
|
21
|
+
label($t) {
|
|
22
|
+
return $t("aiAgentWebFetchRunning", "Fetching web page...");
|
|
23
|
+
},
|
|
24
|
+
paramsSchema,
|
|
25
|
+
resultSchema,
|
|
26
|
+
async execute(ctx, params) {
|
|
27
|
+
const { $t } = ctx.app;
|
|
28
|
+
const response = await fetch("/api/blokkli/agent/fetch", {
|
|
29
|
+
method: "POST",
|
|
30
|
+
headers: { "Content-Type": "application/json" },
|
|
31
|
+
body: JSON.stringify({ url: params.url, format: params.format })
|
|
32
|
+
});
|
|
33
|
+
if (!response.ok) {
|
|
34
|
+
let errorMessage = "Failed to fetch URL";
|
|
35
|
+
try {
|
|
36
|
+
const errorData = await response.json();
|
|
37
|
+
errorMessage = errorData.message || errorMessage;
|
|
38
|
+
} catch {
|
|
39
|
+
}
|
|
40
|
+
return { error: errorMessage };
|
|
41
|
+
}
|
|
42
|
+
const result = await response.json();
|
|
43
|
+
return {
|
|
44
|
+
label: $t("aiAgentWebFetchDone", "Fetched '@title'").replace(
|
|
45
|
+
"@title",
|
|
46
|
+
result.title || params.url
|
|
47
|
+
),
|
|
48
|
+
result
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|