すべてのプラグイン

dsh-inline-visualizer

dsh-inline-visualizer · バージョン 2.0.2 · 2026/11/29 更新

dsh-inline-visualizer では、モデルが widget_guidelines でデザイン仕様を読み込み、描画する内容を明示してから、SVG または HTML の断片を show_widget に渡します。チャット内にカードとして直接描画され、描画結果はモデルのコンテキストに含まれません。

  • バージョンごとに審査
  • UI 拡張
  • MIT
  • 0回ダウンロード

説明

以下はプラグイン作者による原文です。

dsh-inline-visualizer

dsh-inline-visualizer

npm · GitHub · MIT · DSH 0.2.1-rc.5

English · 简体中文

Turns "inline visualization" into two built-in tools for DeepSeek Harness: the model first spells out what it wants to draw (widget_guidelines loads a design contract), then hands the snippet to show_widget — the card renders right in the conversation, and the visual itself never enters the model's context.

  • Targets DSH 0.2.1-rc.5 (engines.dsh: >=0.2.1-rc.5 <0.3.0).
  • Plain JavaScript, no build step, no third-party runtime dependencies; the host side uses the host-provided @deepseek-ai/dsh-tools, and the browser side only pulls react from the host module table.

With and without

with and without

Without the plugin, diagrams can only appear as code blocks or files. With it, cards render directly in the conversation — interactive, downloadable, and theme-aware.

Why this plugin

  • The artifact never enters the model's context. The tool result is a single ack; the visual travels out-of-band into the UI. The SVG source of two or three charts will not flood the conversation, and the model will not start repeating code.
  • No third-party runtime dependencies. No echarts, no mermaid, no build scripts — install and go.
  • Theme actually follows. It reads only the documented entry points ctx.theme and --dsw-alias-*, recalculating colors when the user switches light/dark; it never touches host internals such as data-ds-dark-theme, so host upgrades will not break it.
  • Two render paths, separated by risk. SVG goes through a data: URI into an <img> — vector, crisp, and never executes scripts; HTML goes into an opaque-origin sandbox="allow-scripts" iframe with a default-src 'none' CSP, so it can be interactive but cannot read the host.
  • The model does not have to guess colors. A built-in design contract provides 8 color families × 6 steps, semantic tokens, typography and hard constraints, loaded per module (diagram / chart / mockup / interactive / art).
  • Bilingual UI + complete display metadata. locale/{en,zh}.json carries meta.title / meta.description, and icon.svg is hand-drawn, so the store listing never falls back to a default image.
  • 197 self-tests; 205 when the real dsh-tools Part C is enabled, including tool-schema compilation.

What it does not do

  • No streaming, character-by-character rendering: the visual appears all at once after the tool call, not token by token.
  • No rasterization: output is always vector SVG, never converted to PNG.
  • No Mermaid parsing: install a Mermaid plugin separately if you need it.
  • No bundled chart library: charts are hand-written native SVG by the model, trading a library for zero dependencies and a controlled size.

The two tools

ToolArgumentsPurpose
widget_guidelinesmodules: ('diagram'|'chart'|'mockup'|'interactive'|'art')[]Returns the design contract (tokens, typography, spacing, hard constraints + the selected modules)
show_widgettitle, widget_code, loading_messagesRenders a card in place; returns only a very short ack

widget_code is a bare <svg …>…</svg> (preferred) or an HTML fragment. The tool result contains no snippet content — that is the red line of the whole approach.

Install

Published on npm (dsh-inline-visualizer@2.0.2).

Install it with the DSH plugin manager (recommended):

plugin_manager { action: "install_bundle", target: "dsh-inline-visualizer" }

This requires danger-full-access approval; target accepts any pnpm-resolvable install spec — a package name (installed from npm) or an absolute path to a local directory.

Manual install (development only): drop the package into $DSH_HOME/profiles/<profile>/node_modules/dsh-inline-visualizer (for example ~/.dsh/profiles/desktop/node_modules/dsh-inline-visualizer) and append to that profile's cordis.patch.yml:

- insert:
    - id: visualizer
      name: 'dsh-inline-visualizer'

Installing a new package takes effect via HMR; replacing an already-installed package requires a restart to load the new JS generation.

Optional configuration

- id: visualizer
  name: 'dsh-inline-visualizer'
  config:
    maxCodeChars: 200000     # per-card limit, 1000 - 1000000

Security boundaries

SurfaceApproach
SVGAllowlist-sanitized, then turned into a data: URI and placed in an <img> — <script> / <foreignObject> / animation elements / on* are all stripped, href may only be # or data:; <img> itself never executes scripts
HTMLsandbox="allow-scripts" (opaque origin, never allow-same-origin) + a default-src 'none' CSP + external links limited to 4 CDNs
HeightThe child posts postMessage({type:'viz:height'}); the parent validates event.source before resizing
ThemeReads only documented entry points: ctx.theme.getTheme().colorScheme and theme/change; never touches any host internals
CopyAll strings go through the plugin's own locale namespace (ctx.locale), bilingual EN/ZH

Layout

FilePurpose
index.jsHost half: registers the two tools via defineTool; assembles guidelines/*.md on demand
client.jsBrowser half: a window.__ModuleLoader__.load() factory that registers the card into tool.call.toolview under key: 'show_widget'
guidelines/The design-contract text (_core.md always included + five modules)
locale/{en,zh}.jsonDisplay metadata (meta.title / meta.description) and runtime strings
icon.svgPlugin icon (64×64, shipped in the package)
assets/icon-180.pngStore-card icon (180×180 PNG, listing only)
assets/readme-hero.pngREADME hero image (shipped in the package)
assets/readme-compare.pngWith/without comparison image (shipped in the package)
test/smoke.mjsnpm test: 197 assertions (205 with Part C), including real defineTool schema compilation
CHANGELOG.mdVersion history

Testing

npm test

Four parts: the host half's tool definitions; compiling schemas with the real dsh-tools (enabled when DSH_TOOLS_ENTRY points at its lib/index.js or lib/types/schema.js); the browser half's rendering / XSS / theme; and packaging / publishability requirements.

Visual test cases and screenshots live in docs/test-cases: 5 design modules, both render paths, sanitization and argument validation — 30 cases, 24 screenshots, with a full smoke-test report.

Known limitations

  • No real-browser E2E: the test uses a fake React + fake DOM, so layout, actual CSP enforcement and React reconciliation are not covered.
  • Sanitization is regex-level: mXSS and entity-encoding bypasses are out of scope; routing SVG through <img> keeps the risk minimal, but the HTML branch relies on the CSP as its only line of defense.
  • The spec is a general rewrite: the palette is a first-party 8-family × 6-step system, not an equivalent copy of any product.
  • No performance testing near the 1,000,000-character configuration limit.

Releasing

  1. npm publish --access public (package name dsh-inline-visualizer; if taken, switch to a scope and update the name in three places).
  2. Open a single PR to awesome-dsh-plugin adding one file data/plugins/tonebean__dsh-inline-visualizer.yml, category ui, icon from assets/icon-180.png (raster PNG only).
  3. Or host your own index: any format-1 JSON over http(s), added by the user under Settings → Plugins → Marketplace Index.

Full commands, the acceptance checklist, the PR template and the semver pitfall are in PUBLISHING.md (not shipped in the package).

License

MIT, see LICENSE.

バージョン履歴

  • 2.0.22026/11/29 · 573 KB
dsh-inline-visualizer · SoleAPI Agent プラグイン | SoleAPI