@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,192 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
import { getFieldType, getEditableValue } from "../schemas.js";
|
|
4
|
+
const paramsSchema = z.object({
|
|
5
|
+
uuids: z.array(z.string()).describe(
|
|
6
|
+
"One or more paragraph UUIDs (or the page UUID to get page-level fields)"
|
|
7
|
+
),
|
|
8
|
+
includeNested: z.boolean().optional().default(true).describe(
|
|
9
|
+
"Recursively include content fields from all nested child paragraphs (default: true). Set to false to only get direct fields."
|
|
10
|
+
)
|
|
11
|
+
});
|
|
12
|
+
const fieldSchema = z.discriminatedUnion("type", [
|
|
13
|
+
z.object({
|
|
14
|
+
type: z.literal("plain").describe("Plain text field"),
|
|
15
|
+
currentValue: z.string().describe("Current field value"),
|
|
16
|
+
required: z.boolean().describe("Whether this field is required"),
|
|
17
|
+
maxLength: z.number().describe("Maximum character length (0 means unlimited)")
|
|
18
|
+
}),
|
|
19
|
+
z.object({
|
|
20
|
+
type: z.literal("markup").describe("Rich text / HTML field"),
|
|
21
|
+
currentValue: z.string().describe("Current field value"),
|
|
22
|
+
required: z.boolean().describe("Whether this field is required"),
|
|
23
|
+
maxLength: z.number().describe("Maximum character length (0 means unlimited)")
|
|
24
|
+
}),
|
|
25
|
+
z.object({
|
|
26
|
+
type: z.literal("reference").describe("Entity reference field"),
|
|
27
|
+
label: z.string().describe("Human-readable field label"),
|
|
28
|
+
allowed: z.array(
|
|
29
|
+
z.object({
|
|
30
|
+
type: z.string().describe('The entity type (e.g., "media", "node")'),
|
|
31
|
+
bundles: z.array(z.string()).describe("The bundles accepted for this entity type")
|
|
32
|
+
})
|
|
33
|
+
).describe("Entity types and bundles this field accepts")
|
|
34
|
+
}),
|
|
35
|
+
z.object({
|
|
36
|
+
type: z.literal("link").describe("Link field"),
|
|
37
|
+
label: z.string().describe("Human-readable field label"),
|
|
38
|
+
allowed: z.array(
|
|
39
|
+
z.object({
|
|
40
|
+
type: z.string().describe('The entity type (e.g., "media", "node")'),
|
|
41
|
+
bundles: z.array(z.string()).describe("The bundles accepted for this entity type")
|
|
42
|
+
})
|
|
43
|
+
).describe("Entity types and bundles this field accepts")
|
|
44
|
+
})
|
|
45
|
+
]);
|
|
46
|
+
const resultSchema = z.record(
|
|
47
|
+
z.string().describe("Paragraph UUID"),
|
|
48
|
+
z.record(z.string().describe("Field name"), fieldSchema)
|
|
49
|
+
);
|
|
50
|
+
function addField(result, uuid, fieldName, field) {
|
|
51
|
+
if (!result[uuid]) {
|
|
52
|
+
result[uuid] = {};
|
|
53
|
+
}
|
|
54
|
+
result[uuid][fieldName] = field;
|
|
55
|
+
}
|
|
56
|
+
export default defineBlokkliAgentTool({
|
|
57
|
+
name: "get_content_fields",
|
|
58
|
+
description: "Get all content fields (text, media, links) for a paragraph and optionally its nested children",
|
|
59
|
+
category: "query",
|
|
60
|
+
volatile: true,
|
|
61
|
+
prunedSummary: (r) => `fields for ${Object.keys(r || {}).length} paragraphs`,
|
|
62
|
+
modes: ["readonly", "editing", "translating", "review"],
|
|
63
|
+
label($t) {
|
|
64
|
+
return $t("aiAgentGetContentFieldsRunning", "Getting content fields...");
|
|
65
|
+
},
|
|
66
|
+
paramsSchema,
|
|
67
|
+
resultSchema,
|
|
68
|
+
execute(ctx, params) {
|
|
69
|
+
const { blocks, directive, state, types, $t, context } = ctx.app;
|
|
70
|
+
const result = {};
|
|
71
|
+
const processedUuids = /* @__PURE__ */ new Set();
|
|
72
|
+
function processEntity(entityUuid) {
|
|
73
|
+
const entityType = context.value.entityType;
|
|
74
|
+
const entityBundle = context.value.entityBundle;
|
|
75
|
+
const editableConfigs = types.editableFieldConfig.forEntityTypeAndBundle(entityType, entityBundle).filter((f) => f.type !== "table");
|
|
76
|
+
for (const config of editableConfigs) {
|
|
77
|
+
const fieldType = config.type === "frame" || config.type === "markup" ? "markup" : "plain";
|
|
78
|
+
const currentValue = getEditableValue(
|
|
79
|
+
ctx.app,
|
|
80
|
+
entityType,
|
|
81
|
+
entityUuid,
|
|
82
|
+
entityBundle,
|
|
83
|
+
config.name,
|
|
84
|
+
fieldType
|
|
85
|
+
);
|
|
86
|
+
addField(result, entityUuid, config.name, {
|
|
87
|
+
type: fieldType,
|
|
88
|
+
currentValue,
|
|
89
|
+
required: config.required,
|
|
90
|
+
maxLength: config.maxLength
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
const droppableConfigs = types.droppableFieldConfig.forEntityTypeAndBundle(
|
|
94
|
+
entityType,
|
|
95
|
+
entityBundle
|
|
96
|
+
);
|
|
97
|
+
for (const config of droppableConfigs) {
|
|
98
|
+
addField(result, entityUuid, config.name, {
|
|
99
|
+
type: config.type,
|
|
100
|
+
label: config.label,
|
|
101
|
+
allowed: config.allowed
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function processBlock(blockUuid) {
|
|
106
|
+
if (processedUuids.has(blockUuid)) return;
|
|
107
|
+
processedUuids.add(blockUuid);
|
|
108
|
+
const block = blocks.getBlock(blockUuid);
|
|
109
|
+
if (!block) return;
|
|
110
|
+
const editables = directive.getEditablesForBlock(blockUuid);
|
|
111
|
+
for (const editable of editables) {
|
|
112
|
+
const fieldType = getFieldType(
|
|
113
|
+
ctx.app,
|
|
114
|
+
ctx.itemEntityType,
|
|
115
|
+
block.bundle,
|
|
116
|
+
editable.fieldName
|
|
117
|
+
);
|
|
118
|
+
if (!fieldType) continue;
|
|
119
|
+
const currentValue = getEditableValue(
|
|
120
|
+
ctx.app,
|
|
121
|
+
ctx.itemEntityType,
|
|
122
|
+
blockUuid,
|
|
123
|
+
block.bundle,
|
|
124
|
+
editable.fieldName,
|
|
125
|
+
fieldType
|
|
126
|
+
);
|
|
127
|
+
const config = types.editableFieldConfig.forName(
|
|
128
|
+
ctx.itemEntityType,
|
|
129
|
+
block.bundle,
|
|
130
|
+
editable.fieldName
|
|
131
|
+
);
|
|
132
|
+
addField(result, blockUuid, editable.fieldName, {
|
|
133
|
+
type: fieldType,
|
|
134
|
+
currentValue,
|
|
135
|
+
required: config?.required ?? false,
|
|
136
|
+
maxLength: config?.maxLength ?? 0
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
const droppableConfigs = types.droppableFieldConfig.forEntityTypeAndBundle(
|
|
140
|
+
ctx.itemEntityType,
|
|
141
|
+
block.bundle
|
|
142
|
+
);
|
|
143
|
+
for (const config of droppableConfigs) {
|
|
144
|
+
addField(result, blockUuid, config.name, {
|
|
145
|
+
type: config.type,
|
|
146
|
+
label: config.label,
|
|
147
|
+
allowed: config.allowed
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
if (params.includeNested) {
|
|
151
|
+
const mutatedFields = state.mutatedFields.value;
|
|
152
|
+
for (const field of mutatedFields) {
|
|
153
|
+
if (field.entityUuid === blockUuid) {
|
|
154
|
+
for (const child of field.list) {
|
|
155
|
+
processBlock(child.uuid);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
let hasEntity = false;
|
|
162
|
+
for (const uuid of params.uuids) {
|
|
163
|
+
if (uuid === context.value.entityUuid) {
|
|
164
|
+
hasEntity = true;
|
|
165
|
+
processEntity(uuid);
|
|
166
|
+
} else {
|
|
167
|
+
processBlock(uuid);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const count = params.uuids.length;
|
|
171
|
+
const label = hasEntity && count === 1 ? $t(
|
|
172
|
+
"aiAgentGetEntityContentFieldsDone",
|
|
173
|
+
"Got content fields of page entity"
|
|
174
|
+
) : count === 1 ? $t(
|
|
175
|
+
"aiAgentGetContentFieldsDone",
|
|
176
|
+
"Got content fields of @bundle block"
|
|
177
|
+
).replace(
|
|
178
|
+
"@bundle",
|
|
179
|
+
types.getBlockLabel(
|
|
180
|
+
blocks.getBlock(params.uuids[0])?.bundle || "unknown"
|
|
181
|
+
)
|
|
182
|
+
) : $t(
|
|
183
|
+
"aiAgentGetContentFieldsMultipleDone",
|
|
184
|
+
"Got content fields of @count blocks"
|
|
185
|
+
).replace("@count", String(count));
|
|
186
|
+
return {
|
|
187
|
+
label,
|
|
188
|
+
result,
|
|
189
|
+
affectedUuids: params.uuids
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
const paramsSchema = z.object({
|
|
4
|
+
before: z.number().optional().describe("How many mutations before current to include"),
|
|
5
|
+
after: z.number().optional().describe("How many mutations after current to include (redo-able)")
|
|
6
|
+
});
|
|
7
|
+
const mutationSummarySchema = z.object({
|
|
8
|
+
index: z.number().describe("History index for use with go_to_history_index"),
|
|
9
|
+
label: z.string().describe("Human-readable mutation label")
|
|
10
|
+
});
|
|
11
|
+
const currentMutationSchema = z.object({
|
|
12
|
+
index: z.number().describe("History index for use with go_to_history_index"),
|
|
13
|
+
label: z.string().describe("Human-readable mutation label"),
|
|
14
|
+
pluginId: z.string().optional().describe("Internal plugin ID"),
|
|
15
|
+
affectedParagraphUuid: z.string().optional().describe("UUID of the paragraph that was affected")
|
|
16
|
+
});
|
|
17
|
+
const resultSchema = z.object({
|
|
18
|
+
currentIndex: z.number().describe("Current position in history (-1 = pristine state)"),
|
|
19
|
+
totalCount: z.number().describe("Total mutations in history"),
|
|
20
|
+
canUndo: z.boolean().describe("Whether undo is possible"),
|
|
21
|
+
canRedo: z.boolean().describe("Whether redo is possible"),
|
|
22
|
+
currentMutation: currentMutationSchema.nullable().describe("Details of current mutation (null if at pristine state)"),
|
|
23
|
+
mutationsBefore: z.array(mutationSummarySchema).optional().describe("Previous mutations (if before > 0)"),
|
|
24
|
+
mutationsAfter: z.array(mutationSummarySchema).optional().describe("Following mutations (if after > 0)")
|
|
25
|
+
});
|
|
26
|
+
export default defineBlokkliAgentTool({
|
|
27
|
+
name: "get_mutation_history",
|
|
28
|
+
description: `Get information about the mutation history. Returns current position, undo/redo availability, and optionally context mutations before/after the current position. Use with go_to_history_index to navigate.`,
|
|
29
|
+
category: "query",
|
|
30
|
+
volatile: true,
|
|
31
|
+
lazy: true,
|
|
32
|
+
prunedSummary: (r) => `index ${r.currentIndex ?? -1}/${r.totalCount ?? 0}`,
|
|
33
|
+
modes: ["editing", "translating"],
|
|
34
|
+
label($t) {
|
|
35
|
+
return $t("aiAgentGetMutationHistoryRunning", "Getting mutation history...");
|
|
36
|
+
},
|
|
37
|
+
paramsSchema,
|
|
38
|
+
resultSchema,
|
|
39
|
+
execute(ctx, params) {
|
|
40
|
+
const { state, $t } = ctx.app;
|
|
41
|
+
const mutations = state.mutations.value;
|
|
42
|
+
const currentIndex = state.currentMutationIndex.value;
|
|
43
|
+
const totalCount = mutations.length;
|
|
44
|
+
const canUndo = currentIndex > -1;
|
|
45
|
+
const canRedo = currentIndex < totalCount - 1;
|
|
46
|
+
const getMutationLabel = (mutation) => {
|
|
47
|
+
return mutation.plugin?.label || mutation.pluginId || "Unknown mutation";
|
|
48
|
+
};
|
|
49
|
+
let currentMutation = null;
|
|
50
|
+
if (currentIndex >= 0 && currentIndex < mutations.length) {
|
|
51
|
+
const mutation = mutations[currentIndex];
|
|
52
|
+
if (mutation) {
|
|
53
|
+
currentMutation = {
|
|
54
|
+
index: currentIndex,
|
|
55
|
+
label: getMutationLabel(mutation),
|
|
56
|
+
pluginId: mutation.pluginId,
|
|
57
|
+
affectedParagraphUuid: mutation.plugin?.affectedItemUuid
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
let mutationsBefore;
|
|
62
|
+
if (params.before && params.before > 0 && currentIndex >= 0) {
|
|
63
|
+
const startIndex = Math.max(0, currentIndex - params.before);
|
|
64
|
+
mutationsBefore = [];
|
|
65
|
+
for (let i = startIndex; i < currentIndex; i++) {
|
|
66
|
+
const mutation = mutations[i];
|
|
67
|
+
if (mutation) {
|
|
68
|
+
mutationsBefore.push({
|
|
69
|
+
index: i,
|
|
70
|
+
label: getMutationLabel(mutation)
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
let mutationsAfter;
|
|
76
|
+
if (params.after && params.after > 0 && currentIndex < totalCount - 1) {
|
|
77
|
+
const endIndex = Math.min(totalCount - 1, currentIndex + params.after);
|
|
78
|
+
mutationsAfter = [];
|
|
79
|
+
for (let i = currentIndex + 1; i <= endIndex; i++) {
|
|
80
|
+
const mutation = mutations[i];
|
|
81
|
+
if (mutation) {
|
|
82
|
+
mutationsAfter.push({
|
|
83
|
+
index: i,
|
|
84
|
+
label: getMutationLabel(mutation)
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
label: $t("aiAgentGetMutationHistoryDone", "Got mutation history"),
|
|
91
|
+
result: {
|
|
92
|
+
currentIndex,
|
|
93
|
+
totalCount,
|
|
94
|
+
canUndo,
|
|
95
|
+
canRedo,
|
|
96
|
+
currentMutation,
|
|
97
|
+
mutationsBefore,
|
|
98
|
+
mutationsAfter
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
import {
|
|
4
|
+
buildPageStructure,
|
|
5
|
+
buildBlock,
|
|
6
|
+
countBlocks
|
|
7
|
+
} from "#blokkli/agent/app/helpers/pageStructure";
|
|
8
|
+
const paramsSchema = z.object({
|
|
9
|
+
uuid: z.string().optional().describe(
|
|
10
|
+
"UUID of a specific paragraph. When provided, returns only that paragraph and its subtree. Omit to get the full page structure."
|
|
11
|
+
)
|
|
12
|
+
});
|
|
13
|
+
const resultSchema = z.object({
|
|
14
|
+
totalParagraphs: z.number().describe(
|
|
15
|
+
"Total number of paragraphs in scope (full page or subtree when uuid is given)"
|
|
16
|
+
),
|
|
17
|
+
structure: z.string().describe("The page structure as an XML tree of paragraphs and fields")
|
|
18
|
+
});
|
|
19
|
+
function escapeXml(s) {
|
|
20
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
21
|
+
}
|
|
22
|
+
function formatBlock(block, indent) {
|
|
23
|
+
const hasContent = block.contentFields || block.fields;
|
|
24
|
+
if (!hasContent) {
|
|
25
|
+
return `${indent}<Paragraph uuid="${block.uuid}" bundle="${escapeXml(block.bundle)}" />`;
|
|
26
|
+
}
|
|
27
|
+
const lines = [];
|
|
28
|
+
lines.push(
|
|
29
|
+
`${indent}<Paragraph uuid="${block.uuid}" bundle="${escapeXml(block.bundle)}">`
|
|
30
|
+
);
|
|
31
|
+
if (block.contentFields) {
|
|
32
|
+
for (const [name, value] of Object.entries(block.contentFields)) {
|
|
33
|
+
lines.push(
|
|
34
|
+
`${indent} <ContentField name="${escapeXml(name)}">${escapeXml(value)}</ContentField>`
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (block.fields) {
|
|
39
|
+
for (const [fieldName, children] of Object.entries(block.fields)) {
|
|
40
|
+
lines.push(`${indent} <ParagraphField name="${escapeXml(fieldName)}">`);
|
|
41
|
+
for (const child of children) {
|
|
42
|
+
lines.push(formatBlock(child, indent + " "));
|
|
43
|
+
}
|
|
44
|
+
lines.push(`${indent} </ParagraphField>`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
lines.push(`${indent}</Paragraph>`);
|
|
48
|
+
return lines.join("\n");
|
|
49
|
+
}
|
|
50
|
+
export default defineBlokkliAgentTool({
|
|
51
|
+
name: "get_page_structure",
|
|
52
|
+
description: "Get page structure as an XML tree of paragraphs, their fields, and content previews. Without a UUID, returns the full page. With a UUID, returns that paragraph and its subtree.",
|
|
53
|
+
category: "query",
|
|
54
|
+
volatile: true,
|
|
55
|
+
prunedSummary: (r) => `page structure (${r.totalParagraphs ?? 0} paragraphs)`,
|
|
56
|
+
modes: ["readonly", "editing", "translating", "review"],
|
|
57
|
+
label($t) {
|
|
58
|
+
return $t("aiAgentGetPageStructureRunning", "Getting page structure...");
|
|
59
|
+
},
|
|
60
|
+
paramsSchema,
|
|
61
|
+
resultSchema,
|
|
62
|
+
execute(ctx, params) {
|
|
63
|
+
if (params.uuid) {
|
|
64
|
+
const block = ctx.app.blocks.getBlock(params.uuid);
|
|
65
|
+
if (!block) {
|
|
66
|
+
return { error: `Paragraph with UUID "${params.uuid}" not found.` };
|
|
67
|
+
}
|
|
68
|
+
const paragraph = buildBlock(ctx.app, params.uuid, block.bundle);
|
|
69
|
+
const total = countBlocks(paragraph);
|
|
70
|
+
return {
|
|
71
|
+
label: ctx.app.$t(
|
|
72
|
+
"aiAgentGetPageStructureDone",
|
|
73
|
+
"Got page structure (@count paragraphs)"
|
|
74
|
+
).replace("@count", String(total)),
|
|
75
|
+
result: {
|
|
76
|
+
totalParagraphs: total,
|
|
77
|
+
structure: formatBlock(paragraph, "")
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const pageContext = ctx.app.context.value;
|
|
82
|
+
const ps = buildPageStructure(ctx.app);
|
|
83
|
+
const lines = [];
|
|
84
|
+
lines.push(
|
|
85
|
+
`<Page uuid="${pageContext.entityUuid}" type="${escapeXml(pageContext.entityType)}" bundle="${escapeXml(pageContext.entityBundle)}">`
|
|
86
|
+
);
|
|
87
|
+
if (ps.entityContentFields) {
|
|
88
|
+
for (const [name, value] of Object.entries(ps.entityContentFields)) {
|
|
89
|
+
lines.push(
|
|
90
|
+
` <ContentField name="${escapeXml(name)}">${escapeXml(value)}</ContentField>`
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
for (const [fieldName, blocks] of Object.entries(ps.fields)) {
|
|
95
|
+
lines.push(` <ParagraphField name="${escapeXml(fieldName)}">`);
|
|
96
|
+
for (const block of blocks) {
|
|
97
|
+
lines.push(formatBlock(block, " "));
|
|
98
|
+
}
|
|
99
|
+
lines.push(` </ParagraphField>`);
|
|
100
|
+
}
|
|
101
|
+
lines.push(`</Page>`);
|
|
102
|
+
return {
|
|
103
|
+
label: ctx.app.$t(
|
|
104
|
+
"aiAgentGetPageStructureDone",
|
|
105
|
+
"Got page structure (@count paragraphs)"
|
|
106
|
+
).replace("@count", String(ps.totalParagraphs)),
|
|
107
|
+
result: {
|
|
108
|
+
totalParagraphs: ps.totalParagraphs,
|
|
109
|
+
structure: lines.join("\n")
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
});
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineBlokkliAgentTool } from "#blokkli/agent/app/composables";
|
|
3
|
+
import {
|
|
4
|
+
parentSchema,
|
|
5
|
+
blockOptionsMapSchema,
|
|
6
|
+
buildBlockOptionsMap
|
|
7
|
+
} from "../schemas.js";
|
|
8
|
+
import { getAvailableOptions } from "#blokkli/editor/helpers/options";
|
|
9
|
+
const paramsSchema = z.object({
|
|
10
|
+
uuid: z.string().describe("The paragraph UUID"),
|
|
11
|
+
includeParentChain: z.boolean().optional().default(true).describe("Include ancestor parent paragraphs up to the page"),
|
|
12
|
+
includeSiblings: z.boolean().optional().default(false).describe("Include sibling paragraphs in the same field"),
|
|
13
|
+
includeChildren: z.boolean().optional().default(true).describe("Include child fields summary"),
|
|
14
|
+
includeContentFields: z.boolean().optional().default(true).describe("Include content fields (text, media, links) with values"),
|
|
15
|
+
includeOptions: z.boolean().optional().default(true).describe("Include paragraph options")
|
|
16
|
+
});
|
|
17
|
+
const parentChainItemSchema = z.object({
|
|
18
|
+
uuid: z.string().describe("The parent paragraph UUID"),
|
|
19
|
+
bundle: z.string().describe("The paragraph type"),
|
|
20
|
+
label: z.string().describe("Human-readable paragraph label"),
|
|
21
|
+
field: z.string().describe("The field name this paragraph is in")
|
|
22
|
+
});
|
|
23
|
+
const siblingInfoSchema = z.object({
|
|
24
|
+
total: z.number().describe("Total number of siblings including this paragraph"),
|
|
25
|
+
position: z.number().describe("1-based position of this paragraph"),
|
|
26
|
+
prev: z.object({
|
|
27
|
+
uuid: z.string(),
|
|
28
|
+
bundle: z.string()
|
|
29
|
+
}).nullable().describe("Previous sibling paragraph"),
|
|
30
|
+
next: z.object({
|
|
31
|
+
uuid: z.string(),
|
|
32
|
+
bundle: z.string()
|
|
33
|
+
}).nullable().describe("Next sibling paragraph")
|
|
34
|
+
});
|
|
35
|
+
const childFieldSchema = z.object({
|
|
36
|
+
name: z.string().describe("Field name"),
|
|
37
|
+
label: z.string().describe("Human-readable field label"),
|
|
38
|
+
count: z.number().describe("Number of paragraphs in this field"),
|
|
39
|
+
cardinality: z.number().describe("Max paragraphs allowed (-1 = unlimited)"),
|
|
40
|
+
bundles: z.array(z.string()).describe("Unique bundle types in this field")
|
|
41
|
+
});
|
|
42
|
+
const contentFieldSchema = z.discriminatedUnion("type", [
|
|
43
|
+
z.object({
|
|
44
|
+
field: z.string().describe("The field name"),
|
|
45
|
+
type: z.literal("plain").describe("Plain text field"),
|
|
46
|
+
currentValue: z.string().describe("Current field value")
|
|
47
|
+
}),
|
|
48
|
+
z.object({
|
|
49
|
+
field: z.string().describe("The field name"),
|
|
50
|
+
type: z.literal("markup").describe("Rich text / HTML field"),
|
|
51
|
+
currentValue: z.string().describe("Current field value")
|
|
52
|
+
}),
|
|
53
|
+
z.object({
|
|
54
|
+
field: z.string().describe("The field name"),
|
|
55
|
+
label: z.string().describe("Human-readable field label"),
|
|
56
|
+
type: z.literal("reference").describe("Entity reference field"),
|
|
57
|
+
allowed: z.array(
|
|
58
|
+
z.object({
|
|
59
|
+
type: z.string().describe('The entity type (e.g., "media", "node")'),
|
|
60
|
+
bundles: z.array(z.string()).describe("The bundles accepted for this entity type")
|
|
61
|
+
})
|
|
62
|
+
).describe("Entity types and bundles this field accepts")
|
|
63
|
+
}),
|
|
64
|
+
z.object({
|
|
65
|
+
field: z.string().describe("The field name"),
|
|
66
|
+
label: z.string().describe("Human-readable field label"),
|
|
67
|
+
type: z.literal("link").describe("Link field"),
|
|
68
|
+
allowed: z.array(
|
|
69
|
+
z.object({
|
|
70
|
+
type: z.string().describe('The entity type (e.g., "media", "node")'),
|
|
71
|
+
bundles: z.array(z.string()).describe("The bundles accepted for this entity type")
|
|
72
|
+
})
|
|
73
|
+
).describe("Entity types and bundles this field accepts")
|
|
74
|
+
})
|
|
75
|
+
]);
|
|
76
|
+
const resultSchema = z.object({
|
|
77
|
+
uuid: z.string().describe("The paragraph UUID"),
|
|
78
|
+
bundle: z.string().describe("The paragraph type"),
|
|
79
|
+
label: z.string().describe("Human-readable paragraph label"),
|
|
80
|
+
nestingLevel: z.number().describe("Nesting depth (0 = root level)"),
|
|
81
|
+
parent: parentSchema.nullable().describe("The parent entity containing this paragraph"),
|
|
82
|
+
parentChain: z.array(parentChainItemSchema).optional().describe("Ancestor parent paragraphs from immediate parent to page"),
|
|
83
|
+
siblings: siblingInfoSchema.optional().describe("Information about sibling paragraphs in the same field"),
|
|
84
|
+
childFields: z.array(childFieldSchema).optional().describe("Child fields with paragraph counts"),
|
|
85
|
+
contentFields: z.array(contentFieldSchema).optional().describe("Content fields (text, media, links) with current values"),
|
|
86
|
+
options: blockOptionsMapSchema.optional().describe("Paragraph options with current values")
|
|
87
|
+
});
|
|
88
|
+
export default defineBlokkliAgentTool({
|
|
89
|
+
name: "get_paragraph_context",
|
|
90
|
+
description: "Get comprehensive context for a single paragraph including parent chain, siblings, children, content fields, and options. Preferred over multiple individual tool calls.",
|
|
91
|
+
category: "query",
|
|
92
|
+
volatile: true,
|
|
93
|
+
prunedSummary: (r) => `context for ${r.bundle || "paragraph"} (${r.uuid?.slice(0, 8) || "?"})`,
|
|
94
|
+
modes: ["readonly", "editing", "translating", "review"],
|
|
95
|
+
label($t) {
|
|
96
|
+
return $t("aiAgentGetBlockContextRunning", "Getting block context...");
|
|
97
|
+
},
|
|
98
|
+
paramsSchema,
|
|
99
|
+
resultSchema,
|
|
100
|
+
execute(ctx, params) {
|
|
101
|
+
const {
|
|
102
|
+
blocks,
|
|
103
|
+
state,
|
|
104
|
+
context,
|
|
105
|
+
types,
|
|
106
|
+
directive,
|
|
107
|
+
definitions,
|
|
108
|
+
selection,
|
|
109
|
+
$t
|
|
110
|
+
} = ctx.app;
|
|
111
|
+
const block = blocks.getBlock(params.uuid);
|
|
112
|
+
if (!block) {
|
|
113
|
+
return {
|
|
114
|
+
error: `Paragraph not found: ${params.uuid}`
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const bundleLabel = types.getBlockLabel(block.bundle);
|
|
118
|
+
const fieldList = state.getFieldListForBlock(params.uuid);
|
|
119
|
+
let parent = null;
|
|
120
|
+
if (fieldList) {
|
|
121
|
+
const parentType = fieldList.entityUuid === context.value.entityUuid ? context.value.entityType : ctx.itemEntityType;
|
|
122
|
+
parent = {
|
|
123
|
+
type: parentType,
|
|
124
|
+
uuid: fieldList.entityUuid,
|
|
125
|
+
field: fieldList.name
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const result = {
|
|
129
|
+
uuid: params.uuid,
|
|
130
|
+
bundle: block.bundle,
|
|
131
|
+
label: bundleLabel,
|
|
132
|
+
nestingLevel: state.getNestingLevel(params.uuid),
|
|
133
|
+
parent
|
|
134
|
+
};
|
|
135
|
+
if (params.includeParentChain) {
|
|
136
|
+
const parentChain = [];
|
|
137
|
+
let currentUuid = state.getParentEntityUuid(params.uuid);
|
|
138
|
+
while (currentUuid && currentUuid !== context.value.entityUuid) {
|
|
139
|
+
const parentBlock = blocks.getBlock(currentUuid);
|
|
140
|
+
const parentField = state.getFieldListForBlock(currentUuid);
|
|
141
|
+
if (parentBlock && parentField) {
|
|
142
|
+
parentChain.push({
|
|
143
|
+
uuid: currentUuid,
|
|
144
|
+
bundle: parentBlock.bundle,
|
|
145
|
+
label: types.getBlockLabel(parentBlock.bundle),
|
|
146
|
+
field: parentField.name
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
currentUuid = state.getParentEntityUuid(currentUuid);
|
|
150
|
+
}
|
|
151
|
+
result.parentChain = parentChain;
|
|
152
|
+
}
|
|
153
|
+
if (params.includeSiblings && fieldList) {
|
|
154
|
+
const siblings = fieldList.list;
|
|
155
|
+
const currentIndex = siblings.findIndex(
|
|
156
|
+
(item) => item.uuid === params.uuid
|
|
157
|
+
);
|
|
158
|
+
if (currentIndex !== -1) {
|
|
159
|
+
const prevSibling = currentIndex > 0 ? siblings[currentIndex - 1] : null;
|
|
160
|
+
const nextSibling = currentIndex < siblings.length - 1 ? siblings[currentIndex + 1] : null;
|
|
161
|
+
result.siblings = {
|
|
162
|
+
total: siblings.length,
|
|
163
|
+
position: currentIndex + 1,
|
|
164
|
+
prev: prevSibling ? { uuid: prevSibling.uuid, bundle: prevSibling.bundle } : null,
|
|
165
|
+
next: nextSibling ? { uuid: nextSibling.uuid, bundle: nextSibling.bundle } : null
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (params.includeChildren) {
|
|
170
|
+
const mutatedFields = state.mutatedFields.value;
|
|
171
|
+
const childFields = [];
|
|
172
|
+
for (const field of mutatedFields) {
|
|
173
|
+
if (field.entityUuid === params.uuid && field.list.length > 0) {
|
|
174
|
+
const uniqueBundles = [
|
|
175
|
+
...new Set(field.list.map((item) => item.bundle))
|
|
176
|
+
];
|
|
177
|
+
const fieldConfig = types.fieldConfig.forName(
|
|
178
|
+
field.entityType,
|
|
179
|
+
block.bundle,
|
|
180
|
+
field.name
|
|
181
|
+
);
|
|
182
|
+
childFields.push({
|
|
183
|
+
name: field.name,
|
|
184
|
+
label: fieldConfig?.label || field.name,
|
|
185
|
+
count: field.list.length,
|
|
186
|
+
cardinality: fieldConfig?.cardinality ?? -1,
|
|
187
|
+
bundles: uniqueBundles
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (childFields.length > 0) {
|
|
192
|
+
result.childFields = childFields;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (params.includeContentFields) {
|
|
196
|
+
const fields = [];
|
|
197
|
+
const editables = directive.getEditablesForBlock(params.uuid);
|
|
198
|
+
for (const editable of editables) {
|
|
199
|
+
const config = types.editableFieldConfig.forName(
|
|
200
|
+
ctx.itemEntityType,
|
|
201
|
+
block.bundle,
|
|
202
|
+
editable.fieldName
|
|
203
|
+
);
|
|
204
|
+
if (!config) continue;
|
|
205
|
+
if (config.type === "table") continue;
|
|
206
|
+
const fieldType = config.type === "frame" || config.type === "markup" ? "markup" : "plain";
|
|
207
|
+
let currentValue = "";
|
|
208
|
+
if (editable.getValue) {
|
|
209
|
+
currentValue = editable.getValue();
|
|
210
|
+
} else {
|
|
211
|
+
const element = directive.findEditableElement(editable.fieldName, {
|
|
212
|
+
type: ctx.itemEntityType,
|
|
213
|
+
uuid: params.uuid,
|
|
214
|
+
bundle: block.bundle
|
|
215
|
+
});
|
|
216
|
+
if (element) {
|
|
217
|
+
currentValue = fieldType === "markup" ? element.innerHTML || "" : element.textContent || "";
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
fields.push({
|
|
221
|
+
field: editable.fieldName,
|
|
222
|
+
type: fieldType,
|
|
223
|
+
currentValue
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
const droppableConfigs = types.droppableFieldConfig.forEntityTypeAndBundle(
|
|
227
|
+
ctx.itemEntityType,
|
|
228
|
+
block.bundle
|
|
229
|
+
);
|
|
230
|
+
for (const config of droppableConfigs) {
|
|
231
|
+
fields.push({
|
|
232
|
+
field: config.name,
|
|
233
|
+
label: config.label,
|
|
234
|
+
type: config.type,
|
|
235
|
+
allowed: config.allowed
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
if (fields.length > 0) {
|
|
239
|
+
result.contentFields = fields;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (params.includeOptions) {
|
|
243
|
+
const selectionItem = selection.items.value.find(
|
|
244
|
+
(v) => v.uuid === params.uuid
|
|
245
|
+
);
|
|
246
|
+
const definition = definitions.getBlockDefinition(
|
|
247
|
+
block.bundle,
|
|
248
|
+
selectionItem?.fieldListType ?? "default",
|
|
249
|
+
selectionItem?.parentBlockBundle
|
|
250
|
+
);
|
|
251
|
+
if (definition) {
|
|
252
|
+
const availableOptions = getAvailableOptions(
|
|
253
|
+
definition.options,
|
|
254
|
+
definition.globalOptions,
|
|
255
|
+
definitions.globalOptions.value
|
|
256
|
+
);
|
|
257
|
+
if (availableOptions.length > 0) {
|
|
258
|
+
result.options = buildBlockOptionsMap(
|
|
259
|
+
availableOptions,
|
|
260
|
+
state.mutatedOptions,
|
|
261
|
+
params.uuid
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return {
|
|
267
|
+
label: $t(
|
|
268
|
+
"aiAgentGetBlockContextDone",
|
|
269
|
+
"Got context for @bundle"
|
|
270
|
+
).replace("@bundle", bundleLabel),
|
|
271
|
+
result,
|
|
272
|
+
affectedUuids: [params.uuid]
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
});
|