Preface¶
In DeepSeek Harness (DSH), models often spit out parallel parameters, step comparisons, tables, or chart descriptions all at once, forcing readers to scan long paragraphs and mentally reconstruct the information themselves. The idea behind Generative UI is: have the model write a declarative spec, and the client renders it into cards according to the spec. Dragging and switching happen locally in the browser, and only when the user clicks submit are the results sent back to the model as a regular message. an-an-618/dsh-intelligent-ui is a client plugin for DSH: the Host compiles the spec into a pure JSON program, the Client renders it with an interpreter that does not execute model code, and hooks into toolview and turnTail via presentationMeta. Below we introduce what problems it solves, how to install it, and how to use it.
What Is This¶
Maintainer an-an-618, categorized as Client. One-sentence positioning (README): the model writes a declarative spec, the Host compiles it into a JSON program, the Client interpreter maintains state locally and renders interactive cards; it only returns on explicit submission, and local operations do not consume tokens.
The architecture borrows the layering of the community implementation @comeonzhj/dsh-intelligent-ui (declarative spec, host compilation, presentationMeta, toolview + turnTail, local interaction, explicit submission), but starting from v4 it executes no JavaScript generated by the model, and only interprets the pure data program compiled by the Host.
Current package version 6.5.0 (package.json), license MIT, requires DSH >=0.2.1-rc.2.
Core Features¶
Two Tools¶
| Tool | Purpose | Submit |
|---|---|---|
render_ui |
Delivery card: information, tables, charts, parameter previews; the card itself is the answer, stop after calling | No submit button; sliders/switches only drive in-card display |
ask_with_ui |
Question card: needs confirmation, selection, or parameter input, and returns results to the model | One submit button at the bottom, can carry an optional note |
Both accept a spec object, or a compact JSON text source (pick one). source suits long cards: during the streaming phase, the tool line first shows a read-only preview, and controls appear gradually; after settling, turnTail renders the complete interactive card, and the compiled output matches object mode.
What is returned to the model on submission is a regular user message, for example:
[Intelligent UI] Team plan estimate
- seats: 10
- yearly: on
note: 4 月开始,需要发票
What the spec Can Express¶
spec.controls is a recursive node tree, with containers up to 4 levels deep and 120 nodes per card. Layouts include section, box, row, columns, grid, tabs, list, etc.; displays include headings, tables, key-value pairs, step bars, code blocks, mini line charts, images, etc.; interactions include sliders, switches, dropdowns, inputs, ratings, choice, etc.; charts support bar, line, area, pie, donut, scatter, heatmap, and some charts with an id allow clicking a category and submitting.
Expressions are written as {= expression } (the old syntax {{ }} is still accepted by the compiler, but double braces must not appear in the system prompt, otherwise DSH will treat them as template variables and fail every turn). For control and field limits, see the repository’s CONTRACT.md and the Host system prompt section.
The system prompt defaults to cards-first: whenever the answer contains parallel information, parameters, steps, comparisons, data, tables, charts, code, or adjustable choices, prefer cards; leave plain text for one-sentence facts and chitchat. Can be changed to balanced mode via configuration (see below).
Host and Client Division of Labor¶
| File | Role |
|---|---|
index.js |
Host: register tools, compile spec, attach system prompt |
client.js |
Browser half: interpret program, local state, submit, turnTail |
lib/compile.js etc. |
Compilation, expression AST (no eval), control catalog and validation |
Installation and Activation¶
Plugins run with the permissions of the current DSH process; before installing, it is recommended to browse the GitHub repository source code and MIT license. The DSH ecosystem is “everything is a plugin”; community sites like the SkillHub catalog page have no official affiliation with DeepSeek / High-Flyer, and index sources need to be added by yourself.
Install from the Plugin Market (Recommended)¶
- Open “Plugins → Discover”, and add the following to the index sources:
https://cdn.jsdelivr.net/gh/an-an-618/dsh-intelligent-ui@main/market/index.json
- Search for
Intelligent UIor “智能界面”, then restart DSH after installation. The index points to a pinned commit, making installation reproducible.
Direct Installation (Pinned commit)¶
plugin_manager(action: "install_bundle", target: "git+https://github.com/an-an-618/dsh-intelligent-ui.git#289674809a88fbd347f0e3c2f0c12f3b8b3ae807")
Restart DSH after installation to take effect.
Install from a Local Directory (Development)¶
plugin_manager(action: "install_bundle", target: "/absolute/path/to/intelligent-ui")
Developers can run a self-check before installing into desktop, and try a round in an isolated profile or a new session to confirm there is no turn/end error:
node scripts/check.mjs
To remove the bundle:
plugin_manager(action: "remove_bundle", target: "@an-an-618/dsh-intelligent-ui")
Configuration¶
Common items in cordis.patch.yml:
| Setting | Default | Description |
|---|---|---|
prompt |
true |
Whether to attach spec instructions to the system prompt |
language |
zh |
Language for tool descriptions and ask default buttons (zh / en) |
outputPolicy |
cards-first |
cards-first: cards whenever possible; balanced: prefers cards only for structured answers |
imageHosts |
[] |
Image host whitelist; empty means no host restriction |
allowHttpImages |
false |
Only https:// images by default; private addresses are always rejected |
Changing outputPolicy requires reloading the plugin (remove and reinstall, or restart DSH). If the environment provides a Settings service, you can toggle “Cards-first / Balanced mode” on the Plugins → Intelligent UI page and save it to the profile patch.
Typical Usage¶
Start with a delivery card with local computation: the model calls render_ui and passes a spec with the following structure (excerpt from the README):
{
"spec": {
"title": "Team plan estimate",
"description": "每月约 ${= seats * 29 },按年付 ${= seats * 29 * 12 }/年",
"state": { "seats": 8, "yearly": true },
"controls": [
{ "kind": "heading", "text": "席位与周期" },
{ "kind": "slider", "id": "seats", "label": "席位数", "min": 1, "max": 50, "step": 1 },
{ "kind": "switch", "id": "yearly", "label": "按年付费" },
{ "kind": "stat", "label": "预计月费", "value": "${= seats * 29 }", "hint": "不含税" },
{ "kind": "chart", "chart": "bar", "categories": ["Q1", "Q2", "Q3", "Q4"],
"series": [{ "name": "收入", "values": [12, 18, "{= seats * 2}", "{= seats * 3}"] }], "height": 180 }
]
}
}
When user confirmation of parameters and returning them to the model are needed, switch to ask_with_ui, and add "required": true to interactive controls; before submission, currently visible required items are validated, and if not satisfied the message is not sent and a hint appears next to the field.
Nested layout example (section / row / columns):
{
"kind": "section",
"title": "季度概览",
"children": [
{ "kind": "row", "children": [
{ "kind": "stat", "label": "收入", "value": "$12,480" },
{ "kind": "badge", "text": "**+12%**", "tone": "success" }
] },
{ "kind": "columns", "columns": [
{ "children": [{ "kind": "chart", "chart": "area", "categories": ["Q1","Q2","Q3"], "series": [{ "values": [12, 18, 24] }] }] },
{ "children": [{ "kind": "keyValue", "items": [{ "label": "客户", "value": "Acme" }] }] }
] }
]
}
After the steps above, within the same turn of conversation, the card can carry subjects, difficulty, options, and a start button; selection happens locally, and after submission the conversation continues as a regular user message.
Use Cases and Notes¶
Suitable for developers and users who want to turn structured answers into scannable, fine-tunable interfaces within DSH conversations, without burning extra tokens on every interaction. render_ui is for display and preview; when you need to return selections or parameters, you must use ask_with_ui.
Known limitations (README):
- The tool call line only shows a summary; the complete interactive card appears at the end of the turn via turnTail. For follow-ups, use the card itself or
ask_with_ui. - Card drafts are stored in the current tab’s
sessionStorageand restored on refresh; they are not kept across sessions, tab closures, or after successful submission. - Expressions support only arithmetic, comparison, logical, ternary operations, and one-level
item.fieldattributes; no functions, loops, or array indexing. - Streaming preview is read-only: controls are disabled, no submit, no required validation; complete interaction waits for the final card.
- No HTML, raw CSS, or event callbacks; images and links only via http/https.
Development and regression can be run with zero dependencies:
node test/host.test.mjs
node test/client.test.mjs
Conclusion¶
dsh-intelligent-ui splits “a paragraph of text” into “text + declarative cards”: the Host compiles, the Client interprets locally, and only explicit submission returns to the model. Install via the market index or a plugin_manager pinned commit; behavior and policies are adjustable in cordis.patch.yml and the plugin settings page.
- Catalog page: https://www.skillhub.cn/plugins/an-an-618/dsh-intelligent-ui
- Source code and documentation: https://github.com/an-an-618/dsh-intelligent-ui