@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,289 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
import { generateUUID } from "#blokkli/editor/helpers/uuid";
|
|
4
|
+
import {
|
|
5
|
+
mutationResultSchema,
|
|
6
|
+
parentSchema,
|
|
7
|
+
positionSchema,
|
|
8
|
+
resolvePosition,
|
|
9
|
+
optionValueSchema,
|
|
10
|
+
validateOptionValue
|
|
11
|
+
} from "../schemas.js";
|
|
12
|
+
import { itemEntityType } from "#blokkli-build/config";
|
|
13
|
+
import {
|
|
14
|
+
getAvailableOptions,
|
|
15
|
+
optionValueToStorable
|
|
16
|
+
} from "#blokkli/editor/helpers/options";
|
|
17
|
+
const contentFieldValueSchema = z.union([
|
|
18
|
+
z.string().describe(
|
|
19
|
+
"Text value for plain/markup content fields, or a URL string (starting with http) for link content fields"
|
|
20
|
+
),
|
|
21
|
+
z.object({
|
|
22
|
+
entityType: z.string().describe('Entity type (e.g., "media", "node")'),
|
|
23
|
+
entityId: z.string().describe("Entity ID")
|
|
24
|
+
}).describe(
|
|
25
|
+
"Entity reference for reference content fields (media, content references)"
|
|
26
|
+
)
|
|
27
|
+
]);
|
|
28
|
+
const contentFieldsSchema = z.record(
|
|
29
|
+
z.string().describe("The content field name"),
|
|
30
|
+
contentFieldValueSchema
|
|
31
|
+
).optional().describe(
|
|
32
|
+
"Content field values to set on the new paragraph, keyed by field name. Use this to set text content and media/entity references in one step."
|
|
33
|
+
);
|
|
34
|
+
const blockSchema = z.object({
|
|
35
|
+
bundle: z.string().describe("The paragraph bundle to add"),
|
|
36
|
+
contentFields: contentFieldsSchema,
|
|
37
|
+
options: z.record(z.string(), optionValueSchema).optional().describe(
|
|
38
|
+
"Paragraph options to set as key-value pairs (e.g. alignment, style). Use get_bundle_info to see available options."
|
|
39
|
+
),
|
|
40
|
+
children: z.record(
|
|
41
|
+
z.string().describe("Paragraph field name"),
|
|
42
|
+
z.lazy(() => z.array(blockSchema)).describe("Child paragraphs for this field")
|
|
43
|
+
).optional().describe(
|
|
44
|
+
"Nested child paragraphs keyed by paragraph field name. Recursive \u2014 children can also have children."
|
|
45
|
+
)
|
|
46
|
+
});
|
|
47
|
+
const paramsSchema = z.object({
|
|
48
|
+
paragraphs: z.array(blockSchema).min(1).describe("Array of paragraphs to add, in order"),
|
|
49
|
+
parent: parentSchema.describe("The parent entity to add the paragraphs to"),
|
|
50
|
+
position: positionSchema
|
|
51
|
+
});
|
|
52
|
+
function validateContentFields(ctx, block, path) {
|
|
53
|
+
if (!block.contentFields) return void 0;
|
|
54
|
+
for (const [fieldName, fieldValue] of Object.entries(block.contentFields)) {
|
|
55
|
+
const editableConfig = ctx.app.types.editableFieldConfig.forName(
|
|
56
|
+
ctx.itemEntityType,
|
|
57
|
+
block.bundle,
|
|
58
|
+
fieldName
|
|
59
|
+
);
|
|
60
|
+
const droppableConfig = ctx.app.types.droppableFieldConfig.forName(
|
|
61
|
+
ctx.itemEntityType,
|
|
62
|
+
block.bundle,
|
|
63
|
+
fieldName
|
|
64
|
+
);
|
|
65
|
+
if (!editableConfig && !droppableConfig) {
|
|
66
|
+
const editableFieldNames = ctx.app.types.editableFieldConfig.forEntityTypeAndBundle(ctx.itemEntityType, block.bundle).map((f) => f.name);
|
|
67
|
+
const droppableFieldNames = ctx.app.types.droppableFieldConfig.forEntityTypeAndBundle(ctx.itemEntityType, block.bundle).map((f) => f.name);
|
|
68
|
+
const availableFields = [...editableFieldNames, ...droppableFieldNames];
|
|
69
|
+
return `${path}: Field "${fieldName}" does not exist on bundle "${block.bundle}". ` + (availableFields.length ? `Available content fields: ${availableFields.join(", ")}` : "This bundle has no content fields.");
|
|
70
|
+
}
|
|
71
|
+
if (editableConfig && typeof fieldValue !== "string") {
|
|
72
|
+
return `${path}: Field "${fieldName}" is a text field and expects a string value, got ${typeof fieldValue}.`;
|
|
73
|
+
}
|
|
74
|
+
if (droppableConfig) {
|
|
75
|
+
if (typeof fieldValue === "string" && droppableConfig.type !== "link") {
|
|
76
|
+
return `${path}: Field "${fieldName}" is a reference field and expects { entityType, entityId }, got a string.`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return void 0;
|
|
81
|
+
}
|
|
82
|
+
function validateBlockOptions(ctx, block, path) {
|
|
83
|
+
if (!block.options) return void 0;
|
|
84
|
+
const { definitions } = ctx.app;
|
|
85
|
+
const definition = definitions.getBlockDefinition(block.bundle, "default");
|
|
86
|
+
if (!definition) {
|
|
87
|
+
return `${path}: Paragraph definition not found for bundle "${block.bundle}".`;
|
|
88
|
+
}
|
|
89
|
+
const availableOptions = getAvailableOptions(
|
|
90
|
+
definition.options,
|
|
91
|
+
definition.globalOptions,
|
|
92
|
+
definitions.globalOptions.value
|
|
93
|
+
);
|
|
94
|
+
for (const [key, value] of Object.entries(block.options)) {
|
|
95
|
+
const optionDef = availableOptions.find((o) => o.property === key);
|
|
96
|
+
if (!optionDef) {
|
|
97
|
+
const availableKeys = availableOptions.map((o) => o.property);
|
|
98
|
+
return `${path}: Option "${key}" is not available for bundle "${block.bundle}". ` + (availableKeys.length ? `Available options: ${availableKeys.join(", ")}` : "This bundle has no options.");
|
|
99
|
+
}
|
|
100
|
+
const valueError = validateOptionValue(key, value, optionDef);
|
|
101
|
+
if (valueError) {
|
|
102
|
+
return `${path}: ${valueError}`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return void 0;
|
|
106
|
+
}
|
|
107
|
+
function validateBlockTree(ctx, blocks, allowedBundles, fieldLabel, pathPrefix) {
|
|
108
|
+
const { types } = ctx.app;
|
|
109
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
110
|
+
const block = blocks[i];
|
|
111
|
+
const path = `${pathPrefix}Paragraph ${i + 1}`;
|
|
112
|
+
const bundleDefinition = types.getBlockBundleDefinition(block.bundle);
|
|
113
|
+
if (!bundleDefinition) {
|
|
114
|
+
return `${path}: Bundle "${block.bundle}" does not exist.`;
|
|
115
|
+
}
|
|
116
|
+
if (allowedBundles.length && !allowedBundles.includes(block.bundle)) {
|
|
117
|
+
return `${path}: Bundle "${block.bundle}" is not allowed in field "${fieldLabel}". Allowed bundles: ${allowedBundles.join(", ")}`;
|
|
118
|
+
}
|
|
119
|
+
const contentError = validateContentFields(ctx, block, path);
|
|
120
|
+
if (contentError) return contentError;
|
|
121
|
+
const optionsError = validateBlockOptions(ctx, block, path);
|
|
122
|
+
if (optionsError) return optionsError;
|
|
123
|
+
if (block.children) {
|
|
124
|
+
for (const [childFieldName, childBlocks] of Object.entries(
|
|
125
|
+
block.children
|
|
126
|
+
)) {
|
|
127
|
+
const childFieldConfig = types.fieldConfig.forName(
|
|
128
|
+
ctx.itemEntityType,
|
|
129
|
+
block.bundle,
|
|
130
|
+
childFieldName
|
|
131
|
+
);
|
|
132
|
+
if (!childFieldConfig) {
|
|
133
|
+
const availableBlockFields = types.fieldConfig.forEntityTypeAndBundle(ctx.itemEntityType, block.bundle).map((f) => f.name);
|
|
134
|
+
return `${path}: Paragraph field "${childFieldName}" does not exist on bundle "${block.bundle}". ` + (availableBlockFields.length ? `Available paragraph fields: ${availableBlockFields.join(", ")}` : "This bundle has no paragraph fields.");
|
|
135
|
+
}
|
|
136
|
+
if (!childBlocks.length) continue;
|
|
137
|
+
const childError = validateBlockTree(
|
|
138
|
+
ctx,
|
|
139
|
+
childBlocks,
|
|
140
|
+
childFieldConfig.allowedBundles,
|
|
141
|
+
childFieldName,
|
|
142
|
+
`${path} > ${childFieldName} > `
|
|
143
|
+
);
|
|
144
|
+
if (childError) return childError;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return void 0;
|
|
149
|
+
}
|
|
150
|
+
function buildEventBlocks(ctx, blocks) {
|
|
151
|
+
const { definitions } = ctx.app;
|
|
152
|
+
return blocks.map((block) => {
|
|
153
|
+
const blockUuid = generateUUID();
|
|
154
|
+
const values = block.contentFields ? Object.entries(block.contentFields).map(([fieldName, fieldValue]) => ({
|
|
155
|
+
fieldName,
|
|
156
|
+
fieldValue
|
|
157
|
+
})) : void 0;
|
|
158
|
+
let options;
|
|
159
|
+
if (block.options) {
|
|
160
|
+
const definition = definitions.getBlockDefinition(block.bundle, "default");
|
|
161
|
+
if (definition) {
|
|
162
|
+
const availableOptions = getAvailableOptions(
|
|
163
|
+
definition.options,
|
|
164
|
+
definition.globalOptions,
|
|
165
|
+
definitions.globalOptions.value
|
|
166
|
+
);
|
|
167
|
+
options = {};
|
|
168
|
+
for (const [key, value] of Object.entries(block.options)) {
|
|
169
|
+
const optionDef = availableOptions.find((o) => o.property === key);
|
|
170
|
+
if (optionDef) {
|
|
171
|
+
options[key] = optionValueToStorable(optionDef.option, value);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
let children;
|
|
177
|
+
if (block.children) {
|
|
178
|
+
children = {};
|
|
179
|
+
for (const [fieldName, childBlocks] of Object.entries(block.children)) {
|
|
180
|
+
if (childBlocks.length) {
|
|
181
|
+
children[fieldName] = buildEventBlocks(ctx, childBlocks);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
bundle: block.bundle,
|
|
187
|
+
blockUuid,
|
|
188
|
+
values,
|
|
189
|
+
options,
|
|
190
|
+
children
|
|
191
|
+
};
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
function countBlocks(blocks) {
|
|
195
|
+
let count = blocks.length;
|
|
196
|
+
for (const block of blocks) {
|
|
197
|
+
if (block.children) {
|
|
198
|
+
for (const childBlocks of Object.values(block.children)) {
|
|
199
|
+
count += countBlocks(childBlocks);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return count;
|
|
204
|
+
}
|
|
205
|
+
function collectAllUuids(blocks) {
|
|
206
|
+
const uuids = [];
|
|
207
|
+
for (const block of blocks) {
|
|
208
|
+
uuids.push(block.blockUuid);
|
|
209
|
+
if (block.children) {
|
|
210
|
+
for (const childBlocks of Object.values(block.children)) {
|
|
211
|
+
uuids.push(...collectAllUuids(childBlocks));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return uuids;
|
|
216
|
+
}
|
|
217
|
+
export default defineBlokkliAgentTool({
|
|
218
|
+
name: "add_paragraphs",
|
|
219
|
+
description: "Add one or more new paragraphs to the page. Supports nested structures via the `children` property \u2014 define entire paragraph trees in a single call. IMPORTANT: Always provide content field values (text, media/entity references) directly via contentFields, instead of adding empty paragraphs! For reference content fields (media), set the value to { entityType, entityId } from search_media results. NOTE: You can ONLY provide content fields, NOT paragraph fields! For nested paragraphs, use the `children` property keyed by paragraph field name. You can also set paragraph options inline via the `options` property (key-value pairs).",
|
|
220
|
+
category: "mutation",
|
|
221
|
+
prunedSummary: (r) => r.success ? `added ${r.newParagraphs?.length || 0} paragraphs` : "rejected",
|
|
222
|
+
modes: ["editing"],
|
|
223
|
+
label($t) {
|
|
224
|
+
return $t("aiAgentAddBlocksRunning", "Adding blocks...");
|
|
225
|
+
},
|
|
226
|
+
paramsSchema,
|
|
227
|
+
resultSchema: mutationResultSchema,
|
|
228
|
+
requiredAdapterMethods: ["addNewBlocks"],
|
|
229
|
+
execute(ctx, params) {
|
|
230
|
+
const { types, context, blocks } = ctx.app;
|
|
231
|
+
const isRootEntity = params.parent.uuid === context.value.entityUuid;
|
|
232
|
+
const entityType = isRootEntity ? context.value.entityType : itemEntityType;
|
|
233
|
+
const bundle = isRootEntity ? context.value.entityBundle : blocks.getBlock(params.parent.uuid)?.bundle;
|
|
234
|
+
if (!bundle) {
|
|
235
|
+
return {
|
|
236
|
+
error: "Parent not found."
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
const field = types.getFieldConfig(entityType, bundle, params.parent.field);
|
|
240
|
+
if (!field) {
|
|
241
|
+
const availableFields = types.fieldConfig.forEntityTypeAndBundle(entityType, bundle).map((f) => f.name);
|
|
242
|
+
return {
|
|
243
|
+
error: `Field "${params.parent.field}" not found on bundle "${bundle}". Available fields: ${availableFields.length ? availableFields.join(", ") : "none"}. Use get_child_paragraphs to get the correct parent object.`
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
const validationError = validateBlockTree(
|
|
247
|
+
ctx,
|
|
248
|
+
params.paragraphs,
|
|
249
|
+
field.allowedBundles,
|
|
250
|
+
params.parent.field,
|
|
251
|
+
""
|
|
252
|
+
);
|
|
253
|
+
if (validationError) {
|
|
254
|
+
return { error: validationError };
|
|
255
|
+
}
|
|
256
|
+
const eventBlocks = buildEventBlocks(ctx, params.paragraphs);
|
|
257
|
+
const totalCount = countBlocks(eventBlocks);
|
|
258
|
+
const blockUuids = collectAllUuids(eventBlocks);
|
|
259
|
+
const { $t } = ctx.app;
|
|
260
|
+
const label = totalCount === 1 ? $t("aiAgentAddBlockDone", "Added @bundle").replace(
|
|
261
|
+
"@bundle",
|
|
262
|
+
types.getBlockLabel(eventBlocks[0].bundle)
|
|
263
|
+
) : $t("aiAgentAddBlocksDone", "Added @count blocks").replace(
|
|
264
|
+
"@count",
|
|
265
|
+
String(totalCount)
|
|
266
|
+
);
|
|
267
|
+
const resolved = resolvePosition(
|
|
268
|
+
ctx.app,
|
|
269
|
+
params.parent.uuid,
|
|
270
|
+
params.parent.field,
|
|
271
|
+
params.position
|
|
272
|
+
);
|
|
273
|
+
if ("error" in resolved) return resolved;
|
|
274
|
+
return {
|
|
275
|
+
type: "add",
|
|
276
|
+
label,
|
|
277
|
+
apply: (adapter) => adapter.addNewBlocks({
|
|
278
|
+
blocks: eventBlocks,
|
|
279
|
+
host: {
|
|
280
|
+
type: params.parent.type,
|
|
281
|
+
uuid: params.parent.uuid,
|
|
282
|
+
fieldName: params.parent.field
|
|
283
|
+
},
|
|
284
|
+
afterUuid: resolved.afterUuid
|
|
285
|
+
}),
|
|
286
|
+
affectedUuids: blockUuids
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
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 { fromLibraryBlockBundle, itemEntityType } from "#blokkli-build/config";
|
|
10
|
+
const paramsSchema = z.object({
|
|
11
|
+
libraryItemUuid: z.string().describe(
|
|
12
|
+
"The UUID of the reusable paragraph to add (from search_reusable_paragraphs results)"
|
|
13
|
+
),
|
|
14
|
+
parent: parentSchema.describe(
|
|
15
|
+
"The parent entity to add the reusable paragraph to."
|
|
16
|
+
),
|
|
17
|
+
position: positionSchema
|
|
18
|
+
});
|
|
19
|
+
export default defineBlokkliAgentTool({
|
|
20
|
+
name: "add_reusable_paragraph",
|
|
21
|
+
description: "Add a reusable paragraph to the page. Reusable paragraphs stay linked to the original: edits to the paragraph are reflected everywhere it is used. Use search_reusable_paragraphs first to find available paragraphs.",
|
|
22
|
+
category: "mutation",
|
|
23
|
+
prunedSummary: (r) => r.success ? "added reusable paragraph" : "rejected",
|
|
24
|
+
modes: ["editing"],
|
|
25
|
+
lazy: true,
|
|
26
|
+
label($t) {
|
|
27
|
+
return $t("aiAgentAddLibraryItemRunning", "Adding reusable block...");
|
|
28
|
+
},
|
|
29
|
+
paramsSchema,
|
|
30
|
+
resultSchema: mutationResultSchema,
|
|
31
|
+
requiredAdapterMethods: ["addLibraryItem"],
|
|
32
|
+
execute(ctx, params) {
|
|
33
|
+
const { types, fields, context, blocks, $t } = ctx.app;
|
|
34
|
+
const field = fields.find(params.parent.uuid, params.parent.field);
|
|
35
|
+
if (!field) {
|
|
36
|
+
return {
|
|
37
|
+
error: `Field not found: ${params.parent.field} on entity ${params.parent.uuid}`
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const isRootEntity = params.parent.uuid === context.value.entityUuid;
|
|
41
|
+
const parentEntityType = isRootEntity ? context.value.entityType : itemEntityType;
|
|
42
|
+
const parentBundle = isRootEntity ? context.value.entityBundle : blocks.getBlock(params.parent.uuid)?.bundle;
|
|
43
|
+
if (parentBundle) {
|
|
44
|
+
const fieldConfig = types.getFieldConfig(
|
|
45
|
+
parentEntityType,
|
|
46
|
+
parentBundle,
|
|
47
|
+
params.parent.field
|
|
48
|
+
);
|
|
49
|
+
if (fieldConfig?.allowedBundles.length && !fieldConfig.allowedBundles.includes(fromLibraryBlockBundle)) {
|
|
50
|
+
return {
|
|
51
|
+
error: `Field "${params.parent.field}" does not allow from_library bundles.`
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const resolved = resolvePosition(
|
|
56
|
+
ctx.app,
|
|
57
|
+
params.parent.uuid,
|
|
58
|
+
params.parent.field,
|
|
59
|
+
params.position
|
|
60
|
+
);
|
|
61
|
+
if ("error" in resolved) return resolved;
|
|
62
|
+
return {
|
|
63
|
+
type: "add",
|
|
64
|
+
label: $t("aiAgentAddLibraryItemDone", "Added reusable block"),
|
|
65
|
+
apply: (adapter) => adapter.addLibraryItem({
|
|
66
|
+
libraryItemUuid: params.libraryItemUuid,
|
|
67
|
+
host: {
|
|
68
|
+
type: params.parent.type,
|
|
69
|
+
uuid: params.parent.uuid,
|
|
70
|
+
fieldName: params.parent.field
|
|
71
|
+
},
|
|
72
|
+
afterUuid: resolved.afterUuid
|
|
73
|
+
})
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
const paramsSchema = z.object({
|
|
10
|
+
templateUuid: z.string().describe(
|
|
11
|
+
"The UUID of the template to add (from search_templates results)"
|
|
12
|
+
),
|
|
13
|
+
parent: parentSchema.describe("The parent entity to add the template to"),
|
|
14
|
+
position: positionSchema
|
|
15
|
+
});
|
|
16
|
+
export default defineBlokkliAgentTool({
|
|
17
|
+
name: "add_template",
|
|
18
|
+
description: "Add a template to the page. Templates are copied when added, so changes to the added paragraphs won't affect other pages using the same template. Requires user approval before the template is actually added.",
|
|
19
|
+
category: "mutation",
|
|
20
|
+
prunedSummary: (r) => r.success ? `added template (${r.newParagraphs?.length || 0} paragraphs)` : "rejected",
|
|
21
|
+
lazy: true,
|
|
22
|
+
modes: ["editing"],
|
|
23
|
+
label($t) {
|
|
24
|
+
return $t("aiAgentAddTemplateRunning", "Adding template...");
|
|
25
|
+
},
|
|
26
|
+
paramsSchema,
|
|
27
|
+
resultSchema: mutationResultSchema,
|
|
28
|
+
requiredAdapterMethods: ["templatesAdd"],
|
|
29
|
+
execute(ctx, params) {
|
|
30
|
+
const { fields, $t } = ctx.app;
|
|
31
|
+
const field = fields.find(params.parent.uuid, params.parent.field);
|
|
32
|
+
if (!field) {
|
|
33
|
+
return {
|
|
34
|
+
error: `Field not found: ${params.parent.field} on entity ${params.parent.uuid}`
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const resolved = resolvePosition(
|
|
38
|
+
ctx.app,
|
|
39
|
+
params.parent.uuid,
|
|
40
|
+
params.parent.field,
|
|
41
|
+
params.position
|
|
42
|
+
);
|
|
43
|
+
if ("error" in resolved) return resolved;
|
|
44
|
+
return {
|
|
45
|
+
type: "add",
|
|
46
|
+
label: $t("aiAgentAddTemplateDone", "Added template"),
|
|
47
|
+
apply: (adapter) => adapter.templatesAdd({
|
|
48
|
+
templateUuid: params.templateUuid,
|
|
49
|
+
host: {
|
|
50
|
+
type: params.parent.type,
|
|
51
|
+
uuid: params.parent.uuid,
|
|
52
|
+
fieldName: params.parent.field
|
|
53
|
+
},
|
|
54
|
+
afterUuid: resolved.afterUuid
|
|
55
|
+
})
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { McpToolContext } from '#blokkli/agent/app/types';
|
|
2
|
+
import type { AskQuestionParams } from './index.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
context: McpToolContext;
|
|
5
|
+
params: AskQuestionParams;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
|
+
done: (result: {
|
|
9
|
+
selected: string | string[] | null;
|
|
10
|
+
label?: string | undefined;
|
|
11
|
+
}) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
+
onDone?: ((result: {
|
|
14
|
+
selected: string | string[] | null;
|
|
15
|
+
label?: string | undefined;
|
|
16
|
+
}) => any) | undefined;
|
|
17
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ToolCard
|
|
3
|
+
icon="bk_mdi_help"
|
|
4
|
+
:title="params.question"
|
|
5
|
+
class="bk-agent-tool-question"
|
|
6
|
+
@cancel="cancel"
|
|
7
|
+
>
|
|
8
|
+
<div class="bk-agent-tool-question-inner">
|
|
9
|
+
<FormCheckboxes
|
|
10
|
+
v-if="params.multiSelect"
|
|
11
|
+
id="ask-question"
|
|
12
|
+
v-model="selectedMulti"
|
|
13
|
+
label=""
|
|
14
|
+
:options="params.options"
|
|
15
|
+
/>
|
|
16
|
+
|
|
17
|
+
<div v-else>
|
|
18
|
+
<FormRadio
|
|
19
|
+
id="ask-question"
|
|
20
|
+
v-model="selectedSingle"
|
|
21
|
+
label=""
|
|
22
|
+
:options="radioOptions"
|
|
23
|
+
/>
|
|
24
|
+
<div v-if="isOtherSelected" class="bk-agent-tool-question-other">
|
|
25
|
+
<textarea
|
|
26
|
+
ref="otherTextarea"
|
|
27
|
+
v-model="otherText"
|
|
28
|
+
class="bk-form-input"
|
|
29
|
+
:rows="2"
|
|
30
|
+
:placeholder="
|
|
31
|
+
$t('aiAgentAskQuestionOtherPlaceholder', 'Type your answer...')
|
|
32
|
+
"
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<template #actions>
|
|
39
|
+
<button
|
|
40
|
+
class="bk-button bk-is-small bk-is-lime bk-is-fullwidth"
|
|
41
|
+
:disabled="!hasSelection"
|
|
42
|
+
@click="confirm"
|
|
43
|
+
>
|
|
44
|
+
<Icon name="bk_mdi_check" />
|
|
45
|
+
{{ $t("aiAgentConfirm", "Confirm") }}
|
|
46
|
+
</button>
|
|
47
|
+
</template>
|
|
48
|
+
</ToolCard>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script setup>
|
|
52
|
+
import { ref, computed, watch, nextTick, useBlokkli } from "#imports";
|
|
53
|
+
import { Icon, FormRadio, FormCheckboxes } from "#blokkli/editor/components";
|
|
54
|
+
import ToolCard from "../../features/agent/Panel/ToolCard/index.vue";
|
|
55
|
+
const OTHER_VALUE = "__other__";
|
|
56
|
+
const props = defineProps({
|
|
57
|
+
context: { type: null, required: true },
|
|
58
|
+
params: { type: null, required: true }
|
|
59
|
+
});
|
|
60
|
+
const emit = defineEmits(["done"]);
|
|
61
|
+
const { $t } = useBlokkli();
|
|
62
|
+
const selectedSingle = ref("");
|
|
63
|
+
const selectedMulti = ref([]);
|
|
64
|
+
const otherText = ref("");
|
|
65
|
+
const otherTextarea = ref(null);
|
|
66
|
+
const radioOptions = computed(() => [
|
|
67
|
+
...props.params.options,
|
|
68
|
+
{
|
|
69
|
+
value: OTHER_VALUE,
|
|
70
|
+
label: $t("aiAgentAskQuestionOther", "None of the above")
|
|
71
|
+
}
|
|
72
|
+
]);
|
|
73
|
+
const isOtherSelected = computed(() => selectedSingle.value === OTHER_VALUE);
|
|
74
|
+
watch(isOtherSelected, (isOther) => {
|
|
75
|
+
if (isOther) {
|
|
76
|
+
nextTick(() => {
|
|
77
|
+
otherTextarea.value?.focus();
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const hasSelection = computed(() => {
|
|
82
|
+
if (props.params.multiSelect) {
|
|
83
|
+
return selectedMulti.value.length > 0;
|
|
84
|
+
}
|
|
85
|
+
if (isOtherSelected.value) {
|
|
86
|
+
return otherText.value.trim().length > 0;
|
|
87
|
+
}
|
|
88
|
+
return selectedSingle.value !== "";
|
|
89
|
+
});
|
|
90
|
+
function getSelectedLabel() {
|
|
91
|
+
if (props.params.multiSelect) {
|
|
92
|
+
const labels = selectedMulti.value.map((v) => props.params.options.find((o) => o.value === v)?.label).filter(Boolean);
|
|
93
|
+
return labels.join(", ");
|
|
94
|
+
}
|
|
95
|
+
if (isOtherSelected.value) {
|
|
96
|
+
return otherText.value.trim();
|
|
97
|
+
}
|
|
98
|
+
return props.params.options.find((o) => o.value === selectedSingle.value)?.label || selectedSingle.value;
|
|
99
|
+
}
|
|
100
|
+
function confirm() {
|
|
101
|
+
const selectedLabel = getSelectedLabel();
|
|
102
|
+
const label = `${props.params.question} -> ${selectedLabel}`;
|
|
103
|
+
if (props.params.multiSelect) {
|
|
104
|
+
emit("done", { selected: selectedMulti.value, label });
|
|
105
|
+
} else {
|
|
106
|
+
const value = isOtherSelected.value ? otherText.value.trim() : selectedSingle.value;
|
|
107
|
+
emit("done", { selected: value, label });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function cancel() {
|
|
111
|
+
emit("done", { selected: null, label: $t("aiAgentCancelled", "Cancelled") });
|
|
112
|
+
}
|
|
113
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { McpToolContext } from '#blokkli/agent/app/types';
|
|
2
|
+
import type { AskQuestionParams } from './index.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
context: McpToolContext;
|
|
5
|
+
params: AskQuestionParams;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
8
|
+
done: (result: {
|
|
9
|
+
selected: string | string[] | null;
|
|
10
|
+
label?: string | undefined;
|
|
11
|
+
}) => any;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
+
onDone?: ((result: {
|
|
14
|
+
selected: string | string[] | null;
|
|
15
|
+
label?: string | undefined;
|
|
16
|
+
}) => any) | undefined;
|
|
17
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const paramsSchema: z.ZodObject<{
|
|
3
|
+
question: z.ZodString;
|
|
4
|
+
options: z.ZodArray<z.ZodObject<{
|
|
5
|
+
value: z.ZodString;
|
|
6
|
+
label: z.ZodString;
|
|
7
|
+
}, z.core.$strip>>;
|
|
8
|
+
multiSelect: z.ZodDefault<z.ZodBoolean>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
declare const resultSchema: z.ZodObject<{
|
|
11
|
+
selected: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
12
|
+
label: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export type AskQuestionParams = z.infer<typeof paramsSchema>;
|
|
15
|
+
export type AskQuestionResult = z.infer<typeof resultSchema>;
|
|
16
|
+
declare const _default: any;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
import Component from "./Component.vue";
|
|
4
|
+
const optionSchema = z.object({
|
|
5
|
+
value: z.string().describe("The option value"),
|
|
6
|
+
label: z.string().describe("The display label")
|
|
7
|
+
});
|
|
8
|
+
const paramsSchema = z.object({
|
|
9
|
+
question: z.string().describe("The question to ask the user"),
|
|
10
|
+
options: z.array(optionSchema).describe("Available options to choose from"),
|
|
11
|
+
multiSelect: z.boolean().default(false).describe(
|
|
12
|
+
`Allow selecting multiple options. If false, the user has the option to enter a custom option if none of the options are good.`
|
|
13
|
+
)
|
|
14
|
+
});
|
|
15
|
+
const resultSchema = z.object({
|
|
16
|
+
selected: z.union([z.string(), z.array(z.string())]).nullable().describe("Selected value(s), or null if cancelled"),
|
|
17
|
+
label: z.string().optional().describe("Human-readable label of what was selected (for UI display)")
|
|
18
|
+
});
|
|
19
|
+
export default defineBlokkliAgentTool({
|
|
20
|
+
name: "ask_question",
|
|
21
|
+
description: "Ask the user a question with predefined options.",
|
|
22
|
+
category: "query",
|
|
23
|
+
modes: ["readonly", "editing", "translating", "review"],
|
|
24
|
+
label($t) {
|
|
25
|
+
return $t("aiAgentAskQuestionRunning", "Waiting for answer...");
|
|
26
|
+
},
|
|
27
|
+
paramsSchema,
|
|
28
|
+
resultSchema,
|
|
29
|
+
component: Component,
|
|
30
|
+
execute(_ctx, params) {
|
|
31
|
+
return params;
|
|
32
|
+
},
|
|
33
|
+
mockParams: () => ({
|
|
34
|
+
question: "Which style do you prefer for the hero section?",
|
|
35
|
+
options: [
|
|
36
|
+
{ value: "minimal", label: "Minimal" },
|
|
37
|
+
{ value: "bold", label: "Bold" },
|
|
38
|
+
{ value: "classic", label: "Classic" }
|
|
39
|
+
],
|
|
40
|
+
multiSelect: false
|
|
41
|
+
}),
|
|
42
|
+
mockParamsVariants: () => [
|
|
43
|
+
{
|
|
44
|
+
question: "Which sections should be included on the page?",
|
|
45
|
+
options: [
|
|
46
|
+
{ value: "hero", label: "Hero" },
|
|
47
|
+
{ value: "features", label: "Features" },
|
|
48
|
+
{ value: "testimonials", label: "Testimonials" },
|
|
49
|
+
{ value: "pricing", label: "Pricing" }
|
|
50
|
+
],
|
|
51
|
+
multiSelect: true
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
});
|
|
@@ -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;
|