@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,21 @@
|
|
|
1
|
+
import { Session } from './Session.js';
|
|
2
|
+
export declare class SessionManager {
|
|
3
|
+
private sessions;
|
|
4
|
+
/** Maps used token strings to their embedded timestamp (seconds). */
|
|
5
|
+
private usedTokens;
|
|
6
|
+
private pruneTimer;
|
|
7
|
+
create(peerId: string): Session;
|
|
8
|
+
get(peerId: string): Session | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Record activity for a peer to prevent idle timeout.
|
|
11
|
+
*/
|
|
12
|
+
touch(peerId: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* Validate an auth token and consume it so it cannot be reused.
|
|
15
|
+
* Returns true only if the token is valid, not expired, and not previously used.
|
|
16
|
+
*/
|
|
17
|
+
authenticate(token: string | undefined, authSecret: string): boolean;
|
|
18
|
+
cleanup(peerId: string): void;
|
|
19
|
+
private pruneIdleSessions;
|
|
20
|
+
private pruneTokens;
|
|
21
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
2
|
+
import { Session } from "./Session.js";
|
|
3
|
+
const TOKEN_EXPIRY_SECONDS = 300;
|
|
4
|
+
const SESSION_IDLE_TIMEOUT_MS = 5 * 60 * 1e3;
|
|
5
|
+
export class SessionManager {
|
|
6
|
+
sessions = /* @__PURE__ */ new Map();
|
|
7
|
+
/** Maps used token strings to their embedded timestamp (seconds). */
|
|
8
|
+
usedTokens = /* @__PURE__ */ new Map();
|
|
9
|
+
pruneTimer = setInterval(() => {
|
|
10
|
+
this.pruneIdleSessions();
|
|
11
|
+
this.pruneTokens();
|
|
12
|
+
}, 6e4);
|
|
13
|
+
create(peerId) {
|
|
14
|
+
const session = new Session();
|
|
15
|
+
this.sessions.set(peerId, { session, lastActivity: Date.now() });
|
|
16
|
+
return session;
|
|
17
|
+
}
|
|
18
|
+
get(peerId) {
|
|
19
|
+
return this.sessions.get(peerId)?.session;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Record activity for a peer to prevent idle timeout.
|
|
23
|
+
*/
|
|
24
|
+
touch(peerId) {
|
|
25
|
+
const entry = this.sessions.get(peerId);
|
|
26
|
+
if (entry) {
|
|
27
|
+
entry.lastActivity = Date.now();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Validate an auth token and consume it so it cannot be reused.
|
|
32
|
+
* Returns true only if the token is valid, not expired, and not previously used.
|
|
33
|
+
*/
|
|
34
|
+
authenticate(token, authSecret) {
|
|
35
|
+
if (!token) return false;
|
|
36
|
+
const colonIndex = token.indexOf(":");
|
|
37
|
+
if (colonIndex === -1) return false;
|
|
38
|
+
const timestampStr = token.substring(0, colonIndex);
|
|
39
|
+
const providedHmac = token.substring(colonIndex + 1);
|
|
40
|
+
const timestamp = parseInt(timestampStr, 10);
|
|
41
|
+
if (isNaN(timestamp)) return false;
|
|
42
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
43
|
+
if (Math.abs(now - timestamp) > TOKEN_EXPIRY_SECONDS) return false;
|
|
44
|
+
const expectedHmac = createHmac("sha256", authSecret).update(timestampStr).digest("hex");
|
|
45
|
+
if (providedHmac.length !== expectedHmac.length) return false;
|
|
46
|
+
const valid = timingSafeEqual(
|
|
47
|
+
Buffer.from(providedHmac, "hex"),
|
|
48
|
+
Buffer.from(expectedHmac, "hex")
|
|
49
|
+
);
|
|
50
|
+
if (!valid) return false;
|
|
51
|
+
this.pruneTokens();
|
|
52
|
+
if (this.usedTokens.has(token)) return false;
|
|
53
|
+
this.usedTokens.set(token, timestamp);
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
cleanup(peerId) {
|
|
57
|
+
const entry = this.sessions.get(peerId);
|
|
58
|
+
if (entry) {
|
|
59
|
+
entry.session.cleanup();
|
|
60
|
+
this.sessions.delete(peerId);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
pruneIdleSessions() {
|
|
64
|
+
const cutoff = Date.now() - SESSION_IDLE_TIMEOUT_MS;
|
|
65
|
+
for (const [peerId, entry] of this.sessions) {
|
|
66
|
+
if (entry.lastActivity < cutoff) {
|
|
67
|
+
entry.session.cleanup();
|
|
68
|
+
this.sessions.delete(peerId);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
pruneTokens() {
|
|
73
|
+
const cutoff = Math.floor(Date.now() / 1e3) - TOKEN_EXPIRY_SECONDS;
|
|
74
|
+
for (const [token, timestamp] of this.usedTokens) {
|
|
75
|
+
if (timestamp < cutoff) {
|
|
76
|
+
this.usedTokens.delete(token);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { defineWebSocketHandler, useRuntimeConfig } from "#imports";
|
|
2
|
+
import { clientMessageSchema } from "../shared/types.js";
|
|
3
|
+
import { SessionManager } from "./SessionManager.js";
|
|
4
|
+
import { send } from "./helpers.js";
|
|
5
|
+
const sessionManager = new SessionManager();
|
|
6
|
+
const config = useRuntimeConfig();
|
|
7
|
+
const authSecret = config.blokkli?.agent?.authSecret || "";
|
|
8
|
+
const apiKey = config.blokkli?.agent?.apiKey || "";
|
|
9
|
+
export default defineWebSocketHandler({
|
|
10
|
+
open(_peer) {
|
|
11
|
+
},
|
|
12
|
+
async message(peer, message) {
|
|
13
|
+
try {
|
|
14
|
+
const parsed = clientMessageSchema.safeParse(JSON.parse(message.text()));
|
|
15
|
+
if (!parsed.success) {
|
|
16
|
+
send(peer, {
|
|
17
|
+
type: "error",
|
|
18
|
+
errorType: "bad_request",
|
|
19
|
+
message: "Invalid message format"
|
|
20
|
+
});
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const data = parsed.data;
|
|
24
|
+
if (data.type === "authenticate") {
|
|
25
|
+
if (!authSecret || !sessionManager.authenticate(data.authToken, authSecret)) {
|
|
26
|
+
send(peer, {
|
|
27
|
+
type: "error",
|
|
28
|
+
errorType: "unauthorized",
|
|
29
|
+
message: "Authentication required."
|
|
30
|
+
});
|
|
31
|
+
peer.close();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (sessionManager.get(peer.id)) {
|
|
35
|
+
sessionManager.cleanup(peer.id);
|
|
36
|
+
}
|
|
37
|
+
sessionManager.create(peer.id);
|
|
38
|
+
send(peer, { type: "authenticated" });
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const session = sessionManager.get(peer.id);
|
|
42
|
+
if (!session) {
|
|
43
|
+
send(peer, {
|
|
44
|
+
type: "error",
|
|
45
|
+
errorType: "unauthorized",
|
|
46
|
+
message: "Authentication required."
|
|
47
|
+
});
|
|
48
|
+
peer.close();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
sessionManager.touch(peer.id);
|
|
52
|
+
if (data.type === "ping") {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (session.isProcessing) {
|
|
56
|
+
switch (data.type) {
|
|
57
|
+
case "init":
|
|
58
|
+
case "accept":
|
|
59
|
+
case "reject":
|
|
60
|
+
case "new_conversation":
|
|
61
|
+
case "restore_conversation":
|
|
62
|
+
send(peer, {
|
|
63
|
+
type: "error",
|
|
64
|
+
errorType: "bad_request",
|
|
65
|
+
message: "Cannot perform this action while the agent is processing."
|
|
66
|
+
});
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
switch (data.type) {
|
|
71
|
+
case "init":
|
|
72
|
+
session.init(data.tools, data.pageContext);
|
|
73
|
+
break;
|
|
74
|
+
case "start":
|
|
75
|
+
if (!apiKey) {
|
|
76
|
+
send(peer, {
|
|
77
|
+
type: "error",
|
|
78
|
+
errorType: "authentication",
|
|
79
|
+
message: "API key not configured"
|
|
80
|
+
});
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
session.start(
|
|
84
|
+
peer,
|
|
85
|
+
data.prompt,
|
|
86
|
+
apiKey,
|
|
87
|
+
authSecret,
|
|
88
|
+
data.selectedUuids
|
|
89
|
+
);
|
|
90
|
+
break;
|
|
91
|
+
case "tool_result":
|
|
92
|
+
session.resolveToolResult(data.callId, {
|
|
93
|
+
result: data.result,
|
|
94
|
+
error: data.error
|
|
95
|
+
});
|
|
96
|
+
break;
|
|
97
|
+
case "cancel":
|
|
98
|
+
session.cancel(peer);
|
|
99
|
+
break;
|
|
100
|
+
case "accept":
|
|
101
|
+
session.acceptChanges(peer, authSecret);
|
|
102
|
+
break;
|
|
103
|
+
case "reject":
|
|
104
|
+
session.rejectChanges(peer, authSecret);
|
|
105
|
+
break;
|
|
106
|
+
case "get_transcript":
|
|
107
|
+
session.getTranscript(peer);
|
|
108
|
+
break;
|
|
109
|
+
case "new_conversation":
|
|
110
|
+
session.newConversation(peer, authSecret);
|
|
111
|
+
break;
|
|
112
|
+
case "restore_conversation": {
|
|
113
|
+
const result = session.restoreConversation(data.state, authSecret);
|
|
114
|
+
if (result.success) {
|
|
115
|
+
send(peer, { type: "conversation_restored" });
|
|
116
|
+
} else {
|
|
117
|
+
send(peer, {
|
|
118
|
+
type: "conversation_restore_failed",
|
|
119
|
+
reason: result.reason || "Unknown error"
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case "plan_approve":
|
|
125
|
+
session.approvePlan();
|
|
126
|
+
break;
|
|
127
|
+
case "plan_reject":
|
|
128
|
+
session.rejectPlan();
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
} catch (error) {
|
|
132
|
+
console.error("WebSocket message error:", error);
|
|
133
|
+
send(peer, {
|
|
134
|
+
type: "error",
|
|
135
|
+
errorType: "unknown",
|
|
136
|
+
message: "Failed to process message",
|
|
137
|
+
detail: error instanceof Error ? error.message : void 0
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
close(peer) {
|
|
142
|
+
sessionManager.cleanup(peer.id);
|
|
143
|
+
},
|
|
144
|
+
error(peer, error) {
|
|
145
|
+
console.error(`[WebSocket] Error for ${peer.id}:`, error);
|
|
146
|
+
sessionManager.cleanup(peer.id);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { PageContext } from '../shared/types.js';
|
|
2
|
+
import type { ResolvedSkill } from './skills/types.js';
|
|
3
|
+
import type { ActivePlanContext, SystemPromptBlock } from './system-prompts/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Build structured system prompt blocks for the AI agent.
|
|
6
|
+
* Returns an array of text blocks with optional cache hints.
|
|
7
|
+
*
|
|
8
|
+
* Prompts are sorted by cacheGroup (static → per-page → per-turn), then by weight.
|
|
9
|
+
* A cacheHint is placed on the last block of each cacheable group boundary,
|
|
10
|
+
* enabling providers to apply their caching strategy.
|
|
11
|
+
*/
|
|
12
|
+
export declare function buildSystemPrompt(context: PageContext, resolvedSkills: ResolvedSkill[], lazyTools?: {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
}[], activePlan?: ActivePlanContext, loadedSkills?: ReadonlySet<string>): SystemPromptBlock[];
|
|
16
|
+
/**
|
|
17
|
+
* Build a plain-text system prompt string (for transcript/debug use).
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildSystemPromptText(context: PageContext, resolvedSkills: ResolvedSkill[], lazyTools?: {
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
}[], activePlan?: ActivePlanContext, loadedSkills?: ReadonlySet<string>): string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { debugPrompt, systemPrompts } from "#blokkli-build/agent-server";
|
|
2
|
+
const CACHE_GROUP_ORDER = {
|
|
3
|
+
static: 0,
|
|
4
|
+
"per-page": 1
|
|
5
|
+
};
|
|
6
|
+
function getCacheGroupOrder(sp) {
|
|
7
|
+
return sp.cacheGroup ? CACHE_GROUP_ORDER[sp.cacheGroup] ?? 2 : 2;
|
|
8
|
+
}
|
|
9
|
+
export function buildSystemPrompt(context, resolvedSkills, lazyTools = [], activePlan, loadedSkills = /* @__PURE__ */ new Set()) {
|
|
10
|
+
const promptContext = {
|
|
11
|
+
pageContext: context,
|
|
12
|
+
resolvedSkills,
|
|
13
|
+
lazyTools,
|
|
14
|
+
isDebugMode: !!(import.meta.dev && debugPrompt),
|
|
15
|
+
activePlan,
|
|
16
|
+
loadedSkills
|
|
17
|
+
};
|
|
18
|
+
const sorted = systemPrompts.filter((sp) => !sp.modes?.length || sp.modes.includes(context.editMode)).sort((a, b) => {
|
|
19
|
+
const groupDiff = getCacheGroupOrder(a) - getCacheGroupOrder(b);
|
|
20
|
+
if (groupDiff !== 0) return groupDiff;
|
|
21
|
+
return a.weight - b.weight;
|
|
22
|
+
});
|
|
23
|
+
const entries = [];
|
|
24
|
+
for (const sp of sorted) {
|
|
25
|
+
const text = sp.getPrompt(promptContext)?.trim();
|
|
26
|
+
if (!text) continue;
|
|
27
|
+
const formatted = sp.title ? `## ${sp.title}
|
|
28
|
+
|
|
29
|
+
${text}` : text;
|
|
30
|
+
entries.push({ text: formatted, cacheGroup: sp.cacheGroup });
|
|
31
|
+
}
|
|
32
|
+
const blocks = [];
|
|
33
|
+
for (let i = 0; i < entries.length; i++) {
|
|
34
|
+
const entry = entries[i];
|
|
35
|
+
const nextEntry = entries[i + 1];
|
|
36
|
+
const isLastInGroup = entry.cacheGroup && (!nextEntry || nextEntry.cacheGroup !== entry.cacheGroup);
|
|
37
|
+
const block = { text: entry.text };
|
|
38
|
+
if (isLastInGroup) {
|
|
39
|
+
block.cacheHint = "ephemeral";
|
|
40
|
+
}
|
|
41
|
+
blocks.push(block);
|
|
42
|
+
}
|
|
43
|
+
return blocks;
|
|
44
|
+
}
|
|
45
|
+
export function buildSystemPromptText(context, resolvedSkills, lazyTools = [], activePlan, loadedSkills = /* @__PURE__ */ new Set()) {
|
|
46
|
+
return buildSystemPrompt(
|
|
47
|
+
context,
|
|
48
|
+
resolvedSkills,
|
|
49
|
+
lazyTools,
|
|
50
|
+
activePlan,
|
|
51
|
+
loadedSkills
|
|
52
|
+
).map((b) => b.text).join("\n\n");
|
|
53
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineBlokkliAgentSkill } from "../skills/index.js";
|
|
2
|
+
export default defineBlokkliAgentSkill({
|
|
3
|
+
name: "adding-new-paragraphs",
|
|
4
|
+
label: { en: "Adding new paragraphs", de: "Neue Bl\xF6cke hinzuf\xFCgen" },
|
|
5
|
+
description: "How to add new paragraphs. LOAD THIS THE FIRST TIME BEFORE CALLING add_paragraphs!!!",
|
|
6
|
+
getContents: () => `
|
|
7
|
+
- paragraphs can be NESTED! More often than not a paragraph such as an accordeon, section, grid, etc. will have paragraph fields for nested paragraphs
|
|
8
|
+
- Before adding paragraphs, THINK how you want to structure them! For example, when asked to "create a section about XYZ", check which paragraph is most appropriate for that
|
|
9
|
+
- That paragraph could have multiple paragraph fields!
|
|
10
|
+
- You can add multiple paragraphs using the add_paragraphs tool.
|
|
11
|
+
- Use get_bundle_info to learn which bundles are allowed and what content fields AND paragraph fields they have BEFORE providing values in add_paragraphs.
|
|
12
|
+
- IMPORTANT: When get_bundle_info shows a paragraph has paragraphFields (like "header", "paragraphs", "left", "right"), plan your structure so that matching content goes INTO those fields, not as sibling paragraphs. For example, if a grid has a "header" paragraphField that allows "title" bundles, create the title INSIDE the grid's header field, not as a separate paragraph alongside the grid.
|
|
13
|
+
- PREFERRED: Use the \`children\` property on each paragraph to create entire nested structures in a SINGLE add_paragraphs call! The \`children\` property is a record keyed by paragraph field name, with arrays of child paragraphs. Children can also have children (recursive, no depth limit).
|
|
14
|
+
- This is MUCH better than making multiple sequential calls (create parent, get_child_paragraphs, add children). Use children whenever you know the paragraph field names from get_bundle_info.
|
|
15
|
+
- When adding paragraphs to a NEW parent that you did NOT just create with children, call get_child_paragraphs first to get the correct parent objects and field names. NEVER construct parent objects manually!
|
|
16
|
+
- You SHOULD already provide default content field values if possible!
|
|
17
|
+
- You can set paragraph OPTIONS inline via the \`options\` property on each paragraph (key-value pairs). Use get_bundle_info to see which options are available for a bundle. This avoids a separate set_paragraph_options call after creating paragraphs.
|
|
18
|
+
- The add_paragraphs tool will thoroughly validate your input (including children and options recursively), so it's impossible for you to add invalid paragraphs.
|
|
19
|
+
- If you made a mistake, use the move_paragraphs to move the newly created paragraphs if possible or batch_rewrite_text if you need to change text.
|
|
20
|
+
`
|
|
21
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineBlokkliAgentSkill } from "../skills/index.js";
|
|
2
|
+
export default defineBlokkliAgentSkill({
|
|
3
|
+
name: "page-review",
|
|
4
|
+
label: { en: "Page Review", de: "Seiten-Review" },
|
|
5
|
+
description: "Tool guidance for reviewing page content. Load this IMMEDIATELY AFTER being asked to review, critique, or analyze a page!",
|
|
6
|
+
getContents: () => `
|
|
7
|
+
# Page Review - Tool Guide
|
|
8
|
+
|
|
9
|
+
## Step 1: Get All Content First
|
|
10
|
+
|
|
11
|
+
**Always start with \`get_all_page_content\`** - this returns all text from every paragraph on the page in a single call.
|
|
12
|
+
|
|
13
|
+
This gives you:
|
|
14
|
+
- A flat list of all paragraphs with text content
|
|
15
|
+
- Each paragraph's uuid, bundle (type), and concatenated text
|
|
16
|
+
- Complete page content for analysis
|
|
17
|
+
|
|
18
|
+
## Step 2: Get Structure If Needed
|
|
19
|
+
|
|
20
|
+
If you need to understand how paragraphs are organized:
|
|
21
|
+
|
|
22
|
+
**Use \`get_child_paragraphs\`** (without uuid) to see page-level structure:
|
|
23
|
+
- Shows which fields exist and what paragraphs they contain
|
|
24
|
+
- Reveals the hierarchy and grouping of content
|
|
25
|
+
|
|
26
|
+
**Use \`get_child_paragraphs\` with a uuid** to see a specific paragraph's children.
|
|
27
|
+
`
|
|
28
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineBlokkliAgentSkill } from "../skills/index.js";
|
|
2
|
+
export default defineBlokkliAgentSkill({
|
|
3
|
+
name: "from-library-reusable-paragraphs",
|
|
4
|
+
label: { en: "Reusable paragraphs", de: "Bl\xF6cke aus der Bibliothek" },
|
|
5
|
+
description: 'READ this BEFORE dealing with reusable paragraphs ("from_library"), such as editing a from_library paragraph OR searching one in the library ("Bibliothek", "wiederverwendbar").',
|
|
6
|
+
getContents: () => `
|
|
7
|
+
- reusable paragraphs are "global" paragraphs that are shared between multiple pages
|
|
8
|
+
- editing them updates them everywhere
|
|
9
|
+
- BUT: They can NOT be directly edited on this page!
|
|
10
|
+
- This means: You can NOT edit content fields or paragraph fields of a reusable paragraph!
|
|
11
|
+
- You CAN however edit their options - editing them ONLY affects the options on THIS current page, because the options are stored on the "from_library" paragraph and they override options from the "global" one.
|
|
12
|
+
|
|
13
|
+
Internally, a "from_library" paragraph bundle references a special entity called "library_item". This entity contains the actual paragraph.
|
|
14
|
+
So basically, if the user wants to "edit a reusable paragraph", you have to guide them to the edit mode of a library item. They can just double click the paragraph to launch a separate bl\xF6kkli instance.
|
|
15
|
+
|
|
16
|
+
## Tools
|
|
17
|
+
- Use "search_reusable_paragraphs" to find paragraphs from the library
|
|
18
|
+
- Use "add_reusable_paragraph" to add a paragraph from the library on the page
|
|
19
|
+
- Use "detach_reusable_paragraph" to _detach_ a "from_library" paragraph on the current page. Doing so will copy the reusable paragraph into this page, making it fully editable.
|
|
20
|
+
`
|
|
21
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineBlokkliAgentSkill } from "../skills/index.js";
|
|
2
|
+
export default defineBlokkliAgentSkill({
|
|
3
|
+
name: "rewrite-and-translate",
|
|
4
|
+
label: { en: "Rewrite and Translate", de: "Umschreiben und \xDCbersetzen" },
|
|
5
|
+
description: "ALWAYS use this skill when asked to rewrite OR translate texts.",
|
|
6
|
+
getContents: () => `
|
|
7
|
+
- Use the batch_rewrite_text tool to rewrite or translate multiple texts at once!
|
|
8
|
+
- The batch_rewrite_text will ASK the user accept each changed text by default - no need to manually ask the user beforehand!
|
|
9
|
+
- You CAN set requireApproval to "false" if the user already provided you with the text (either manually in a message OR via a tool), as it makes no sense to let the user approve a text they are approved (e.g. via ask_question) or by explicitly requesting a text.
|
|
10
|
+
- When approval is required and the user rejects one or more texts, they can provide a reason. Carefully read the reason if provided!
|
|
11
|
+
- If unsure about something: USE THE ask_question TOOL!
|
|
12
|
+
- When asked for suggestions by the user: USE THE ask_question TOOL!
|
|
13
|
+
`
|
|
14
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { PLACEHOLDER_USER_NAME } from "../../shared/placeholders.js";
|
|
2
|
+
import { defineBlokkliAgentSystemPrompt } from "../system-prompts/index.js";
|
|
3
|
+
export default defineBlokkliAgentSystemPrompt({
|
|
4
|
+
id: "architecture",
|
|
5
|
+
title: "Architecture",
|
|
6
|
+
weight: 200,
|
|
7
|
+
cacheGroup: "static",
|
|
8
|
+
getPrompt: () => {
|
|
9
|
+
return `- bl\xF6kkli is an interactive page builder to manage complex content paragraphs
|
|
10
|
+
- The "page" itself is a separate entity type, e.g. "content" or "node"
|
|
11
|
+
- A paragraph can be placed in "paragraph fields"
|
|
12
|
+
- A field can restrict which paragraph bundles it allows or how many paragraphs are allowed (cardinality)
|
|
13
|
+
- A cardinality of -1 means: no limit on number of paragraphs, 1 = one paragraph, 2 = two paragraphs, etc.
|
|
14
|
+
- Both the page and paragraph bundles themselves can have fields to place nested paragraphs
|
|
15
|
+
- A paragraph always has a "parent". This consists of:
|
|
16
|
+
- type: The entity type of the "parent"
|
|
17
|
+
- uuid: The UUID of the "parent"
|
|
18
|
+
- field: The name of the field the paragraph is in
|
|
19
|
+
- paragraphs can have "content fields" \u2014 fields that hold content values. There are four types:
|
|
20
|
+
- **plain**: Plain text (no HTML)
|
|
21
|
+
- **markup**: Rich text / HTML
|
|
22
|
+
- **reference**: Entity reference (media, nodes, etc.)
|
|
23
|
+
- **link**: Link field
|
|
24
|
+
- paragraphs can have "options", such as "backgroundColor" or "showLink". They make it possible to change the appearance or behaviour of a paragraph.
|
|
25
|
+
- The available options change based on various factors, such as the value of other options, the specific state of the paragraph's field values, etc. Always first check which options are available.
|
|
26
|
+
|
|
27
|
+
### EXTRA UX FEATURES
|
|
28
|
+
- You can create markdown links for a specific paragraph by using the paragraph UUID! For example: "You should rewrite [this text](#UUID)". This will be converted to a HTML link the user can click on!
|
|
29
|
+
- You can address the user using the special "${PLACEHOLDER_USER_NAME}" placeholder for a friendly welcome message. This is magically replaced in the frontend with the name of the user!
|
|
30
|
+
|
|
31
|
+
### History and Undo/Redo
|
|
32
|
+
- bl\xF6kkli maintains a history of all changes (undo/redo)
|
|
33
|
+
- All query tools reflect the **current** history state
|
|
34
|
+
- This works exactly like any history implementation:
|
|
35
|
+
- When navigating back in history (undo), all changes are reverted and none of the mutations past that index are applied
|
|
36
|
+
- When navigating forward (redo), changes will be re-applied
|
|
37
|
+
- When navigating back **and then** adding a new mutation, ALL mutations past that index are removed; you can not navigate forward anymore`;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineBlokkliAgentSystemPrompt } from "../system-prompts/index.js";
|
|
2
|
+
import { formatItems } from "../system-prompts/helpers.js";
|
|
3
|
+
export default defineBlokkliAgentSystemPrompt({
|
|
4
|
+
id: "available-skills",
|
|
5
|
+
title: "Available Skills",
|
|
6
|
+
weight: 900,
|
|
7
|
+
cacheGroup: "per-page",
|
|
8
|
+
getPrompt: (context) => {
|
|
9
|
+
return formatItems(
|
|
10
|
+
context.resolvedSkills.map((s) => ({
|
|
11
|
+
id: s.name,
|
|
12
|
+
label: context.loadedSkills.has(s.name) ? `${s.englishLabel} (loaded)` : s.englishLabel,
|
|
13
|
+
description: context.loadedSkills.has(s.name) ? "Already loaded in the conversation. Do NOT load again." : s.description
|
|
14
|
+
})),
|
|
15
|
+
"You can load detailed guidelines using the `load_skill` tool. Use skills when the task requires following specific rules or guidelines. Load skills when you feel they help you achieve a goal or when the user mentions it."
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineBlokkliAgentSystemPrompt } from "../system-prompts/index.js";
|
|
2
|
+
import { formatItems } from "../system-prompts/helpers.js";
|
|
3
|
+
export default defineBlokkliAgentSystemPrompt({
|
|
4
|
+
id: "available-tools",
|
|
5
|
+
title: "Additional Tools",
|
|
6
|
+
weight: 1e3,
|
|
7
|
+
cacheGroup: "per-page",
|
|
8
|
+
getPrompt: (context) => {
|
|
9
|
+
return formatItems(
|
|
10
|
+
context.lazyTools.map((t) => ({
|
|
11
|
+
id: t.name,
|
|
12
|
+
label: t.name,
|
|
13
|
+
description: t.description
|
|
14
|
+
})),
|
|
15
|
+
"The following tools are available but must be loaded first by calling `load_tools`. Only load tools you actually need for the current task."
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineBlokkliAgentSystemPrompt } from "../system-prompts/index.js";
|
|
2
|
+
import { formatItems } from "../system-prompts/helpers.js";
|
|
3
|
+
export default defineBlokkliAgentSystemPrompt({
|
|
4
|
+
id: "fragments",
|
|
5
|
+
title: "Available Fragments",
|
|
6
|
+
weight: 820,
|
|
7
|
+
cacheGroup: "per-page",
|
|
8
|
+
modes: ["editing"],
|
|
9
|
+
getPrompt: (context) => {
|
|
10
|
+
return formatItems(
|
|
11
|
+
context.pageContext.fragments.map((f) => ({
|
|
12
|
+
id: f.name,
|
|
13
|
+
label: f.label,
|
|
14
|
+
description: f.description
|
|
15
|
+
})),
|
|
16
|
+
"Fragments are hardcoded content components that can be added to the page. They have no content that can be edited by users."
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineBlokkliAgentSystemPrompt } from "../system-prompts/index.js";
|
|
2
|
+
export default defineBlokkliAgentSystemPrompt({
|
|
3
|
+
id: "important-rules",
|
|
4
|
+
title: "IMPORTANT",
|
|
5
|
+
weight: 600,
|
|
6
|
+
cacheGroup: "static",
|
|
7
|
+
getPrompt: () => {
|
|
8
|
+
return `
|
|
9
|
+
- ALWAYS USE THE "ask_question" TOOL TO ASK STRUCTURED QUESTIONS!!!
|
|
10
|
+
- Use "ask_question" also when presenting the user with some options to pick from (text suggestions, suggestions on how to change structure, etc.)
|
|
11
|
+
- Always verify the structure before making changes
|
|
12
|
+
- For markup fields, preserve HTML structure
|
|
13
|
+
- For plain fields, use plain text only
|
|
14
|
+
- When adding paragraphs, make sure to populate all required text fields!
|
|
15
|
+
- Use the move_paragraphs tool when moving paragraphs, instead of creating a new paragraph of the same bundle and copy pasting text.
|
|
16
|
+
- ALL mutation MCP tools will make sure that the mutation is valid - it's not possible for you to make a mistake there. They return a descriptive error message.
|
|
17
|
+
- It's impossible for you to make irreversible mutations! All mutations can ALWAYS be undone. You can not actually publish any changes, this can only be done by a human.
|
|
18
|
+
- When the user's prompt implies acting on specific paragraphs but doesn't specify which ones (e.g. "translate this to german", "make this bigger", "delete these"), ALWAYS call "get_selected_paragraphs" first to check what is selected. Do this even if the prompt seems ambiguous - the selection is the most likely target.
|
|
19
|
+
- You can output text as you please, markdown is allowed!
|
|
20
|
+
`;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineBlokkliAgentSystemPrompt } from "../system-prompts/index.js";
|
|
2
|
+
export default defineBlokkliAgentSystemPrompt({
|
|
3
|
+
id: "interaction",
|
|
4
|
+
title: "Interaction with User",
|
|
5
|
+
weight: 400,
|
|
6
|
+
cacheGroup: "per-page",
|
|
7
|
+
getPrompt: ({ pageContext }) => {
|
|
8
|
+
const isGerman = pageContext.interfaceLanguage === "de";
|
|
9
|
+
const listItems = [
|
|
10
|
+
`Be polite and helpful.`,
|
|
11
|
+
isGerman ? `When speaking in German, address the bl\xF6kkli user in the "informal you" ("du", "dich", "deine", etc.). This does not apply for generated page content!` : void 0,
|
|
12
|
+
`The bl\xF6kkli user is a person who edits content. They are not interested in technical jargon. They don't care about UUIDs (this is never shown to them in the editor).`,
|
|
13
|
+
`Never use any swear words, even if the user's prompt is mean towards you.`,
|
|
14
|
+
`Talk to the user in the same language as their initial message`,
|
|
15
|
+
`DO NOT respond with long messages, unless asked to! Keep your answers short.`,
|
|
16
|
+
`After mutations, **BRIEFLY** confirm what you did. No lengthy summaries. No repeating of updated content.`
|
|
17
|
+
].filter(Boolean);
|
|
18
|
+
return listItems.map((v) => "- " + v).join("\n");
|
|
19
|
+
}
|
|
20
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineBlokkliAgentSystemPrompt } from "../system-prompts/index.js";
|
|
2
|
+
export default defineBlokkliAgentSystemPrompt({
|
|
3
|
+
id: "introduction",
|
|
4
|
+
title: "",
|
|
5
|
+
weight: 100,
|
|
6
|
+
cacheGroup: "static",
|
|
7
|
+
getPrompt: () => {
|
|
8
|
+
return `You are a friendly AI agent that helps users create and edit complex page content in a Drupal paragraphs-based page editor called bl\xF6kkli.
|
|
9
|
+
|
|
10
|
+
You have access to various MCP tools to query and mutate the page. Use them! You also have access to additional knowledge available via load_skill!
|
|
11
|
+
These tools will use a lot of Drupal terminology such as "paragraph", "entity type", "bundle" or "field".
|
|
12
|
+
`;
|
|
13
|
+
}
|
|
14
|
+
});
|