@sparkelf/dsh-genui 0.11.4-patch.2 → 0.13.0-sparkelf.3

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/ICON-NAMES.md +30 -0
  3. package/README.md +26 -28
  4. package/README.zh-CN.md +26 -28
  5. package/SKILL.md +128 -19
  6. package/THIRD_PARTY_NOTICES.md +42 -0
  7. package/assets/genui-icon.svg +20 -0
  8. package/assets/genui-logo.svg +18 -0
  9. package/lib/assets/icons.js +1 -0
  10. package/lib/assets/mermaid.js +325 -325
  11. package/lib/assets/standalone-runtime.js +10 -9
  12. package/lib/client.js +32 -31
  13. package/lib/index.js +523 -80
  14. package/lib/types/client/action-context.d.ts +1 -1
  15. package/lib/types/client/artifact/types.d.ts +1 -1
  16. package/lib/types/client/asset-loader.d.ts +2 -2
  17. package/lib/types/client/blocks/blocks.d.ts +12 -0
  18. package/lib/types/client/blocks/icon.d.ts +4 -0
  19. package/lib/types/client/dom-fence.d.ts +2 -1
  20. package/lib/types/client/fence-render.d.ts +5 -21
  21. package/lib/types/client/file-address.d.ts +4 -0
  22. package/lib/types/client/file-link-context.d.ts +49 -0
  23. package/lib/types/client/file-link.d.ts +17 -0
  24. package/lib/types/client/gallery.d.ts +8 -2
  25. package/lib/types/client/genui-runtime/diagnostics.d.ts +1 -1
  26. package/lib/types/client/genui-runtime/limits.d.ts +4 -0
  27. package/lib/types/client/genui-runtime/schema.d.ts +14 -1
  28. package/lib/types/client/guard.d.ts +4 -1
  29. package/lib/types/client/i18n/en.d.ts +5 -1
  30. package/lib/types/client/i18n/index.d.ts +1 -1
  31. package/lib/types/client/icons/asset-icons.d.ts +1 -0
  32. package/lib/types/client/icons/icon-data-full.d.ts +23 -0
  33. package/lib/types/client/icons/icon-data.d.ts +24 -0
  34. package/lib/types/client/icons/icon-lazy.d.ts +18 -0
  35. package/lib/types/client/icons/icon-names-full.d.ts +12 -0
  36. package/lib/types/client/index.d.ts +5 -15
  37. package/lib/types/client/inline.d.ts +1 -1
  38. package/lib/types/client/mermaid-colors.d.ts +2 -0
  39. package/lib/types/client/mermaid-core.d.ts +2 -1
  40. package/lib/types/client/mermaid-lazy.d.ts +5 -1
  41. package/lib/types/client/panel-command.d.ts +21 -1
  42. package/lib/types/client/panel.d.ts +6 -1
  43. package/lib/types/client/primitive-adapter.d.ts +0 -2
  44. package/lib/types/client/session-resolver.d.ts +13 -2
  45. package/lib/types/client/source-fence.d.ts +1 -1
  46. package/lib/types/client/spec.d.ts +127 -3
  47. package/lib/types/client/standalone/asset-loader.d.ts +1 -1
  48. package/lib/types/client/standalone/primitive-adapter.d.ts +0 -4
  49. package/lib/types/plugin/fence-feedback.d.ts +11 -7
  50. package/lib/types/plugin/index.d.ts +6 -2
  51. package/lib/types/shared/fence-language.d.ts +14 -0
  52. package/lib/types/shared/fence-repair.d.ts +2 -1
  53. package/lib/types/shared/fence-resolve.d.ts +1 -1
  54. package/package.json +92 -83
  55. package/src/client/EChartNode.tsx +17 -3
  56. package/src/client/GenuiBlock.module.css +411 -76
  57. package/src/client/action-context.ts +5 -15
  58. package/src/client/artifact/ArtifactExport.module.css +34 -3
  59. package/src/client/artifact/ExportableGenuiBlock.tsx +23 -2
  60. package/src/client/artifact/portability.ts +6 -1
  61. package/src/client/artifact/types.ts +1 -1
  62. package/src/client/asset-loader.ts +3 -3
  63. package/src/client/blocks/advanced.tsx +101 -14
  64. package/src/client/blocks/blocks.tsx +143 -0
  65. package/src/client/blocks/charts.tsx +22 -6
  66. package/src/client/blocks/icon.tsx +93 -0
  67. package/src/client/blocks/image.tsx +1 -0
  68. package/src/client/blocks/render-node.tsx +84 -52
  69. package/src/client/dom-fence.tsx +546 -72
  70. package/src/client/fence-render.tsx +5 -21
  71. package/src/client/file-address.ts +37 -0
  72. package/src/client/file-link-context.tsx +116 -0
  73. package/src/client/file-link.ts +46 -0
  74. package/src/client/gallery.ts +161 -133
  75. package/src/client/genui-runtime/diagnostics.ts +1 -1
  76. package/src/client/genui-runtime/limits.ts +4 -0
  77. package/src/client/genui-runtime/normalize.ts +42 -6
  78. package/src/client/genui-runtime/schema.ts +39 -7
  79. package/src/client/guard.ts +170 -15
  80. package/src/client/i18n/en.ts +5 -1
  81. package/src/client/i18n/index.ts +1 -1
  82. package/src/client/i18n/zh.ts +5 -1
  83. package/src/client/icons/asset-icons.ts +16 -0
  84. package/src/client/icons/icon-data-full.ts +5715 -0
  85. package/src/client/icons/icon-data.ts +507 -0
  86. package/src/client/icons/icon-lazy.ts +80 -0
  87. package/src/client/icons/icon-names-full.ts +12 -0
  88. package/src/client/index.tsx +27 -51
  89. package/src/client/inline.ts +17 -6
  90. package/src/client/mermaid-colors.ts +40 -0
  91. package/src/client/mermaid-core.ts +69 -61
  92. package/src/client/mermaid-lazy.ts +99 -4
  93. package/src/client/panel-command.ts +16 -2
  94. package/src/client/panel.tsx +18 -5
  95. package/src/client/parse-partial.ts +6 -1
  96. package/src/client/primitive-adapter.ts +0 -11
  97. package/src/client/session-resolver.ts +12 -21
  98. package/src/client/source-fence.ts +4 -2
  99. package/src/client/spec.ts +149 -2
  100. package/src/client/standalone/asset-loader.ts +1 -1
  101. package/src/client/standalone/primitive-adapter.tsx +1 -9
  102. package/src/client/table-details.ts +4 -3
  103. package/src/plugin/fence-feedback.ts +60 -14
  104. package/src/plugin/index.ts +45 -20
  105. package/src/plugin/tool.ts +11 -2
  106. package/src/shared/fence-language.ts +30 -0
  107. package/src/shared/fence-repair.ts +37 -1
  108. package/src/shared/fence-resolve.ts +1 -1
  109. package/tsdown.config.ts +7 -8
  110. package/lib/invariant.js +0 -19
  111. package/lib/types/plugin/invariant.d.ts +0 -15
  112. package/src/plugin/invariant.ts +0 -30
package/CHANGELOG.md CHANGED
@@ -2,6 +2,82 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ### 新增
6
+
7
+ - 新增 `icon` 节点:内置 OpenAI Apps SDK UI 的 749 个可忠实渲染字形(MIT,见 `THIRD_PARTY_NOTICES.md`),其中 64 个随客户端内联,其余 685 个首次使用时经 `lib/assets/icons.js` 一次性载入;未知名字降级为中性圆点,不触发下载。生成器直接解析固定上游 TSX,保留真实几何、显式填色与根级描边继承;无法忠实渲染的 6 个字形(分组 / clipPath)被明确剔除并在生成日志中列出,不再静默过滤。
8
+ - 新增 `blocks` 节点:按行分组的色块图,覆盖阶梯(8→4→2→1)、等分块与泳道三种形态。支持 `columns` 固定列数、行级 `variant`(`fill` / `outline` / `plain`)、单元格 `tone` / `color` / `sub`;格子是数据而非节点,64 格仍只占 1 个节点预算。
9
+ - 新增 `arrow` 节点:细线连接件(`dir` / `length` / `label`),替代此前只能用文字「↓」表达流程的做法。
10
+ - 新增排版字段:`card.flat`(去阴影的图内面板)、`text.tone`(语义色文字)、`text.mono`(等宽文字,无行内代码底色)、`col.width`(按百分比占行宽)、`row.justify`(主轴对齐)。
11
+ - `SKILL.md` 新增「阶段图」编排范式;图标名清单拆到 `ICON-NAMES.md`,按需 grep,不再随 SKILL 全量加载。
12
+
13
+ ### 变更
14
+
15
+ - 语义底纹浓度由 8% 调整为 12%(深色主题 18%):8% 在白色画布上的明度差不足 3%,badge、callout、card tone 与新图标底板都会退化为纯白。新增 `--dsl-g-tint-quiet` 保留旧的 8% 档位。
16
+
17
+ ### 修复
18
+
19
+ - Mermaid 使用实际图表卡片的主题色并保留原有透明度;卡片局部配色及主题样式表更新后,已渲染的图表会同步刷新,避免沿用全局或旧的不透明底色(#328)。
20
+ - 修复 `repairGenuiSpec` 重建节点时丢弃 `row.justify` 的问题:repair 维护着第二份手写字段表,新增字段必须在 `src/client/guard.ts` 同步登记。
21
+ - 独立导出(artifact / standalone)的资源枚举补上 `icons`,避免离线 HTML 中的非内联字形退化为圆点。
22
+ - 色块图中的 RGB/HSL 等不透明底色使用对比度合适的文字颜色,避免深色主题下白底白字。
23
+
24
+ ### 兼容性
25
+
26
+ - 将当前 DSH 的 CI 与发布验证目标更新为 `0.2.1-rc.2`,保留 `0.2.0-rc.1` 最低版本验证;现有版本范围已包含 rc.2,无需放宽依赖约束(#337)。
27
+
28
+ ## [0.13.0] - 2026-10-17
29
+
30
+ ### 新增
31
+
32
+ - `divider.label` 支持章节分隔;新增 `text.size: "display"`、`text.align`、`card.eyebrow` 和 `image.caption` 字段。
33
+ - 完成六类 SKILL 界面编排示例,重组组件画廊,并更新 README 展示截图与 GitHub Pages 选集页。
34
+ - 设计系统 v11 补充字号、间距、动效和交互状态令牌。
35
+
36
+ ### 性能与修复
37
+
38
+ - DOM 围栏发现改为跟踪页面变更,减少对话内容的重复扫描。
39
+ - Mermaid 延迟渲染视口外图表,并分批让出渲染时间;修复渲染调度竞态和主题切换时的标签颜色问题。
40
+ - 表格列定义支持使用 `name` 作为备用列名。
41
+ - 修复 `tabs` 和 `accordion` 数量限制与围栏校验之间的冲突;保留范围内内容,并在 `validate_dsh_ui` 结果中提供 `policy_truncated` 提示。
42
+ - 修复 `divider`、`spacer` 的发前校验误报,以及 quiz 选项标记混入可访问名称的问题。
43
+ - 围栏兼容 DSH `0.2.x` 的公开会话与输入触发 API,并在宿主重载后继续恢复 `/panel` 状态。
44
+
45
+ ### 兼容性
46
+
47
+ - DSH peer 依赖支持 `^0.2.0-rc.1 || ^0.2.1-rc.1`;CI 覆盖最低宿主、当前宿主的接口检查、完整测试、构建与安装包验证。
48
+
49
+ ### 致谢
50
+
51
+ - 感谢 @TCX111、@DDDFXYqiming、@taekchef 和 @kelvinwww 对围栏发现、GenUI 组件、测试与性能优化的贡献。
52
+
53
+ ## [0.12.0] - 2026-10-13
54
+
55
+ ### 新增
56
+
57
+ - GenUI 正文、表格、工具卡片和会话面板支持本地文件链接,点击后在宿主右侧栏打开文件并定位到指定行;支持工作区相对路径和 Windows 路径(#273、PR #278)。
58
+ - 增加默认开启的 `renderUiTool` 配置。设为 `false` 时只关闭 `render_ui` 工具及相关模型指引,发前校验、正文围栏和会话面板继续可用(#276、PR #281)。
59
+
60
+ ### 修复
61
+
62
+ - JSON 对象中无值的字段名紧接正常字段时,围栏修复只移除无值字段,保留后续内容;浏览器渲染与发前校验共用这一修复,避免将两个字段名拼接后丢失卡片正文(#290、#291)。
63
+ - 宿主隐藏 `dsh-ui` 语言、同时改变代码块包装类名时,DOM 通道现可通过宿主的代码内容语义标记定位包装节点,继续从原始消息识别围栏;不再因漏扫描而留下裸 JSON,正文和明确声明为普通代码的围栏保持原样(#275)。
64
+ - 缺少结束标记的 `dsh-ui` 围栏若正文已经可以渲染(包括尾部工具残片或可修复的 JSON),不再要求模型重发同一张卡片;一条回复中只有无法渲染的围栏会进入纠错(#288)。
65
+ - 修复单行表格中的行内代码导致文字越过列边界的问题,同时保留连续空格;需要更宽空间的表格通过容器横向滚动显示(#280)。
66
+ - 表格页脚单元格中的行内代码同样沿用「表格内 chip 不重新开启断行」的规则;浏览器回归夹具补上宿主 `.markdown` 级联(`overflow-wrap: anywhere` 与 `:not(pre) > code` 的 `inline-flex`),让跨列溢出在夹具中可复现,并把重叠检查从首列相邻对扩展到所有相邻列对(#285)。
67
+ - 发前校验遇到原生组件的未知字段时,返回结构化字段路径并要求修改后重验,不再指示直接发送围栏;JSON 已修复的路径同样执行这一判定(#275 追加反馈)。
68
+ - 图表主题色先解析为实际 RGB/RGBA,修复第三方皮肤中 `calc()` 等颜色表达式导致 Mermaid 渲染失败的问题(PR #279)。
69
+ - DOM 围栏扫描遇到已失效的 Cordis Context 时,会保留已挂载的流式围栏和组件状态,并在 Context 恢复后继续解析(#280)。
70
+
71
+ ### 兼容性
72
+
73
+ - 将 DSH 当前宿主与下一测试版的接口、打包安装和发布验证目标更新为 `0.2.0-rc.2` 与 `0.2.1-alpha.1`。
74
+ - 移除 DSH 已废弃的运行时诊断配套入口 `./invariant`、对应构建产物与 `@deepseek-ai/dsh-invariants` 直接依赖。
75
+ - 对应宿主版本的公开依赖检查加入技能注册、插件重载和持久化纠错恢复测试;会话样本补齐新版要求的消息记录字段。
76
+
77
+ ### 变更
78
+
79
+ - 完成态 GenUI 的导出入口改为无边框图标,沿用既有图标按钮的悬浮与聚焦反馈;保留“导出”提示和 HTML / GenUI JSON 菜单,并补齐第三方主题中的悬浮反馈(#274、PR #277)。
80
+
5
81
  ## [0.11.4] - 2026-10-08
6
82
 
7
83
  ### 修复
package/ICON-NAMES.md ADDED
@@ -0,0 +1,30 @@
1
+ # 图标名清单(全量 749 个)
2
+
3
+ > 本文件由 `scripts/generate-icon-data.mjs` 生成,请勿手改。
4
+ > 来源:OpenAI Apps SDK UI,commit `0f00143c7a639906f1621fe58e1b6be7b5bea46d`,MIT。
5
+
6
+ `icon` 节点接受下列任意名字(区分大小写)。未知名字渲染为中性圆点,
7
+ 不会丢块,也不会触发下载。
8
+
9
+ 不支持的嵌套 SVG 结构按整图排除(6 个):
10
+ - Document: unsupported nested SVG structure
11
+ - DownloadGifWatermark: unsupported nested SVG structure
12
+ - Linear: unsupported nested SVG structure
13
+ - OpenaiLogoBold: unsupported nested SVG structure
14
+ - OpenaiLogoRegular: unsupported nested SVG structure
15
+ - Zendesk: unsupported nested SVG structure
16
+
17
+ ## 内联(64 个,无需下载)
18
+
19
+ ```text
20
+ Check CheckCircle Info InfoCircle Warning Error X Plus Minus ArrowDown ArrowUp ArrowRight ArrowLeft ArrowCurvedRight Function Functions Operator Atom Nodes Connect Share Branch Grid GridAlt Stack Cube Storage Chart Trending Pulse Speed Timer Clock TableFilled Code SquareCode Terminal File FileCode Folder Folders Link Paperclip Lightbulb Book BookOpen GraduationCap Flask Lab Brain Robot Sparkles ShieldCheck Lock Globe WebsiteNetwork Search MagnifyingGlassSearch PluginPuzzle Settings Bolt Compass Trash Report
21
+ ```
22
+
23
+ ## 按需载入(685 个)
24
+
25
+ 首次用到非内联名字时,会一次性拉取 `lib/assets/icons.js`(约 1 MB),
26
+ 此后本页全部可用。
27
+
28
+ ```text
29
+ AddMember AddSources Agent AgentMode AllGizmos AllProductsExplore Analytics AnalyzeData ApiKey ApiKeyAdmin ApiKeyServiceAccount ApiKeys Archive Array ArrowBottomLeftSm ArrowBottomRightSm ArrowCurved ArrowCurvedLeft ArrowCurvedRightXs ArrowCurvedRightXs24px ArrowDownLg ArrowDownSm ArrowLeftLg ArrowLeftSm ArrowRightLg ArrowRightSm ArrowRotateCcw ArrowRotateCw ArrowTopLeftSm ArrowTopRightSm ArrowUpLg ArrowUpRight ArrowUpSm AspectRatio11 AspectRatio169 AspectRatio34 AspectRatio43 AspectRatio916 Assistant Astronout AtSign AutoPairApps AutoSuggestedEdits Autocomplete AvatarFilledProfile AvatarProfile Back10s Back15s BackLarge BackSmall BackToApp BackgroundConversation BalancingScale BarChart BarChartFilled Batch Batches Bell BellFilled Beta Bills Blend BlendingCurveSharp BlendingCurveSmooth BlendingCurveSubtle BookBookmark BookClock BookClosed BookWrench Boolean BranchAlt Bug BuilderProfileCard BuildingWorkspace Business BusinessFilled Cabinet Calendar CalendarAlt CalendarToday Camera CameraFilledPhoto CameraPhoto CaptionCcOff CaptionCcOn CaptionOff CaptionOn Card CaretDown CaretLeft CaretRight CaretUp Category Certificate ChartXAxis ChartYAxis Chat ChatCompose ChatDashedCheckedTemp ChatDashedTemp ChatTemporary ChatTripleDots Chats CheckCircleDashed CheckCircleFilled CheckLg CheckMd ChevronDown ChevronDownLg ChevronDownMd ChevronDownUp ChevronDownVector ChevronLeft ChevronLeftLg ChevronLeftMd ChevronRight ChevronRightAlt ChevronRightLg ChevronRightMd ChevronSmallDown ChevronSmallLeft ChevronSmallRight ChevronSmallUp ChevronUp ChevronUpDown ChevronUpLg ChevronUpMd Circle CircleDashed CircleQuestion ClappingBoardClosed ClappingBoardOpen Cleanup Clear Click Clip Clipboard ClipboardCopy Clock10s Clock15s Clock20s Clock5s ClockOff CloseBold CodeSquareSlash Collapse CollapseLarge CollapseLeft CollapseLg CollapseRight CollapseSm CollapseSmall ColorTheme Comment Commit Compare CompareArrows Complete ComposeCanvasEditStar ComposeDashedTemporary ComposeEditSquare Confetti ConfettiParty ConnectApps ConnectedDynamicGpt ConnectorsConnectedApps Copy CreditCard Credits Cursor Customize DarkMode DataControls DeepSearchTelescope Delete DeleteAccount Desktop DiningEvents DisabledCursor Dock Documentation DollarCircle Dot DotsHorizontal DotsHorizontalCircle DotsHorizontalMoreMenu DotsVertical DotsVerticalCircle DotsVerticalMoreMenu DoubleChevronLeft DoubleChevronRight Download DownloadCircle DownloadSimple DownloadVideo DownloadVideoWatermark Dropdown DropdownVector Dumbbell EarthTravelWorld Edit EditAlt EditDalleImage EditPencil EditStar EditXs Education Email EmojiAdd EmojiLists EmojiRemove EmojiSections EmojiWords EmptyCircle EmptyCircleFilled EnterLogin Enum Equal ExclamationMarkCircle ExitLogout Expand ExpandLarge ExpandLg ExpandMd ExpandSm ExpandSmall Explore ExploreSora ExternalLink Eye EyeClosed EyeOff FeaturedWreath File3d FileAudio FileBlank FileDocument FileImage FilePresentation FileSpreadsheet FileSpreedsheet FileUpload FileVideo FileZip Filter FineTuning FistBump Flag Flash FlaskFilled FolderDocumentsFinder FolderOpen FolderPlus FolderPlusAdd FolderShared FolderSharedOpen FolderStuffed FolderUnshare Followup Forum Forward Forward10s Forward15s Frozen GenerateSuggestedEdits Glasses GlobeAltRealTimeSearch GlobeFilled GlobeOffRealTimeSearch GlobeRealTimeSearch GlobeSpin Go GoFilled Graduate Group GroupFilled Groups Hamburger HandBack HandFront HandPeace HandRaised HandRaisedHey HandWavingBye HapticFeedback Headphones Health Heart HeartFilled HeartFilledXs HeartXs Help History HistoryOff HistoryOn Home HomeAlt Identity IdentityMeSecure ImageCaption ImageSquare ImageSquarePictureLibrary ImageToText ImageWide ImageWideFilled ImageWidePictureLibrary Images Inkedin Inpaint InpaintRespond Inspiration InspirationFilled Instagram Interactiv InternalKnowledge InternalKnowledgeOptimizedForCircle Invoice Io Jira JumpToCaption Kettlebell Key Keyboard KeyboardShortcut Language Latency Lifesaver LightMode Lightbulb20 Lightbulb22 Lightbulb22Filled LightbulbGlow LinkDisabledBold LinkExternalWebsite LocalServices LockKeyHole Logout Loop LoopLong LoopNormal LoopShort LoopXs Lotus Love MagnifyingGlassSmSearch Mail ManageHistory MapPin Maps MapsAddress MapsDirections MarkerCode MarkerData MarkerMultiple MarkerQuote Mcp Members MembersFilled MemoryFilledSm MemoryOffRemember MemoryOnRemember MemoryWriteSm Menu MenuInverted MenuSidebar Menubar Messaging Mic MicFilled MicFilledOff MicLgDictate MicOff MinimizeDown MinimizeLeft MinimizeRight MinimizeTop MinusCircle MinusCircleFilled Mobile Moon MoonSunSystem MoreCircleMenuDots Music MyGptProfileMe Name NewsPaper NoTraining Notebook NotebookCheck NotebookNarrow NotebookPencil Notepad NotificationBell NotificationOffBell Number ObjectIcon On OpenLeft OpenRight OpenaiLogoBoldBoundingBox OpenaiLogoRegularBoundingBox OpenaiLogoWebappVariable480 Order PageBlank Paid PaperclipAttach ParentControl PastedText Pause PauseCircle PauseCircleFilled PauseOutline PauseSm Paw Pencil PencilSparkle PencilSquare Pens Phone PhoneMissed PhoneRing PhoneWaves PictureInPicture Pin PinFilled PinWindow Plane PlantDesk Play PlayCircle PlayCircleFilled PlayOutline PlaySm PlayTriangle Playground Plugin Plus14px PlusCircle PlusCircleAdd PlusCircleFilled PlusComposer PlusFilled PlusLg PlusLg18pxAdd PlusSm12px PlusSquareAdd PopOutWindow PresetDefault PresetSelected PrivacyIntern ProDiamond ProFilledDiamond ProductTag PullRequestClosed PullRequestDraft PullRequestMerged PullRequestOpen Question QuestionMark QuestionMarkCircle QuickStart Quote QuoteReplyFilledQuoteXs RadioSelected ReadingLevel Record Regenerate RegenerateOff RegenerateStar Reload RemixMild RemixMildXs RemixStrong RemixSubtle RemoveForeverPermanently RemoveRedEye Reply Resend ResetChat Resolution1080p Resolution360p Resolution480p Resolution720p RestoreUntrash Rewind RobotHead RobotHeadSad SavedFilledXs SavedXs Scales Scissor ScissorXs ScreenPosition SearchConnector SearchFeed SearchXs SelectText SettingsCircle SettingsCog SettingsSlider SettingsWrench ShareChat ShareScreen ShareScreenFilled ShareScreenOff ShareScreenOffFilled ShieldKey ShieldLock ShieldPerson ShoppingBag Shortcuts Shuffle Sidebar SidebarCollapseLeft SidebarCollapseRight SidebarFloatingLeft SidebarFloatingOpenLeft SidebarFloatingOpenRight SidebarFloatingRight SidebarLeft SidebarMenuMobile SidebarMenuMobileBadgeCutout SidebarOpenLeft SidebarOpenLeftAlt SidebarOpenRight SidebarOpenRightAlt SidebarRight SimpleRelax SimpleSad SimpleSmile Skip Sleep Snapchat Snorkle Snowflake SoraBasicPopcorn SoraProDirector SoundOffSimpleMute SoundOffSpeaker SoundOnReadOutLoudSpeaker Sparkle SparkleDouble SparkleFilledPlus SparklePlus SparklesFilled Speak SpeechToText SpeedometerLatencySpeed Spelling Spin SquareCheckCheckboxChecked SquareCheckFilledCheckboxCheckedFilled SquareCheckboxUnchecked SquareFilledTableLegend SquareImage SquarePlus SquarePlusAlt SquareTableLegend SquareText Star StarFilled StartStrokeMd Status Stethoscope StickyNote Stop StopCircle StopCircleFilled StopOutline StopSm StopStrokeMd Stopwatch Storyboard String Studio Stuff StuffTools SubscriptionPlan SuggestEdit Suitcase SuitcaseFilledWorkBusiness SuitcaseWorkBusiness Sun SystemMode TBoneRaw TableCellFilled TableCellsFilled TableColumnFilled TableRowFilled Tag Tap Tasks Telescope TerminalLg Terms Text TextLonger TextPrompt TextShorter TextShorterConcise TextToSpeech ThumbDown ThumbDownFilled ThumbMixed ThumbUp ThumbUpFilled ThumbnailLarge ThumbnailMedium ThumbnailSmall Thumbs Tiktok Tools ToolsSkills Translate TrashRemove TriangleExclamationErrorWarning TriangleExclamationFilledErrorWarning TrophyTop TuningFork Unarchive Undo Unlink Unpin Upgrade UpgradePlan UploadDocuments Upscale UpscaleXs Usage User UserAdd UserGpts UserHeart UserLock UserVoice Users Variation2v2 VariationV21 VariationV31 VariationV32 VariationV33 VariationV41 VariationV42 VariationV43 VariationV44 VersionsV1 Video VideoCaption VideoFilled VideoFilledOff VideoGrid VideoList VideoToText Videos Voice Voice4Bars Voice5BarsSoundwave VoiceBold VoiceInputAreaMobileFilledVoiceXs VoiceLight WarningFilledWrapCenteredForCircle WarningWrapCenteredForCircle Wave Wechat Whatsapp Whisk WhisperAutoSubmit Widget WidgetAdd WorkWithApps Workspace Wreath WriteAlt WriteAlt2 Writing XCircle XCircleCrossedClose XCircleFilled XCircleFilledCrossedClose XCrossed XSquareCrossed XSquareFilledCrossed XXs XXsCrossed Youtube
30
+ ```
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # 🎨 dsh-genui
1
+ <h1><img src="./assets/genui-logo.svg" width="355" height="80" alt="GenUI"></h1>
2
2
 
3
3
  <div align="center">
4
4
 
@@ -50,38 +50,32 @@ The walkthrough moves from an answer-embedded panel through forms, plotting, Mer
50
50
 
51
51
  <p align="center">
52
52
  <img src="./assets/showcase-panel.png" width="92%" alt="Real dsh-genui monitoring panel rendered inside a DSH conversation">
53
- <br><em>Real output: refresh/reset controls, time-range selection, statistics, charts, and a service table live inside the assistant reply.</em>
53
+ <br><em>Real output: eyebrow stat cards, a filterable service table with drill-down rows, grouped totals, and spark/ring/bar cell types live inside the assistant reply.</em>
54
54
  </p>
55
55
 
56
56
  #### 2. A function plot redraws locally as its parameters change
57
57
 
58
58
  <p align="center">
59
59
  <img src="./assets/showcase-plot.png" width="76%" alt="Real dsh-genui function plot with draggable parameter sliders">
60
- <br><em>Real output: `plot` renders curves while sliders, reset, and animation controls update the graph locally.</em>
60
+ <br><em>Real output: `plot` renders curves while parameter sliders update the graph locally — drag to redraw, no round-trip.</em>
61
61
  </p>
62
62
 
63
63
  #### 3. Layout primitives compose into structured work surfaces
64
64
 
65
65
  <p align="center">
66
66
  <img src="./assets/showcase.png" width="76%" alt="Real dsh-genui layout and card component composition">
67
- <br><em>Real output: typography, grid, card, and row/column primitives combine into a hierarchy the model can describe declaratively.</em>
67
+ <br><em>Real output: display typography, eyebrow stat cards, a ring progress, and labeled chapter dividers combine into a hierarchy the model can describe declaratively.</em>
68
68
  </p>
69
69
 
70
70
  ---
71
71
 
72
- ## ⚠️ Read this first: dual-channel rendering (no host source patch required)
72
+ ## ⚠️ Read this first: DSH compatibility
73
73
 
74
- The plugin ships **two rendering channels** and picks one automatically after the host activates its browser module:
75
-
76
- - **Registry channel**: when the host exposes the `fence-registry` extension point (newer dsh builds), fences register through the host's streaming render pipeline and behave seamlessly with the host;
77
- - **DOM channel**: when the host lacks that extension point (including supported stock DSH builds), the plugin observes the session DOM and mounts its own render tree. Since 0.7.2 it **supports streaming rendering**: components appear as the model writes them — the first finished component shows up immediately, no need to wait for the whole reply. Since 0.8.3 fence discovery is **multi-surface**: it matches the stock `md-code-block` surface, the deepsuite-style `.code-block` / `.code-block-small` surfaces some host builds render instead, and — as a structural backstop — any element whose banner labels it `dsh-ui` and contains a `<pre>` body. If your dsh build renders fences with a different class name, they still render (and a one-time console warning tells you the host DOM drifted).
78
- - **DSH 0.1.7 generic code banner**: when the host's final DOM omits fenced-code language metadata, dsh-genui reads the current assistant's original Markdown from the public ChatSnapshot and only takes over `dsh-ui` fences. The DOM identifies the mount location. If source data is temporarily unavailable, a settled assistant CodeBlock can use the strict canonical GenUI validation as a final fallback.
79
-
80
- Whichever channel is active, components, interactions, panels, and persistence behave identically.
74
+ The browser plugin observes the DSH conversation DOM and mounts GenUI in plugin-owned React roots. It supports DSH `^0.2.0-rc.1 || ^0.2.1-rc.1`, including `0.2.1-rc.2`, with continuous checks against the minimum `dsh-v0.2.0-rc.1` and current `dsh-v0.2.1-rc.2` releases. Streaming rendering shows each completed component as the model writes it. Fence discovery supports the stock `md-code-block` surface, `.code-block` and `.code-block-small`, plus any element whose banner labels it `dsh-ui` and contains a `<pre>` body.
81
75
 
82
76
  CI's packed host smoke installs the generated npm tarball in a real DSH host and verifies host startup and rendering. Source-backed fence routing is covered by integration tests; the smoke does not claim to validate a real model response. Real-model E2E requires configured model credentials.
83
77
 
84
- The repository ships both renderer channels, the host plugin, and the built browser bundle. The host still owns **client activation** and must provide the `slots` and `sessions` services. A downloaded `client.js` or a ModuleLoader cache entry proves only that bytes arrived — successful activation always prints `[genui] client active; fence-channel=registry|dom`. If that line is absent, fix package/profile identity or host activation first; DOM attributes such as `data-streaming` and `data-chat-anchor-key` are optional fallbacks, not installation prerequisites.
78
+ The repository ships the host plugin and built browser bundle. The host still owns **client activation** and must provide the `slots` and `sessions` services. A downloaded `client.js` or a ModuleLoader cache entry proves only that bytes arrived — successful activation prints `[genui] client active; fence-channel=dom`. If that line is absent, check package/profile identity or host activation; DOM attributes such as `data-streaming` and `data-chat-anchor-key` are optional signals, not installation prerequisites.
85
79
 
86
80
  ---
87
81
 
@@ -96,7 +90,7 @@ The repository ships both renderer channels, the host plugin, and the built brow
96
90
 
97
91
  Prerequisites — all required:
98
92
 
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.0-rc.1` is currently a prerelease; verified host roles: minimum `dsh-v0.1.2-rc.1`, current `dsh-v0.1.7-rc.2`, next `dsh-v0.2.0-rc.2`; users on DSH `<=0.1.1-rc.x` should use dsh-genui `0.9.8`)
93
+ 1. **dsh `^0.2.0-rc.1 || ^0.2.1-rc.1`** (verified host roles: minimum `dsh-v0.2.0-rc.1`, current `dsh-v0.2.1-rc.2`)
100
94
  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
95
 
102
96
  Install and activate in DSH (one command, all dependencies included):
@@ -141,7 +135,7 @@ After the command completes, restart dsh web and hard-refresh the browser. In a
141
135
  Use dsh-ui to draw a stats dashboard with a sortable service table.
142
136
  ```
143
137
 
144
- You should see the reply turn into an in-place dashboard rather than a code block. For an unambiguous technical check, open the browser console: successful activation prints `[genui] client active; fence-channel=registry|dom`.
138
+ You should see the reply turn into an in-place dashboard rather than a code block. To check activation, open the browser console and look for `[genui] client active; fence-channel=dom`.
145
139
 
146
140
  ### Developer iteration (link mode)
147
141
 
@@ -177,7 +171,15 @@ The following is the detailed capability reference. Every behavior is constraine
177
171
  - **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
172
  - **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
173
  - **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**: the `render_ui` tool renders the same spec as a card in the tool row (deliverable-style UI goes through the tool, answer-style UI through the fence)
174
+ - **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.
175
+ - **Disable the `render_ui` tool**: add `renderUiTool: false` under this plugin's `config:` in your profile:
176
+
177
+ ```yaml
178
+ - id: genui
179
+ name: '@changfenhuang/dsh-genui'
180
+ config:
181
+ renderUiTool: false
182
+ ```
181
183
  - **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
184
  - **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
185
  - **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
@@ -219,7 +221,7 @@ What you see: a themed bar chart with tooltips and axis labels — rendered by E
219
221
 
220
222
  ## 🔧 How it works
221
223
 
222
- The model writes the interface description as JSON inside a `dsh-ui` fence; the browser-side renderer (`src/client`) claims this language through the main repo's `fence-registry` interface and renders it. Components are whitelisted — the model can't smuggle in HTML/scripts; function expressions go through a standalone parser, never `eval`.
224
+ The model writes the interface description as JSON inside a `dsh-ui` fence; the browser-side renderer (`src/client`) identifies it in the DSH conversation DOM and renders it. Components are whitelisted — the model can't smuggle in HTML or scripts; function expressions go through a standalone parser, never `eval`.
223
225
 
224
226
  The core render package stays light (≈110 KB min / 28 KB gzip); the mermaid, three.js, and echarts engines are bundled separately as on-demand assets (loaded through the plugin's self-registered HTTP routes the first time they're used), so startup only downloads the rendering core.
225
227
 
@@ -229,8 +231,8 @@ Settled GenUI blocks expose **Export → HTML** and **GenUI JSON**. The `.html`
229
231
 
230
232
  ## ❓ FAQ
231
233
 
232
- - **Rendering as a code block?** First check the browser console for `[genui] client active; fence-channel=registry|dom`. If absent, the client bundle was not activated even if its URL returns 200 — align the profile dependency, `package.json.name`, `cordis.patch.yml`, ModuleLoader id, and configured bundle name. If present, inspect the fence label/body; registry-less hosts automatically use the DOM channel.
233
- - **Chat UI goes blank when rendering a dsh-ui fence?** This dsh-genui release requires DSH `^0.1.2-rc.1 || ^0.1.5-alpha.1 || ^0.1.6-alpha.1 || ^0.1.7-alpha.1`; users on DSH `<=0.1.1-rc.x` should use dsh-genui `0.9.8`.
234
+ - **Rendering as a code block?** First check the browser console for `[genui] client active; fence-channel=dom`. If absent, the client bundle was not activated even if its URL returns 200 — check the profile dependency, `package.json.name`, `cordis.patch.yml`, ModuleLoader id, and configured bundle name. If present, inspect the fence label and body.
235
+ - **Chat UI goes blank when rendering a dsh-ui fence?** This dsh-genui release requires DSH `^0.2.0-rc.1 || ^0.2.1-rc.1`.
234
236
  - **`dsh: pnpm not found on PATH`?** Install pnpm, then **open a new terminal** and retry (`corepack enable` or `npm i -g pnpm`).
235
237
  - **npm install returns 404?** The npm package is public and requires no login. Run `npm view @changfenhuang/dsh-genui version` to verify the package name and public registry; if a newly published version still returns 404, retry shortly.
236
238
  - **Installed but scene3d/mermaid/echarts don't render?** The engines (mermaid / three / echarts) are no longer inlined in client.js — they load on demand the first time they're used (`/plugins/@changfenhuang/dsh-genui/assets/*.js`, hosted by the plugin's own HTTP routes). First restart dsh web + hard refresh (Cmd+Shift+R); still broken, remove and reinstall (`dsh plugin --profile web remove @changfenhuang/dsh-genui`, then add again). Hosts without the asset routes degrade to source/load-error hints — update dsh.
@@ -244,11 +246,7 @@ pnpm install
244
246
  pnpm run check # type check + full tests + build
245
247
  ```
246
248
 
247
- 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
-
249
- The verified host roles are minimum `dsh-v0.1.2-rc.1`, current `dsh-v0.1.7-rc.2`, and next `dsh-v0.2.0-rc.1`. DSH `0.2.0-rc.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
-
251
- `pnpm run check:host-api dsh-v0.1.7-rc.2` and `pnpm run check:host-api dsh-v0.2.0-rc.1` install the corresponding published DSH packages and run TypeScript typecheck plus tsdown build. Each CI host lane then installs the generated tarball in its pinned DSH host and runs the packed smoke.
249
+ With the locked dependencies installed, `pnpm run check` runs type checking, the full unit test suite, the build, and standalone checks against DSH `0.2.1-rc.1` packages. CI also checks DSH `0.2.0-rc.1` on Node 24 and DSH `0.2.1-rc.2` on Node 22 and 24. Each lane runs the host API checks and installs the generated tarball in its pinned DSH checkout for a packed smoke.
252
250
 
253
251
  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
252
 
@@ -257,23 +255,23 @@ Run `node scripts/verify-pack.mjs --keep` to retain the verified tarball for ins
257
255
  The real chain end to end: start a temporary dsh web → install the plugin → send a message in a browser so the model outputs a `dsh-ui` fence → assert the rendering → click an action button → assert the model responds (event-loop closure):
258
256
 
259
257
  ```sh
260
- export DSH_ROOT=/path/to/deepseek-harness-0.1.2-rc.1
258
+ export DSH_ROOT=/path/to/deepseek-harness-0.2.1-rc.2
261
259
  export DSH_BIN="$DSH_ROOT/apps/cli/lib/bin.js"
262
260
  DEEPSEEK_API_KEY=sk-... node scripts/e2e.mjs # link-installs the current workspace
263
261
  ```
264
262
 
265
- Build the DSH `0.1.2-rc.1` checkout first. Set `DSH_ROOT` to that checkout and `DSH_BIN` to its `apps/cli/lib/bin.js`, as shown above; also provide `pnpm`, `DEEPSEEK_API_KEY`, and the main repo's web build output. On PASS it saves an `e2e-final.png` screenshot.
263
+ Build the DSH `0.2.1-rc.2` checkout first. Set `DSH_ROOT` to that checkout and `DSH_BIN` to its `apps/cli/lib/bin.js`, as shown above; also provide `pnpm`, `DEEPSEEK_API_KEY`, and the main repo's web build output. On PASS it saves an `e2e-final.png` screenshot.
266
264
 
267
265
  ### Visual e2e (no model key)
268
266
 
269
- For style/component iterations, a visual smoke that needs no API key: boots a real DSH `0.1.2-rc.1` checkout with the plugin link-installed, injects the component gallery fence through the DOM channel, renders it in headless Chrome, screenshots the full page, and exercises local interactions (table sort, quiz judging, tree collapse, numeric alignment) with hard assertions. Set `DSH_ROOT` and `DSH_BIN` to that checkout as shown above before running it.
267
+ For style/component iterations, a visual smoke that needs no API key: boots a real DSH `0.2.1-rc.2` checkout with the plugin link-installed, injects the component gallery fence through the DOM channel, renders it in headless Chrome, screenshots the full page, and exercises local interactions (table sort, quiz judging, tree collapse, numeric alignment) with hard assertions. Set `DSH_ROOT` and `DSH_BIN` to that checkout as shown above before running it.
270
268
 
271
269
  ```sh
272
270
  npx tsx scripts/e2e-visual.mts # → .e2e-artifacts/gallery.png + interactions.png
273
271
  npx tsx scripts/e2e-visual.mts --keep # keep the scratch DSH_HOME for debugging
274
272
  ```
275
273
 
276
- Overridable: `--port 3098`, `--out <dir>`, `DSH_BIN` (set it to the `apps/cli/lib/bin.js` inside the DSH `0.1.2-rc.1` checkout), `PLAYWRIGHT_PATH` (defaults to the global playwright-core).
274
+ Overridable: `--port 3098`, `--out <dir>`, `DSH_BIN` (set it to the `apps/cli/lib/bin.js` inside the DSH `0.2.1-rc.2` checkout), `PLAYWRIGHT_PATH` (defaults to the global playwright-core).
277
275
 
278
276
  ## 🗺️ Roadmap (evaluated)
279
277
 
package/README.zh-CN.md CHANGED
@@ -1,4 +1,4 @@
1
- # 🎨 dsh-genui
1
+ <h1><img src="./assets/genui-logo.svg" width="355" height="80" alt="GenUI"></h1>
2
2
 
3
3
  <div align="center">
4
4
 
@@ -50,38 +50,32 @@ https://github.com/user-attachments/assets/f5db33ec-7471-4d4a-a85b-79c9962ab4ef
50
50
 
51
51
  <p align="center">
52
52
  <img src="./assets/showcase-panel.png" width="92%" alt="真实 DSH 对话中渲染的 dsh-genui 监控面板">
53
- <br><em>真实输出:刷新/重置、时间范围、统计卡、图表和服务表都活在助手回答里。</em>
53
+ <br><em>真实输出:eyebrow 指标卡、可筛选可钻取的服务表、分组合计,以及 spark/ring/bar 单元格类型,都活在助手回答里。</em>
54
54
  </p>
55
55
 
56
56
  #### 2. 改参数时,函数图在本地即时重绘
57
57
 
58
58
  <p align="center">
59
59
  <img src="./assets/showcase-plot.png" width="76%" alt="带可拖动参数滑块的真实 dsh-genui 函数图">
60
- <br><em>真实输出:`plot` 绘制曲线;拖动滑块、重置和动画控制都直接更新图形。</em>
60
+ <br><em>真实输出:`plot` 绘制曲线;拖动参数滑块即时重绘,零模型往返。</em>
61
61
  </p>
62
62
 
63
63
  #### 3. 布局原语可以组成有层级的工作界面
64
64
 
65
65
  <p align="center">
66
66
  <img src="./assets/showcase.png" width="76%" alt="真实 dsh-genui 排版和卡片组件组合">
67
- <br><em>真实输出:文字、网格、卡片、行列原语可组合成模型能够声明的界面层级。</em>
67
+ <br><em>真实输出:display 引言、eyebrow 指标卡、环形进度和带名字的章节分隔线,组合成模型能够声明的界面层级。</em>
68
68
  </p>
69
69
 
70
70
  ---
71
71
 
72
- ## ⚠️ 先看这里:双通道渲染(无需修改宿主源码)
72
+ ## ⚠️ 先看这里:DSH 兼容范围
73
73
 
74
- 本插件自带**两套渲染通道**;宿主激活浏览器模块后,插件会自动选择:
75
-
76
- - **Registry 通道**:宿主提供 `fence-registry` 扩展点(新版 dsh 构建)时,围栏经宿主流式渲染管线注册,行为与宿主无缝;
77
- - **DOM 通道**:宿主没有该扩展点(包括支持范围内的原版 DSH 构建)时,插件观察会话 DOM 自行挂载渲染树。自 0.7.2 起**支持流式渲染**:模型写到哪渲染到哪,首个完成的组件立即出现,不用等整段回复写完。自 0.8.3 起围栏发现**多表面兼容**:同时匹配标准 `md-code-block` 表面、部分宿主构建使用的 deepsuite 风格 `.code-block` / `.code-block-small` 表面,并以「label+`<pre>`」结构兜底——任何 banner 标注 `dsh-ui` 且含 `<pre>` 正文的元素都能被识别。即使你的 dsh 构建用了别的类名,围栏照常渲染(控制台会有一条一次性提示说明宿主 DOM 发生漂移)。
78
- - **DSH 0.1.7 通用代码块**:宿主最终 DOM 没有提供围栏 language metadata 时,dsh-genui 会从公开 ChatSnapshot 读取当前 assistant 的原始 Markdown,并且只接管 `dsh-ui` 围栏。DOM 负责确定挂载位置。source 数据暂时不可用时,assistant 已结束的通用 CodeBlock 才能通过严格的 canonical GenUI 规范校验进入最终兜底。
79
-
80
- 无论走哪条通道,组件、交互、面板、持久化行为完全一致。
74
+ 浏览器插件会观察 DSH 对话 DOM,并在插件自己的 React root 中显示 GenUI。支持 DSH `^0.2.0-rc.1 || ^0.2.1-rc.1`,其中已包含 `0.2.1-rc.2`;持续检查最低版本 `dsh-v0.2.0-rc.1` 和当前版本 `dsh-v0.2.1-rc.2`。流式渲染会随着模型输出显示已完成的组件。围栏识别支持标准 `md-code-block`、`.code-block`、`.code-block-small`,以及 banner 标注 `dsh-ui` 且含 `<pre>` 正文的元素。
81
75
 
82
76
  CI 的 packed host smoke 会把实际生成的 npm tarball 安装到真实 DSH 宿主,并验证宿主启动与界面渲染。source-backed 围栏识别由 integration tests 覆盖;该 smoke 不代表真实模型回复验收。真实模型 E2E 需要配置模型凭据。
83
77
 
84
- 本仓库已经包含两条渲染通道、服务端插件和浏览器构建产物;宿主仍负责**激活客户端模块**,并提供 `slots` 与 `sessions` 服务。`client.js` 返回 200 或出现在 ModuleLoader 缓存里,只能证明文件下载成功;真正激活后一定会打印 `[genui] client active; fence-channel=registry|dom`。没有这行时应先核对包名/网页配置/宿主激活链,`data-streaming`、`data-chat-anchor-key` 等页面属性只是可选信息,不是安装前提。
78
+ 本仓库包含服务端插件和浏览器构建产物;宿主仍负责**激活客户端模块**,并提供 `slots` 与 `sessions` 服务。`client.js` 返回 200 或出现在 ModuleLoader 缓存里,只能证明文件下载成功;成功激活后会打印 `[genui] client active; fence-channel=dom`。没有这行时应核对包名、网页配置和宿主激活链,`data-streaming`、`data-chat-anchor-key` 等页面属性只是可选信息,不是安装前提。
85
79
 
86
80
  ---
87
81
 
@@ -96,7 +90,7 @@ CI 的 packed host smoke 会把实际生成的 npm tarball 安装到真实 DSH
96
90
 
97
91
  前置条件,缺一不可:
98
92
 
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.0-rc.1` 当前属于预发布版本;已验证宿主角色:minimum `dsh-v0.1.2-rc.1`、current `dsh-v0.1.7-rc.2`、next `dsh-v0.2.0-rc.2`;使用 DSH `<=0.1.1-rc.x` 的用户请使用 dsh-genui `0.9.8`)
93
+ 1. **dsh `^0.2.0-rc.1 || ^0.2.1-rc.1`**(已验证宿主角色:最低版本 `dsh-v0.2.0-rc.1`、当前版本 `dsh-v0.2.1-rc.2`)
100
94
  2. **`pnpm` 在 PATH 上**:`dsh plugin` 命令依赖它。没有就 `corepack enable`(或 `npm i -g pnpm`),然后**新开一个终端**,确认 `pnpm -v` 有输出
101
95
 
102
96
  安装并在 DSH 中激活(一行命令,自动带上全部依赖):
@@ -141,7 +135,7 @@ dsh plugin --profile web add @changfenhuang/dsh-genui
141
135
  用 dsh-ui 画一个带可排序服务表的统计看板。
142
136
  ```
143
137
 
144
- 正常情况下,回答会原地变成仪表盘,而不是显示成代码块。想做最明确的技术确认时,打开浏览器控制台:成功激活会打印 `[genui] client active; fence-channel=registry|dom`。
138
+ 正常情况下,回答会原地变成仪表盘,而不是显示成代码块。检查客户端激活状态时,打开浏览器控制台查找 `[genui] client active; fence-channel=dom`。
145
139
 
146
140
  ### 开发者迭代(link 模式)
147
141
 
@@ -177,7 +171,15 @@ dsh plugin --profile web add link:$PWD
177
171
  - **本地优先原则**:UI 自己能完成的状态变化(判卷、判题、重置、展开、选中)一律本地即时完成;action 只用于必须模型参与的事(生成新内容、执行工具、下一步建议)
178
172
  - **诚实交互**:交互组件必须带 `action`;不带 `action` 的按钮渲染为禁用态(消灭"看着能点、点了没反应"的假按钮);带 `action` 的按钮点击后立即显示「已触发」本地反馈(只证明本地事件已触发,不代表模型已收到)
179
173
  - **事件循环**:按钮、复选框、单选、开关、下拉、输入、文本域、提交和测验等离散交互按一次手势一次事件立即回传模型;`slider` 连续拖动保留尾沿防抖,同一滑块只回传最终值,不同 `id` 的滑块互不合并。
180
- - **工具通道**:`render_ui` 工具把同一份 spec 渲染成工具行卡片(交付物型 UI 走工具、回答型 UI 走围栏)
174
+ - **工具通道**:默认注册 `render_ui`,并将同一份 spec 渲染成工具行卡片;`validate_dsh_ui` 始终可用。在本插件的 `config:` 中设置 `renderUiTool: false` 后,宿主不再注册 `render_ui`。正文 `dsh-ui` 围栏、`panel: true`、`/panel` 和客户端工具视图中的历史 `render_ui` 结果仍可使用。修改此设置后需要让宿主重新加载插件。
175
+ - **关闭 `render_ui` 工具**:在用户 profile 中本插件条目的 `config:` 下添加:
176
+
177
+ ```yaml
178
+ - id: genui
179
+ name: '@changfenhuang/dsh-genui'
180
+ config:
181
+ renderUiTool: false
182
+ ```
181
183
  - **会话面板**:composer 上方常驻 dock,`render_ui` / `panel: true` 围栏原地更新同一块界面;`/panel` 命令客户端直开(`/panel <指令>` 转模型定制、`/panel clear` 清空);顶边框可拖拽调高;`append: true` 增量合并——同名标签页追加内容、新标签页新增;整面板默认最多 200 节点 / 200 条追加,达到上限后模型应发送 `replace` 重建
182
184
  - **围栏自修**:默认开启;在 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
185
  - **自愈与上限**:每个围栏过规格守卫——坏节点静默丢弃(同围栏其余组件照常渲染,单个坏组件不再拖垮整条围栏)、数值钳位、字符串截断,整树 ≤200 节点 / 8 层嵌套,病态 spec 不会拖垮界面
@@ -225,14 +227,14 @@ dsh plugin --profile web add link:$PWD
225
227
 
226
228
  ## 🔧 原理
227
229
 
228
- 模型把界面描述写成 JSON 放进 `dsh-ui` 围栏,浏览器端渲染器(`src/client`)通过主仓 `fence-registry` 接口认领这门语言并渲染。组件是白名单的,模型塞不进 HTML/脚本;函数表达式走独立解析器,不用 eval。
230
+ 模型把界面描述写成 JSON 放进 `dsh-ui` 围栏,浏览器端渲染器(`src/client`)从 DSH 对话 DOM 识别围栏并显示。组件是白名单的,模型无法插入 HTML 或脚本;函数表达式使用独立解析器,不调用 eval。
229
231
 
230
232
  主渲染包保持轻量(≈110 KB min / 28 KB gzip),mermaid、three.js 与 echarts 引擎单独打包为按需资产(首次用到时经插件自注册的 HTTP 路由加载),启动时只下载渲染核心。
231
233
 
232
234
  ## ❓ 常见问题
233
235
 
234
- - **显示成代码块?** 先在浏览器控制台找 `[genui] client active; fence-channel=registry|dom`。没有这行,即使 `client.js` 返回 200,也只是下载了文件、没有激活:请对齐网页配置依赖名、`package.json.name`、`cordis.patch.yml`、ModuleLoader id 和配置中的 bundle 名。出现这行后再查围栏标签/正文;宿主没有 registry 时会自动走 DOM 通道。
235
- - **渲染 dsh-ui fence 时聊天界面白屏?** 此版 dsh-genui 要求 DSH `^0.1.2-rc.1 || ^0.1.5-alpha.1 || ^0.1.6-alpha.1 || ^0.1.7-alpha.1`;使用 DSH `<=0.1.1-rc.x` 的用户请使用 dsh-genui `0.9.8`。
236
+ - **显示成代码块?** 先在浏览器控制台找 `[genui] client active; fence-channel=dom`。没有这行,即使 `client.js` 返回 200,也只是下载了文件、没有激活:请核对网页配置依赖名、`package.json.name`、`cordis.patch.yml`、ModuleLoader id 和配置中的 bundle 名。出现这行后再检查围栏标签与正文。
237
+ - **渲染 dsh-ui fence 时聊天界面白屏?** 此版 dsh-genui 要求 DSH `^0.2.0-rc.1 || ^0.2.1-rc.1`。
236
238
  - **`dsh: pnpm not found on PATH`?** 装 pnpm 后**新开终端**再试(`corepack enable` 或 `npm i -g pnpm`)。
237
239
  - **npm 安装返回 404?** npm 包是公开的,无需登录。先执行 `npm view @changfenhuang/dsh-genui version` 核对包名与公共 registry;若新版本刚发布仍返回 404,稍后重试。
238
240
  - **装了但 scene3d/mermaid/echarts 不渲染?** 引擎(mermaid / three / echarts)不再内联进 client.js——它们在首次用到时按需加载(`/plugins/@changfenhuang/dsh-genui/assets/*.js`,插件自带 HTTP 路由托管)。先重启 dsh web + 硬刷新(Cmd+Shift+R);仍不渲染就卸掉重装(`dsh plugin --profile web remove @changfenhuang/dsh-genui` 后再 add)。旧版宿主缺少资产路由时会降级显示源码/加载失败提示,更新 dsh 即可。
@@ -258,11 +260,7 @@ pnpm install
258
260
  pnpm run check # 类型检查 + 全量测试 + 构建
259
261
  ```
260
262
 
261
- 安装锁定依赖后,检查脚本(`pnpm run check` 或 `npm run check`)使用固定的 DSH `0.1.2-rc.1` 发布包。
262
-
263
- 已验证宿主角色为 minimum `dsh-v0.1.2-rc.1`、current `dsh-v0.1.7-rc.2`、next `dsh-v0.2.0-rc.1`。DSH `0.2.0-rc.1` 当前属于预发布版本。CI 保持四条主要 lane:Node 22 + current,以及 Node 24 + minimum/current/next。DSH 发布新版本后,替换对应固定标签。
264
-
265
- `pnpm run check:host-api dsh-v0.1.7-rc.2` 与 `pnpm run check:host-api dsh-v0.2.0-rc.1` 会安装对应 DSH 发布包,运行 TypeScript 类型检查与 tsdown 构建。每条 CI 宿主 lane 随后会把生成的 tarball 安装到固定版本的 DSH 宿主并运行 packed smoke。
263
+ 安装锁定依赖后,`pnpm run check` 会使用 DSH `0.2.1-rc.1` 包运行类型检查、全量单元测试、构建和 standalone 检查。CI 还会在 Node 24 检查 DSH `0.2.0-rc.1`,并在 Node 22、24 检查 DSH `0.2.1-rc.2`。每条 CI lane 都会检查宿主 API,并把生成的 tarball 安装到固定版本的 DSH checkout 中运行 packed smoke。
266
264
 
267
265
  运行 `node scripts/verify-pack.mjs --keep` 可保留已验收的 tarball,便于检查或运行 e2e;默认的 `node scripts/verify-pack.mjs` 会在验收后清理临时目录。
268
266
 
@@ -271,23 +269,23 @@ pnpm run check # 类型检查 + 全量测试 + 构建
271
269
  真实链路验证:起一个临时 dsh web → 装上插件 → 浏览器里发消息让模型输出 `dsh-ui` fence → 断言渲染 → 点击 action 按钮 → 断言模型响应(事件循环闭环):
272
270
 
273
271
  ```sh
274
- export DSH_ROOT=/path/to/deepseek-harness-0.1.2-rc.1
272
+ export DSH_ROOT=/path/to/deepseek-harness-0.2.1-rc.2
275
273
  export DSH_BIN="$DSH_ROOT/apps/cli/lib/bin.js"
276
274
  DEEPSEEK_API_KEY=sk-... node scripts/e2e.mjs # link 安装当前工作区
277
275
  ```
278
276
 
279
- 先构建 DSH `0.1.2-rc.1` checkout。按上面的示例将 `DSH_ROOT` 指向该 checkout,将 `DSH_BIN` 指向其中的 `apps/cli/lib/bin.js`;另需准备 `pnpm`、`DEEPSEEK_API_KEY` 和主仓 web 构建产物。PASS 时保存 `e2e-final.png` 截图。
277
+ 先构建 DSH `0.2.1-rc.2` checkout。按上面的示例将 `DSH_ROOT` 指向该 checkout,将 `DSH_BIN` 指向其中的 `apps/cli/lib/bin.js`;另需准备 `pnpm`、`DEEPSEEK_API_KEY` 和主仓 web 构建产物。PASS 时保存 `e2e-final.png` 截图。
280
278
 
281
279
  ### 视觉 e2e(无需模型 key)
282
280
 
283
- 样式/组件迭代用:使用 DSH `0.1.2-rc.1` checkout 起真实 dsh web + link 安装插件 → 通过 DOM 通道注入组件画廊围栏 → headless Chrome 全页截图 + 本地交互(表格排序 / 判题 / 目录折叠 / 数值对齐)硬断言,不需要任何模型额度。运行前按上面的示例将 `DSH_ROOT` 和 `DSH_BIN` 指向该 checkout:
281
+ 样式/组件迭代用:使用 DSH `0.2.1-rc.2` checkout 起真实 dsh web + link 安装插件 → 通过 DOM 通道注入组件画廊围栏 → headless Chrome 全页截图 + 本地交互(表格排序 / 判题 / 目录折叠 / 数值对齐)硬断言,不需要任何模型额度。运行前按上面的示例将 `DSH_ROOT` 和 `DSH_BIN` 指向该 checkout:
284
282
 
285
283
  ```sh
286
284
  npx tsx scripts/e2e-visual.mts # → .e2e-artifacts/gallery.png + interactions.png
287
285
  npx tsx scripts/e2e-visual.mts --keep # 保留 scratch DSH_HOME 便于排查
288
286
  ```
289
287
 
290
- 可覆盖:`--port 3098`、`--out <dir>`、`DSH_BIN`(设为 DSH `0.1.2-rc.1` checkout 内的 `apps/cli/lib/bin.js`)、`PLAYWRIGHT_PATH`(默认全局 playwright-core)。
288
+ 可覆盖:`--port 3098`、`--out <dir>`、`DSH_BIN`(设为 DSH `0.2.1-rc.2` checkout 内的 `apps/cli/lib/bin.js`)、`PLAYWRIGHT_PATH`(默认全局 playwright-core)。
291
289
 
292
290
  ## 🗺️ Roadmap(已评估项)
293
291