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):凡有需要用户决策或确认的内容(待执行任务、待挑选选项、待批准方案),必须用成对标记包裹:<!-- dsh-todo:start --> - [ ] 事项一 - [ ] 事项二 <!-- dsh-todo:end -->Client 半区只认标记块:标记是 HTML 注释,渲染后不可见、不破坏正文美观;头尾成对、天然区分多个清单(同一条回复可含多个标记对)。没有标记的普通列表一律不触发增强 UI。
安装 / Install
本包自带 dsh.bundle 补丁(cordis.patch.yml),一条命令即可安装,并自动加入 profile 的 bundle 层:
dsh plugin --profile <profile名> add <本包路径>
例如: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,产物已提交,安装无需构建步骤)。 - 安装后重启 dsh 服务(bundle 层在启动时加载),并刷新浏览器页面(重新拉取插件清单)。
- 若 profile 装有 dshmarket,其也会自动挂载此类插件。
使用 / Usage
面板是标记触发式的,平时不可见:
- 重启服务并刷新页面后,向 LLM 发送会产出「需要你决策」内容的消息(例如「列出 3 个可选方案,让我选一个」);
- Host 规则会要求 LLM 用标记包裹清单,回复完成后输入框上方出现面板;
- 勾选 / 编辑后,选择「直接发送」「填入对话框」或「关闭」。
工作原理 / 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);数据源为槽位所有者 propssession;session.running作为「输出完成」闸门;动作走标准 propsinputActions.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
npm run build:client # 由 lib/client.js 重新生成 lib/client.bundle.js(产物已提交,仅改动源码后需重跑)
npm run check # 重新生成 bundle 并对全部入口 node --check
node test.mjs # 离线冒烟测试(无标记不触发、多标记块多面板、思维链排除、Host 段落注册、动态体求值)
License
MIT
No comments yet. Be the first to write one.