From 53a9ced6bf6edac2d6843294883bf6fd02788692 Mon Sep 17 00:00:00 2001 From: Menghuan1918 Date: Tue, 11 Aug 2026 12:00:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(client-modules):=20package.json=20=E8=A1=A5?= =?UTF-8?q?=20dsh.client=20=E5=A3=B0=E6=98=8E=20=E2=80=94=20client=20?= =?UTF-8?q?=E5=8D=8A=E6=9C=AA=E8=BF=9B=E5=BC=95=E5=AF=BC=E6=B8=85=E5=8D=95?= =?UTF-8?q?=E7=9A=84=E6=A0=B9=E5=9B=A0=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 诊断(2026-08-11 重启后侧边栏不显示):host 半正常(/sidebar/api 路由 200),但页面 window.__DSH_BOOT__ 引导清单 30 个 client 插件中没有 dsh-better-sidebar。client-modules 扫描器(packages/client/modules)读 package.json 的 pkg.dsh.client 声明 + exports["./client"] 组合 bundle; 插件只声明了旧字段 dshClient(dsH 新版本约定改为 dsh.client,工作正常的 ui-genui 两者并存)。旧字段缺失 → 负判定缓存 → 无 client 入口 → 浏览器 不加载侧边栏。 修复:package.json 新增 "dsh": { "client": { inject, platform } } 与 dshClient 并存(兼容新旧 dsh);README 规范符合性章节同步字段说明, 并顺带修正上一轮安装章节重排遗留的两个失效锚点链接。 --- README.md | 4 ++-- package.json | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4a03932..64daa8b 100644 --- a/README.md +++ b/README.md @@ -260,10 +260,10 @@ pnpm watch # tsdown --watch(client bundle 热重建) ### 规范符合性 -插件按 DSH 官方插件规范组织(参考 [dsh-external/turtle-ui](https://github.com/dsh-external/turtle-ui) 与 mainline `packages/client/AGENTS.md`),并额外提供 plugin-registry 标准发布面(`dsh.plugin.json`)。**安装通道与渲染方式是两个独立概念**:安装走 profile 清单协议(`dsh plugin` / cordis.yml 行,见[一键安装](#一键安装把提示词发给-dsh))**或** registry 通道(`dsh registry`,见[通过 plugin-registry 安装](#通过-plugin-registry-安装标准)),二者互斥;下面的 portal 条目只描述面板在页面上的渲染方式。 +插件按 DSH 官方插件规范组织(参考 [dsh-external/turtle-ui](https://github.com/dsh-external/turtle-ui) 与 mainline `packages/client/AGENTS.md`),并额外提供 plugin-registry 标准发布面(`dsh.plugin.json`)。**安装通道与渲染方式是两个独立概念**:安装走 profile 清单协议(`dsh plugin` / cordis.yml 行,见[官方 profile 安装](#官方-profile-安装推荐无需-plugin-registry))**或** registry 通道(`dsh registry`,见[通过 plugin-registry 安装](#通过-plugin-registry-安装可选)),二者互斥;下面的 portal 条目只描述面板在页面上的渲染方式。 - **插件形态**:`export const name / inject / Config / apply`,无 default 导出;`tests/plugin-shape.spec.ts` 通过 `Loader.unwrapExports` 守卫该形态 -- **清单**:`types` + `exports`(`.` / `./invariant` / `./client` / `./src/*` / `./package.json`)、`dshClient`(`platform: 'web'` + 信息性 `inject` 边)、peerDependencies、`engines`、`files` 产物明细、`prepare`(消费者侧 `tsdown`,git 安装可用) +- **清单**:`types` + `exports`(`.` / `./invariant` / `./client` / `./src/*` / `./package.json`)、`dsh.client`(`platform: 'web'` + `inject` 边;旧字段 `dshClient` 并存保留兼容)、peerDependencies、`engines`、`files` 产物明细、`prepare`(消费者侧 `tsdown`,git 安装可用) - **client 契约**:仅导出 `apply`/`inject`(+ 类型);store 为 `createSidebarStore()` 工厂,实例归 `apply` 所有;`src/invariant.ts` 伴生;client bundle 复刻官方 preset(externals = 平台模块表 + runtime/client 豁免、纯度门、CSS Modules 内联) - **registry 形态(标准发布面)**:仓库根 `dsh.plugin.json`(原生清单:id `dsh-external/dsh-better-sidebar`、`main` = host 构建产物、`client.main` = registry client bundle、`contributes` 空声明);`tests/manifest-consistency.spec.ts` 守卫清单与构建产物一致性(id 严格两段、version 与 package.json 同步、bundle id = 清单 id) - **双 client bundle**:同一 `src/client/index.tsx` 构建出 `lib/client.js`(官方通道,id = 包名 `dsh-better-sidebar`)与 `lib/client-registry.js`(registry 通道,id = 清单 id)——两通道的 bundle-id 契约互不相同,各产出一份、同源不漂移;每个部署二选一(见安装章节「通道互斥」) diff --git a/package.json b/package.json index f31927c..1ddbd3c 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,16 @@ "engines": { "node": ">=20" }, + "dsh": { + "client": { + "inject": [ + "@deepseek-ai/dsh-client-runtime", + "@deepseek-ai/dsh-client-ui-slots", + "@deepseek-ai/dsh-client-ui-conversation" + ], + "platform": "web" + } + }, "dshClient": { "inject": [ "@deepseek-ai/dsh-client-runtime",