DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

HometownVoyager /

HometownVoyager/dsh-preset-menu-compress

Verified

Compact preset menu for DeepSeek Harness (DSH): hides long preset descriptions in the new-session menu and reveals the full text in a theme-aware side card on hover or keyboard focus. DSH 新会话预设菜单紧凑化

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@2dea600b

自用声明:本仓是 DSH-OrcaMind 个人工作区的自研插件独立发布仓,与 deepseek-ai 官方无关。路径按本机硬编码(Windows,工作区根 D:\Tools\DeepSeek Harness),不保证开箱即用。

dsh-preset-menu-compress

DSH(DeepSeek Harness)新会话预设菜单的紧凑化 Client 插件:菜单里每项只显示名称,长描述收进右侧的主题自适应详情卡,鼠标悬停或键盘聚焦时展开。

为什么

新会话页的预设选择菜单里,每项同时渲染名称和一段不截断的长描述。描述一长,菜单就被撑得老高,把后面的模式挤出可视区域、还得滚动才能看到全部选项。

行为

  • 菜单只显示名称:描述 span 用 clip 方式视觉隐藏(position: absolute + clip-path),仍留在无障碍树里——读屏软件照样能读到完整描述,菜单按钮的可访问名称不受影响。
  • 悬停 / 键盘聚焦出详情卡:在菜单侧边浮出卡片,显示名称 + 完整描述。右侧放不下翻到左侧,两侧都放不下就改为在行下方(再不行翻上方)堆叠;窗口滚动或改尺寸时跟着当前行重定位;窄屏(≤560px)隐藏卡片。
  • 不接管任何交互:点击仍走官方 onSelect,Escape / 方向键 / Tab / Enter 仍由官方 Menu 组件处理。键盘导航期间指针悬停不抢焦点卡(:focus-visible 优先)。
  • 只影响这一处菜单:设置页的预设卡片、创建位置菜单、定时任务目标菜单均不受影响。
  • 安全降级:找不到预期的 DOM 结构就什么都不做,菜单原样显示。

实现

纯 DOM 装饰器,不替换 conversation.hero.agentPreset 槽位的官方 AgentPresetSeat,也不碰它的取数、暂存、选择与拒绝提示。

  • 菜单识别用多重结构信号交叉判定:portaled 列表的 position-anchor 指向 --dsh-menu-trigger-*、锚点包装内有带 title 的 button[aria-haspopup="menu"]、按钮可见标签等于某个菜单行名称、行标签为「名称 span + 描述 span」两段式。这些信号排除了同样用两段式标签的其他菜单。
  • 描述文本只在首次读到后缓存进 data-pmc-desc,之后不再读 DOM。
  • 一个 MutationObserver 观察 document.body 的 childList/subtree,用 requestAnimationFrame 合并扫描;只在 DOM 变动后扫描,不轮询。菜单打开期间只在官方菜单节点上挂 4 个轻量监听。
  • 样式全部走 --dsw-alias-* / --dsw-radius-* 官方 token,自动跟随深色/浅色主题。
  • <style> 在 apply(ctx) 时插入,ctx.effect 卸载时移除。

文件构成:index.js 宿主半(空实现,Client 半才是本体)、client.js Client 半(约 457 行,静态模块 window.__ModuleLoader__.load(...))、cordis.patch.yml bundle 补丁。

安装

作为 web profile 的本地 bundle 挂载:

// ~/.dsh/profiles/web/package.json
"dependencies": {
  "@local/dsh-preset-menu-compress": "link:D:/Tools/DeepSeek Harness/Plugins/dsh-preset-menu-compress"
}

并把 @local/dsh-preset-menu-compress 加进 dsh.profile.bundles。装后重启 DSH 生效(bundle 层改动都需重启)。

目录结构:

index.js            宿主半
client.js           Client 半(本体)
cordis.patch.yml    bundle patch
package.json        manifest(dsh.bundle.patch / dsh.client.platform)
icon.svg            插件图标(原创)
locale/{zh,en}.json 插件页元数据
docs/               详情图文(DETAIL.md / DETAIL.zh.md + preview.svg)

环境要求

  • DSH ^0.2.3-alpha.3(package.json 的 engines.dsh)
  • 仅 Windows 路径在本机验证过;插件本身是纯前端 DOM 逻辑,跨平台应无碍

已知限制

  • 依赖官方 AgentPresetSeat 的 DOM 结构(.item / .itemName / .itemDesc)。官方重构这套结构后插件会静默降级(菜单恢复原样),不会报错也不会弄坏菜单——届时更新选择器即可。
  • 不修改描述文本内容,只做显示/隐藏。

许可

BSD-3-Clause,见 LICENSE。


工作区真源在 D:\Tools\DeepSeek Harness\Plugins\dsh-preset-menu-compress,本仓是导出副本:插件有改动时从工作区重新导出推送,勿反向覆盖工作区。

—/ 5

No ratings yet

Verified DSH bundle

Commit 2dea600b00ce

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout