Repository navigation
Conversation
DSH 0.1.5-alpha.2 起 markdown 管线不再内置 HTML 解析器 (packages/client/ui-primitives/src/markdown/render.tsx:case 'html' 返回字面文本), 原 vc/Xu 属性转换函数整体消失,旧两代锚点 0 命中 → install-all 第一步安全中止,装不上。 ## 第三代适配(install-v6.cjs 新增锚点组 + isGen3 代际探测) - case"html":return t.value; → v6 三态钩子(渲染 switch 为 Z2(t,r,i),streaming 取 i.streaming) - u5(t,r) 属性循环 → v6 安全加固(script/iframe/object/embed 过滤、onclick 桥、 style 消毒 + !important 文字属性锁定、href/src/action 白名单) - 注入宿主桥 window.__vcpHost:把模块作用域的 React I、jsx runtime a、DOM→React 转换 u5、style 解析 xg 桥给 v6 模块(模块顶层 + case 内兜底双写) - patch/v6-inject.js 去宿主符号硬依赖:新增 __vcpHostRef/__vcpF/__vcpJsx/__vcpFrag 惰性解析(宿主桥优先;旧代际 vc/hp、Xu/jd 与测试 stub 原路径不变),7 处 f. 调用点改写 - case"code" 围栏兜底第三代形态未收录 → 警告跳过,不阻塞基础渲染(与 rc.8+ 同策略) ## 跨平台与幂等修复 - bundle 自动探测补 POSIX 候选($DSH_HOME 或 ~/.dsh 的 profiles/web/node_modules 与 profiles/node_modules):此前 Linux/macOS 上必然「未自动找到 dsh-web-frontend 的 dist bundle」,必须手传路径才能装 - update-v6-inject.cjs 把 __DSH_V6_INJECT_END__ 后的换行一并纳入替换区间: 修复「每次重跑 bundle +1 字节」(此前 README 宣称的幂等失真,连跑三次字节递增) - 测试 jsdom 硬编码作者机 Windows 路径(G:/AI/AI 助手/VCPChat-main/node_modules/jsdom), 换机即 MODULE_NOT_FOUND;新增 tests/load-jsdom.cjs 可移植解析 (JSDOM_PATH → 本地 node_modules → 常见借用位置),5 个测试文件统一改走该模块 ## 测试 - 新增 tests/gen3-host.test.mjs(27 断言):用最小第三代 fixture 串起 install-all 三步 → 无 vc/hp/f 环境加载 → 真实 case"html" 分支渲染卡片 → script 过滤 / onclick 桥 / javascript: 拒收 → 幂等复跑字节不变 - tests/bundle.test.mjs 兼容三代特征 + POSIX 自动探测 - 全套 9 个测试文件 343 断言全绿(stable 105 / security 54 / bundle 40 / gen3 27 / math 59 / mermaid 22 / trusted 21 / smoke 15 / boost-fontface) ## 实机验证 真实 dsh-web-frontend bundle(apps/web/dist/assets/index-CIp0YSTs.js) 516,566 → 621,136 字节;从打补丁后的实产物中抽出 xg + 宿主桥 + v6 模块 + 加固 u5 隔离运行:返回元素树(非字面文本)、script 被过滤、onclick 桥接为 React onClick、 javascript: 拒收、style 对象化、流式帧正常;install-all 连续复跑字节数恒定。 旧两代(0.0.1-rc.5~0.1.0-rc.7 的 vc/hp、0.1.0-rc.8/0.1.1-rc.x 的 Xu/jd) 锚点与行为不变;package.json 版本 0.6.0 → 0.6.4(与 CHANGELOG 0.6.4 条目对齐)。
This was referenced Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景:为什么现在装不上
DSH 前端升到
dsh-web-frontend 0.1.5-alpha.2后,patch/install-all.cjs在第一步就安全中止:根因(上游源码为准):从这一代起 markdown 管线不再内置 HTML 解析器。
packages/client/ui-primitives/src/markdown/render.tsx的case 'html'写着于是插件赖以加固的
vc/Xu属性转换函数整体消失(bundle 里叫vc的已经是 Immer 内部函数function vc(t,r,i,s,c,u,h)),case"html":return t.value;成了第三代形态 —— 旧两代锚点必然 0 命中。本 PR 新增第三代代际支持。改动
1. 第三代适配(
patch/install-v6.cjs)isGen3:function u5(t,r){且无function Xu(n,i){/function vc(n,r){case"html":return t.value;→ v6 三态化钩子(渲染 switch 为Z2(t,r,i),流式标记取i.streaming)u5(t,r)的原始循环 → v6 形态(script/iframe/object/embed 过滤、onclick→window.__dshInput桥、style 消毒 + 文字属性!important锁定、href/src/action 白名单)window.__vcpHost:0.1.5 的模块作用域没有vc/hp/f,可复用的宿主设施只剩渲染 switch、KaTeX 结果路径的u5(DOM→React)、style 解析xg、ReactI与 jsx runtimea。桥在模块顶层 +case"html"内兜底双写(防 TDZ 导致顶层初始化未生效)case"code"围栏兜底第三代形态未收录 → 警告跳过,不阻塞基础渲染(与 rc.8+ 同策略)2.
patch/v6-inject.js去宿主符号硬依赖新增
__vcpHostRef/__vcpF/__vcpJsx/__vcpFrag惰性解析:宿主桥优先,缺失时回落模块作用域f/vc/hp/Xu/jd/Sd—— 旧两代与测试 stub 走原路径不变,7 处f.调用点改写。3. 顺带修三个真实安装坑
findBundle()只认%APPDATA%/%USERPROFILE%$DSH_HOME或~/.dsh的profiles/web/node_modules与profiles/node_modules)——install-v6.cjs/trusted-patch.cjs/update-v6-inject.cjs/tests/bundle.test.mjsupdate-v6-inject.cjs未吞 END 标记后的换行G:/AI/AI 助手/VCPChat-main/node_modules/jsdomMODULE_NOT_FOUND,全套测试跑不起来tests/load-jsdom.cjs可移植解析(JSDOM_PATH→ 本地node_modules→ 常见借用位置),5 个测试文件统一改走4. 测试
tests/gen3-host.test.mjs(27 断言):最小第三代 fixture 串起「install-all 三步 → 在没有vc/hp/f的环境里加载 → 真实case"html"分支渲染卡片 → script 过滤 / onclick 桥 /javascript:拒收 / style 对象化 → 幂等复跑字节不变」tests/bundle.test.mjs兼容三代特征与 POSIX 自动探测实机验证
dsh-web-frontendbundle(apps/web/dist/assets/index-CIp0YSTs.js)打补丁:516,566 → 621,136 字节,node --check+ 特征自检通过xg+ 宿主桥 + v6 模块 + 加固后u5隔离运行:__vcpStable.render()返回元素树(非字面文本)、script被过滤、onclick桥接为 ReactonClick、javascript:被拒、style对象化、流式帧同样返回元素install-all.cjs连续复跑:各步骤正确跳过、文件字节数恒定兼容性与影响面说明
0.0.1-rc.5~0.1.0-rc.7(vc/hp)与0.1.0-rc.8 / 0.1.1-rc.x(Xu/jd)路径保持原样,测试 stub 走老路径u5同时被 KaTeX 渲染路径(bundle 内L2)复用,因此本 PR 的 u5 加固(URL 白名单 /on*过滤 / style 消毒)对该路径同样生效。KaTeX 输出不含 script/事件/危险 URL,实机未见差异,但这是本次唯一的"扩大作用面"改动,需要 reviewer 知情case"code"围栏兜底(```html 包裹卡片的场景),行为为「警告 + 跳过」,不影响基础渲染;如需要可后续补锚点package.json版本0.6.0 → 0.6.4:仓库 CHANGELOG 已有 0.6.1/0.6.2/0.6.3 条目但 package.json 仍停在 0.6.0,本次顺手与新增的 0.6.4 条目对齐