@blokkli/editor 2.0.0-alpha.31 → 2.0.0-alpha.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/global/constants/index.d.ts +1 -0
- package/dist/global/constants/index.js +1 -0
- package/dist/global/types/blockOptions.d.ts +16 -0
- package/dist/global/types/features.d.ts +4 -0
- package/dist/module.d.mts +1 -24
- package/dist/module.json +1 -1
- package/dist/module.mjs +453 -10828
- package/dist/modules/agent/index.d.mts +64 -0
- package/dist/modules/agent/index.mjs +407 -0
- package/dist/modules/agent/runtime/app/composables/agentProvider.d.ts +55 -0
- package/dist/modules/agent/runtime/app/composables/agentProvider.js +875 -0
- package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentPrompt.d.ts +32 -0
- package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentPrompt.js +6 -0
- package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentTool.d.ts +65 -0
- package/dist/modules/agent/runtime/app/composables/defineBlokkliAgentTool.js +6 -0
- package/dist/modules/agent/runtime/app/composables/index.d.ts +4 -0
- package/dist/modules/agent/runtime/app/composables/index.js +2 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Attachment/index.d.vue.ts +12 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Attachment/index.vue +62 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Attachment/index.vue.d.ts +12 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Assistant/index.d.vue.ts +9 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Assistant/index.vue +38 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Assistant/index.vue.d.ts +9 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Error/index.d.vue.ts +14 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Error/index.vue +68 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Error/index.vue.d.ts +14 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/ServerTool/index.d.vue.ts +10 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/ServerTool/index.vue +72 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/ServerTool/index.vue.d.ts +10 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Tool/index.d.vue.ts +13 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Tool/index.vue +37 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Tool/index.vue.d.ts +13 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Unknown/index.d.vue.ts +8 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Unknown/index.vue +17 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/Unknown/index.vue.d.ts +8 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/User/index.d.vue.ts +11 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/User/index.vue +29 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/User/index.vue.d.ts +11 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/index.d.vue.ts +12 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/index.vue +30 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Item/index.vue.d.ts +12 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Thinking/index.d.vue.ts +3 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Thinking/index.vue +14 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/Thinking/index.vue.d.ts +3 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/index.d.vue.ts +13 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/index.vue +46 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Conversation/index.vue.d.ts +13 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/ConversationList/index.d.vue.ts +15 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/ConversationList/index.vue +50 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/ConversationList/index.vue.d.ts +15 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/DebugGallery/index.d.vue.ts +3 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/DebugGallery/index.vue +160 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/DebugGallery/index.vue.d.ts +3 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/DropdownItem/index.d.vue.ts +12 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/DropdownItem/index.vue +15 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/DropdownItem/index.vue.d.ts +12 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/TokenUsage/index.d.vue.ts +7 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/TokenUsage/index.vue +67 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/TokenUsage/index.vue.d.ts +7 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.d.vue.ts +23 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue +109 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/Actions/index.vue.d.ts +23 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/index.d.vue.ts +45 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/index.vue +120 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Input/index.vue.d.ts +45 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/PendingMutation/index.d.vue.ts +15 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/PendingMutation/index.vue +47 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/PendingMutation/index.vue.d.ts +15 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Plan/index.d.vue.ts +14 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Plan/index.vue +55 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Plan/index.vue.d.ts +14 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/ToolCard/index.d.vue.ts +25 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/ToolCard/index.vue +36 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/ToolCard/index.vue.d.ts +25 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/de.md +19 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/en.md +18 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/index.d.vue.ts +10 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/index.vue +44 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/Welcome/index.vue.d.ts +10 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/index.d.vue.ts +58 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/index.vue +274 -0
- package/dist/modules/agent/runtime/app/features/agent/Panel/index.vue.d.ts +58 -0
- package/dist/modules/agent/runtime/app/features/agent/index.d.vue.ts +3 -0
- package/dist/modules/agent/runtime/app/features/agent/index.vue +162 -0
- package/dist/modules/agent/runtime/app/features/agent/index.vue.d.ts +3 -0
- package/dist/modules/agent/runtime/app/features/agent/types.d.ts +58 -0
- package/dist/modules/agent/runtime/app/features/agent/types.js +0 -0
- package/dist/modules/agent/runtime/app/helpers/index.d.ts +55 -0
- package/dist/modules/agent/runtime/app/helpers/index.js +88 -0
- package/dist/modules/agent/runtime/app/helpers/pageStructure.d.ts +5 -0
- package/dist/modules/agent/runtime/app/helpers/pageStructure.js +106 -0
- package/dist/modules/agent/runtime/app/helpers/validation.d.ts +35 -0
- package/dist/modules/agent/runtime/app/helpers/validation.js +77 -0
- package/dist/modules/agent/runtime/app/tools/add_content_search_paragraph/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/add_content_search_paragraph/index.js +69 -0
- package/dist/modules/agent/runtime/app/tools/add_fragment/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/add_fragment/index.js +83 -0
- package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.js +62 -0
- package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/add_paragraphs/index.js +289 -0
- package/dist/modules/agent/runtime/app/tools/add_reusable_paragraph/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/add_reusable_paragraph/index.js +76 -0
- package/dist/modules/agent/runtime/app/tools/add_template/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/add_template/index.js +58 -0
- package/dist/modules/agent/runtime/app/tools/ask_question/Component.d.vue.ts +19 -0
- package/dist/modules/agent/runtime/app/tools/ask_question/Component.vue +113 -0
- package/dist/modules/agent/runtime/app/tools/ask_question/Component.vue.d.ts +19 -0
- package/dist/modules/agent/runtime/app/tools/ask_question/index.d.ts +17 -0
- package/dist/modules/agent/runtime/app/tools/ask_question/index.js +54 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/Component.d.vue.ts +29 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/Component.vue +190 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/Component.vue.d.ts +29 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/Item.d.vue.ts +20 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/Item.vue +90 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/Item.vue.d.ts +20 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/index.d.ts +18 -0
- package/dist/modules/agent/runtime/app/tools/batch_rewrite_text/index.js +55 -0
- package/dist/modules/agent/runtime/app/tools/delete_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/delete_paragraphs/index.js +47 -0
- package/dist/modules/agent/runtime/app/tools/detach_reusable_paragraph/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/detach_reusable_paragraph/index.js +47 -0
- package/dist/modules/agent/runtime/app/tools/duplicate_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/duplicate_paragraphs/index.js +144 -0
- package/dist/modules/agent/runtime/app/tools/find_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/find_paragraphs/index.js +180 -0
- package/dist/modules/agent/runtime/app/tools/get_all_fragments/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_all_fragments/index.js +33 -0
- package/dist/modules/agent/runtime/app/tools/get_all_page_content/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_all_page_content/index.js +93 -0
- package/dist/modules/agent/runtime/app/tools/get_available_bundles/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_available_bundles/index.js +104 -0
- package/dist/modules/agent/runtime/app/tools/get_child_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_child_paragraphs/index.js +108 -0
- package/dist/modules/agent/runtime/app/tools/get_content_fields/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_content_fields/index.js +192 -0
- package/dist/modules/agent/runtime/app/tools/get_mutation_history/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_mutation_history/index.js +102 -0
- package/dist/modules/agent/runtime/app/tools/get_page_structure/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_page_structure/index.js +113 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraph_context/index.js +275 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraph_options/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraph_options/index.js +63 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraphs_in_viewport/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_paragraphs_in_viewport/index.js +180 -0
- package/dist/modules/agent/runtime/app/tools/get_selected_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/get_selected_paragraphs/index.js +46 -0
- package/dist/modules/agent/runtime/app/tools/go_to_history_index/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/go_to_history_index/index.js +54 -0
- package/dist/modules/agent/runtime/app/tools/move_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/move_paragraphs/index.js +69 -0
- package/dist/modules/agent/runtime/app/tools/rearrange_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/rearrange_paragraphs/index.js +95 -0
- package/dist/modules/agent/runtime/app/tools/replace_content_search_item/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/replace_content_search_item/index.js +80 -0
- package/dist/modules/agent/runtime/app/tools/replace_media_field/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/replace_media_field/index.js +85 -0
- package/dist/modules/agent/runtime/app/tools/schemas.d.ts +128 -0
- package/dist/modules/agent/runtime/app/tools/schemas.js +242 -0
- package/dist/modules/agent/runtime/app/tools/search_content/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/search_content/index.js +65 -0
- package/dist/modules/agent/runtime/app/tools/search_media/index.d.ts +14 -0
- package/dist/modules/agent/runtime/app/tools/search_media/index.js +60 -0
- package/dist/modules/agent/runtime/app/tools/search_reusable_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/search_reusable_paragraphs/index.js +75 -0
- package/dist/modules/agent/runtime/app/tools/search_templates/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/search_templates/index.js +51 -0
- package/dist/modules/agent/runtime/app/tools/search_text/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/search_text/index.js +114 -0
- package/dist/modules/agent/runtime/app/tools/select_media/Component.d.vue.ts +29 -0
- package/dist/modules/agent/runtime/app/tools/select_media/Component.vue +70 -0
- package/dist/modules/agent/runtime/app/tools/select_media/Component.vue.d.ts +29 -0
- package/dist/modules/agent/runtime/app/tools/select_media/index.d.ts +30 -0
- package/dist/modules/agent/runtime/app/tools/select_media/index.js +74 -0
- package/dist/modules/agent/runtime/app/tools/set_paragraph_options/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/set_paragraph_options/index.js +109 -0
- package/dist/modules/agent/runtime/app/tools/swap_paragraphs/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/swap_paragraphs/index.js +74 -0
- package/dist/modules/agent/runtime/app/tools/web_fetch/index.d.ts +2 -0
- package/dist/modules/agent/runtime/app/tools/web_fetch/index.js +51 -0
- package/dist/modules/agent/runtime/app/types/index.d.ts +440 -0
- package/dist/modules/agent/runtime/app/types/index.js +51 -0
- package/dist/modules/agent/runtime/server/Session.d.ts +94 -0
- package/dist/modules/agent/runtime/server/Session.js +734 -0
- package/dist/modules/agent/runtime/server/SessionManager.d.ts +21 -0
- package/dist/modules/agent/runtime/server/SessionManager.js +80 -0
- package/dist/modules/agent/runtime/server/agent.d.ts +2 -0
- package/dist/modules/agent/runtime/server/agent.js +148 -0
- package/dist/modules/agent/runtime/server/agentPrompt.d.ts +22 -0
- package/dist/modules/agent/runtime/server/agentPrompt.js +53 -0
- package/dist/modules/agent/runtime/server/default-skills/adding-new-paragraphs.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-skills/adding-new-paragraphs.js +21 -0
- package/dist/modules/agent/runtime/server/default-skills/pageReview.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-skills/pageReview.js +28 -0
- package/dist/modules/agent/runtime/server/default-skills/reusable-paragraphs.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-skills/reusable-paragraphs.js +21 -0
- package/dist/modules/agent/runtime/server/default-skills/rewriteAndTranslate.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-skills/rewriteAndTranslate.js +14 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/architecture.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/architecture.js +39 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/available-skills.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/available-skills.js +18 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/available-tools.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/available-tools.js +18 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/fragments.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/fragments.js +19 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/important-rules.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/important-rules.js +22 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/interaction.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/interaction.js +20 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/introduction.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/introduction.js +14 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/page-context.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/page-context.js +60 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/paragraph-bundles.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/paragraph-bundles.js +37 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/plan-mode.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/plan-mode.js +36 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/security.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/security.js +27 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/workflow.d.ts +2 -0
- package/dist/modules/agent/runtime/server/default-system-prompts/workflow.js +22 -0
- package/dist/modules/agent/runtime/server/fetch.d.ts +2 -0
- package/dist/modules/agent/runtime/server/fetch.js +127 -0
- package/dist/modules/agent/runtime/server/helpers.d.ts +77 -0
- package/dist/modules/agent/runtime/server/helpers.js +352 -0
- package/dist/modules/agent/runtime/server/providers/anthropic.d.ts +12 -0
- package/dist/modules/agent/runtime/server/providers/anthropic.js +128 -0
- package/dist/modules/agent/runtime/server/providers/openai.d.ts +12 -0
- package/dist/modules/agent/runtime/server/providers/openai.js +165 -0
- package/dist/modules/agent/runtime/server/providers/types.d.ts +74 -0
- package/dist/modules/agent/runtime/server/providers/types.js +0 -0
- package/dist/modules/agent/runtime/server/server-tools/complete_plan_step/index.d.ts +3 -0
- package/dist/modules/agent/runtime/server/server-tools/complete_plan_step/index.js +79 -0
- package/dist/modules/agent/runtime/server/server-tools/create_plan/index.d.ts +9 -0
- package/dist/modules/agent/runtime/server/server-tools/create_plan/index.js +86 -0
- package/dist/modules/agent/runtime/server/server-tools/index.d.ts +86 -0
- package/dist/modules/agent/runtime/server/server-tools/index.js +30 -0
- package/dist/modules/agent/runtime/server/server-tools/load_skill/index.d.ts +7 -0
- package/dist/modules/agent/runtime/server/server-tools/load_skill/index.js +58 -0
- package/dist/modules/agent/runtime/server/server-tools/load_tools/index.d.ts +7 -0
- package/dist/modules/agent/runtime/server/server-tools/load_tools/index.js +43 -0
- package/dist/modules/agent/runtime/server/skills/defineBlokkliAgentSkill.d.ts +23 -0
- package/dist/modules/agent/runtime/server/skills/defineBlokkliAgentSkill.js +3 -0
- package/dist/modules/agent/runtime/server/skills/index.d.ts +2 -0
- package/dist/modules/agent/runtime/server/skills/index.js +1 -0
- package/dist/modules/agent/runtime/server/skills/types.d.ts +45 -0
- package/dist/modules/agent/runtime/server/skills/types.js +0 -0
- package/dist/modules/agent/runtime/server/system-prompts/defineBlokkliAgentSystemPrompt.d.ts +21 -0
- package/dist/modules/agent/runtime/server/system-prompts/defineBlokkliAgentSystemPrompt.js +3 -0
- package/dist/modules/agent/runtime/server/system-prompts/helpers.d.ts +20 -0
- package/dist/modules/agent/runtime/server/system-prompts/helpers.js +41 -0
- package/dist/modules/agent/runtime/server/system-prompts/index.d.ts +2 -0
- package/dist/modules/agent/runtime/server/system-prompts/index.js +1 -0
- package/dist/modules/agent/runtime/server/system-prompts/types.d.ts +49 -0
- package/dist/modules/agent/runtime/server/system-prompts/types.js +0 -0
- package/dist/modules/agent/runtime/shared/placeholders.d.ts +4 -0
- package/dist/modules/agent/runtime/shared/placeholders.js +1 -0
- package/dist/modules/agent/runtime/shared/types.d.ts +426 -0
- package/dist/modules/agent/runtime/shared/types.js +147 -0
- package/dist/modules/drupal/graphql/base/query.pbConfig.graphql +27 -2
- package/dist/modules/drupal/graphql/features/agent.graphql +69 -0
- package/dist/modules/drupal/graphql/features/search.graphql +5 -0
- package/dist/modules/drupal/graphql/features/templates.graphql +36 -2
- package/dist/modules/drupal/graphql/mutations/add_multiple.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/bulk_update_field_values.graphql +15 -0
- package/dist/modules/drupal/graphql/mutations/rearrange.graphql +23 -0
- package/dist/modules/drupal/graphql/mutations/replace_entity_reference.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/swap.graphql +16 -0
- package/dist/modules/drupal/index.d.mts +18 -2
- package/dist/modules/drupal/index.mjs +60 -12
- package/dist/modules/drupal/runtime/adapter/index.js +246 -21
- package/dist/modules/drupal/runtime/components/BlokkliDrupalEditTemplate/index.d.vue.ts +9 -0
- package/dist/modules/drupal/runtime/components/BlokkliDrupalEditTemplate/index.vue +26 -0
- package/dist/modules/drupal/runtime/components/BlokkliDrupalEditTemplate/index.vue.d.ts +9 -0
- package/dist/runtime/components/Blocks/Fragment/index.vue +11 -2
- package/dist/runtime/components/BlokkliItem.vue +3 -1
- package/dist/runtime/composables/defineBlokkli.js +1 -3
- package/dist/runtime/composables/defineBlokkliFeature.d.ts +5 -3
- package/dist/runtime/composables/defineBlokkliFeature.js +2 -1
- package/dist/runtime/composables/defineBlokkliProvider.js +1 -3
- package/dist/runtime/editor/adapter/index.d.ts +45 -4
- package/dist/runtime/editor/adapter/index.js +3 -0
- package/dist/runtime/editor/components/Actions/ItemDropdown.vue +6 -1
- package/dist/runtime/editor/components/Actions/index.vue +4 -1
- package/dist/runtime/editor/components/AddListItem/index.d.vue.ts +9 -1
- package/dist/runtime/editor/components/AddListItem/index.vue +36 -2
- package/dist/runtime/editor/components/AddListItem/index.vue.d.ts +9 -1
- package/dist/runtime/editor/components/AnimationCanvas/index.vue +17 -7
- package/dist/runtime/editor/components/ArtboardTooltip/index.d.vue.ts +3 -1
- package/dist/runtime/editor/components/ArtboardTooltip/index.vue +4 -3
- package/dist/runtime/editor/components/ArtboardTooltip/index.vue.d.ts +3 -1
- package/dist/runtime/editor/components/AutoHeight/index.d.vue.ts +16 -0
- package/dist/runtime/editor/components/AutoHeight/index.vue +32 -0
- package/dist/runtime/editor/components/AutoHeight/index.vue.d.ts +16 -0
- package/dist/runtime/editor/components/BlockPreviewItem/index.d.vue.ts +5 -1
- package/dist/runtime/editor/components/BlockPreviewItem/index.vue +10 -7
- package/dist/runtime/editor/components/BlockPreviewItem/index.vue.d.ts +5 -1
- package/dist/runtime/editor/components/DiffViewer/DiffValue.d.vue.ts +7 -0
- package/dist/runtime/editor/components/DiffViewer/DiffValue.vue +21 -0
- package/dist/runtime/editor/components/DiffViewer/DiffValue.vue.d.ts +7 -0
- package/dist/runtime/editor/components/DiffViewer/State.vue +4 -9
- package/dist/runtime/editor/components/EditProvider.vue +25 -4
- package/dist/runtime/editor/components/FeaturesRenderer/index.vue +26 -8
- package/dist/runtime/editor/components/FlexTextarea/index.d.vue.ts +31 -0
- package/dist/runtime/editor/components/FlexTextarea/index.vue +179 -0
- package/dist/runtime/editor/components/FlexTextarea/index.vue.d.ts +31 -0
- package/dist/runtime/editor/components/Form/Text/index.vue +23 -11
- package/dist/runtime/editor/components/Form/Toggle/index.d.vue.ts +1 -0
- package/dist/runtime/editor/components/Form/Toggle/index.vue +7 -3
- package/dist/runtime/editor/components/Form/Toggle/index.vue.d.ts +1 -0
- package/dist/runtime/editor/components/Icon/index.vue +3 -1
- package/dist/runtime/editor/components/Indicators/index.vue +20 -10
- package/dist/runtime/editor/components/ItemIcon/index.d.vue.ts +3 -0
- package/dist/runtime/editor/components/ItemIcon/index.vue +3 -2
- package/dist/runtime/editor/components/ItemIcon/index.vue.d.ts +3 -0
- package/dist/runtime/editor/components/ItemIconBox/index.vue +4 -1
- package/dist/runtime/editor/components/NestedEditorOverlay/index.d.vue.ts +3 -1
- package/dist/runtime/editor/components/NestedEditorOverlay/index.vue +150 -71
- package/dist/runtime/editor/components/NestedEditorOverlay/index.vue.d.ts +3 -1
- package/dist/runtime/editor/components/PluginConfigForm/index.vue +6 -2
- package/dist/runtime/editor/components/RelativeTime/index.d.vue.ts +3 -2
- package/dist/runtime/editor/components/RelativeTime/index.vue +21 -7
- package/dist/runtime/editor/components/RelativeTime/index.vue.d.ts +3 -2
- package/dist/runtime/editor/components/StatusIcon/index.d.vue.ts +9 -0
- package/dist/runtime/editor/components/StatusIcon/index.vue +31 -0
- package/dist/runtime/editor/components/StatusIcon/index.vue.d.ts +9 -0
- package/dist/runtime/editor/components/SystemRequirements/index.vue +5 -1
- package/dist/runtime/editor/components/Transition/Height.vue +3 -2
- package/dist/runtime/editor/components/Transition/index.d.vue.ts +1 -1
- package/dist/runtime/editor/components/Transition/index.vue +2 -1
- package/dist/runtime/editor/components/Transition/index.vue.d.ts +1 -1
- package/dist/runtime/editor/components/index.d.ts +10 -6
- package/dist/runtime/editor/components/index.js +19 -11
- package/dist/runtime/editor/composables/index.d.ts +2 -0
- package/dist/runtime/editor/composables/index.js +2 -0
- package/dist/runtime/editor/composables/onElementResize.d.ts +3 -0
- package/dist/runtime/editor/composables/onElementResize.js +37 -0
- package/dist/runtime/editor/composables/useEditableFieldOverride.d.ts +24 -0
- package/dist/runtime/editor/composables/useEditableFieldOverride.js +130 -0
- package/dist/runtime/editor/composables/useStickyToolbar.d.ts +4 -3
- package/dist/runtime/editor/composables/useStickyToolbar.js +26 -10
- package/dist/runtime/editor/css/output.css +1 -1
- package/dist/runtime/editor/events/index.d.ts +31 -0
- package/dist/runtime/editor/features/add-list/Actions/Action.d.vue.ts +8 -1
- package/dist/runtime/editor/features/add-list/Actions/Action.vue +7 -1
- package/dist/runtime/editor/features/add-list/Actions/Action.vue.d.ts +8 -1
- package/dist/runtime/editor/features/add-list/Actions/index.d.vue.ts +11 -1
- package/dist/runtime/editor/features/add-list/Actions/index.vue +30 -10
- package/dist/runtime/editor/features/add-list/Actions/index.vue.d.ts +11 -1
- package/dist/runtime/editor/features/add-list/Blocks/index.d.vue.ts +11 -2
- package/dist/runtime/editor/features/add-list/Blocks/index.vue +27 -1
- package/dist/runtime/editor/features/add-list/Blocks/index.vue.d.ts +11 -2
- package/dist/runtime/editor/features/add-list/Help/Item.d.vue.ts +12 -0
- package/dist/runtime/editor/features/add-list/Help/Item.vue +186 -0
- package/dist/runtime/editor/features/add-list/Help/Item.vue.d.ts +12 -0
- package/dist/runtime/editor/features/add-list/Help/index.d.vue.ts +13 -0
- package/dist/runtime/editor/features/add-list/Help/index.vue +127 -0
- package/dist/runtime/editor/features/add-list/Help/index.vue.d.ts +13 -0
- package/dist/runtime/editor/features/add-list/docs.md +2 -2
- package/dist/runtime/editor/features/add-list/index.vue +108 -9
- package/dist/runtime/editor/features/add-list/types.d.ts +5 -0
- package/dist/runtime/editor/features/analyze/Main.vue +4 -1
- package/dist/runtime/editor/features/analyze/Summary/Chart.vue +9 -9
- package/dist/runtime/editor/features/analyze/index.vue +2 -14
- package/dist/runtime/editor/features/analyze/types.d.ts +4 -1
- package/dist/runtime/editor/features/artboard/Renderer.vue +43 -0
- package/dist/runtime/editor/features/assistant/docs.md +5 -5
- package/dist/runtime/editor/features/breadcrumbs/index.vue +4 -1
- package/dist/runtime/editor/features/clipboard/index.vue +6 -2
- package/dist/runtime/editor/features/comments/index.vue +1 -0
- package/dist/runtime/editor/features/comments/types.d.ts +6 -0
- package/dist/runtime/editor/features/dragging-overlay/DragItems/DragItem.d.vue.ts +1 -0
- package/dist/runtime/editor/features/dragging-overlay/DragItems/DragItem.vue +6 -31
- package/dist/runtime/editor/features/dragging-overlay/DragItems/DragItem.vue.d.ts +1 -0
- package/dist/runtime/editor/features/dragging-overlay/DragItems/index.d.vue.ts +2 -1
- package/dist/runtime/editor/features/dragging-overlay/DragItems/index.vue +42 -18
- package/dist/runtime/editor/features/dragging-overlay/DragItems/index.vue.d.ts +2 -1
- package/dist/runtime/editor/features/dragging-overlay/Renderer/fragment.glsl +77 -2
- package/dist/runtime/editor/features/dragging-overlay/Renderer/index.d.vue.ts +1 -0
- package/dist/runtime/editor/features/dragging-overlay/Renderer/index.vue +143 -52
- package/dist/runtime/editor/features/dragging-overlay/Renderer/index.vue.d.ts +1 -0
- package/dist/runtime/editor/features/dragging-overlay/Renderer/vertex.glsl +84 -31
- package/dist/runtime/editor/features/dragging-overlay/index.vue +3 -2
- package/dist/runtime/editor/features/edit/index.vue +7 -1
- package/dist/runtime/editor/features/editable-field/Overlay/Plaintext/index.vue +13 -23
- package/dist/runtime/editor/features/editable-field/Overlay/index.vue +10 -102
- package/dist/runtime/editor/features/editable-field/types.d.ts +12 -2
- package/dist/runtime/editor/features/entity-title/index.vue +7 -7
- package/dist/runtime/editor/features/fragments/index.vue +1 -1
- package/dist/runtime/editor/features/import-existing/Dialog/index.vue +8 -13
- package/dist/runtime/editor/features/library/ReusableDialog/index.vue +6 -1
- package/dist/runtime/editor/features/library/index.vue +14 -5
- package/dist/runtime/editor/features/library/types.d.ts +6 -0
- package/dist/runtime/editor/features/media-library/Library/Item.d.vue.ts +2 -2
- package/dist/runtime/editor/features/media-library/Library/Item.vue +17 -1
- package/dist/runtime/editor/features/media-library/Library/Item.vue.d.ts +2 -2
- package/dist/runtime/editor/features/media-library/Library/index.vue +6 -1
- package/dist/runtime/editor/features/media-library/index.vue +4 -4
- package/dist/runtime/editor/features/options/Form/index.vue +11 -43
- package/dist/runtime/editor/features/ownership/Banner/index.d.vue.ts +6 -3
- package/dist/runtime/editor/features/ownership/Banner/index.vue +10 -1
- package/dist/runtime/editor/features/ownership/Banner/index.vue.d.ts +6 -3
- package/dist/runtime/editor/features/ownership/index.vue +18 -6
- package/dist/runtime/editor/features/ownership/types.d.ts +5 -0
- package/dist/runtime/editor/features/publish/index.vue +5 -1
- package/dist/runtime/editor/features/search/Overlay/index.vue +5 -2
- package/dist/runtime/editor/features/search/index.vue +64 -3
- package/dist/runtime/editor/features/search/types.d.ts +16 -1
- package/dist/runtime/editor/features/selection/AddButtons/Renderer/index.vue +1 -3
- package/dist/runtime/editor/features/selection/AddButtons/index.vue +24 -4
- package/dist/runtime/editor/features/selection/Renderer/index.vue +5 -1
- package/dist/runtime/editor/features/selection/index.vue +5 -1
- package/dist/runtime/editor/features/settings/Dialog/index.vue +3 -1
- package/dist/runtime/editor/features/settings/index.vue +4 -1
- package/dist/runtime/editor/features/templates/CreateDialog/index.vue +21 -2
- package/dist/runtime/editor/features/templates/Dialog/Item/index.d.vue.ts +1 -1
- package/dist/runtime/editor/features/templates/Dialog/Item/index.vue +3 -3
- package/dist/runtime/editor/features/templates/Dialog/Item/index.vue.d.ts +1 -1
- package/dist/runtime/editor/features/templates/Dialog/index.vue +21 -5
- package/dist/runtime/editor/features/templates/ManageDialog/Item.d.vue.ts +8 -0
- package/dist/runtime/editor/features/templates/ManageDialog/Item.vue +147 -0
- package/dist/runtime/editor/features/templates/ManageDialog/Item.vue.d.ts +8 -0
- package/dist/runtime/editor/features/templates/ManageDialog/index.vue +30 -107
- package/dist/runtime/editor/features/templates/index.vue +7 -5
- package/dist/runtime/editor/features/templates/types.d.ts +11 -2
- package/dist/runtime/editor/features/transform/Dialog/index.vue +6 -1
- package/dist/runtime/editor/features/transform/index.vue +25 -20
- package/dist/runtime/editor/features/transform/types.d.ts +6 -4
- package/dist/runtime/editor/features/validations/index.vue +6 -1
- package/dist/runtime/editor/helpers/date/index.d.ts +1 -0
- package/dist/runtime/editor/helpers/date/index.js +3 -0
- package/dist/runtime/editor/helpers/options/index.d.ts +20 -0
- package/dist/runtime/editor/helpers/options/index.js +60 -0
- package/dist/runtime/editor/helpers/webgl/index.d.ts +5 -1
- package/dist/runtime/editor/helpers/webgl/index.js +45 -13
- package/dist/runtime/editor/icons/svg/stars.svg +1 -0
- package/dist/runtime/editor/plugins/Sidebar/Detached/index.d.vue.ts +1 -1
- package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue +13 -10
- package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue.d.ts +1 -1
- package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +3 -1
- package/dist/runtime/editor/plugins/Sidebar/index.vue +14 -2
- package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +3 -1
- package/dist/runtime/editor/providers/adapters.d.ts +33 -0
- package/dist/runtime/editor/providers/adapters.js +88 -0
- package/dist/runtime/editor/providers/animation.js +3 -0
- package/dist/runtime/editor/providers/definition.d.ts +8 -1
- package/dist/runtime/editor/providers/definition.js +7 -3
- package/dist/runtime/editor/providers/dom.d.ts +7 -0
- package/dist/runtime/editor/providers/dom.js +12 -0
- package/dist/runtime/editor/providers/permissions.d.ts +6 -0
- package/dist/runtime/editor/providers/permissions.js +9 -0
- package/dist/runtime/editor/providers/plugin.d.ts +1 -0
- package/dist/runtime/editor/providers/state.js +1 -0
- package/dist/runtime/editor/providers/texts.js +20 -6
- package/dist/runtime/editor/providers/types.d.ts +7 -0
- package/dist/runtime/editor/providers/types.js +4 -0
- package/dist/runtime/editor/providers/ui.d.ts +40 -0
- package/dist/runtime/editor/providers/ui.js +27 -1
- package/dist/runtime/editor/translations/de.json +2738 -0
- package/dist/runtime/editor/translations/fr.json +2738 -0
- package/dist/runtime/editor/translations/gsw_CH.json +2738 -0
- package/dist/runtime/editor/translations/it.json +2738 -0
- package/dist/runtime/editor/types/app.d.ts +9 -2
- package/dist/runtime/editor/types/definitions.d.ts +5 -0
- package/dist/runtime/editor/types/features.d.ts +3 -1
- package/dist/runtime/editor/types/permissions.d.ts +17 -0
- package/dist/runtime/editor/types/permissions.js +0 -0
- package/dist/runtime/helpers/runtimeHelpers/index.d.ts +2 -1
- package/dist/runtime/helpers/runtimeHelpers/index.js +44 -6
- package/dist/runtime/types/index.d.ts +6 -0
- package/dist/shared/editor.CGf7C_0M.mjs +10 -0
- package/dist/shared/editor.DMFfaLVE.mjs +175 -0
- package/dist/shared/{editor.BKQCh70G.d.mts → editor.Iax3GCvt.d.mts} +94 -40
- package/dist/types.d.mts +7 -1
- package/package.json +29 -7
- package/dist/runtime/css/output.css +0 -1
- package/dist/runtime/material-icons/index.d.ts +0 -12
- package/dist/runtime/material-icons/index.js +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
import { getAvailableOptions } from "#blokkli/editor/helpers/options";
|
|
4
|
+
import { blockOptionsMapSchema, buildBlockOptionsMap } from "../schemas.js";
|
|
5
|
+
const paramsSchema = z.object({
|
|
6
|
+
uuids: z.array(z.string()).describe("The paragraph UUIDs to get options for")
|
|
7
|
+
});
|
|
8
|
+
const resultSchema = z.record(
|
|
9
|
+
z.string().describe("Paragraph UUID"),
|
|
10
|
+
blockOptionsMapSchema.describe("Options for this paragraph")
|
|
11
|
+
);
|
|
12
|
+
export default defineBlokkliAgentTool({
|
|
13
|
+
name: "get_paragraph_options",
|
|
14
|
+
description: "Get available options and their current values for one or more paragraphs",
|
|
15
|
+
category: "query",
|
|
16
|
+
volatile: true,
|
|
17
|
+
prunedSummary: (r) => `options for ${Object.keys(r || {}).length} paragraphs`,
|
|
18
|
+
modes: ["readonly", "editing", "translating", "review"],
|
|
19
|
+
label($t) {
|
|
20
|
+
return $t("aiAgentGetBlockOptionsRunning", "Getting block options...");
|
|
21
|
+
},
|
|
22
|
+
paramsSchema,
|
|
23
|
+
resultSchema,
|
|
24
|
+
execute(ctx, params) {
|
|
25
|
+
const { blocks, state, definitions, selection, types, $t } = ctx.app;
|
|
26
|
+
const result = {};
|
|
27
|
+
const affectedUuids = [];
|
|
28
|
+
for (const uuid of params.uuids) {
|
|
29
|
+
const block = blocks.getBlock(uuid);
|
|
30
|
+
if (!block) continue;
|
|
31
|
+
const bundle = block.library?.reusableBundle || block.bundle;
|
|
32
|
+
const selectionItem = selection.items.value.find((v) => v.uuid === uuid);
|
|
33
|
+
const definition = definitions.getBlockDefinition(
|
|
34
|
+
bundle,
|
|
35
|
+
selectionItem?.fieldListType ?? "default",
|
|
36
|
+
selectionItem?.parentBlockBundle
|
|
37
|
+
);
|
|
38
|
+
if (!definition) continue;
|
|
39
|
+
const availableOptions = getAvailableOptions(
|
|
40
|
+
definition.options,
|
|
41
|
+
definition.globalOptions,
|
|
42
|
+
definitions.globalOptions.value
|
|
43
|
+
);
|
|
44
|
+
result[uuid] = buildBlockOptionsMap(
|
|
45
|
+
availableOptions,
|
|
46
|
+
state.mutatedOptions,
|
|
47
|
+
uuid
|
|
48
|
+
);
|
|
49
|
+
affectedUuids.push(uuid);
|
|
50
|
+
}
|
|
51
|
+
const count = affectedUuids.length;
|
|
52
|
+
const firstUuid = affectedUuids[0];
|
|
53
|
+
const firstBlock = firstUuid ? blocks.getBlock(firstUuid) : null;
|
|
54
|
+
const label = count === 1 && firstBlock ? $t("aiAgentGetBlockOptionsDone", "Got options of @bundle").replace(
|
|
55
|
+
"@bundle",
|
|
56
|
+
types.getBlockLabel(firstBlock.bundle)
|
|
57
|
+
) : $t(
|
|
58
|
+
"aiAgentGetBlockOptionsMultipleDone",
|
|
59
|
+
"Got options of @count blocks"
|
|
60
|
+
).replace("@count", String(count));
|
|
61
|
+
return { label, result, affectedUuids };
|
|
62
|
+
}
|
|
63
|
+
});
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
const paramsSchema = z.object({
|
|
4
|
+
maxNestingLevel: z.number().optional().describe(
|
|
5
|
+
"Maximum nesting depth to include (0 = only root paragraphs, 1 = root + direct children, etc.). Omit for unlimited depth."
|
|
6
|
+
),
|
|
7
|
+
includeDimensions: z.boolean().optional().default(false).describe(
|
|
8
|
+
"Include x, y, width, height for each paragraph (default: false)"
|
|
9
|
+
)
|
|
10
|
+
});
|
|
11
|
+
const dimensionsSchema = z.object({
|
|
12
|
+
x: z.number().describe("X position in artboard coordinates"),
|
|
13
|
+
y: z.number().describe("Y position in artboard coordinates"),
|
|
14
|
+
width: z.number().describe("Width in pixels"),
|
|
15
|
+
height: z.number().describe("Height in pixels")
|
|
16
|
+
});
|
|
17
|
+
const nestedBlockSchema = z.object({
|
|
18
|
+
uuid: z.string().describe("The paragraph UUID"),
|
|
19
|
+
bundle: z.string().describe("The paragraph type"),
|
|
20
|
+
label: z.string().describe("Human-readable paragraph label"),
|
|
21
|
+
dimensions: dimensionsSchema.optional().describe("Paragraph position and size (if requested)"),
|
|
22
|
+
children: z.record(z.string(), z.array(z.lazy(() => nestedBlockSchema))).optional().describe("Child paragraphs organized by field name")
|
|
23
|
+
});
|
|
24
|
+
const rootBlockSchema = z.object({
|
|
25
|
+
uuid: z.string().describe("The paragraph UUID"),
|
|
26
|
+
bundle: z.string().describe("The paragraph type"),
|
|
27
|
+
label: z.string().describe("Human-readable paragraph label"),
|
|
28
|
+
dimensions: dimensionsSchema.optional().describe("Paragraph position and size (if requested)"),
|
|
29
|
+
visibilityPercent: z.number().describe("Percentage of paragraph area visible in viewport (0-100)"),
|
|
30
|
+
parent: z.object({
|
|
31
|
+
type: z.string().describe("Parent entity type"),
|
|
32
|
+
uuid: z.string().describe("Parent entity UUID"),
|
|
33
|
+
field: z.string().describe("Field name containing this paragraph")
|
|
34
|
+
}).describe("Parent field information"),
|
|
35
|
+
children: z.record(z.string(), z.array(nestedBlockSchema)).optional().describe("Child paragraphs organized by field name")
|
|
36
|
+
});
|
|
37
|
+
const resultSchema = z.object({
|
|
38
|
+
paragraphs: z.array(rootBlockSchema).describe("Root-level paragraphs currently visible in the viewport")
|
|
39
|
+
});
|
|
40
|
+
function getDimensions(app, uuid) {
|
|
41
|
+
const rect = app.dom.getBlockRect(uuid);
|
|
42
|
+
if (!rect) {
|
|
43
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
x: Math.round(rect.x),
|
|
47
|
+
y: Math.round(rect.y),
|
|
48
|
+
width: Math.round(rect.width),
|
|
49
|
+
height: Math.round(rect.height)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function calculateVisibility(app, uuid) {
|
|
53
|
+
const artboardRect = app.dom.getBlockRect(uuid);
|
|
54
|
+
if (!artboardRect) return 0;
|
|
55
|
+
const viewport = app.ui.visibleViewport.value;
|
|
56
|
+
const rect = app.ui.getViewportRelativeRect(artboardRect);
|
|
57
|
+
const intersectX = Math.max(
|
|
58
|
+
0,
|
|
59
|
+
Math.min(rect.x + rect.width, viewport.x + viewport.width) - Math.max(rect.x, viewport.x)
|
|
60
|
+
);
|
|
61
|
+
const intersectY = Math.max(
|
|
62
|
+
0,
|
|
63
|
+
Math.min(rect.y + rect.height, viewport.y + viewport.height) - Math.max(rect.y, viewport.y)
|
|
64
|
+
);
|
|
65
|
+
const intersectArea = intersectX * intersectY;
|
|
66
|
+
const blockArea = rect.width * rect.height;
|
|
67
|
+
if (blockArea === 0) return 0;
|
|
68
|
+
return Math.round(intersectArea / blockArea * 100);
|
|
69
|
+
}
|
|
70
|
+
function buildNestedBlockTree(app, uuid, options) {
|
|
71
|
+
const block = app.blocks.getBlock(uuid);
|
|
72
|
+
const bundle = block?.bundle ?? "unknown";
|
|
73
|
+
const result = {
|
|
74
|
+
uuid,
|
|
75
|
+
bundle,
|
|
76
|
+
label: app.types.getBlockLabel(bundle)
|
|
77
|
+
};
|
|
78
|
+
if (options.includeDimensions) {
|
|
79
|
+
result.dimensions = getDimensions(app, uuid);
|
|
80
|
+
}
|
|
81
|
+
const shouldIncludeChildren = options.maxNestingLevel === void 0 || options.currentLevel < options.maxNestingLevel;
|
|
82
|
+
if (shouldIncludeChildren) {
|
|
83
|
+
const mutatedFields = app.state.mutatedFields.value;
|
|
84
|
+
const childFields = {};
|
|
85
|
+
for (const field of mutatedFields) {
|
|
86
|
+
if (field.entityUuid === uuid && field.list.length > 0) {
|
|
87
|
+
childFields[field.name] = field.list.map(
|
|
88
|
+
(item) => buildNestedBlockTree(app, item.uuid, {
|
|
89
|
+
...options,
|
|
90
|
+
currentLevel: options.currentLevel + 1
|
|
91
|
+
})
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (Object.keys(childFields).length > 0) {
|
|
96
|
+
result.children = childFields;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
function buildRootBlockTree(app, uuid, options) {
|
|
102
|
+
const block = app.blocks.getBlock(uuid);
|
|
103
|
+
const bundle = block?.bundle ?? "unknown";
|
|
104
|
+
const parentField = app.state.getFieldListForBlock(uuid);
|
|
105
|
+
const parent = parentField ? {
|
|
106
|
+
type: parentField.entityType,
|
|
107
|
+
uuid: parentField.entityUuid,
|
|
108
|
+
field: parentField.name
|
|
109
|
+
} : { type: "unknown", uuid: "unknown", field: "unknown" };
|
|
110
|
+
const result = {
|
|
111
|
+
uuid,
|
|
112
|
+
bundle,
|
|
113
|
+
label: app.types.getBlockLabel(bundle),
|
|
114
|
+
visibilityPercent: calculateVisibility(app, uuid),
|
|
115
|
+
parent
|
|
116
|
+
};
|
|
117
|
+
if (options.includeDimensions) {
|
|
118
|
+
result.dimensions = getDimensions(app, uuid);
|
|
119
|
+
}
|
|
120
|
+
const shouldIncludeChildren = options.maxNestingLevel === void 0 || options.currentLevel < options.maxNestingLevel;
|
|
121
|
+
if (shouldIncludeChildren) {
|
|
122
|
+
const mutatedFields = app.state.mutatedFields.value;
|
|
123
|
+
const childFields = {};
|
|
124
|
+
for (const field of mutatedFields) {
|
|
125
|
+
if (field.entityUuid === uuid && field.list.length > 0) {
|
|
126
|
+
childFields[field.name] = field.list.map(
|
|
127
|
+
(item) => buildNestedBlockTree(app, item.uuid, {
|
|
128
|
+
...options,
|
|
129
|
+
currentLevel: options.currentLevel + 1
|
|
130
|
+
})
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (Object.keys(childFields).length > 0) {
|
|
135
|
+
result.children = childFields;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
export default defineBlokkliAgentTool({
|
|
141
|
+
name: "get_paragraphs_in_viewport",
|
|
142
|
+
description: `Get paragraphs currently visible in the viewport with their visibility percentage. Use this for viewport-relative queries like "the paragraph at the top", "what's in the center", or "paragraphs near the bottom". NOT for getting all page content - use get_all_page_content for that.`,
|
|
143
|
+
category: "query",
|
|
144
|
+
volatile: true,
|
|
145
|
+
prunedSummary: (r) => `${r.paragraphs?.length || 0} paragraphs in viewport`,
|
|
146
|
+
modes: ["readonly", "editing", "translating", "review"],
|
|
147
|
+
label($t) {
|
|
148
|
+
return $t(
|
|
149
|
+
"aiAgentGetBlocksInViewportRunning",
|
|
150
|
+
"Getting blocks in viewport..."
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
paramsSchema,
|
|
154
|
+
resultSchema,
|
|
155
|
+
execute(ctx, params) {
|
|
156
|
+
const { dom, state, $t } = ctx.app;
|
|
157
|
+
const visibleUuids = dom.getVisibleBlocks();
|
|
158
|
+
const buildOptions = {
|
|
159
|
+
includeDimensions: params.includeDimensions ?? false,
|
|
160
|
+
maxNestingLevel: params.maxNestingLevel,
|
|
161
|
+
currentLevel: 0
|
|
162
|
+
};
|
|
163
|
+
const rootUuids = visibleUuids.filter(
|
|
164
|
+
(uuid) => state.getNestingLevel(uuid) === 0
|
|
165
|
+
);
|
|
166
|
+
const blockTrees = rootUuids.map(
|
|
167
|
+
(uuid) => buildRootBlockTree(ctx.app, uuid, buildOptions)
|
|
168
|
+
);
|
|
169
|
+
blockTrees.sort((a, b) => b.visibilityPercent - a.visibilityPercent);
|
|
170
|
+
return {
|
|
171
|
+
label: $t(
|
|
172
|
+
"aiAgentGetBlocksInViewportDone",
|
|
173
|
+
"Got @count blocks in viewport"
|
|
174
|
+
).replace("@count", String(blockTrees.length)),
|
|
175
|
+
result: {
|
|
176
|
+
paragraphs: blockTrees
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
const paramsSchema = z.object({});
|
|
4
|
+
const paragraphSchema = z.object({
|
|
5
|
+
uuid: z.string().describe("The paragraph UUID"),
|
|
6
|
+
bundle: z.string().describe("The paragraph type"),
|
|
7
|
+
label: z.string().describe("Human-readable paragraph label")
|
|
8
|
+
});
|
|
9
|
+
const resultSchema = z.object({
|
|
10
|
+
paragraphs: z.array(paragraphSchema).describe("Currently selected paragraphs")
|
|
11
|
+
});
|
|
12
|
+
export default defineBlokkliAgentTool({
|
|
13
|
+
name: "get_selected_paragraphs",
|
|
14
|
+
description: "Get the paragraphs currently selected by the user. Returns an empty array if nothing is selected.",
|
|
15
|
+
category: "query",
|
|
16
|
+
volatile: true,
|
|
17
|
+
prunedSummary: (r) => `${r.paragraphs?.length || 0} paragraphs selected`,
|
|
18
|
+
modes: ["readonly", "editing", "translating", "review"],
|
|
19
|
+
label($t) {
|
|
20
|
+
return $t("aiAgentGetSelectedBlocksRunning", "Getting selected blocks...");
|
|
21
|
+
},
|
|
22
|
+
paramsSchema,
|
|
23
|
+
resultSchema,
|
|
24
|
+
execute(ctx) {
|
|
25
|
+
const { selection, types, $t } = ctx.app;
|
|
26
|
+
const paragraphs = selection.uuids.value.map((uuid) => {
|
|
27
|
+
const item = selection.items.value.find((v) => v.uuid === uuid);
|
|
28
|
+
const bundle = item?.bundle ?? "unknown";
|
|
29
|
+
return {
|
|
30
|
+
uuid,
|
|
31
|
+
bundle,
|
|
32
|
+
label: types.getBlockLabel(bundle)
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
const count = paragraphs.length;
|
|
36
|
+
const label = count ? $t("aiAgentGetSelectedBlocksDone", "@count block(s) selected").replace(
|
|
37
|
+
"@count",
|
|
38
|
+
String(count)
|
|
39
|
+
) : $t("aiAgentGetSelectedBlocksNone", "No blocks selected");
|
|
40
|
+
return {
|
|
41
|
+
label,
|
|
42
|
+
result: { paragraphs },
|
|
43
|
+
affectedUuids: paragraphs.map((b) => b.uuid)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
index: z.number().describe(
|
|
6
|
+
"History index to navigate to (-1 = pristine state, 0+ = mutation index)"
|
|
7
|
+
)
|
|
8
|
+
});
|
|
9
|
+
export default defineBlokkliAgentTool({
|
|
10
|
+
name: "go_to_history_index",
|
|
11
|
+
description: `Navigate to a specific point in mutation history (undo/redo). -1 = pristine state, 0 = first mutation, etc.`,
|
|
12
|
+
category: "mutation",
|
|
13
|
+
lazy: true,
|
|
14
|
+
prunedSummary: (r) => r.success ? `navigated to index ${r.historyIndex ?? "?"}` : "rejected",
|
|
15
|
+
modes: ["editing", "translating"],
|
|
16
|
+
label($t) {
|
|
17
|
+
return $t("aiAgentGoToHistoryIndexRunning", "Navigating history...");
|
|
18
|
+
},
|
|
19
|
+
paramsSchema,
|
|
20
|
+
resultSchema: mutationResultSchema,
|
|
21
|
+
requiredAdapterMethods: ["setHistoryIndex"],
|
|
22
|
+
execute(ctx, params) {
|
|
23
|
+
const { $t, state } = ctx.app;
|
|
24
|
+
const mutations = state.mutations.value;
|
|
25
|
+
const currentIndex = state.currentMutationIndex.value;
|
|
26
|
+
const minIndex = -1;
|
|
27
|
+
const maxIndex = mutations.length - 1;
|
|
28
|
+
if (params.index < minIndex) {
|
|
29
|
+
return { error: `Index ${params.index} is below minimum (-1)` };
|
|
30
|
+
}
|
|
31
|
+
if (params.index > maxIndex) {
|
|
32
|
+
return {
|
|
33
|
+
error: `Index ${params.index} exceeds maximum (${maxIndex}). There are ${mutations.length} mutations.`
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (params.index === currentIndex) {
|
|
37
|
+
return { error: `Already at history index ${params.index}` };
|
|
38
|
+
}
|
|
39
|
+
const isUndo = params.index < currentIndex;
|
|
40
|
+
const steps = Math.abs(currentIndex - params.index);
|
|
41
|
+
const label = isUndo ? $t("aiAgentUndoDone", "Undid @count changes").replace(
|
|
42
|
+
"@count",
|
|
43
|
+
String(steps)
|
|
44
|
+
) : $t("aiAgentRedoDone", "Redid @count changes").replace(
|
|
45
|
+
"@count",
|
|
46
|
+
String(steps)
|
|
47
|
+
);
|
|
48
|
+
return {
|
|
49
|
+
type: "move",
|
|
50
|
+
label,
|
|
51
|
+
apply: (adapter) => adapter.setHistoryIndex(params.index)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
uuids: z.array(z.string()).describe("The UUIDs of the paragraphs to move"),
|
|
11
|
+
parent: parentSchema.describe("The target parent entity"),
|
|
12
|
+
position: positionSchema
|
|
13
|
+
});
|
|
14
|
+
export default defineBlokkliAgentTool({
|
|
15
|
+
name: "move_paragraphs",
|
|
16
|
+
description: "Move one or more paragraphs to a different parent field. All paragraphs are moved to the same location and they KEEP their UUIDs!!",
|
|
17
|
+
category: "mutation",
|
|
18
|
+
prunedSummary: (r) => r.success ? "moved paragraphs" : "rejected",
|
|
19
|
+
modes: ["editing"],
|
|
20
|
+
label($t) {
|
|
21
|
+
return $t("aiAgentMoveBlocksRunning", "Moving blocks...");
|
|
22
|
+
},
|
|
23
|
+
paramsSchema,
|
|
24
|
+
resultSchema: mutationResultSchema,
|
|
25
|
+
requiredAdapterMethods: ["moveMultipleBlocks"],
|
|
26
|
+
execute(ctx, params) {
|
|
27
|
+
const { blocks, types } = ctx.app;
|
|
28
|
+
if (params.uuids.length === 0) {
|
|
29
|
+
return { error: "No paragraph UUIDs provided" };
|
|
30
|
+
}
|
|
31
|
+
const validBlocks = [];
|
|
32
|
+
for (const uuid of params.uuids) {
|
|
33
|
+
const block = blocks.getBlock(uuid);
|
|
34
|
+
if (!block) {
|
|
35
|
+
return { error: `Paragraph not found: ${uuid}` };
|
|
36
|
+
}
|
|
37
|
+
validBlocks.push({ uuid, bundle: block.bundle });
|
|
38
|
+
}
|
|
39
|
+
const { $t } = ctx.app;
|
|
40
|
+
const firstBlock = validBlocks[0];
|
|
41
|
+
const label = validBlocks.length === 1 && firstBlock ? $t("aiAgentMoveBlockDone", "Moved @bundle").replace(
|
|
42
|
+
"@bundle",
|
|
43
|
+
types.getBlockLabel(firstBlock.bundle)
|
|
44
|
+
) : $t("aiAgentMoveBlocksDone", "Moved @count blocks").replace(
|
|
45
|
+
"@count",
|
|
46
|
+
String(validBlocks.length)
|
|
47
|
+
);
|
|
48
|
+
const resolved = resolvePosition(
|
|
49
|
+
ctx.app,
|
|
50
|
+
params.parent.uuid,
|
|
51
|
+
params.parent.field,
|
|
52
|
+
params.position
|
|
53
|
+
);
|
|
54
|
+
if ("error" in resolved) return resolved;
|
|
55
|
+
return {
|
|
56
|
+
type: "move",
|
|
57
|
+
label,
|
|
58
|
+
apply: (adapter) => adapter.moveMultipleBlocks({
|
|
59
|
+
uuids: params.uuids,
|
|
60
|
+
host: {
|
|
61
|
+
type: params.parent.type,
|
|
62
|
+
uuid: params.parent.uuid,
|
|
63
|
+
fieldName: params.parent.field
|
|
64
|
+
},
|
|
65
|
+
afterUuid: resolved.afterUuid
|
|
66
|
+
})
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
import { mutationResultSchema, parentSchema } from "../schemas.js";
|
|
4
|
+
import { itemEntityType } from "#blokkli-build/config";
|
|
5
|
+
const paramsSchema = z.object({
|
|
6
|
+
parent: parentSchema.describe("The parent field containing the paragraphs"),
|
|
7
|
+
uuids: z.array(z.string()).min(2).describe(
|
|
8
|
+
"The UUIDs of the paragraphs in the desired order. Must include ALL paragraphs currently in the field."
|
|
9
|
+
)
|
|
10
|
+
});
|
|
11
|
+
export default defineBlokkliAgentTool({
|
|
12
|
+
name: "rearrange_paragraphs",
|
|
13
|
+
description: "Rearrange paragraphs within a single field by specifying the desired order. You must provide ALL paragraph UUIDs that are currently in the field \u2014 use get_child_paragraphs to get them. This only reorders, it does not add or remove paragraphs.",
|
|
14
|
+
category: "mutation",
|
|
15
|
+
prunedSummary: (r) => r.success ? "rearranged paragraphs" : "rejected",
|
|
16
|
+
modes: ["editing"],
|
|
17
|
+
label($t) {
|
|
18
|
+
return $t("aiAgentRearrangeBlocksRunning", "Rearranging blocks...");
|
|
19
|
+
},
|
|
20
|
+
paramsSchema,
|
|
21
|
+
resultSchema: mutationResultSchema,
|
|
22
|
+
requiredAdapterMethods: ["rearrangeBlocks"],
|
|
23
|
+
execute(ctx, params) {
|
|
24
|
+
const { blocks, types, context, state, $t } = ctx.app;
|
|
25
|
+
const isRootEntity = params.parent.uuid === context.value.entityUuid;
|
|
26
|
+
const entityType = isRootEntity ? context.value.entityType : itemEntityType;
|
|
27
|
+
const bundle = isRootEntity ? context.value.entityBundle : blocks.getBlock(params.parent.uuid)?.bundle;
|
|
28
|
+
if (!bundle) {
|
|
29
|
+
return { error: "Parent not found." };
|
|
30
|
+
}
|
|
31
|
+
const field = types.getFieldConfig(entityType, bundle, params.parent.field);
|
|
32
|
+
if (!field) {
|
|
33
|
+
const availableFields = types.fieldConfig.forEntityTypeAndBundle(entityType, bundle).map((f) => f.name);
|
|
34
|
+
return {
|
|
35
|
+
error: `Field "${params.parent.field}" not found on bundle "${bundle}". Available fields: ${availableFields.length ? availableFields.join(", ") : "none"}.`
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const mutatedField = state.mutatedFields.value.find(
|
|
39
|
+
(f) => f.entityUuid === params.parent.uuid && f.name === params.parent.field
|
|
40
|
+
);
|
|
41
|
+
if (!mutatedField || mutatedField.list.length === 0) {
|
|
42
|
+
return {
|
|
43
|
+
error: `Field "${params.parent.field}" has no paragraphs on parent "${params.parent.uuid}".`
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const currentUuids = mutatedField.list.map((item) => item.uuid);
|
|
47
|
+
if (params.uuids.length !== currentUuids.length) {
|
|
48
|
+
return {
|
|
49
|
+
error: `Expected ${currentUuids.length} UUIDs (all paragraphs in the field), got ${params.uuids.length}. Current UUIDs: ${currentUuids.join(", ")}`
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const providedSet = new Set(params.uuids);
|
|
53
|
+
const currentSet = new Set(currentUuids);
|
|
54
|
+
if (providedSet.size !== params.uuids.length) {
|
|
55
|
+
return { error: "Duplicate UUIDs provided." };
|
|
56
|
+
}
|
|
57
|
+
for (const uuid of params.uuids) {
|
|
58
|
+
if (!currentSet.has(uuid)) {
|
|
59
|
+
return {
|
|
60
|
+
error: `Paragraph "${uuid}" is not in field "${params.parent.field}". Current UUIDs: ${currentUuids.join(", ")}`
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
for (const uuid of currentUuids) {
|
|
65
|
+
if (!providedSet.has(uuid)) {
|
|
66
|
+
return {
|
|
67
|
+
error: `Missing paragraph "${uuid}" from the provided list. You must include ALL paragraphs in the field.`
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const isAlreadyInOrder = params.uuids.every(
|
|
72
|
+
(uuid, i) => uuid === currentUuids[i]
|
|
73
|
+
);
|
|
74
|
+
if (isAlreadyInOrder) {
|
|
75
|
+
return { error: "The paragraphs are already in the requested order." };
|
|
76
|
+
}
|
|
77
|
+
const label = $t(
|
|
78
|
+
"aiAgentRearrangeBlocksDone",
|
|
79
|
+
"Rearranged @count blocks"
|
|
80
|
+
).replace("@count", String(params.uuids.length));
|
|
81
|
+
return {
|
|
82
|
+
type: "move",
|
|
83
|
+
label,
|
|
84
|
+
affectedUuids: params.uuids,
|
|
85
|
+
apply: (adapter) => adapter.rearrangeBlocks({
|
|
86
|
+
host: {
|
|
87
|
+
type: params.parent.type,
|
|
88
|
+
uuid: params.parent.uuid,
|
|
89
|
+
fieldName: params.parent.field
|
|
90
|
+
},
|
|
91
|
+
uuids: params.uuids
|
|
92
|
+
})
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
uuid: z.string().describe("The paragraph UUID containing the content reference field"),
|
|
6
|
+
field: z.string().describe("The content field name (reference type)"),
|
|
7
|
+
itemId: z.string().describe("Content item ID from search_content_* results"),
|
|
8
|
+
itemEntityType: z.string().describe("Entity type of the content item"),
|
|
9
|
+
itemEntityBundle: z.string().describe("Entity bundle of the content item")
|
|
10
|
+
});
|
|
11
|
+
export default defineBlokkliAgentTool({
|
|
12
|
+
name: "replace_content_search_item",
|
|
13
|
+
description: "Replace a content reference on an existing paragraph field. Use get_content_fields first to see available reference fields, then search_content_* to find content items.",
|
|
14
|
+
category: "mutation",
|
|
15
|
+
prunedSummary: (r) => r.success ? "replaced content reference" : "rejected",
|
|
16
|
+
modes: ["editing"],
|
|
17
|
+
label($t) {
|
|
18
|
+
return $t(
|
|
19
|
+
"aiAgentReplaceContentSearchItemRunning",
|
|
20
|
+
"Replacing content reference..."
|
|
21
|
+
);
|
|
22
|
+
},
|
|
23
|
+
lazy: true,
|
|
24
|
+
paramsSchema,
|
|
25
|
+
resultSchema: mutationResultSchema,
|
|
26
|
+
requiredAdapterMethods: ["replaceContentSearchItem"],
|
|
27
|
+
execute(ctx, params) {
|
|
28
|
+
const { blocks, types, $t } = ctx.app;
|
|
29
|
+
const block = blocks.getBlock(params.uuid);
|
|
30
|
+
if (!block) {
|
|
31
|
+
return { error: `Paragraph not found: ${params.uuid}` };
|
|
32
|
+
}
|
|
33
|
+
const config = types.droppableFieldConfig.forName(
|
|
34
|
+
ctx.itemEntityType,
|
|
35
|
+
block.bundle,
|
|
36
|
+
params.field
|
|
37
|
+
);
|
|
38
|
+
if (!config) {
|
|
39
|
+
return {
|
|
40
|
+
error: `Field "${params.field}" is not a reference content field on ${block.bundle} paragraphs`
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const allowedRestriction = config.allowed.find(
|
|
44
|
+
(v) => v.type === params.itemEntityType
|
|
45
|
+
);
|
|
46
|
+
if (!allowedRestriction) {
|
|
47
|
+
return {
|
|
48
|
+
error: `Field "${params.field}" does not accept ${params.itemEntityType} entities. Allowed types: ${config.allowed.map((v) => v.type).join(", ")}`
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (!allowedRestriction.bundles.includes(params.itemEntityBundle)) {
|
|
52
|
+
return {
|
|
53
|
+
error: `Field "${params.field}" does not accept ${params.itemEntityBundle} bundles. Allowed: ${allowedRestriction.bundles.join(", ")}`
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const item = {
|
|
57
|
+
id: params.itemId,
|
|
58
|
+
entityType: params.itemEntityType,
|
|
59
|
+
entityBundle: params.itemEntityBundle,
|
|
60
|
+
title: params.itemId,
|
|
61
|
+
targetBundles: []
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
type: "rewrite",
|
|
65
|
+
label: $t(
|
|
66
|
+
"aiAgentReplaceContentSearchItemDone",
|
|
67
|
+
"Replaced content reference on @field"
|
|
68
|
+
).replace("@field", config.label),
|
|
69
|
+
apply: (adapter) => adapter.replaceContentSearchItem({
|
|
70
|
+
host: {
|
|
71
|
+
type: ctx.itemEntityType,
|
|
72
|
+
uuid: params.uuid,
|
|
73
|
+
fieldName: params.field
|
|
74
|
+
},
|
|
75
|
+
item
|
|
76
|
+
}),
|
|
77
|
+
affectedUuids: [params.uuid]
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
});
|