Plugins can now emit a list of typed visual outputs beyond the flat
summary dict. Each figure is a small JSON object with a `type` field;
the result card renders them inline below the summary table.
Five types ship today
- markdown — headings, lists, bold/italic/code, fenced code blocks.
Raw HTML is rejected by the backend; the frontend renderer never
reaches for dangerouslySetInnerHTML on this path.
- table — headers (≤ 12 cols) + rows (≤ 100 rows), primitives only.
- bar — inline SVG bar chart, up to 50 bars, zero JS deps.
- svg — escape hatch with sanitisation: rejects <script>,
javascript:, <foreignObject>, <iframe>, <object>, <embed>, and any
on*= event-handler attribute. Up to 256 KB.
- image_png_b64 — base64-encoded PNG, ≤ 1 MB decoded, must have the
PNG magic bytes (JPEG/GIF/other formats rejected).
Each figure also accepts an optional `title` (≤ 120 chars) rendered
as the panel header. Total `figures` list capped at 10 entries.
Backend
- New plugin_run…
Full audit pass: leak fixes, sign-in clarity, functional bugs
Yuchen Yuan+1: Claude Opus 4.7 (1M context)
4c566b4
Triggered by user request "全方位的检查、测试" covering visualization,
user comprehension, page logic, ease-of-use, science, info leakage,
and security. Three parallel audits ran (info-leak, sign-in clarity,
visual/a11y, functional/scientific); fixes batched below.
Critical functional bugs
- workflow_service.run_pipeline + run_pipeline_stream now call
plugin_service.hydrate_from_dataset_if_needed before dispatch.
Without this, a logged-in user running a pipeline on a fresh
container (or on the mirror Space) would see "plugin not found"
even though it sits safely in their HF Datasets backing store.
- plugin_runner._scrub_scalars / _scrub_value drop NaN and ±Inf
instead of passing them through. Standard JSON has no representation
for either; model_dump_json emits NaN/Infinity which the browser's
JSON.parse refuses, so any plugin returning a numerically degenerate
scalar used to make the entire /run response fail to parse client-
side. NaN → dropped from scalars dict; Inf → nul…
Bundled example plugins + UX polish from second audit pass
Yuchen Yuan+1: Claude Opus 4.7 (1M context)
ef8bb5f
Lets users try the plugin upload flow end-to-end without writing one
from scratch: the Upload modal now shows a "Try with a sample" section
that fetches /api/plugins/examples and offers per-example Install +
.zip download buttons.
Backend:
- New read-only GET /api/plugins/examples returns minimal metadata
parsed from each bundled zip's manifest.json (label, family, tagline,
color, size). Catalog is empty if the examples dir is missing.
- New read-only GET /api/plugins/examples/{name}.zip returns the raw
zip bytes. Name is constrained to `^[a-z][a-z0-9_]{0,30}$`; resolved
path must stay inside the examples dir (defence in depth against
symlink shenanigans). 400 on bad name, 404 on missing or escaped path.
- manifest.json read inside the zip capped at 64 KB so a malformed
bundled example can't allocate unboundedly.
- Defensive comment about route ordering vs the path-param DELETE.
- Dockerfile COPYs example_plugins/ into the runtime image so the
endpoints have content to s…
Plugin protocol Phase 5: final audit fixes + polish
Yuchen Yuan+1: Claude Opus 4.7 (1M context)
d06bf19
Defence-in-depth fixes from the security/UX/scientific audits:
Backend safety:
- Reject `\` and absolute paths in zip entry names (defensive even on
Linux containers).
- Cap stdin payload at 50 MB in the subprocess wrapper before parsing.
- Drop the full `/tmp/quda_plugins/<user>/<kind>/` path from the
"handler.py missing" error message — user already knows their kind.
Frontend UX:
- QNode now renders a red-bordered tombstone card with a "?" badge and
a "plugin not installed" hint when a referenced plugin has been
deleted, instead of silently disappearing.
- App.tsx listens for `storage` events on `quda.*` keys to refresh the
plugin list across tabs.
- UploadPluginModal title now reads "Upload your own block" with a
one-line explanation of what plugins do.
- TrySlide adds a "Upload your own block" tip alongside the Export .py
one so new users discover the plugin workflow.
Docs:
- README.md gains a User plugins section pointing to PLUGIN_SDK.md.
- PLUGIN_SDK.md adds a "…
Plugin protocol Phase 5: SDK docs + two example plugins
Yuchen Yuan
e66189d
* PLUGIN_SDK.md — complete plugin developer guide:
- .zip layout (manifest.json + handler.py at top level)
- Full manifest schema with each field's constraints
- run(inputs, params) signature + every recognised return key
- Minimum working example (h_counter metric)
- Execution environment table (10-min timeout, 1 GB RAM, env strip)
- Per-family conventions for source/backend/algorithm/metric/sink
- Where plugins live + lifecycle (per-browser, /tmp scoped)
- Safety notes (no IBM token leakage, subprocess isolation)
- Troubleshooting table
* example_plugins/count_gates/ — minimal metric plugin: counts gate
types in the upstream circuit, returns summary + scalars.
* example_plugins/prefix_x/ — minimal algorithm plugin: prepends an
X gate on a chosen qubit, returns new circuit + summary.
* example_plugins/*.zip — pre-zipped versions for users who want to
download + upload directly without re-zipping.
End-to-end verified on live HF Space: both example plugins up…