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…
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…