Back to home@statem-li

dsh-done-pill

DSH 对话完成胶囊:顶部悬浮消息胶囊(原 webui done-pill 拆出)——任一会话回合完成提醒、点击跳会话、悬停查看记录全文、可拖拽定位、健康提醒与字体/缩放设置。零 DSH 源码改动,可与 dsh-webui 并存(webui 关闭 donePill 模块即可)。

Stars
0
Language
TypeScript
Created
Aug 30, 2026
Updated
Aug 30, 2026
GitHub repo

Introduction

dsh-done-pill — 对话完成胶囊(消息胶囊)

从 dsh-webui 的 done-pill 模块拆出的独立插件:顶部悬浮「消息胶囊」, 任一会话(含后台会话)回合完成时提醒、点击跳会话、悬停看记录全文、可拖拽 定位并持久化,附带健康提醒(休息时段 / 凌晨提醒)与胶囊外观设置(大小 / 字体)。全程零 DSH 源码改动。

背景:dsh-webui(全家桶)已于 2026-08-28 卸载,其 done-pill 能力随之下线。 本插件把该模块原样移植为单体插件,行为与数据契约不变,方便只想要「消息 胶囊」的用户。

模块清单

半身模块说明
hostsession/event 监听(global)任一会话(含后台会话)turn/end 时提取标题 / 触发问题 / 助手回复,写入内存完成列表(最近 50 条,seq 单调递增);running 表跟踪进行中的回合(turn/start 入表、turn/end 出表)
hostGET /api/dsh-done-pill前端轮询增量数据;?since=N 返回 items = seq > N(升序)+ running
clientshell.overlay 顶部胶囊常驻悬浮、可拖拽(位置按中心点视口比率持久化)、点击进最新完成会话、悬停滑出记录面板(运行中任务列表 + 完成记录全文)
client通用设置 5 行对话完成胶囊(显隐)/ 休息时间提醒 / 凌晨注意休息 / 胶囊大小 / 胶囊字体

路由

GET /api/dsh-done-pill?since=N
→ 200 { ok: true, version, items: DoneEntry[], running: RunningEntry[] }
其他方法 → 405

DoneEntryseq / id / sessionId / title / question / answer / endedAt / turn / reasonKindRunningEntrysessionId / since / question / title

设计约束(与 webui 一致):subagent 回合跳过;aborted 回合不算完成; 空回合(无问题也无回复)不上报;客户端每个页面加载先全量拉取恢复最近记录, 之后按 since 增量(仅存内存)。

配置

无 host 配置项。客户端全部走 localStorage(与 webui 共用同一套键,旧配置 无缝延续;卸载 webui 后再装本插件,位置 / 已读 / 开关 / 时段 / 外观都在):

含义
dsh.donePill.enabled胶囊整体显隐("1"/"0")
dsh.donePill.pos拖拽位置(中心点视口比率 {xc,yc}
dsh.donePill.read已读记录 id 集合
dsh.donePill.rest休息时间提醒 {enabled,start,end}
dsh.donePill.late凌晨注意休息 {enabled,start,end}
dsh.donePill.appearance外观 {scale,font}

与 dsh-webui 的关系

  • 路由:本插件用私有路径 /api/dsh-done-pill(不复用 webui 的 /api/webui-done-pill),二者同时安装也不会注册冲突;路由冲突时 host 端会 warn 并跳过,不影响插件加载。
  • 座位:本插件槽位 id 带 dsh-done-pill 前缀,与 webui 的 done-pill 座位不冲突。
  • 建议:同时装了 webui 时,在 webui 模块开关里关掉 donePill, 避免双胶囊 + 双宿主路由。
  • CSS 类名(.dsh-done-pill*)与样式表 id(dsh-done-pill-css)沿用 webui 原值,注入幂等,两边共存无冲突。

与 webui 版的三处差异:① 路由/座位前缀独立(见上);② 已移除胶囊右侧 的「文件」按钮——它依赖 webui fileExplorer 的跨模块事件桥 (dsh-file-explorer-toggle),独立插件里没有监听者,去掉避免无效入口; 需要文件入口时用 webui(关掉 donePill 模块)或另行装文件浏览器插件; ③ 视觉风格改为 HUD 线条感(tech-line)——外壳全透明无框无线(只有 文字与状态件直接浮在页面上,无矩形围绕、无引线装饰)、方形仪表状态件 (✓框/未读框/运行方块)、左侧运行中计数块(点击=进入运行会话、悬停=滑出 任务列表)、面板标题下沿青点虚线、未读扫描光带与运行点脉冲;深/浅主题 各一套 --dpl-* 变量,几何骨架与形变动画节奏不变。

构建与自测

pnpm install            # 只需 esbuild(devDependency);没有 pnpm 时
                        # build.mjs 会自动借用 DSH checkout 的 esbuild
node build.mjs          # 产出 lib/index.js(host)+ lib/client.js(browser)
node scripts/smoke-host.mjs    # host 冒烟:事件流 → 完成条目 / 路由过滤 /
                               # aborted / subagent 跳过(裸 node 即可)
node scripts/smoke-client.mjs  # client 冒烟:loader 契约 + 6 个槽位注册

lib/ 随仓库提交(pnpm≥10 拦截 git 依赖的 prepare,安装方不跑构建)。

安装 / 卸载

# 一句话安装(从 GitHub)——bundle patch 自动注册,无需手编 profile
dsh plugin --profile web add github:statem-li/dsh-done-pill
dsh plugin --profile web remove dsh-done-pill

本地开发用 junction(源码目录即运行目录):

New-Item -ItemType Junction -Path "C:\Users\Anti\.dsh\profiles\web\node_modules\dsh-done-pill" `
  -Target "D:\AI\Dsh\dsh-done-pill"

然后在 profile cordis.patch.yml 追加:

- insert:
    - id: dsh-done-pill
      name: dsh-done-pill

宿主半身不支持热重载:装完重启一次 DSH(client 半身随页面刷新生效, 但 /api/dsh-done-pill 路由与新的事件监听需要服务重启)。

目录结构

src/host.ts           host 半身(监听 + 路由 + 插件契约)
src/client/index.ts   client 入口(apply + inject)
src/client/pill.tsx   胶囊 UI(自 webui done-pill.tsx 移植)
scripts/smoke-host.mjs   host 冒烟
scripts/smoke-client.mjs client 冒烟
build.mjs             esbuild 双产物构建 + 外部依赖守卫
cordis.patch.yml      插件自带 bundle patch(dsh plugin add 自动并入)

卸载步骤

  1. dsh plugin --profile web remove dsh-done-pill(或删除 junction + profile cordis.patch.yml 里的 insert 条目);
  2. 重启 DSH;
  3. 浏览器控制台 localStorage.removeItem('dsh.donePill.enabled') 等键可 一并清掉(可选,留着无副作用)。