Bundle
dsh-todo-enhancer
DeepSeek Harness 插件:Host 半区向系统提示词注入规则,要求 LLM 把需要用户决策的内容用 <!-- dsh-todo:start -->…<!-- dsh-todo:end --> 成对标记包裹(渲染不可见);Client 半区仅对标记块在输入框上方显示带复选框的表格增强 UI,支持单行/整体编辑与「直接发送」「填入对话框」「关闭」,任意操作完成后关闭。
- Source
- EmptyCollin
- stars
- 1 stars
- License
- MIT
- Updated
- Updated 5 days ago
Readme
# dsh-todo-enhancer
让「需要用户决策的内容」以**带复选框的表格**呈现在输入框上方:勾选确认、行内编辑,然后直接发送 / 填入对话框 / 关闭,任意操作后面板自动关闭。
Turn "content that needs your decision" into an **editable checkbox table** above the composer — check, edit, then send / fill the draft / close; any action closes the panel.
DeepSeek Harness 双半区插件:Host 半区向系统提示词注入标记规则;Client 半区把 LLM 用标记包裹的决策清单渲染为可编辑表格。
A DeepSeek Harness plugin (Host + Client halves): the Host injects a marker rule into the system prompt; the Client renders LLM decision lists — wrapped in markers — as an editable table above the composer.
## 功能 / Features
- **标记驱动识别,杜绝误报**:只解析 `<!-- dsh-todo:start -->…<!-- dsh-todo:end -->` 标记块;普通陈述性列表(编号 / 项目符号 / checkbox)一律不触发。每个标记块 = 一个独立面板;块前紧邻的标题行作为列表标题。
- **复选框表格**:勾选 = 确认执行;行内直接编辑文本;删除行 / 添加行;全选 / 全不选。
- **整体编辑**:列表标题可改;「整体补充说明」多行文本会追加在发送内容末尾。
- **三种操作**(任选其一,面板随即关闭):**直接发送**(填入输入框并立即提交)/ **填入对话框**(仅填入 draft)/ **关闭**。
- **时序保证**:仅在对话全部输出完成(`session.running === false`)后渲染;流式输出中隐藏。
- **来源纯净**:思维链(reasoning)与工具调用块永不参与;dsh 自身的 `todo_write` 任务清单不处理。
- **人类口吻序列化**(而非逐字粘贴表格原文):
```
关于“发布检查”,我决定执行以下内容:
1. 确认版本号与发布说明一致
2. 检查回滚预案是否就绪
补充:发布窗口定在今晚十点
```
## 设计:标记驱动,杜绝误报 / Design: marker-driven, no false positives
普通启发式(把编号 / checkbox 列表都当作待办)会把**陈述性列表**误判为「需要用户决策」。本插件改为**契约式识别**:
- **Host 半区**向系统提示词注入一条规则(`systemPrompt.section`,order 120):凡有需要用户决策或确认的内容(待执行任务、待挑选选项、待批准方案),**必须**用成对标记包裹:
```markdown
<!-- dsh-todo:start -->
- [ ] 事项一
- [ ] 事项二
<!-- dsh-todo:end -->
```
- **Client 半区只认标记块**:标记是 HTML 注释,渲染后不可见、不破坏正文美观;头尾成对、天然区分多个清单(同一条回复可含多个标记对)。**没有标记的普通列表一律不触发**增强 UI。
## 安装 / Install
支持从 GitHub 直接安装(公开仓库,需能访问 github.com;公开克隆无需登录,若本机 git 配置要求凭据则按 Git Credential Manager 授权即可):
```bash
dsh plugin --profile web add github:EmptyCollin/dsh-todo-enhancer
```
配合峰谷排队插件(dsh-peak-valley-queue)使用时,建议**一条命令同时安装两个独立插件**(两者都会加入 bundle 层):
```bash
dsh plugin --profile web add github:EmptyCollin/dsh-peak-valley-queue github:EmptyCollin/dsh-todo-enhancer
```
- 安装后**重启 dsh 服务**(bundle 层在启动时加载),并**刷新浏览器页面**(重新拉取插件清单)。
- 其他 profile 把 `web` 换成对应 profile 名。
- 离线 / 尚未推送 GitHub 时,用本地路径安装:`dsh plugin --profile web add D:\dsh-plugin\dsh-todo-enhancer`。
- Host 半区:`lib/index.js`;Client 半区:`lib/client.bundle.js`(由 `lib/client.js` 经 `npm run build:client` 生成的模块加载器 bundle,产物已提交、无 prepare 脚本,安装无需构建)。
- 若 profile 装有 dshmarket,其也会自动挂载此类插件。
## 使用 / Usage
面板是**标记触发**式的,平时不可见:
1. 重启服务并刷新页面后,向 LLM 发送会产出「需要你决策」内容的消息(例如「列出 3 个可选方案,让我选一个」);
2. Host 规则会要求 LLM 用标记包裹清单,回复完成后输入框上方出现面板;
3. 勾选 / 编辑后,选择「直接发送」「填入对话框」或「关闭」。
## 工作原理 / How it works
- Host:`ctx.get('systemPrompt').section({ name: 'dsh-todo-enhancer:decision-markers', order: 120, text })` —— 会话作用域内注入标记规则。
- Client:注册 `conversation.input.dock`(id=`todo-enhanced`,order=5);数据源为槽位所有者 props `session`;`session.running` 作为「输出完成」闸门;动作走标准 props `inputActions.setDraft/submit`。
- 纯前端 + 单服务调用,无持久化;样式与注册随插件卸载自动回收。
## 目录结构 / Structure
```
cordis.patch.yml # dsh.bundle 补丁:把本包插入 profile 的 bundle 层
lib/
index.js # Host 半区(提示词注入,导出 { name, apply })
client.js # Client 半区源码(import React,导出 { name, inject, apply } + 纯函数)
client.bundle.js # Client bundle(__ModuleLoader__ 自注册形式,由 client.js 生成,产物已提交)
dynamic-host.js / dynamic-host-body.txt # Host 动态函数体(export const hostBody,供 cordis_define 开发用)
dynamic-client.js / dynamic-body.txt # Client 动态函数体(export const clientBody)
scripts/
build-bundle.mjs # 从 lib/client.js 生成 lib/client.bundle.js
```
## 开发 / Development
```bash
npm run build:client # 由 lib/client.js 重新生成 lib/client.bundle.js(产物已提交,仅改动源码后需重跑)
npm run check # 重新生成 bundle 并对全部入口 node --check
node test.mjs # 离线冒烟测试(无标记不触发、多标记块多面板、思维链排除、Host 段落注册、动态体求值)
```
## License
MIT
Install
dsh plugin --profile web add github:EmptyCollin/dsh-todo-enhancer
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-todo-enhancer from the hub
- This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.