dsh-smart-ui: Rendering interactive response cards in DSH using JSON specifications

Preface

In DSH conversations, models often output long blocks of Markdown. Comparisons, charts, tables, and step-by-step instructions are frequently crammed into the same text block, requiring readers to manually scan headings and lists. Changing a single number also fails to trigger linked updates. Some users ask the model to write HTML or scripts directly, but this is difficult to validate and hard to reproduce stably within conversation logs; furthermore, it is prone to distortion when switching themes or continuing conversations.

The client plugin dsh-smart-ui maintained by beex-labs (npm package name dsh-intelligent-ui, GitHub: beex-labs/dsh-smart-ui) takes a different path: the model simply calls the tool ui_render to write a pure JSON UI Schema. The page then renders this into fixed cards or stateful interactive interfaces, without writing HTML/JSX/JavaScript. The specification is plain JSON, which remains unchanged across conversation records, forks, and resumes.

What is this

dsh-smart-ui targets the DSH Web client and belongs to the “Client” category in the community plugin directory. It takes over the display of ui_render in the conversation tool view: the Host side provides the tool schema and prompt fragments, while the Client side renders using React and theme tokens; charts and flowcharts are drawn via lazy-loaded chunks for ECharts and Mermaid.

Maintainer: beex-labs. Current GitHub stars: 0; package.json indicates version 1.0.0 and license MIT.

Two Vocabularies: Fixed Cards and Generative UI

Fixed Cards (Single Structure, Stateless)

Suitable for “one answer, one layout.” After selecting kind, you primarily fill in data fields:

kind Usage Summary
compare Comparison of three or more items on the same dimension
chart Series such as bar/line/pie or donut charts
stats Two to six headline numbers
progress A single ratio (pass rate, quota, etc.)
steps Ordered list of steps
table Row and column data tables
diagram Node-edge graphs or raw mermaid
calculator Recalculation where users can change numbers (e.g., bill splitting, tips)
unit Unit conversion
note Short prompts requiring emphasis

Generative UI (kind: "app" and playground)

  • app: Interactive tools, simulators, or dashboards. Described using state, compute, tree (component tree: id, type, props, bind, on, children), and optional stream. Component types come from a registry of approximately 71 classes (including chart aliases, maps, quiz/flashcard/countdown, etc.). bind evaluates in a safe expression language (no eval, fixed function table); on supports actions like set, toggle, copy, open, submit, call, etc., reporting only actually occurred effects via the Action Router.
  • playground: Editable JSON UI Schema with validation and live preview; source is JSON text, intentionally allowing incomplete schemas for debugging.

Semantic color tones are parsed as theme tokens. Fixed cards and app share the same set of rules for light/dark modes. The DSH theme writes content font size to --dsh-content-font-size (10–22px), allowing the entire card to scale according to this variable. Wide tables scroll horizontally; if the table body exceeds 15 rows, it scrolls vertically within the card with a fixed header.

Runtime Architecture (Brief)

Model writes plain JSON spec
   ↓
index.js      Host: ui_render tool, normalizeSpec, compile diagram to Mermaid source written to log
   ↓
engine.cjs    Shared: registry, safe expressions, validateApp, computeAll, streaming protocol
   ↓
client.js     Client: Fixed cards, app runtime, REGISTRY, Playground, Mock Streaming

engine.cjs and the bundled client.engine.js share the same source logic. Validation and evaluation are consistent between Host and Client to avoid drift. structured diagram is compiled on the Host, so what is saved in the session is the actual drawn graph.

For more detailed field descriptions, see docs/schema.md, docs/components.md, and docs/architecture.md in the repository.

Installation and Enablement

The plugin depends on build artifacts (client.engine.js, client.echarts.js, client.mermaid.js, etc., which are git-ignored in the repo). Without building, charts degrade to plain text summaries, and app cannot load the engine.

Build first in the plugin source directory:

pnpm install
node build-engine.mjs && node build-echarts.mjs && node build-mermaid.mjs

Then add it to your DSH Profile dependencies (local link: or GitHub URL are both acceptable). Example in the Profile’s package.json:

{
  "dependencies": { "dsh-intelligent-ui": "link:<absolute path>" },
  "dsh": { "profile": { "bundles": ["dsh-intelligent-ui"] } }
}

Insert the bundle in the Profile’s cordis.patch.yml:

- insert:
    - id: intelligent-ui
      name: 'dsh-intelligent-ui'

Then install in the Profile directory:

cd "$DSH_PROFILE_DIR"
pnpm install --no-frozen-lockfile

Note: The community directory page is beex-labs/dsh-smart-ui. Installation steps should follow the GitHub README; do not construct dsh plugin add commands not found in the documentation based on the repository name.

Typical Usage

  1. Guide the model in system prompts or tool descriptions: when structured display is needed, call ui_render with a payload of JSON conforming to the schema, and do not output markup.
  2. Static Answers: Choose a kind from the table above. For example, use compare for sales comparisons, chart for trends (series, variant, unit), and table for lists (columns, rows).
  3. Interactive Answers: Set kind to app, defining initial state, derived compute, and tree. When the user changes controls, KPIs, charts, and tables dependent on the same state update together.
  4. Learning and Debugging: The repository’s demos/ folder contains seven runnable app specs (travel planning, sales dashboard, compound interest simulation, Pythagorean theorem explanation, AA bill splitting, geography quiz, streaming load board, etc.). You can wrap file content in {"spec": {"kind": "app", …}} and pass it to ui_render, or paste it into the source field of playground to preview.

Example form for calculator (refer to docs/schema.md for fields):

{
  "kind": "calculator",
  "mode": "split",
  "fields": [
    { "label": "Total Amount", "value": 100 },
    { "label": "Number of People", "value": 4, "min": 1 }
  ]
}

Use Cases and Notes

Suitable for: Situations requiring stable presentation of comparison tables, charts, flowcharts, calculators, and unit conversions within DSH conversations; or when you need small dashboards, forms, map point selections, quiz cards, and other “change-and-link” interfaces, while hoping the specification is archivable and auditable.

Notes:

  • The plugin runs under the current DSH process permissions. Please review the source code and the MIT license yourself before installation to confirm that dependencies (such as echarts, mermaid) are acceptable.
  • You must complete build-engine / build-echarts / build-mermaid first, otherwise capabilities will be incomplete.
  • Whether app actions like call connect to a real backend depends on your configuration in the schema and Host environment. Some call functions in the repository demos will explicitly indicate they are not connected; do not mistake this for a built-in remote service.
  • The community directory skillhub.cn has no official affiliation with DeepSeek / High-Flyer. The DSH ecosystem emphasizes “everything is a plugin.” The facts in this article are derived from the aforementioned README and package.json.

Conclusion

dsh-smart-ui implements “model writes data, client renders” through a single toolchain: ui_render + JSON Schema, covering ten types of fixed cards and a composable app runtime. If you are building DSH agents and want to turn answers into readable interactive cards, you can learn more from the directory page, then build and attach it to your Profile following the GitHub README.

  • Directory Page: https://www.skillhub.cn/plugins/beex-labs/dsh-smart-ui
  • Source Code and Documentation: https://github.com/beex-labs/dsh-smart-ui
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye