# dsh-plugin-edit-message

[English](README.md) · **中文** **DSH(DeepSeek Harness)Web GUI 插件:智能体回复被中断后,一键把最后一条用户消息文本载回输入框,改完直接发送——不用再重新打一遍。** ## 为什么做这个 发出一条消息、停止回复、想稍微改一下再重新问,目前只能把整段提示词重新打一遍。本插件在输入框工具行加了一个「编辑上一条消息」按钮:点击后把最后一条用户消息的文本原样载入输入框并聚焦,直接修改、发送即可。 它是**纯客户端插件**——会话日志保持只追加(append-only)。发送编辑后的文本会作为新的一轮**追加**(原消息和被中断的回复仍保留在记录里)。它完全不触碰 host、会话日志或 agent 循环。 ## 安装 插件以 `dsh.bundle` + `dsh.client` 包形式发布,适用于任何能加载第三方 bundle 的 DSH 环境(源码 `dsh web`、DSH Desktop、自定义 profile)。 ### 从 npm 安装(已发布,推荐) ```sh dsh plugin --profile web add dsh-plugin-edit-message ``` 装完后**完全退出并重新打开 GUI**——客户端插件 bundle 在启动时注册。 **DSH Desktop 用户**:Desktop 的 `DSH_HOME` 位于 `%APPDATA%\dsh-desktop\harness`,需显式指定: ```bash DSH_HOME="${APPDATA}/dsh-desktop/harness" \ dsh plugin --profile web add dsh-plugin-edit-message ``` 然后退出重开 DSH Desktop。 ### 从 GitHub 或本地源码安装(未发布版本) ```sh # GitHub 仓库 dsh plugin --profile web add git+https://github.com/WyxBUPT-22/dsh-plugin-edit-message.git # 本地 checkout(先 pnpm install && pnpm run build) dsh plugin --profile web add /path/to/dsh-plugin-edit-message ``` ### 从源码构建安装 仓库完全自包含:devDependencies 从 npm 解析官方 harness 客户端包,**不需要**任何 `deepseek-harness` checkout。 ```sh pnpm install # 从 npm 拉取官方客户端包 pnpm run build # 产出 lib/index.js + lib/client.js + lib/types dsh plugin --profile add /path/to/dsh-plugin-edit-message dsh --profile ``` 卸载:`dsh plugin --profile remove dsh-plugin-edit-message`。`dsh plugin` 的完整用法参见官方 checkout 的 `docs/user/develop/basic/publish.md`。 ## 工作原理 - 注册一个客户端插件(`dsh.client` manifest,`platform: web`),向官方 `conversation.input.left`(输入框工具行左侧,一个文档化的多插件 list 插槽)贡献一个条目——**官方代码零改动**。 - 按钮**仅在以下条件同时成立时显示**:会话空闲、存在最后一条用户/steering 消息、且该消息为纯文本(草稿图片是浏览器 File 引用,无法从持久化日志中复活,因此含图片的消息保持仅复制)。 - 点击行为:`inputActions.setDraft(text)` 恢复文本并聚焦输入框。当部署的运行时暴露 `inputActions.focus` 时优先使用它,否则聚焦可编辑表面——harness 0.1.2+ 上是 `[data-composer-input]`(Lexical 驱动的 `contenteditable`),旧版 composer `