feat(v3): add/remove plugins from a dropdown + "New" button (v0.20)#90
Merged
Conversation
Addresses Lisa's feedback: the v3 editor only exposed commands for plugins already declared in the imported YAML, with no way to add a new one (e.g. a thermometer for temperature monitoring). Creating a protocol from scratch was also hidden inside the demo dropdown. - Settings → Plugins is now editable: a "+ Add plugin…" dropdown lists supported plugins from the registry (backlight, thermometer, camera), excluding ones already declared, with an Add button and a per-plugin ✕ remove button (confirm dialog warns if commands still reference it). Newly added plugins' commands appear in the Inspector "+ add" picker immediately (listV3PluginNames reads experiment.plugins[]). - New "+ New" toolbar button loads the blank skeleton (was only reachable via the demo dropdown); removed the redundant demo entry. - New onAddPlugin/onRemovePlugin/countPluginUsage handlers follow the existing mutation pattern (importMode guard, pushUndo, renderAll); newBtn added to IMPORT_LOCKED_CONTROLS. - protocol-yaml-v3.js: new docRemovePlugin(); add path reuses createPluginEntry → _doc.createNode → docInsertPluginNode. - Tests: new Suite N11 (add/remove/roundtrip) — 592/592 pass. - Quickstart + footer updated to v0.20. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What & why
Addresses Lisa's Slack feedback: the v3 Experiment Designer only exposed commands for plugins already declared in the imported YAML, so there was no way to add a new plugin (e.g. a thermometer for temperature monitoring) and surface its commands. Separately, creating a protocol from scratch was possible but hidden inside the "Load demo" dropdown.
Changes
Add/remove plugins (Settings → Plugins)
backlight,thermometer/DAQThermometerPlugin,camera), excluding ones already declared."+ New" button — loads the blank minimum-valid skeleton from the toolbar (next to Import); removed the now-redundant demo-dropdown entry.
Plumbing
onAddPlugin/onRemovePlugin/countPluginUsagefollow the existing mutation pattern (importModeguard,pushUndo,renderAll);newBtnadded toIMPORT_LOCKED_CONTROLS.js/protocol-yaml-v3.js: newdocRemovePlugin(). The add path reusescreatePluginEntry→_doc.createNode→ existingdocInsertPluginNode.Tests
tests/test-protocol-roundtrip-v3.js(add / remove / roundtrip / no-plugins:-key creation). 592/592 pass.🤖 Generated with Claude Code