From ff94d0c124bc4e4b90300533027129858f1dbd49 Mon Sep 17 00:00:00 2001 From: Menghuan1918 Date: Tue, 11 Aug 2026 14:34:18 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20release=20v0.4.1=20=E2=80=94=20?= =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8F=E8=AE=BE=E7=BD=AE=E5=A3=B0=E6=98=8E?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=20+=20=E5=B0=8F=E5=8D=A1=E7=89=87=E7=BD=91?= =?UTF-8?q?=E6=A0=BC=20+=20=E4=BA=8C=E7=BA=A7=E8=AE=BE=E7=BD=AE=E5=BC=B9?= =?UTF-8?q?=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 版本从 0.5.0 定为 0.4.1(patch release,含未打 tag 的 v0.4.0 服务化改造) - 文档版本标注(AGENTS.md / 设计文档)同步为 v0.4.1+ --- AGENTS.md | 14 +++++++------- ...26-08-11-declarative-sidebar-settings-design.md | 6 +++--- dsh.plugin.json | 2 +- package.json | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 55d76c7..00bc739 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -118,7 +118,7 @@ interface TabDescriptor { */ createTab?: (state: SidebarState) => { tab: SidebarTab; patch?: Partial } | null /** - * 声明式设置(v0.5.0+):每个注册的 tab 都会在 Side card 设置页获得一行 + * 声明式设置(v0.4.1+):每个注册的 tab 都会在 Side card 设置页获得一行 * 开关(图标 + 标题 + 类型 id),`settings.toggles` 在其行下追加嵌套开关, * 绑定 SidebarPrefs 字段。嵌套开关仅父级启用时显示。 */ @@ -224,9 +224,9 @@ ctx.effect(() => interface FileViewerDescriptor { /** 唯一 id:'image' / 'pdf' / 'my-plugin:csv' */ id: string - /** 设置清单展示名(v0.5.0+,i18n 友好);缺省回退到 id */ + /** 设置清单展示名(v0.4.1+,i18n 友好);缺省回退到 id */ title?: string | (() => string) - /** 设置清单图标(v0.5.0+):ReactNode 或 (size: number) => ReactNode */ + /** 设置清单图标(v0.4.1+):ReactNode 或 (size: number) => ReactNode */ icon?: ReactNode | ((size: number) => ReactNode) /** 小写无点的扩展名数组:['png','jpg']。[] = catch-all(仅最低优先级有效) */ exts: readonly string[] @@ -238,7 +238,7 @@ interface FileViewerDescriptor { detect?: (path: string, head: Uint8Array) => boolean /** fetchStrategy='custom' 时的加载函数 */ load?: (path: string, scope: SessionScope) => Promise - /** 声明式设置(v0.5.0+):形状同 TabDescriptor.settings */ + /** 声明式设置(v0.4.1+):形状同 TabDescriptor.settings */ settings?: { toggles?: readonly { key: string; title: string | (() => string); desc?: string | (() => string) }[] } /** 渲染函数 */ component: (props: FileViewerProps) => ReactNode @@ -350,9 +350,9 @@ interface BetterSidebarService { getFileViewers(): readonly FileViewerDescriptor[] /** 按 id 查 tab 描述符 */ getTab(id: string): TabDescriptor | undefined - /** 某个 tab 类型是否在 Side card 设置中启用(v0.5.0+;缺省 = 启用) */ + /** 某个 tab 类型是否在 Side card 设置中启用(v0.4.1+;缺省 = 启用) */ isTabEnabled(id: string): boolean - /** 某个 file viewer 是否在 Side card 设置中启用(v0.5.0+;缺省 = 启用) */ + /** 某个 file viewer 是否在 Side card 设置中启用(v0.4.1+;缺省 = 启用) */ isViewerEnabled(id: string): boolean /** 按 path 匹配 file viewer(priority 降序单趟:detect → exts;跳过硬禁用 viewer) */ matchFileViewer(path: string, head?: Uint8Array): FileViewerDescriptor | undefined @@ -370,7 +370,7 @@ interface BetterSidebarService { } ``` -> **声明式设置(v0.5.0+)**:每个注册的 tab/viewer 自动出现在 DSH 设置页「侧边卡片」分区的清单里——响应式网格中的**小卡片**(图标 + 标题 + 类型 id + **高亮 = 启用**,勾选徽标钉在卡片最右端,viewer 卡片还显示扩展名),开关持久化到 `SidebarPrefs.tabsEnabled / viewersEnabled`(开放 map,缺省 = 启用)。关闭语义:tab 从 `+` 菜单消失、`openTab` 拒绝新开、子代理自动展开 / agent 终端自动补 tab 等派生流程停止,**已打开的 tab 保留**;viewer 被 `matchFileViewer` 跳过,文件落到下一个匹配。`settings.toggles` 声明的相关设置(如子代理的 `autoOpenSubagent`)通过卡片右下角的齿轮按钮在**原生弹窗**中编辑(复选框行),父级卡片关闭时齿轮隐藏;**key 必须是宿主 PrefsSchema 的字段**(内置键:`autoOpenSubagent` / `agentTerminalTools`),外部插件的自定义键会被 settings seam 丢弃。 +> **声明式设置(v0.4.1+)**:每个注册的 tab/viewer 自动出现在 DSH 设置页「侧边卡片」分区的清单里——响应式网格中的**小卡片**(图标 + 标题 + 类型 id + **高亮 = 启用**,勾选徽标钉在卡片最右端,viewer 卡片还显示扩展名),开关持久化到 `SidebarPrefs.tabsEnabled / viewersEnabled`(开放 map,缺省 = 启用)。关闭语义:tab 从 `+` 菜单消失、`openTab` 拒绝新开、子代理自动展开 / agent 终端自动补 tab 等派生流程停止,**已打开的 tab 保留**;viewer 被 `matchFileViewer` 跳过,文件落到下一个匹配。`settings.toggles` 声明的相关设置(如子代理的 `autoOpenSubagent`)通过卡片右下角的齿轮按钮在**原生弹窗**中编辑(复选框行),父级卡片关闭时齿轮隐藏;**key 必须是宿主 PrefsSchema 的字段**(内置键:`autoOpenSubagent` / `agentTerminalTools`),外部插件的自定义键会被 settings seam 丢弃。 --- diff --git a/docs/plans/2026-08-11-declarative-sidebar-settings-design.md b/docs/plans/2026-08-11-declarative-sidebar-settings-design.md index 7a11aad..bef73bc 100644 --- a/docs/plans/2026-08-11-declarative-sidebar-settings-design.md +++ b/docs/plans/2026-08-11-declarative-sidebar-settings-design.md @@ -2,7 +2,7 @@ **日期**:2026-08-11 **状态**:已实施(本文档含实施偏差记录) -**目标版本**:v0.5.0 +**目标版本**:v0.4.1 ## 1. 目标 @@ -133,5 +133,5 @@ isViewerEnabled(id: string): boolean 2. **宿主 `syncToolsGate` 不改**:`agentTerminalTools` 仅随自身开关走,不与 `tabsEnabled['terminal']` 联动(模型终端工具是模型面向能力,与侧边栏 UI 开关解耦)。 3. **`renderRow` 统一行渲染**:tab/viewer/嵌套开关共用一行渲染器(`sub` 参数区分缩进),CSS 新增 `.sectionHeading` / `.rowIcon` / `.titleLine` / `.subRow`。 4. **清单排序**:tabs 按 `hidden` 置后 + `order` 升序(editor/diff 殿后);viewers 按 priority 降序(code 兜底最后)。 -5. **开关改为卡片点击(v0.5.0 追加)**:清单项与嵌套相关设置、`openByDefault` 全部从"复选框行"改为**可点击卡片**——`