dsh-message-rewind 0.0.0-stage → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 xCube007
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,136 @@
1
+ # dsh-message-rewind
2
+
3
+ [简体中文](README.md) | **English**
4
+
5
+ Edit and delete your own messages in [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness).
6
+
7
+ - Typo in a sent prompt? Fix it, and the conversation continues from the edited text — no need to start over.
8
+ - Said something you regret? Delete that message and every turn after it disappears with it.
9
+ - Files changed during that turn? Optionally roll them back to the state before the message.
10
+
11
+ ---
12
+
13
+ ## What it does
14
+
15
+ | You want to | What the plugin does |
16
+ | --- | --- |
17
+ | Change a sent message | Click the pencil under your bubble, edit the text, then click **Save and resend**. Everything after that message is truncated and the conversation restarts from your edited text. |
18
+ | Drop an out-of-line message | Click the trash icon and confirm. That message and every following turn are deleted. |
19
+ | Restore files too | When deleting or editing, if that turn recorded file changes, the dialog lets you choose **messages only** or **messages and files**. |
20
+ | Stay out of a running task | The action is refused while a turn is still running, so it never races the agent's writes. |
21
+
22
+ Only messages you sent have these buttons. The **Copy** button is still there, in the same position.
23
+
24
+ ## Screenshots
25
+
26
+ Your own messages get **edit / delete / copy** buttons under the bubble:
27
+
28
+ <img src="img/message-actions.png" alt="Edit, delete and copy buttons under a user message" width="760">
29
+
30
+ The edit dialog lists the file changes recorded after that message as soon as it opens, and the **rollback scope** decides whether files are restored too:
31
+
32
+ | Edit dialog | Delete confirmation |
33
+ | :---: | :---: |
34
+ | <img src="img/edit-dialog.png" alt="Edit dialog with the file list and rollback scope" width="340"> | <img src="img/delete-dialog.png" alt="Delete confirmation with the same rollback scope" width="340"> |
35
+
36
+ Snapshot and Git-worktree limits are shown in the dialog itself, not after a failed operation.
37
+
38
+ ## Install
39
+
40
+ Requires DSH 0.2.1-rc.3 or newer (0.2.x) and Node.js ≥ 20; verified on 0.2.1-rc.5. DSH validates `engines.dsh` at startup and refuses to load the plugin on an older host.
41
+
42
+ ### From npm (recommended)
43
+
44
+ 1. Add the dependency to your profile's `package.json` (`~/.dsh/profiles/<profile>/package.json`):
45
+
46
+ ```json
47
+ {
48
+ "dependencies": {
49
+ "dsh-message-rewind": "^1.1.2"
50
+ }
51
+ }
52
+ ```
53
+
54
+ 2. Register the plugin in the same profile's `cordis.patch.yml`:
55
+
56
+ ```yaml
57
+ - insert:
58
+ - id: message-rewind
59
+ name: 'dsh-message-rewind'
60
+ ```
61
+
62
+ 3. Run `pnpm install` in that profile directory, then restart DSH (or enable it under **Settings → Plugins**).
63
+
64
+ ### From source (if you want to change the code)
65
+
66
+ ```bash
67
+ git clone https://github.com/xCube007/dsh-message-rewind.git D:/Code/dsh-message-rewind
68
+ ```
69
+
70
+ Use a link dependency; the remaining steps are the same:
71
+
72
+ ```json
73
+ "dsh-message-rewind": "link:D:/Code/dsh-message-rewind"
74
+ ```
75
+
76
+ ### After installing
77
+
78
+ The DSH startup log lists `message-rewind` as active. Refresh the page and your own message bubbles get **edit / delete / copy** buttons.
79
+
80
+ ## Usage
81
+
82
+ 1. Click the pencil → the editor opens; change the text and click **Save and resend**.
83
+ 2. Click the trash icon → click **Delete** to remove that message and every following turn.
84
+ 3. The dialog reads the file changes recorded after that message as soon as it opens, and lists them; when files changed (or the snapshots expired) it also offers a **Rollback scope**:
85
+ - **Roll back messages only** (default) — leave files untouched;
86
+ - **Roll back messages and files** — restore files to their content before that message;
87
+ - pick the scope, then click **Save and resend** or **Delete**.
88
+
89
+ Either way, the dialog tells you exactly what will be lost and whether the file rollback can be refused.
90
+
91
+ ## File rollback: what can and cannot be restored
92
+
93
+ **Can be restored:** creating, modifying, and deleting text files — including combinations within one turn, such as "create then delete".
94
+
95
+ **When it cannot, the plugin fails loudly instead of skipping silently:**
96
+
97
+ | Situation | Result |
98
+ | --- | --- |
99
+ | Binary file | Cannot be restored (only text diffs are recorded) |
100
+ | Workspace is not a Git repository and the file was changed by a shell command | Not recorded, so it cannot be restored. Run `git init` in that directory to record everything. |
101
+ | Session restarted or released, so earlier snapshots expired | You are told some snapshots are unavailable; messages-only rollback still works |
102
+ | The file was changed again after being recorded (by you or another tool) | Rollback is **refused** rather than overwriting your later changes |
103
+ | The conversation has no workspace | Messages-only rollback |
104
+
105
+ ## FAQ
106
+
107
+ **Q: Does the sidebar get an extra conversation after a rollback?**
108
+ No — there is always just one conversation with the same name. The underlying session ID does change, though: DSH session logs are append-only and have no "delete a middle chunk" API, so the plugin forks a truncated branch, archives the original out of the sidebar, and deletes its log directory. If you referenced that session ID elsewhere, fetch it again.
109
+
110
+ **Q: Can the original record be recovered?**
111
+ Normally it is deleted. Only when its log directory is still held open and cannot be removed does the original stay in the archive.
112
+
113
+ **Q: Why can't messages with attachments be edited?**
114
+ Attachments are stored as part of the message content, and editing only supports plain-text messages. Messages with attachments can still be deleted.
115
+
116
+ **Q: The button says a turn is still running?**
117
+ Stop the running task first. Also note that queued prompts are discarded together with the deleted record — the dialog warns you about this.
118
+
119
+ **Q: I don't see the buttons.**
120
+ Check that the plugin is enabled under **Settings → Plugins** and that you refreshed the page. Only messages you sent have these buttons.
121
+
122
+ ## Uninstall
123
+
124
+ Remove the `dsh-message-rewind` dependency from your profile's `package.json`, delete the matching `insert` entry from `cordis.patch.yml`, run `pnpm install`, and restart DSH.
125
+
126
+ ## Feedback
127
+
128
+ Found a bug or want a feature? Open an [issue](https://github.com/xCube007/dsh-message-rewind/issues).
129
+
130
+ ## Development
131
+
132
+ To change the code or cut a release, see [CONTRIBUTING.md](https://github.com/xCube007/dsh-message-rewind/blob/main/CONTRIBUTING.md) (in Chinese).
133
+
134
+ ## License
135
+
136
+ MIT
package/README.md CHANGED
@@ -1,3 +1,138 @@
1
- # Temporary Holding Version
1
+ # dsh-message-rewind
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **简体中文** | [English](README.en.md)
4
+
5
+ 给 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 的消息气泡加两个按钮:**编辑**和**删除**。
6
+
7
+ - 发错字了?改一下,直接从改后的内容重新开始,不用重开对话。
8
+ - 说话越界了?删掉这条,它之后的所有对话一起消失。
9
+ - 那一轮还改过文件?可以顺手把文件也还原到这条消息之前的样子。
10
+
11
+ > A DSH plugin that adds **edit** and **delete** to your own message bubbles. Deleting truncates every following turn and can optionally roll the recorded file changes back.
12
+
13
+ ---
14
+
15
+ ## 它能做什么
16
+
17
+ | 你想要的 | 插件怎么帮你 |
18
+ | --- | --- |
19
+ | 改掉已发送的消息 | 点消息气泡下方的铅笔,改完点「保存并重发」,这条消息之后的内容会被截断,然后按你改后的内容重新开始 |
20
+ | 撤掉一条越界的消息 | 点垃圾桶,确认后这条消息连同它之后的所有对话一起删除 |
21
+ | 连文件一起还原 | 删除/编辑时,如果那一轮动过文件,弹窗会让你选「只回滚消息」还是「同时回滚消息和文件」 |
22
+ | 不打扰正在跑的任务 | 有未结束的轮次时直接拒绝操作,不会和正在执行的 turn 抢写 |
23
+
24
+ 只有你自己发出的消息才有这两个按钮;「复制」按钮仍在,位置不变。
25
+
26
+ ## 界面
27
+
28
+ 自己发出的消息,气泡下方会多出「编辑 / 删除 / 复制」三个按钮:
29
+
30
+ <img src="img/message-actions.png" alt="消息气泡下方的编辑、删除、复制按钮" width="760">
31
+
32
+ 编辑弹窗打开时就会列出这条消息之后记录到的文件改动,并用「回滚范围」决定要不要连文件一起还原:
33
+
34
+ | 编辑弹窗 | 删除确认 |
35
+ | :---: | :---: |
36
+ | <img src="img/edit-dialog.png" alt="编辑弹窗:文件改动列表和回滚范围" width="340"> | <img src="img/delete-dialog.png" alt="删除确认框:与编辑共用同一个回滚范围" width="340"> |
37
+
38
+ 快照失效、工作区不在 Git 仓库等限制也会直接标在弹窗里,不用等到操作失败才知道。
39
+
40
+ ## 安装
41
+
42
+ 需要 DSH 0.2.1-rc.3 及以上(0.2.x),Node.js ≥ 20;已在 0.2.1-rc.5 上验证。宿主启动时会按 `engines.dsh` 校验,低于该版本会拒绝加载。
43
+
44
+ ### 从 npm 安装(推荐)
45
+
46
+ 1. 在 profile 的 `package.json`(`~/.dsh/profiles/<profile>/package.json`)里加依赖:
47
+
48
+ ```json
49
+ {
50
+ "dependencies": {
51
+ "dsh-message-rewind": "^1.1.2"
52
+ }
53
+ }
54
+ ```
55
+
56
+ 2. 在同一个 profile 的 `cordis.patch.yml` 里挂上插件:
57
+
58
+ ```yaml
59
+ - insert:
60
+ - id: message-rewind
61
+ name: 'dsh-message-rewind'
62
+ ```
63
+
64
+ 3. 在该 profile 目录执行 `pnpm install`,然后重启 DSH(或在「设置 → 插件」里启用)。
65
+
66
+ ### 从源码安装(想改代码时用)
67
+
68
+ ```bash
69
+ git clone https://github.com/xCube007/dsh-message-rewind.git D:/Code/dsh-message-rewind
70
+ ```
71
+
72
+ 依赖写成链接形式,其余步骤相同:
73
+
74
+ ```json
75
+ "dsh-message-rewind": "link:D:/Code/dsh-message-rewind"
76
+ ```
77
+
78
+ ### 装好之后
79
+
80
+ DSH 启动日志里会出现 `message-rewind` 且状态为 active;刷新页面,你自己消息的气泡下方就会多出「编辑 / 删除 / 复制」三个按钮。
81
+
82
+ ## 使用
83
+
84
+ 1. 点铅笔 → 弹出编辑框,改完点「保存并重发」。
85
+ 2. 点垃圾桶 → 点「删除」,删除这条消息及其后的全部对话。
86
+ 3. 弹窗打开时就会读取这条消息之后记录到的文件改动,并列出来;有改动(或快照已失效)时,弹窗里会多出一个「回滚范围」:
87
+ - **只回滚消息**(默认):文件保持现状;
88
+ - **同时回滚消息和文件**:文件恢复成这条消息之前的内容;
89
+ - 选好范围后,点「保存并重发」或「删除」执行。
90
+
91
+ 无论选哪个,弹窗里都会明确告诉你这次操作会丢掉哪些内容、以及文件回滚会不会被拒绝。
92
+
93
+ ## 文件回滚:什么能回、什么回不了
94
+
95
+ **能回**:文本文件的新建、修改、删除——包括同一轮里「先新建再删掉」这类组合。
96
+
97
+ **回不了时会直接报错,不会静默跳过**:
98
+
99
+ | 情况 | 结果 |
100
+ | --- | --- |
101
+ | 二进制文件 | 无法回滚(只记录了文本 diff) |
102
+ | 工作区不在 Git 仓库内,且文件是被 shell 命令改的 | 无法记录,因而无法回滚;在该目录 `git init` 后可完整记录 |
103
+ | 会话重启或释放后,早先的快照已过期 | 提示「部分改动快照已不可用」,此时只能只回滚消息 |
104
+ | 文件在记录之后又被你(或别的工具)改过 | 回滚会被**拒绝**,不会覆盖掉你后来的改动 |
105
+ | 这个会话没有工作区 | 只能只回滚消息 |
106
+
107
+ ## 常见问题
108
+
109
+ **Q:回滚之后,侧边栏是不是会多出一条对话?**
110
+ 不会,始终只有一条同名对话。但底层会话 ID 会变:DSH 的会话日志是只追加的,没有「删掉中间一段」的接口,插件只能 fork 出一个截断后的分支,再把原会话移出侧边栏并删除其日志目录。所以如果你在别处引用过这个会话 ID,需要重新取一次。
111
+
112
+ **Q:原会话的记录还能找回吗?**
113
+ 正常情况下会被删除。只有当日志目录被占用删不掉时,原会话会保留在归档里。
114
+
115
+ **Q:为什么带附件的消息不能编辑?**
116
+ 附件是作为消息内容的一部分存下来的,编辑只支持纯文本消息。带附件的消息可以删除。
117
+
118
+ **Q:点按钮提示「当前有未结束的轮次」?**
119
+ 先停止正在运行的任务再操作。另外,如果有排队中的消息,它们会随被删除的记录一起作废——弹窗里会提示。
120
+
121
+ **Q:看不到按钮?**
122
+ 确认插件已在「设置 → 插件」里启用、并且刷新过一次页面;另外只有你自己发的消息才有这两个按钮。
123
+
124
+ ## 卸载
125
+
126
+ 从 profile 的 `package.json` 里删掉 `dsh-message-rewind` 依赖,并删掉 `cordis.patch.yml` 里对应的 `insert` 段,`pnpm install` 后重启 DSH。
127
+
128
+ ## 反馈
129
+
130
+ 遇到问题或想加功能,欢迎提 [Issue](https://github.com/xCube007/dsh-message-rewind/issues)。
131
+
132
+ ## 开发
133
+
134
+ 想改代码或自己发版,看 [CONTRIBUTING.md](https://github.com/xCube007/dsh-message-rewind/blob/main/CONTRIBUTING.md)。
135
+
136
+ ## License
137
+
138
+ MIT