Attach prompts, content items, and visual editor elements to AI Assistant Context#26512
Attach prompts, content items, and visual editor elements to AI Assistant Context#26512AlexGaillard merged 63 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for attaching additional context (prompts, content items, and visual editor selections) to AI Chat requests, and exposes new UI to stage/manage that context from the App and Visual Editor.
Changes:
- Introduces “context attachments” plumbing end-to-end (App → API request schema → system-prompt formatting).
- Adds UI for staging prompts/items/visual elements, plus AI sidebar integration in the visual editor and live preview split panel.
- Refactors AI tooling state into a dedicated store and improves related typings/tests.
Reviewed changes
Copilot reviewed 46 out of 47 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Bumps webidl-conversions to 8.0.1. |
| packages/ai/src/types.ts | Adds shared context attachment types for AI package consumers. |
| app/src/views/private/components/live-preview.vue | Adds optional split-panel sidebar support + new slots/events for sidebar and notifications. |
| app/src/views/private/components/file-preview.vue | Allows overriding preview src instead of always using asset URL. |
| app/src/views/private/components/file-lightbox.vue | Passes through optional src to support non-asset image previews. |
| app/src/modules/visual/types/index.ts | Extends visual editor message protocol for context add + element highlight + stronger types. |
| app/src/modules/visual/routes/visual-editor.vue | Adds AI sidebar/drawer in visual editor, responsive behavior, and header button integration. |
| app/src/modules/visual/components/editing-layer.vue | Adds support for staging visual elements into AI context and highlighting elements from AI UI. |
| app/src/modules/content/routes/item.vue | Refreshes previews on non-read item tool calls and supports staging visual elements from popup. |
| app/src/lang/translations/en-US.yaml | Adds new i18n keys for live preview + AI context menu/staging. |
| app/src/components/v-form/composables/use-ai-tools.ts | Improves tool descriptions to clarify UI-only vs database mutations. |
| app/src/ai/types/prompts.ts | Adds MCP prompt type used by prompt staging. |
| app/src/ai/types/index.ts | Re-exports new AI app types. |
| app/src/ai/types/context.ts | Defines pending context items + type guards for context UI/store. |
| app/src/ai/stores/use-ai.ts | Adds context snapshotting + page context, integrates new tools/context stores, adds highlight/focus hooks. |
| app/src/ai/stores/use-ai.test.ts | Updates tests for refactors/typing changes in AI store. |
| app/src/ai/stores/use-ai-tools.ts | New store to manage system tools, local tools, and approval modes. |
| app/src/ai/stores/use-ai-tools.test.ts | Adds tests for the new AI tools store. |
| app/src/ai/stores/use-ai-context.ts | New store for pending context + snapshotting attachments (incl. fetching current visual element data). |
| app/src/ai/stores/use-ai-context.test.ts | Adds tests for context store behaviors and snapshotting. |
| app/src/ai/composables/use-search-filter.ts | Adds reusable search filtering composable for context menus. |
| app/src/ai/composables/use-prompts.ts | Adds prompt fetching, template variable extraction, rendering, and conversion to chat messages. |
| app/src/ai/composables/use-prompts.test.ts | Adds tests for prompt fetching/rendering/variable extraction. |
| app/src/ai/composables/use-context-staging.ts | Adds staging logic for prompts/items/visual elements into pending context with notifications. |
| app/src/ai/composables/use-context-staging.test.ts | Adds tests for context staging behavior. |
| app/src/ai/composables/define-tool.ts | Moves local tool registration from AI store to tools store. |
| app/src/ai/composables/define-tool.test.ts | Updates mocks/tests to reflect tools store usage. |
| app/src/ai/components/parts/ai-message-tool.vue | Updates typing for tool message parts. |
| app/src/ai/components/parts/ai-message-file.vue | Adds lightbox support for image attachments in AI messages. |
| app/src/ai/components/ai-settings-menu.vue | Adds fallback icon handling for approval preview. |
| app/src/ai/components/ai-prompt-variables-modal.vue | New modal to collect template variables when inserting prompts. |
| app/src/ai/components/ai-pending-context.vue | New UI component to display/removal/hover-highlighting of pending context items. |
| app/src/ai/components/ai-message.vue | Renders context attachments from user message metadata + hover highlight integration. |
| app/src/ai/components/ai-input.vue | Adds context menu + pending context strip and focus hook wiring. |
| app/src/ai/components/ai-conversation.vue | Minor layout updates for conversation container. |
| app/src/ai/components/ai-context-menu/list-view.vue | New reusable list view wrapper for context menu sections. |
| app/src/ai/components/ai-context-menu/empty-state.vue | New empty state list item for context menu lists. |
| app/src/ai/components/ai-context-menu/context-menu-item.vue | New menu item component used across context menu lists. |
| app/src/ai/components/ai-context-menu.vue | New context picker menu for staging prompts and items into AI context. |
| app/src/ai/components/ai-context-card.vue | New pill/card UI for context items/attachments (pending + snapshotted). |
| api/src/ai/tools/items/prompt.md | Updates items tool documentation examples for update payload shape. |
| api/src/ai/tools/items/index.ts | Allows data to be object or array to support both keyed and batch updates. |
| api/src/ai/chat/utils/format-context.ts | New formatter to append attachments/page context to the system prompt. |
| api/src/ai/chat/models/chat-request.ts | Extends request schema with validated context + attachment types. |
| api/src/ai/chat/lib/create-ui-stream.ts | Passes context into prompt assembly per step (via formatter). |
| api/src/ai/chat/controllers/chat.post.ts | Wires context from request into UI stream creation. |
| .changeset/fresh-doodles-relax.md | Adds changeset for minor bumps across ai/api/app packages. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Florian C. Wachmann <[email protected]>
Co-authored-by: Florian C. Wachmann <[email protected]>
Co-authored-by: Florian C. Wachmann <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
* refactor: replace useVisualEditorAi with useAiSidebar for clarity * fix: add type annotation for ComputedRef in useAiSidebar function * fix: add type annotations for sidebarSize and sidebarCollapsed emit events * add comment * remove comment (from html) * changeset: add usage notice for visual editing library
This comment was marked as resolved.
This comment was marked as resolved.
this can be ignored - due to the AI SDK we need to make sure we modify the system prompt in the onPrepareStep everytime so that it gets the updated context. |
formfcw
left a comment
There was a problem hiding this comment.
Well done @bryantgillespie ❤️
LGTM 🎉
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [directus/directus](https://github.com/directus/directus) | minor | `11.14.1` → `11.15.0` | --- ### Release Notes <details> <summary>directus/directus (directus/directus)</summary> ### [`v11.15.0`](https://github.com/directus/directus/releases/tag/v11.15.0) [Compare Source](directus/directus@v11.14.1...v11.15.0) #####⚠️ Potential Breaking Changes **Attached prompts, content items, and visual editor elements to AI Assistant Context ([#​26512](directus/directus#26512) by [@​bryantgillespie](https://github.com/bryantgillespie))** To use this feature, update [@​directus/visual-editing](https://github.com/directus/visual-editing) to v1.2.0+ on your website. ##### ✨ New Features & Improvements - **[@​directus/app](https://github.com/directus/app)** - Added deployment module for triggering deployments from Directus with Vercel as first supported provider ([#​26473](directus/directus#26473) by [@​gaetansenn](https://github.com/gaetansenn)) - Added collaborative editing ([#​26172](directus/directus#26172) by [@​Nitwel](https://github.com/Nitwel)) - Attached prompts, content items, and visual editor elements to AI Assistant Context ([#​26512](directus/directus#26512) by [@​bryantgillespie](https://github.com/bryantgillespie)) - Added multi-provider AI support with Google and OpenAI-compatible providers. Extracted shared AI types into new `@directus/ai` package. ([#​26481](directus/directus#26481) by [@​bryantgillespie](https://github.com/bryantgillespie)) - Added toggle to allow comparing revision to previous revision ([#​26480](directus/directus#26480) by [@​robluton](https://github.com/robluton)) - Added relational field support on x-axis of bar chart ([#​26489](directus/directus#26489) by [@​JamesW1](https://github.com/JamesW1)) - Added visual editing support to the live preview split pane, including display options menu, full-width mode with drag-to-expand, and quick access to the Visual Editor module. ([#​26463](directus/directus#26463) by [@​bryantgillespie](https://github.com/bryantgillespie)) - Changed permission-blocked fields from disabled to non-editable appearance ([#​26572](directus/directus#26572) by [@​HZooly](https://github.com/HZooly)) - **[@​directus/api](https://github.com/directus/api)** - Added deployment module for triggering deployments from Directus with Vercel as first supported provider ([#​26473](directus/directus#26473) by [@​gaetansenn](https://github.com/gaetansenn)) - Added collaborative editing ([#​26172](directus/directus#26172) by [@​Nitwel](https://github.com/Nitwel)) - Attached prompts, content items, and visual editor elements to AI Assistant Context ([#​26512](directus/directus#26512) by [@​bryantgillespie](https://github.com/bryantgillespie)) - Added multi-provider AI support with Google and OpenAI-compatible providers. Extracted shared AI types into new `@directus/ai` package. ([#​26481](directus/directus#26481) by [@​bryantgillespie](https://github.com/bryantgillespie)) - **[@​directus/sdk](https://github.com/directus/sdk)** - Fixed race condition and allow accessing the connected state ([#​26511](directus/directus#26511) by [@​Nitwel](https://github.com/Nitwel)) - Added deployment module for triggering deployments from Directus with Vercel as first supported provider ([#​26473](directus/directus#26473) by [@​gaetansenn](https://github.com/gaetansenn)) - **[@​directus/system-data](https://github.com/directus/system-data)** - Added deployment module for triggering deployments from Directus with Vercel as first supported provider ([#​26473](directus/directus#26473) by [@​gaetansenn](https://github.com/gaetansenn)) - **[@​directus/types](https://github.com/directus/types)** - Added deployment module for triggering deployments from Directus with Vercel as first supported provider ([#​26473](directus/directus#26473) by [@​gaetansenn](https://github.com/gaetansenn)) - Added collaborative editing ([#​26172](directus/directus#26172) by [@​Nitwel](https://github.com/Nitwel)) - Added multi-provider AI support with Google and OpenAI-compatible providers. Extracted shared AI types into new `@directus/ai` package. ([#​26481](directus/directus#26481) by [@​bryantgillespie](https://github.com/bryantgillespie)) - **[@​directus/errors](https://github.com/directus/errors)** - Added deployment module for triggering deployments from Directus with Vercel as first supported provider ([#​26473](directus/directus#26473) by [@​gaetansenn](https://github.com/gaetansenn)) - **[@​directus/env](https://github.com/directus/env)** - Added deployment module for triggering deployments from Directus with Vercel as first supported provider ([#​26473](directus/directus#26473) by [@​gaetansenn](https://github.com/gaetansenn)) - Added collaborative editing ([#​26172](directus/directus#26172) by [@​Nitwel](https://github.com/Nitwel)) - **[@​directus/utils](https://github.com/directus/utils)** - Added collaborative editing ([#​26172](directus/directus#26172) by [@​Nitwel](https://github.com/Nitwel)) - **[@​directus/ai](https://github.com/directus/ai)** - Attached prompts, content items, and visual editor elements to AI Assistant Context ([#​26512](directus/directus#26512) by [@​bryantgillespie](https://github.com/bryantgillespie)) - Added multi-provider AI support with Google and OpenAI-compatible providers. Extracted shared AI types into new `@directus/ai` package. ([#​26481](directus/directus#26481) by [@​bryantgillespie](https://github.com/bryantgillespie)) - **[@​directus/memory](https://github.com/directus/memory)** - Added distributed locking ([#​26172](directus/directus#26172) by [@​Nitwel](https://github.com/Nitwel)) ##### 🐛 Bug Fixes & Optimizations - **[@​directus/app](https://github.com/directus/app)** - Replaced deprecated `ldapjs` with `ldapts` ([#​26363](directus/directus#26363) by [@​dstockton](https://github.com/dstockton)) - Fixed an issue where the caret would jump to the end of the input in `v-template-input` when typing or updating content. ([#​26520](directus/directus#26520) by [@​mustafaazad03](https://github.com/mustafaazad03)) - Fixed back button navigation on related items ([#​26553](directus/directus#26553) by [@​robluton](https://github.com/robluton)) - Fixed table options menu clipping in markdown editor ([#​26487](directus/directus#26487) by [@​DamnItAzriel](https://github.com/DamnItAzriel)) - Hide AI settings page when MCP and AI features are disabled through ENV ([#​26504](directus/directus#26504) by [@​bryantgillespie](https://github.com/bryantgillespie)) - Updated dependency ([#​26518](directus/directus#26518) by [@​rijkvanzanten](https://github.com/rijkvanzanten)) - Fixed inconsistent disabled state across interfaces ([#​26470](directus/directus#26470) by [@​formfcw](https://github.com/formfcw)) - Fixed an issue where custom CSS classes applied to PrivateView were not rendered ([#​26523](directus/directus#26523) by [@​u12206050](https://github.com/u12206050)) - Fixed WYSIWYG interface not rendering when field is named "tooltip" ([#​26581](directus/directus#26581) by [@​robluton](https://github.com/robluton)) - Fixed issue preventing sidebar details from being fetched when navigating back ([#​26542](directus/directus#26542) by [@​robluton](https://github.com/robluton)) - Fixed Vue warning by passing required prop to interfaces ([#​26506](directus/directus#26506) by [@​formfcw](https://github.com/formfcw)) - Fixed hardcoded "Loading..." text in field tree by using translation key ([#​26526](directus/directus#26526) by [@​sinan-yildiz-marsus](https://github.com/sinan-yildiz-marsus)) - Renamed AI Chat to AI Assistant ([#​26517](directus/directus#26517) by [@​bryantgillespie](https://github.com/bryantgillespie)) - **[@​directus/api](https://github.com/directus/api)** - Improved error message for system field updates that are not schema.is\_indexed ([#​26548](directus/directus#26548) by [@​JamesW1](https://github.com/JamesW1)) - Replaced deprecated `ldapjs` with `ldapts` ([#​26363](directus/directus#26363) by [@​dstockton](https://github.com/dstockton)) - Changed users.last\_access display mode to absolute ([#​26548](directus/directus#26548) by [@​JamesW1](https://github.com/JamesW1)) - **[@​directus/system-data](https://github.com/directus/system-data)** - Added collaborative editing ([#​26172](directus/directus#26172) by [@​Nitwel](https://github.com/Nitwel)) - Added multi-provider AI support with Google and OpenAI-compatible providers. Extracted shared AI types into new `@directus/ai` package. ([#​26481](directus/directus#26481) by [@​bryantgillespie](https://github.com/bryantgillespie)) - Changed users.last\_access display mode to absolute ([#​26548](directus/directus#26548) by [@​JamesW1](https://github.com/JamesW1)) - Renamed AI Chat to AI Assistant ([#​26517](directus/directus#26517) by [@​bryantgillespie](https://github.com/bryantgillespie)) - **[@​directus/env](https://github.com/directus/env)** - Fixed LDAP DN properties casted as arrays ([#​26579](directus/directus#26579) by [@​ComfortablyCoding](https://github.com/ComfortablyCoding)) - **[@​directus/memory](https://github.com/directus/memory)** - Handled empty buffers to prevent errors during race conditions or disconnects ([#​26172](directus/directus#26172) by [@​Nitwel](https://github.com/Nitwel)) ##### 📦 Published Versions - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/storage-driver-s3@​12.1.1` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` - `@directus/[email protected]` </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4zLjYiLCJ1cGRhdGVkSW5WZXIiOiI0My4zLjYiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbImltYWdlIl19--> Reviewed-on: https://gitea.alexlebens.dev/alexlebens/infrastructure/pulls/3752 Co-authored-by: Renovate Bot <[email protected]> Co-committed-by: Renovate Bot <[email protected]>
…tant Context (#26512) * wip * cleanup * fix: Hide button when AI_ENABLED = false * wip: add chat to visual editor module * fix: menu tweaks * cleanup more * fix: only refresh if mutation * merge menu components * use new menu component * cleanup more * add changeset * cleanup more * add some tests * fix: make resize handles visible again * extract format context to separate util * fix: items tool prompt causing issues * fix visual editing notifications route * refactor out visual elements tool in favor of context plus items tool * refactor to use visual editor config to handle highligthing * wip: context for prompts * Update format-context.ts Co-authored-by: Copilot <[email protected]> * Update use-search-filter.ts Co-authored-by: Copilot <[email protected]> * Update ai-prompt-variables-modal.vue Co-authored-by: Copilot <[email protected]> * remove logging * more fixes * formatter * add some lightweight xml prompt injection protection * failed to add to context notification * remove unneeded prop * appease ai overlords again * fix tests * actually fix tests * changeset past tense * part of claude code review * no proxy stores * more of claudes fixes * fix claudes composable * more of claudes fixes * fix focus * restore staged context if send message throws * simplify because nested field updates weren't working * add v-textoverflow * move display value to core responsiblity instead of being passed from ve package * fix test * show errors on submit * fix escaping * Update app/src/lang/translations/en-US.yaml Co-authored-by: Florian C. Wachmann <[email protected]> * Update app/src/ai/components/ai-context-menu.vue Co-authored-by: Florian C. Wachmann <[email protected]> * Update app/src/modules/content/routes/item.vue Co-authored-by: Florian C. Wachmann <[email protected]> * latest round of feedback * change id to key to match conventions and fix tool calling issues * make codebot happy * change it to test * fix test * fix translation * one more * veai ← cleanup (#26577) * refactor: replace useVisualEditorAi with useAiSidebar for clarity * fix: add type annotation for ComputedRef in useAiSidebar function * fix: add type annotations for sidebarSize and sidebarCollapsed emit events * add comment * remove comment (from html) * changeset: add usage notice for visual editing library --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Florian C. Wachmann <[email protected]>

Scope
What's changed:
Potential Risks / Drawbacks
TBD
Tested Scenarios
Review Notes / Questions
TBD
Checklist
This pull request introduces a new AI Assistant Context system, allowing prompts, content items, and visual editor elements to be attached as context for AI interactions. The changes span API, backend models, prompt formatting, and frontend UI, making context-aware AI responses possible and improving the user experience in the visual editor and chat. The update also refines how item updates are handled in AI tools.
AI Assistant Context Attachments and Context-Aware Prompts:
ContextAttachment,ChatContext, etc.) to represent prompts, items, and visual elements as context attachments inchat-request.ts. The chat request schema now accepts acontextfield.formatContextForSystemPromptutility to format these attachments and page context for inclusion in the AI system prompt, ensuring the AI receives structured, prioritized context.contextfield, dynamically appending formatted context to the system prompt for each AI step. [1] [2] [3] [4]Frontend Visual Improvements:
ai-context-card.vuecomponent for displaying context attachments (items, prompts, visual elements) in the UI, with icons, display text, and removal support.AI Tools and Prompt Documentation:
datato be either an object or array, supporting both single and batch updates, and clarified this in the prompt documentation. [1] [2] [3]Changelog: