@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,88 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export function createToolMap(tools) {
|
|
3
|
+
return Object.fromEntries(tools.map((t) => [t.name, t]));
|
|
4
|
+
}
|
|
5
|
+
function stripSchemaOverhead(obj) {
|
|
6
|
+
if (Array.isArray(obj)) {
|
|
7
|
+
return obj.map(stripSchemaOverhead);
|
|
8
|
+
}
|
|
9
|
+
if (typeof obj === "object" && obj !== null) {
|
|
10
|
+
const result = {};
|
|
11
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
12
|
+
if (key === "$schema") continue;
|
|
13
|
+
if (key === "additionalProperties" && value === false) continue;
|
|
14
|
+
if (key === "propertyNames") continue;
|
|
15
|
+
result[key] = stripSchemaOverhead(value);
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
return obj;
|
|
20
|
+
}
|
|
21
|
+
export function getToolsForServer(tools, editMode, adapter) {
|
|
22
|
+
return tools.filter((tool) => {
|
|
23
|
+
if (!tool.modes.includes(editMode)) return false;
|
|
24
|
+
if (!tool.requiredAdapterMethods) return true;
|
|
25
|
+
if (!adapter) return true;
|
|
26
|
+
return tool.requiredAdapterMethods.every(
|
|
27
|
+
(method) => typeof adapter[method] === "function"
|
|
28
|
+
);
|
|
29
|
+
}).map((tool) => ({
|
|
30
|
+
name: tool.name,
|
|
31
|
+
description: tool.description,
|
|
32
|
+
input_schema: stripSchemaOverhead(
|
|
33
|
+
z.toJSONSchema(tool.paramsSchema)
|
|
34
|
+
),
|
|
35
|
+
...tool.lazy ? { lazy: true } : {},
|
|
36
|
+
category: tool.category,
|
|
37
|
+
...tool.volatile ? { volatile: true } : {}
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
export async function executeTool(toolMap, name, context, params) {
|
|
41
|
+
const tool = toolMap[name];
|
|
42
|
+
if (!tool) {
|
|
43
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
44
|
+
}
|
|
45
|
+
const validatedParams = tool.paramsSchema.parse(params);
|
|
46
|
+
return tool.execute(context, validatedParams);
|
|
47
|
+
}
|
|
48
|
+
export function getToolCategory(toolMap, name) {
|
|
49
|
+
const tool = toolMap[name];
|
|
50
|
+
if (!tool) {
|
|
51
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
52
|
+
}
|
|
53
|
+
return tool.category;
|
|
54
|
+
}
|
|
55
|
+
export function getToolDefinition(toolMap, name) {
|
|
56
|
+
const tool = toolMap[name];
|
|
57
|
+
if (!tool) {
|
|
58
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
59
|
+
}
|
|
60
|
+
return tool;
|
|
61
|
+
}
|
|
62
|
+
export function isMutationAction(result) {
|
|
63
|
+
return typeof result === "object" && result !== null && "type" in result && "label" in result && "apply" in result && typeof result.apply === "function";
|
|
64
|
+
}
|
|
65
|
+
export function isQueryResult(result) {
|
|
66
|
+
return typeof result === "object" && result !== null && "label" in result && "result" in result && !("apply" in result);
|
|
67
|
+
}
|
|
68
|
+
export function isToolError(result) {
|
|
69
|
+
return typeof result === "object" && result !== null && "error" in result && typeof result.error === "string";
|
|
70
|
+
}
|
|
71
|
+
export function isToolFactory(item) {
|
|
72
|
+
return "__factory" in item && item.__factory === true;
|
|
73
|
+
}
|
|
74
|
+
export function isToolDefinition(item) {
|
|
75
|
+
return !isToolFactory(item);
|
|
76
|
+
}
|
|
77
|
+
export async function resolveTools(tools, context) {
|
|
78
|
+
const resolved = [];
|
|
79
|
+
for (const tool of tools) {
|
|
80
|
+
if (isToolFactory(tool)) {
|
|
81
|
+
const factoryTools = await tool.resolve(context);
|
|
82
|
+
resolved.push(...factoryTools);
|
|
83
|
+
} else {
|
|
84
|
+
resolved.push(tool);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return resolved;
|
|
88
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BlokkliApp } from '#blokkli/editor/types/app';
|
|
2
|
+
import type { PageStructure, PageStructureBlock } from '#blokkli/agent/shared/types';
|
|
3
|
+
export declare function buildBlock(app: BlokkliApp, uuid: string, bundle: string): PageStructureBlock;
|
|
4
|
+
export declare function buildPageStructure(app: BlokkliApp): PageStructure;
|
|
5
|
+
export declare function countBlocks(block: PageStructureBlock): number;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getFieldType,
|
|
3
|
+
getEditableValue,
|
|
4
|
+
getParagraphChildren
|
|
5
|
+
} from "#blokkli/agent/app/tools/schemas";
|
|
6
|
+
import { itemEntityType } from "#blokkli-build/config";
|
|
7
|
+
const MAX_CONTENT_LENGTH = 150;
|
|
8
|
+
function stripHtml(html) {
|
|
9
|
+
return html.replace(/<[^>]*>/g, "").trim();
|
|
10
|
+
}
|
|
11
|
+
function truncate(text) {
|
|
12
|
+
const cleaned = text.trim();
|
|
13
|
+
if (cleaned.length <= MAX_CONTENT_LENGTH) return cleaned;
|
|
14
|
+
return cleaned.slice(0, MAX_CONTENT_LENGTH) + "\u2026";
|
|
15
|
+
}
|
|
16
|
+
export function buildBlock(app, uuid, bundle) {
|
|
17
|
+
const block = { uuid, bundle };
|
|
18
|
+
const editables = app.directive.getEditablesForBlock(uuid);
|
|
19
|
+
const content = {};
|
|
20
|
+
for (const editable of editables) {
|
|
21
|
+
const fieldType = getFieldType(
|
|
22
|
+
app,
|
|
23
|
+
itemEntityType,
|
|
24
|
+
bundle,
|
|
25
|
+
editable.fieldName
|
|
26
|
+
);
|
|
27
|
+
if (!fieldType) continue;
|
|
28
|
+
const raw = getEditableValue(
|
|
29
|
+
app,
|
|
30
|
+
itemEntityType,
|
|
31
|
+
uuid,
|
|
32
|
+
bundle,
|
|
33
|
+
editable.fieldName,
|
|
34
|
+
fieldType
|
|
35
|
+
);
|
|
36
|
+
const text = fieldType === "markup" ? stripHtml(raw) : raw;
|
|
37
|
+
const truncated = truncate(text);
|
|
38
|
+
if (truncated) {
|
|
39
|
+
content[editable.fieldName] = truncated;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (Object.keys(content).length > 0) {
|
|
43
|
+
block.contentFields = content;
|
|
44
|
+
}
|
|
45
|
+
const children = getParagraphChildren(app, uuid);
|
|
46
|
+
if (children.length > 0) {
|
|
47
|
+
const fields = {};
|
|
48
|
+
for (const child of children) {
|
|
49
|
+
fields[child.fieldName] = child.paragraphs.map(
|
|
50
|
+
(b) => buildBlock(app, b.uuid, b.bundle)
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
block.fields = fields;
|
|
54
|
+
}
|
|
55
|
+
return block;
|
|
56
|
+
}
|
|
57
|
+
export function buildPageStructure(app) {
|
|
58
|
+
const pageUuid = app.context.value.entityUuid;
|
|
59
|
+
const entityType = app.context.value.entityType;
|
|
60
|
+
const entityBundle = app.context.value.entityBundle;
|
|
61
|
+
const topLevelChildren = getParagraphChildren(app, pageUuid);
|
|
62
|
+
const fields = {};
|
|
63
|
+
let totalParagraphs = 0;
|
|
64
|
+
for (const child of topLevelChildren) {
|
|
65
|
+
fields[child.fieldName] = child.paragraphs.map((b) => {
|
|
66
|
+
const block = buildBlock(app, b.uuid, b.bundle);
|
|
67
|
+
totalParagraphs += countBlocks(block);
|
|
68
|
+
return block;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const entityEditableConfigs = app.types.editableFieldConfig.forEntityTypeAndBundle(entityType, entityBundle).filter((f) => f.type !== "table");
|
|
72
|
+
let entityContentFields;
|
|
73
|
+
for (const config of entityEditableConfigs) {
|
|
74
|
+
const fieldType = config.type === "frame" || config.type === "markup" ? "markup" : "plain";
|
|
75
|
+
const raw = getEditableValue(
|
|
76
|
+
app,
|
|
77
|
+
entityType,
|
|
78
|
+
pageUuid,
|
|
79
|
+
entityBundle,
|
|
80
|
+
config.name,
|
|
81
|
+
fieldType
|
|
82
|
+
);
|
|
83
|
+
const text = fieldType === "markup" ? stripHtml(raw) : raw;
|
|
84
|
+
const truncated = truncate(text);
|
|
85
|
+
if (truncated) {
|
|
86
|
+
if (!entityContentFields) entityContentFields = {};
|
|
87
|
+
entityContentFields[config.name] = truncated;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
totalParagraphs,
|
|
92
|
+
fields,
|
|
93
|
+
entityContentFields
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export function countBlocks(block) {
|
|
97
|
+
let count = 1;
|
|
98
|
+
if (block.fields) {
|
|
99
|
+
for (const blocks of Object.values(block.fields)) {
|
|
100
|
+
for (const child of blocks) {
|
|
101
|
+
count += countBlocks(child);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return count;
|
|
106
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { BlokkliApp } from '#blokkli/editor/types/app';
|
|
2
|
+
import type { RenderedFieldListItem } from '#blokkli/editor/types/field';
|
|
3
|
+
type ValidationResult = {
|
|
4
|
+
valid: true;
|
|
5
|
+
} | {
|
|
6
|
+
valid: false;
|
|
7
|
+
error: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Validate that all blocks exist and return them.
|
|
11
|
+
*/
|
|
12
|
+
export declare function validateBlocksExist(app: BlokkliApp, uuids: string[]): {
|
|
13
|
+
blocks: RenderedFieldListItem[];
|
|
14
|
+
} | {
|
|
15
|
+
error: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Validate that all blocks are in the same field.
|
|
19
|
+
* Returns the field key if valid.
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateSameField(blocks: RenderedFieldListItem[]): {
|
|
22
|
+
fieldKey: string;
|
|
23
|
+
host: RenderedFieldListItem['host'];
|
|
24
|
+
} | {
|
|
25
|
+
error: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Validate that field cardinality allows adding N blocks.
|
|
29
|
+
*/
|
|
30
|
+
export declare function validateFieldCardinality(app: BlokkliApp, host: RenderedFieldListItem['host'], fieldKey: string, additionalCount: number): ValidationResult;
|
|
31
|
+
/**
|
|
32
|
+
* Validate that all bundles are allowed in the field.
|
|
33
|
+
*/
|
|
34
|
+
export declare function validateBundlesAllowed(app: BlokkliApp, host: RenderedFieldListItem['host'], bundles: string[]): ValidationResult;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { getFieldKey } from "#blokkli/helpers";
|
|
2
|
+
export function validateBlocksExist(app, uuids) {
|
|
3
|
+
const blocks = [];
|
|
4
|
+
for (const uuid of uuids) {
|
|
5
|
+
const block = app.blocks.getBlock(uuid);
|
|
6
|
+
if (!block) {
|
|
7
|
+
return { error: `Paragraph not found: ${uuid}` };
|
|
8
|
+
}
|
|
9
|
+
blocks.push(block);
|
|
10
|
+
}
|
|
11
|
+
return { blocks };
|
|
12
|
+
}
|
|
13
|
+
export function validateSameField(blocks) {
|
|
14
|
+
if (blocks.length === 0) {
|
|
15
|
+
return { error: "No paragraphs provided" };
|
|
16
|
+
}
|
|
17
|
+
const firstBlock = blocks[0];
|
|
18
|
+
const fieldKey = getFieldKey(firstBlock.host.uuid, firstBlock.host.fieldName);
|
|
19
|
+
for (let i = 1; i < blocks.length; i++) {
|
|
20
|
+
const block = blocks[i];
|
|
21
|
+
const blockFieldKey = getFieldKey(block.host.uuid, block.host.fieldName);
|
|
22
|
+
if (blockFieldKey !== fieldKey) {
|
|
23
|
+
return { error: "All paragraphs must be in the same field" };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return { fieldKey, host: firstBlock.host };
|
|
27
|
+
}
|
|
28
|
+
export function validateFieldCardinality(app, host, fieldKey, additionalCount) {
|
|
29
|
+
const fieldConfig = app.types.getFieldConfig(
|
|
30
|
+
host.type,
|
|
31
|
+
host.bundle,
|
|
32
|
+
host.fieldName
|
|
33
|
+
);
|
|
34
|
+
if (!fieldConfig) {
|
|
35
|
+
return {
|
|
36
|
+
valid: false,
|
|
37
|
+
error: `Field configuration not found for ${host.fieldName}`
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (fieldConfig.cardinality === -1) {
|
|
41
|
+
return { valid: true };
|
|
42
|
+
}
|
|
43
|
+
const currentCount = app.state.getFieldBlockCount(fieldKey);
|
|
44
|
+
if (currentCount + additionalCount > fieldConfig.cardinality) {
|
|
45
|
+
return {
|
|
46
|
+
valid: false,
|
|
47
|
+
error: `Field "${host.fieldName}" can only hold ${fieldConfig.cardinality} paragraphs (currently has ${currentCount}, trying to add ${additionalCount})`
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return { valid: true };
|
|
51
|
+
}
|
|
52
|
+
export function validateBundlesAllowed(app, host, bundles) {
|
|
53
|
+
const fieldConfig = app.types.getFieldConfig(
|
|
54
|
+
host.type,
|
|
55
|
+
host.bundle,
|
|
56
|
+
host.fieldName
|
|
57
|
+
);
|
|
58
|
+
if (!fieldConfig) {
|
|
59
|
+
return {
|
|
60
|
+
valid: false,
|
|
61
|
+
error: `Field configuration not found for ${host.fieldName}`
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (!fieldConfig.allowedBundles.length) {
|
|
65
|
+
return { valid: true };
|
|
66
|
+
}
|
|
67
|
+
const disallowed = bundles.filter(
|
|
68
|
+
(b) => !fieldConfig.allowedBundles.includes(b)
|
|
69
|
+
);
|
|
70
|
+
if (disallowed.length > 0) {
|
|
71
|
+
return {
|
|
72
|
+
valid: false,
|
|
73
|
+
error: `Bundle(s) "${disallowed.join(", ")}" not allowed in field "${host.fieldName}"`
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
return { valid: true };
|
|
77
|
+
}
|
|
@@ -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
|
+
itemId: z.string().describe("Content item ID from search_content_* results"),
|
|
11
|
+
itemEntityType: z.string().describe("Entity type of the content item"),
|
|
12
|
+
itemEntityBundle: z.string().describe("Entity bundle of the content item"),
|
|
13
|
+
targetBundle: z.string().describe(
|
|
14
|
+
"Paragraph bundle to create (from targetBundles in search_content_* results)"
|
|
15
|
+
),
|
|
16
|
+
parent: parentSchema.describe("The parent entity to add the paragraph to"),
|
|
17
|
+
position: positionSchema
|
|
18
|
+
});
|
|
19
|
+
export default defineBlokkliAgentTool({
|
|
20
|
+
name: "add_content_search_paragraphs",
|
|
21
|
+
description: "Add a paragraph using a content item from search results. Use search_content_* first to find content items, then use this tool to add one to the page. Requires user approval.",
|
|
22
|
+
category: "mutation",
|
|
23
|
+
prunedSummary: (r) => r.success ? "added content paragraph" : "rejected",
|
|
24
|
+
modes: ["editing"],
|
|
25
|
+
lazy: true,
|
|
26
|
+
label($t) {
|
|
27
|
+
return $t(
|
|
28
|
+
"aiAgentAddContentSearchBlockRunning",
|
|
29
|
+
"Adding content paragraph..."
|
|
30
|
+
);
|
|
31
|
+
},
|
|
32
|
+
paramsSchema,
|
|
33
|
+
resultSchema: mutationResultSchema,
|
|
34
|
+
requiredAdapterMethods: ["addContentSearchItem"],
|
|
35
|
+
execute(ctx, params) {
|
|
36
|
+
const { $t, types } = ctx.app;
|
|
37
|
+
const item = {
|
|
38
|
+
id: params.itemId,
|
|
39
|
+
entityType: params.itemEntityType,
|
|
40
|
+
entityBundle: params.itemEntityBundle,
|
|
41
|
+
title: params.itemId,
|
|
42
|
+
targetBundles: [params.targetBundle]
|
|
43
|
+
};
|
|
44
|
+
const resolved = resolvePosition(
|
|
45
|
+
ctx.app,
|
|
46
|
+
params.parent.uuid,
|
|
47
|
+
params.parent.field,
|
|
48
|
+
params.position
|
|
49
|
+
);
|
|
50
|
+
if ("error" in resolved) return resolved;
|
|
51
|
+
return {
|
|
52
|
+
type: "add",
|
|
53
|
+
label: $t(
|
|
54
|
+
"aiAgentAddContentSearchBlockDone",
|
|
55
|
+
"Added @bundle with content ID @id"
|
|
56
|
+
).replace("@bundle", types.getBlockLabel(params.targetBundle)).replace("@id", params.itemId),
|
|
57
|
+
apply: (adapter) => adapter.addContentSearchItem({
|
|
58
|
+
host: {
|
|
59
|
+
type: params.parent.type,
|
|
60
|
+
uuid: params.parent.uuid,
|
|
61
|
+
fieldName: params.parent.field
|
|
62
|
+
},
|
|
63
|
+
afterUuid: resolved.afterUuid,
|
|
64
|
+
item,
|
|
65
|
+
bundle: params.targetBundle
|
|
66
|
+
})
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
name: z.string().describe("The fragment name to add"),
|
|
11
|
+
parent: parentSchema.describe("The parent entity to add the fragment to"),
|
|
12
|
+
position: positionSchema
|
|
13
|
+
});
|
|
14
|
+
export default defineBlokkliAgentTool({
|
|
15
|
+
name: "add_fragment",
|
|
16
|
+
description: "Add a fragment paragraph to the page. Requires user approval before the fragment is actually added.",
|
|
17
|
+
category: "mutation",
|
|
18
|
+
prunedSummary: (r) => r.success ? "added fragment" : "rejected",
|
|
19
|
+
modes: ["editing"],
|
|
20
|
+
lazy: true,
|
|
21
|
+
label($t) {
|
|
22
|
+
return $t("aiAgentAddFragmentRunning", "Adding fragment...");
|
|
23
|
+
},
|
|
24
|
+
paramsSchema,
|
|
25
|
+
resultSchema: mutationResultSchema,
|
|
26
|
+
requiredAdapterMethods: ["fragmentsAddBlock"],
|
|
27
|
+
execute(ctx, params) {
|
|
28
|
+
const { fields, definitions } = ctx.app;
|
|
29
|
+
const fragment = definitions.fragmentDefinitions.value.find(
|
|
30
|
+
(f) => f.name === params.name
|
|
31
|
+
);
|
|
32
|
+
if (!fragment) {
|
|
33
|
+
return { error: `Fragment not found: ${params.name}` };
|
|
34
|
+
}
|
|
35
|
+
const field = fields.find(params.parent.uuid, params.parent.field);
|
|
36
|
+
if (!field) {
|
|
37
|
+
return {
|
|
38
|
+
error: `Field not found: ${params.parent.field} on entity ${params.parent.uuid}`
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (!field.allowedFragments.length) {
|
|
42
|
+
return {
|
|
43
|
+
error: `Field "${params.parent.field}" does not allow fragments`
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
if (!field.allowedFragments.includes(params.name)) {
|
|
47
|
+
const allowedIn = ctx.app.dom.getFieldsAllowingFragment(params.name);
|
|
48
|
+
if (allowedIn.length === 0) {
|
|
49
|
+
return {
|
|
50
|
+
error: `Fragment "${params.name}" is not allowed in any currently registered field.`
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const locationsList = allowedIn.map((f) => `${f.fieldName} on ${f.entity.type} ${f.entity.uuid}`).join(", ");
|
|
54
|
+
return {
|
|
55
|
+
error: `Fragment "${params.name}" is not allowed in field "${params.parent.field}". This fragment can be added to: ${locationsList}`
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const { $t } = ctx.app;
|
|
59
|
+
const resolved = resolvePosition(
|
|
60
|
+
ctx.app,
|
|
61
|
+
params.parent.uuid,
|
|
62
|
+
params.parent.field,
|
|
63
|
+
params.position
|
|
64
|
+
);
|
|
65
|
+
if ("error" in resolved) return resolved;
|
|
66
|
+
return {
|
|
67
|
+
type: "add",
|
|
68
|
+
label: $t("aiAgentAddFragmentDone", 'Added fragment "@label"').replace(
|
|
69
|
+
"@label",
|
|
70
|
+
fragment.label
|
|
71
|
+
),
|
|
72
|
+
apply: (adapter) => adapter.fragmentsAddBlock({
|
|
73
|
+
name: params.name,
|
|
74
|
+
host: {
|
|
75
|
+
type: params.parent.type,
|
|
76
|
+
uuid: params.parent.uuid,
|
|
77
|
+
fieldName: params.parent.field
|
|
78
|
+
},
|
|
79
|
+
preceedingUuid: resolved.afterUuid
|
|
80
|
+
})
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
mediaId: z.string().describe("Media item ID from search_media results"),
|
|
11
|
+
mediaBundle: z.string().describe('Media bundle type (e.g., "image")'),
|
|
12
|
+
targetBundle: z.string().describe(
|
|
13
|
+
"Paragraph bundle to create (from targetBundles in search_media)"
|
|
14
|
+
),
|
|
15
|
+
parent: parentSchema.describe("The parent entity to add the paragraph to"),
|
|
16
|
+
position: positionSchema
|
|
17
|
+
});
|
|
18
|
+
export default defineBlokkliAgentTool({
|
|
19
|
+
name: "add_media_paragraph",
|
|
20
|
+
description: "Add a paragraph using a media item from the library. Use search_media first to find media items, then use this tool to add one to the page. Requires user approval.",
|
|
21
|
+
category: "mutation",
|
|
22
|
+
prunedSummary: (r) => r.success ? "added media paragraph" : "rejected",
|
|
23
|
+
modes: ["editing"],
|
|
24
|
+
lazy: true,
|
|
25
|
+
label($t) {
|
|
26
|
+
return $t("aiAgentAddMediaBlockRunning", "Adding media block...");
|
|
27
|
+
},
|
|
28
|
+
paramsSchema,
|
|
29
|
+
resultSchema: mutationResultSchema,
|
|
30
|
+
requiredAdapterMethods: ["mediaLibraryAddBlock"],
|
|
31
|
+
execute(ctx, params) {
|
|
32
|
+
const { $t, types } = ctx.app;
|
|
33
|
+
const item = {
|
|
34
|
+
itemType: "media_library",
|
|
35
|
+
mediaId: params.mediaId,
|
|
36
|
+
mediaBundle: params.mediaBundle,
|
|
37
|
+
itemBundles: [params.targetBundle],
|
|
38
|
+
element: () => document.createElement("div")
|
|
39
|
+
};
|
|
40
|
+
const resolved = resolvePosition(
|
|
41
|
+
ctx.app,
|
|
42
|
+
params.parent.uuid,
|
|
43
|
+
params.parent.field,
|
|
44
|
+
params.position
|
|
45
|
+
);
|
|
46
|
+
if ("error" in resolved) return resolved;
|
|
47
|
+
return {
|
|
48
|
+
type: "add",
|
|
49
|
+
label: $t("aiAgentAddMediaBlockDone", "Added @bundle with media ID @id").replace("@bundle", types.getBlockLabel(params.targetBundle)).replace("@id", params.mediaId),
|
|
50
|
+
apply: (adapter) => adapter.mediaLibraryAddBlock({
|
|
51
|
+
host: {
|
|
52
|
+
type: params.parent.type,
|
|
53
|
+
uuid: params.parent.uuid,
|
|
54
|
+
fieldName: params.parent.field
|
|
55
|
+
},
|
|
56
|
+
preceedingUuid: resolved.afterUuid,
|
|
57
|
+
item,
|
|
58
|
+
targetBundle: params.targetBundle
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
});
|