[stories] Allow vibe coded plugins inside nao stories (first draft) - #1465
Draft
Bl3f wants to merge 2 commits into
Draft
[stories] Allow vibe coded plugins inside nao stories (first draft)#1465Bl3f wants to merge 2 commits into
Bl3f wants to merge 2 commits into
Conversation
…ins agent setting Co-authored-by: Christophe Blefari <christophe.blefari@gmail.com>
Co-authored-by: Christophe Blefari <christophe.blefari@gmail.com>
Contributor
🚀 Preview Deployment
Preview will be automatically removed when this PR is closed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1464
First draft of vibe coded plugin blocks inside nao stories.
What this adds
New
<plugin>story block. Stories can now embed<plugin title="...">…JavaScript ES module code…</plugin>blocks. The code must be a self-contained vanilla JS module withexport default function render(element)that renders into the provided DOM element (no imports, no external network calls). Parsing lives inapps/shared/src/story-segments.tsas a newpluginsegment variant, with validation (closing tag, non-empty code) instory-validation.ts.Admin toggle, off by default. New
storyPlugins.enabledkey in projectAgentSettings, editable only by admins viaproject.updateAgentSettings. A "Vibe coded plugins" card is added to Settings → Project → Agent, plus a settings search index entry.Agent gating. The
storytool description only teaches the agent the plugin tag, module contract, and usage restrictions when the setting is enabled; when disabled the description never mentions plugins. The live-story refresh prompt preserves<plugin>blocks verbatim.Movable but not editable. In the story TipTap editor, plugin blocks are atom nodes with the standard drag grip and drop zones: they can be reordered, grouped into
<grid>columns, and moved within/out of grids, and the raw markup round-trips losslessly. There is no edit affordance anywhere (no pencil, no edit dialog); the editor shows a labeled placeholder card. All other blocks keep their existing edit behavior.Rendering. In read/preview mode the plugin module is loaded via a blob URL
import()(same pattern as custom chart plugins) and rendered into a framed card with loading/error states and cleanup on unmount. Backend static HTML export (story-html.tsx) deliberately skips plugin execution.Testing
npm run lint(tsc + eslint across backend/frontend/shared): passesnpm run format:check: passes</>, plugins as grid columns) and validation: passchart-builder.test.tsxwidth assertion in shared, and backend tests importingbun:sqliteunder the Node vitest runnerNotes for review