@changfenhuang/dsh-genui 0.11.4 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +12 -4
- package/README.zh-CN.md +12 -4
- package/SKILL.md +2 -2
- package/lib/assets/mermaid.js +325 -325
- package/lib/assets/standalone-runtime.js +9 -9
- package/lib/client.js +30 -30
- package/lib/index.js +101 -14
- package/lib/types/client/dom-fence.d.ts +2 -1
- package/lib/types/client/file-address.d.ts +4 -0
- package/lib/types/client/file-link-context.d.ts +41 -0
- package/lib/types/client/file-link.d.ts +17 -0
- package/lib/types/client/i18n/en.d.ts +5 -1
- package/lib/types/client/inline.d.ts +1 -1
- package/lib/types/client/mermaid-colors.d.ts +2 -0
- package/lib/types/client/panel.d.ts +6 -1
- package/lib/types/plugin/fence-feedback.d.ts +6 -2
- package/lib/types/plugin/index.d.ts +4 -0
- package/lib/types/shared/fence-repair.d.ts +1 -0
- package/package.json +1 -12
- package/src/client/GenuiBlock.module.css +35 -3
- package/src/client/artifact/ArtifactExport.module.css +34 -3
- package/src/client/artifact/ExportableGenuiBlock.tsx +23 -2
- package/src/client/blocks/charts.tsx +22 -6
- package/src/client/blocks/render-node.tsx +10 -7
- package/src/client/dom-fence.tsx +97 -30
- package/src/client/file-address.ts +37 -0
- package/src/client/file-link-context.tsx +114 -0
- package/src/client/file-link.ts +46 -0
- package/src/client/guard.ts +5 -2
- package/src/client/i18n/en.ts +5 -1
- package/src/client/i18n/zh.ts +5 -1
- package/src/client/index.tsx +23 -5
- package/src/client/inline.ts +17 -6
- package/src/client/mermaid-colors.ts +39 -0
- package/src/client/mermaid-core.ts +7 -3
- package/src/client/panel.tsx +18 -5
- package/src/plugin/fence-feedback.ts +17 -5
- package/src/plugin/index.ts +14 -4
- package/src/plugin/tool.ts +8 -2
- package/src/shared/fence-repair.ts +36 -0
- package/tsdown.config.ts +3 -7
- package/lib/invariant.js +0 -19
- package/lib/types/plugin/invariant.d.ts +0 -15
- package/src/plugin/invariant.ts +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.12.0] - 2026-10-13
|
|
6
|
+
|
|
7
|
+
### 新增
|
|
8
|
+
|
|
9
|
+
- GenUI 正文、表格、工具卡片和会话面板支持本地文件链接,点击后在宿主右侧栏打开文件并定位到指定行;支持工作区相对路径和 Windows 路径(#273、PR #278)。
|
|
10
|
+
- 增加默认开启的 `renderUiTool` 配置。设为 `false` 时只关闭 `render_ui` 工具及相关模型指引,发前校验、正文围栏和会话面板继续可用(#276、PR #281)。
|
|
11
|
+
|
|
12
|
+
### 修复
|
|
13
|
+
|
|
14
|
+
- JSON 对象中无值的字段名紧接正常字段时,围栏修复只移除无值字段,保留后续内容;浏览器渲染与发前校验共用这一修复,避免将两个字段名拼接后丢失卡片正文(#290、#291)。
|
|
15
|
+
- 宿主隐藏 `dsh-ui` 语言、同时改变代码块包装类名时,DOM 通道现可通过宿主的代码内容语义标记定位包装节点,继续从原始消息识别围栏;不再因漏扫描而留下裸 JSON,正文和明确声明为普通代码的围栏保持原样(#275)。
|
|
16
|
+
- 缺少结束标记的 `dsh-ui` 围栏若正文已经可以渲染(包括尾部工具残片或可修复的 JSON),不再要求模型重发同一张卡片;一条回复中只有无法渲染的围栏会进入纠错(#288)。
|
|
17
|
+
- 修复单行表格中的行内代码导致文字越过列边界的问题,同时保留连续空格;需要更宽空间的表格通过容器横向滚动显示(#280)。
|
|
18
|
+
- 表格页脚单元格中的行内代码同样沿用「表格内 chip 不重新开启断行」的规则;浏览器回归夹具补上宿主 `.markdown` 级联(`overflow-wrap: anywhere` 与 `:not(pre) > code` 的 `inline-flex`),让跨列溢出在夹具中可复现,并把重叠检查从首列相邻对扩展到所有相邻列对(#285)。
|
|
19
|
+
- 发前校验遇到原生组件的未知字段时,返回结构化字段路径并要求修改后重验,不再指示直接发送围栏;JSON 已修复的路径同样执行这一判定(#275 追加反馈)。
|
|
20
|
+
- 图表主题色先解析为实际 RGB/RGBA,修复第三方皮肤中 `calc()` 等颜色表达式导致 Mermaid 渲染失败的问题(PR #279)。
|
|
21
|
+
- DOM 围栏扫描遇到已失效的 Cordis Context 时,会保留已挂载的流式围栏和组件状态,并在 Context 恢复后继续解析(#280)。
|
|
22
|
+
|
|
23
|
+
### 兼容性
|
|
24
|
+
|
|
25
|
+
- 将 DSH 当前宿主与下一测试版的接口、打包安装和发布验证目标更新为 `0.2.0-rc.2` 与 `0.2.1-alpha.1`。
|
|
26
|
+
- 移除 DSH 已废弃的运行时诊断配套入口 `./invariant`、对应构建产物与 `@deepseek-ai/dsh-invariants` 直接依赖。
|
|
27
|
+
- 对应宿主版本的公开依赖检查加入技能注册、插件重载和持久化纠错恢复测试;会话样本补齐新版要求的消息记录字段。
|
|
28
|
+
|
|
29
|
+
### 变更
|
|
30
|
+
|
|
31
|
+
- 完成态 GenUI 的导出入口改为无边框图标,沿用既有图标按钮的悬浮与聚焦反馈;保留“导出”提示和 HTML / GenUI JSON 菜单,并补齐第三方主题中的悬浮反馈(#274、PR #277)。
|
|
32
|
+
|
|
5
33
|
## [0.11.4] - 2026-10-08
|
|
6
34
|
|
|
7
35
|
### 修复
|
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ The repository ships both renderer channels, the host plugin, and the built brow
|
|
|
96
96
|
|
|
97
97
|
Prerequisites — all required:
|
|
98
98
|
|
|
99
|
-
1. **dsh `^0.1.2-rc.1 || ^0.1.5-alpha.1 || ^0.1.6-alpha.1 || ^0.1.7-alpha.1 || >=0.2.0-rc.1 <0.3.0-0`** (DSH `0.2.
|
|
99
|
+
1. **dsh `^0.1.2-rc.1 || ^0.1.5-alpha.1 || ^0.1.6-alpha.1 || ^0.1.7-alpha.1 || >=0.2.0-rc.1 <0.3.0-0`** (DSH `0.2.1-alpha.1` is currently a prerelease; verified host roles: minimum `dsh-v0.1.2-rc.1`, current `dsh-v0.2.0-rc.2`, next `dsh-v0.2.1-alpha.1`; users on DSH `<=0.1.1-rc.x` should use dsh-genui `0.9.8`)
|
|
100
100
|
2. **`pnpm` on your PATH**: the `dsh plugin` command depends on it. If missing: `corepack enable` (or `npm i -g pnpm`), then **open a new terminal** and confirm `pnpm -v` prints a version
|
|
101
101
|
|
|
102
102
|
Install and activate in DSH (one command, all dependencies included):
|
|
@@ -177,7 +177,15 @@ The following is the detailed capability reference. Every behavior is constraine
|
|
|
177
177
|
- **Local-first principle**: state changes the UI can do itself (grading, quiz checking, resets, expand/collapse, selection) always happen locally and instantly; actions are reserved for things that genuinely need the model (generating new content, running tools, next-step suggestions)
|
|
178
178
|
- **Honest interactions**: interactive components must carry `action`; buttons without one render disabled (kills the "looks clickable, does nothing" fake button); buttons with `action` show instant "triggered" local feedback (proof the local event fired, not that the model received it)
|
|
179
179
|
- **Event loop**: buttons, checkboxes, radio buttons, switches, selects, inputs, textareas, submits, and quizzes send one event immediately per gesture; slider drags keep trailing-edge debounce, sending only the final value per slider, with different `id`s handled independently
|
|
180
|
-
- **Tool channel**:
|
|
180
|
+
- **Tool channel**: `render_ui` is registered by default and renders the same spec as a card in the tool row; `validate_dsh_ui` remains available. Set `renderUiTool: false` in this plugin's config to stop registering `render_ui`. The `dsh-ui` fence, `panel: true`, `/panel`, and historical `render_ui` results in the client tool view continue to work. Reload the host plugin after changing this setting.
|
|
181
|
+
- **Disable the `render_ui` tool**: add `renderUiTool: false` under this plugin's `config:` in your profile:
|
|
182
|
+
|
|
183
|
+
```yaml
|
|
184
|
+
- id: genui
|
|
185
|
+
name: '@changfenhuang/dsh-genui'
|
|
186
|
+
config:
|
|
187
|
+
renderUiTool: false
|
|
188
|
+
```
|
|
181
189
|
- **Session panel**: a persistent dock above the composer; `render_ui` / `panel: true` fences update the same surface in place; `/panel` opens it from the client (`/panel <instruction>` customizes via the model, `/panel clear` clears); the top border is draggable to resize; `append: true` merges incrementally — same-named tabs append content, new tabs get added; the whole panel caps at 200 nodes / 200 appends, after which the model should send `replace` to rebuild
|
|
182
190
|
- **Fence auto-repair**: enabled by default; set `fenceFeedback: false` in this plugin's config (under the plugin entry's `config:` in your profile's cordis.patch.yml) to disable same-turn fence corrections. A validated GenUI turn that ends with reasoning only still becomes `EMPTY_RESPONSE` and uses the host's retry policy. When a reply's final dsh-ui fence fails to render, the plugin steers the SAME turn with the per-node diagnosis so the model can resend a fixed fence. At most two corrections are sent per turn, shared by render failures and validated turns with no formal delivery; each fence fingerprint is corrected once per turn, and a nothing-delivered reminder is sent once per turn. A new turn can correct the same failed fence again. Plugin reload restores the current turn's fence fingerprints and correction count, along with delivery reminders, from persisted correction messages. Corrections are never sent in subagent sessions.
|
|
183
191
|
- **Self-healing & limits**: every fence passes a spec guard — bad nodes are silently dropped (the surviving siblings keep rendering: one bad component no longer degrades the whole fence), numbers clamped, strings truncated; the whole tree is capped at 200 nodes / 8 nesting levels; pathological specs never crash the UI
|
|
@@ -246,9 +254,9 @@ pnpm run check # type check + full tests + build
|
|
|
246
254
|
|
|
247
255
|
With the locked dependencies installed, the check script (`pnpm run check` or `npm run check`) uses the pinned DSH `0.1.2-rc.1` release packages.
|
|
248
256
|
|
|
249
|
-
The verified host roles are minimum `dsh-v0.1.2-rc.1`, current `dsh-v0.
|
|
257
|
+
The verified host roles are minimum `dsh-v0.1.2-rc.1`, current `dsh-v0.2.0-rc.2`, and next `dsh-v0.2.1-alpha.1`. DSH `0.2.1-alpha.1` is currently a prerelease. CI keeps four primary lanes: Node 22 + current, and Node 24 + minimum/current/next. Replace these pinned tags as DSH publishes newer versions.
|
|
250
258
|
|
|
251
|
-
`pnpm run check:host-api dsh-v0.
|
|
259
|
+
`pnpm run check:host-api dsh-v0.2.0-rc.2` and `pnpm run check:host-api dsh-v0.2.1-alpha.1` install the corresponding published DSH packages and run TypeScript typecheck, plugin lifecycle tests (including skill registration and persisted feedback recovery), and tsdown build. Each CI host lane then installs the generated tarball in its pinned DSH host and runs the packed smoke.
|
|
252
260
|
|
|
253
261
|
Run `node scripts/verify-pack.mjs --keep` to retain the verified tarball for inspection or e2e use. The default `node scripts/verify-pack.mjs` removes its temporary directory after verification.
|
|
254
262
|
|
package/README.zh-CN.md
CHANGED
|
@@ -96,7 +96,7 @@ CI 的 packed host smoke 会把实际生成的 npm tarball 安装到真实 DSH
|
|
|
96
96
|
|
|
97
97
|
前置条件,缺一不可:
|
|
98
98
|
|
|
99
|
-
1. **dsh `^0.1.2-rc.1 || ^0.1.5-alpha.1 || ^0.1.6-alpha.1 || ^0.1.7-alpha.1 || >=0.2.0-rc.1 <0.3.0-0`**(DSH `0.2.
|
|
99
|
+
1. **dsh `^0.1.2-rc.1 || ^0.1.5-alpha.1 || ^0.1.6-alpha.1 || ^0.1.7-alpha.1 || >=0.2.0-rc.1 <0.3.0-0`**(DSH `0.2.1-alpha.1` 当前属于预发布版本;已验证宿主角色:minimum `dsh-v0.1.2-rc.1`、current `dsh-v0.2.0-rc.2`、next `dsh-v0.2.1-alpha.1`;使用 DSH `<=0.1.1-rc.x` 的用户请使用 dsh-genui `0.9.8`)
|
|
100
100
|
2. **`pnpm` 在 PATH 上**:`dsh plugin` 命令依赖它。没有就 `corepack enable`(或 `npm i -g pnpm`),然后**新开一个终端**,确认 `pnpm -v` 有输出
|
|
101
101
|
|
|
102
102
|
安装并在 DSH 中激活(一行命令,自动带上全部依赖):
|
|
@@ -177,7 +177,15 @@ dsh plugin --profile web add link:$PWD
|
|
|
177
177
|
- **本地优先原则**:UI 自己能完成的状态变化(判卷、判题、重置、展开、选中)一律本地即时完成;action 只用于必须模型参与的事(生成新内容、执行工具、下一步建议)
|
|
178
178
|
- **诚实交互**:交互组件必须带 `action`;不带 `action` 的按钮渲染为禁用态(消灭"看着能点、点了没反应"的假按钮);带 `action` 的按钮点击后立即显示「已触发」本地反馈(只证明本地事件已触发,不代表模型已收到)
|
|
179
179
|
- **事件循环**:按钮、复选框、单选、开关、下拉、输入、文本域、提交和测验等离散交互按一次手势一次事件立即回传模型;`slider` 连续拖动保留尾沿防抖,同一滑块只回传最终值,不同 `id` 的滑块互不合并。
|
|
180
|
-
-
|
|
180
|
+
- **工具通道**:默认注册 `render_ui`,并将同一份 spec 渲染成工具行卡片;`validate_dsh_ui` 始终可用。在本插件的 `config:` 中设置 `renderUiTool: false` 后,宿主不再注册 `render_ui`。正文 `dsh-ui` 围栏、`panel: true`、`/panel` 和客户端工具视图中的历史 `render_ui` 结果仍可使用。修改此设置后需要让宿主重新加载插件。
|
|
181
|
+
- **关闭 `render_ui` 工具**:在用户 profile 中本插件条目的 `config:` 下添加:
|
|
182
|
+
|
|
183
|
+
```yaml
|
|
184
|
+
- id: genui
|
|
185
|
+
name: '@changfenhuang/dsh-genui'
|
|
186
|
+
config:
|
|
187
|
+
renderUiTool: false
|
|
188
|
+
```
|
|
181
189
|
- **会话面板**:composer 上方常驻 dock,`render_ui` / `panel: true` 围栏原地更新同一块界面;`/panel` 命令客户端直开(`/panel <指令>` 转模型定制、`/panel clear` 清空);顶边框可拖拽调高;`append: true` 增量合并——同名标签页追加内容、新标签页新增;整面板默认最多 200 节点 / 200 条追加,达到上限后模型应发送 `replace` 重建
|
|
182
190
|
- **围栏自修**:默认开启;在 profile 的 cordis.patch.yml 中本插件条目的 `config:` 下设置 `fenceFeedback: false` 可以关闭同回合围栏修正。已调用 `validate_dsh_ui` 的 GenUI 回合若只输出 reasoning 并以 `stop` 结束,仍会转换为 `EMPTY_RESPONSE`,交给宿主重试策略处理。回答最终的 dsh-ui 围栏无法渲染时,插件借宿主的轮内转向(steer)把逐节点诊断送回**同一轮**,模型重发修好的围栏。每个 turn 最多发送两条 correction,渲染失败与“已验证但没有正式交付”共用该上限;同一 turn 内相同围栏 fingerprint 只修正一次,新 turn 可以重新修正相同错误;同一 turn 的零交付提醒只发送一次。plugin reload 后会从持久化的 correction message 恢复当前 turn 的围栏去重记录、已消费的 correction 次数以及零交付提醒记录。子代理回合不会收到围栏修正。
|
|
183
191
|
- **自愈与上限**:每个围栏过规格守卫——坏节点静默丢弃(同围栏其余组件照常渲染,单个坏组件不再拖垮整条围栏)、数值钳位、字符串截断,整树 ≤200 节点 / 8 层嵌套,病态 spec 不会拖垮界面
|
|
@@ -260,9 +268,9 @@ pnpm run check # 类型检查 + 全量测试 + 构建
|
|
|
260
268
|
|
|
261
269
|
安装锁定依赖后,检查脚本(`pnpm run check` 或 `npm run check`)使用固定的 DSH `0.1.2-rc.1` 发布包。
|
|
262
270
|
|
|
263
|
-
已验证宿主角色为 minimum `dsh-v0.1.2-rc.1`、current `dsh-v0.
|
|
271
|
+
已验证宿主角色为 minimum `dsh-v0.1.2-rc.1`、current `dsh-v0.2.0-rc.2`、next `dsh-v0.2.1-alpha.1`。DSH `0.2.1-alpha.1` 当前属于预发布版本。CI 保持四条主要 lane:Node 22 + current,以及 Node 24 + minimum/current/next。DSH 发布新版本后,替换对应固定标签。
|
|
264
272
|
|
|
265
|
-
`pnpm run check:host-api dsh-v0.
|
|
273
|
+
`pnpm run check:host-api dsh-v0.2.0-rc.2` 与 `pnpm run check:host-api dsh-v0.2.1-alpha.1` 会安装对应 DSH 发布包,运行 TypeScript 类型检查、插件生命周期测试(包括技能注册与持久化纠错恢复)和 tsdown 构建。每条 CI 宿主 lane 随后会把生成的 tarball 安装到固定版本的 DSH 宿主并运行 packed smoke。
|
|
266
274
|
|
|
267
275
|
运行 `node scripts/verify-pack.mjs --keep` 可保留已验收的 tarball,便于检查或运行 e2e;默认的 `node scripts/verify-pack.mjs` 会在验收后清理临时目录。
|
|
268
276
|
|
package/SKILL.md
CHANGED
|
@@ -131,10 +131,10 @@ description: "Render structured interactive UI inline through the dsh-ui fence.
|
|
|
131
131
|
| `` `code` `` | 行内代码胶囊 |
|
|
132
132
|
| `**加粗**` | 强调(不换行、不成块) |
|
|
133
133
|
| `==高亮==` | 极淡底色标记 |
|
|
134
|
-
| `[文字](https://…)` | 行内链接(http/https/mailto
|
|
134
|
+
| `[文字](https://…)` | 行内链接(http/https/mailto;围栏会话中的本地文件链接支持右侧栏打开与行号定位;无效目标及独立 HTML artifact 中的本地文件链接显示为普通文字) |
|
|
135
135
|
| JSON `"\n"`(真实换行符) | 换行——**多段文字写同一个字段**,不要为换行拆成多个节点 |
|
|
136
136
|
|
|
137
|
-
不嵌套、不解析 HTML(每个标记生成 React 元素,不走 innerHTML;`<br>` 字面显示,换行用 `"\n"
|
|
137
|
+
不嵌套、不解析 HTML(每个标记生成 React 元素,不走 innerHTML;`<br>` 字面显示,换行用 `"\n"`);标记没闭合时原样显示。表格文本、`badge`、`delta` 单元格只识别本地文件链接,外部链接与无效目标显示为普通文字;`bar`、`spark`、`ring`、`index` 等专用数值单元格保持原有展示。
|
|
138
138
|
|
|
139
139
|
文字字段只支持行内富文本。`text.content`、`callout.content`、`list` 项、`keyvalue` 值、`table` 单元格等字段中不要嵌入 Markdown 表格或连续三个及以上反引号、波浪号组成的代码围栏;表格使用 `table`,代码使用 `code`,代码改动使用 `diff`,结构化 JSON 使用 `json`。误写入文字字段的代码围栏连同内部标记保持原文,未闭合时从围栏标记开始保持原文。`validate_dsh_ui` 返回 `warning=block_markdown` 时,按照 `replacement` 改写结构节点并重新验证。
|
|
140
140
|
|