dsh-message-rewind 1.5.1 → 1.6.0
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/README.en.md +3 -2
- package/README.md +3 -2
- package/client.js +29 -9
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -34,6 +34,7 @@ Edit or roll back your own messages in [DeepSeek Harness](https://github.com/dee
|
|
|
34
34
|
| --- | --- |
|
|
35
35
|
| 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. |
|
|
36
36
|
| Roll back an out-of-line message | Click the rollback icon (the undo arrow) and confirm. The conversation returns to before that message, and every following turn is discarded. |
|
|
37
|
+
| Fix it before resending | A rollback puts that message's text back into the composer below, so you can edit and send it again without retyping. |
|
|
37
38
|
| Restore files too | When rolling back or editing, if that turn recorded file changes and the record is complete, the popover lets you choose **messages only** or **messages and files**. |
|
|
38
39
|
| Stay out of a running task | The action is refused while a turn is still running, so it never races the agent's writes. |
|
|
39
40
|
|
|
@@ -88,7 +89,7 @@ If you prefer editing the profile yourself, the manual route is the same three s
|
|
|
88
89
|
```json
|
|
89
90
|
{
|
|
90
91
|
"dependencies": {
|
|
91
|
-
"dsh-message-rewind": "^1.
|
|
92
|
+
"dsh-message-rewind": "^1.6.0"
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
```
|
|
@@ -122,7 +123,7 @@ The DSH startup log lists `message-rewind` as active. Refresh the page and your
|
|
|
122
123
|
## Usage
|
|
123
124
|
|
|
124
125
|
1. Click the pencil → a popover opens under the button; change the text and click **Save and resend**.
|
|
125
|
-
2. Click the rollback icon (the undo arrow) → click **Roll back** to return to before that message; every following turn is discarded.
|
|
126
|
+
2. Click the rollback icon (the undo arrow) → click **Roll back** to return to before that message; every following turn is discarded. The rolled-back message's text is put back into the composer below for editing and resending (text only; attachments do not return).
|
|
126
127
|
3. The popover reads the file changes recorded after that message as soon as it opens and keeps them collapsed into one line; when files changed and their record is complete it also offers a two-way **Rollback scope**:
|
|
127
128
|
- **Messages only** (default) — leave files untouched;
|
|
128
129
|
- **Messages + files** — restore files to their content before that message;
|
package/README.md
CHANGED
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
| --- | --- |
|
|
37
37
|
| 改掉已发送的消息 | 点消息气泡下方的铅笔,改完点「保存并重发」,这条消息之后的内容会被截断,然后按你改后的内容重新开始 |
|
|
38
38
|
| 回滚一条越界的消息 | 点回滚按钮(撤销箭头),确认后回到这条消息之前,之后的对话一并丢弃 |
|
|
39
|
+
| 回滚后改一改再发 | 回滚会把这条消息的文字放回下面的输入框,直接改、直接发,不用重新打字 |
|
|
39
40
|
| 连文件一起还原 | 回滚或编辑时,如果那一轮动过文件且改动记录完整,按钮下方的小窗会让你选「只回滚消息」还是「连文件一起回滚」 |
|
|
40
41
|
| 不打扰正在跑的任务 | 有未结束的轮次时直接拒绝操作,不会和正在执行的 turn 抢写 |
|
|
41
42
|
|
|
@@ -90,7 +91,7 @@ dsh plugin --profile web add dsh-message-rewind
|
|
|
90
91
|
```json
|
|
91
92
|
{
|
|
92
93
|
"dependencies": {
|
|
93
|
-
"dsh-message-rewind": "^1.
|
|
94
|
+
"dsh-message-rewind": "^1.6.0"
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
```
|
|
@@ -124,7 +125,7 @@ DSH 启动日志里会出现 `message-rewind` 且状态为 active;刷新页面
|
|
|
124
125
|
## 使用
|
|
125
126
|
|
|
126
127
|
1. 点铅笔 → 按钮下方弹出小窗,改完点「保存并重发」。
|
|
127
|
-
2. 点回滚按钮(撤销箭头)→
|
|
128
|
+
2. 点回滚按钮(撤销箭头)→ 点「回滚」,回滚这条消息及其后的全部对话;被回滚这条消息的文字会放回下方输入框,方便改完重发(只回填文字,附件不会回到输入框)。
|
|
128
129
|
3. 小窗打开时就会读取这条消息之后记录到的文件改动:默认折叠成一行「已记录 N 处文件改动」,点开可看路径;改动记录完整且有改动时还会多出一个二选一的回滚范围:
|
|
129
130
|
- **只回滚消息**(默认):文件保持现状;
|
|
130
131
|
- **连文件一起回滚**:文件恢复成这条消息之前的内容;
|
package/client.js
CHANGED
|
@@ -107,7 +107,7 @@ window.__ModuleLoader__.load({
|
|
|
107
107
|
.dmr-action:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
|
|
108
108
|
.dmr-layer{position:fixed;inset:0;z-index:1000;pointer-events:none}
|
|
109
109
|
.dmr-pop{position:fixed;z-index:1;box-sizing:border-box;visibility:hidden;pointer-events:auto;padding:14px 14px 12px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-md);box-shadow:var(--dsw-elevation-prominent);font-size:13px;line-height:20px}
|
|
110
|
-
.dmr-pop-edit{width:min(
|
|
110
|
+
.dmr-pop-edit{width:min(520px,calc(100vw - 16px))}
|
|
111
111
|
.dmr-pop-delete{width:min(320px,calc(100vw - 16px))}
|
|
112
112
|
.dmr-pop[data-ready]{visibility:visible}
|
|
113
113
|
.dmr-pop[data-ready][data-side=bottom]{animation:dmr-drop .15s cubic-bezier(.2,.9,.3,1) both}
|
|
@@ -121,9 +121,9 @@ window.__ModuleLoader__.load({
|
|
|
121
121
|
.dmr-head{margin:0 0 8px}
|
|
122
122
|
.dmr-title{font-size:13px;font-weight:600;line-height:19px;margin:0;color:var(--dsw-alias-label-primary)}
|
|
123
123
|
.dmr-note{font-size:12px;line-height:17px;margin:3px 0 0;color:var(--dsw-alias-label-tertiary)}
|
|
124
|
-
.dmr-body{max-height:min(
|
|
124
|
+
.dmr-body{max-height:min(72vh,calc(100vh - 150px),560px);overflow:auto;overscroll-behavior:contain}
|
|
125
125
|
.dmr-body>:first-child{margin-top:0}
|
|
126
|
-
.dmr-text{display:block;box-sizing:border-box;width:100%;min-height:
|
|
126
|
+
.dmr-text{display:block;box-sizing:border-box;width:100%;min-height:min(180px,32vh);max-height:min(52vh,480px);resize:vertical;margin:0;border:1px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-sm);background:0 0;color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:20px;padding:8px 10px;transition:border-color .12s}
|
|
127
127
|
.dmr-text:hover{border-color:var(--dsw-alias-border-l3)}
|
|
128
128
|
.dmr-text:focus{outline:none;border-color:var(--dsw-alias-state-business-primary)}
|
|
129
129
|
.dmr-files-block{margin:10px 0 0}
|
|
@@ -417,7 +417,7 @@ window.__ModuleLoader__.load({
|
|
|
417
417
|
// Session-added frame that races this reply, so pull the Session list
|
|
418
418
|
// (a refresh) until the row lands before navigating; otherwise
|
|
419
419
|
// `openSession` throws and strands the user on the source conversation.
|
|
420
|
-
async function openCreated(sessionId) {
|
|
420
|
+
async function openCreated(sessionId, draftText) {
|
|
421
421
|
const catalogued = () => {
|
|
422
422
|
try {
|
|
423
423
|
return ctx.sessions.list.getSnapshot().byId[sessionId] !== undefined;
|
|
@@ -430,6 +430,26 @@ window.__ModuleLoader__.load({
|
|
|
430
430
|
await ctx.sessions.refresh().catch(() => {});
|
|
431
431
|
}
|
|
432
432
|
ctx.uiWorkspace.openSession(sessionId);
|
|
433
|
+
restoreDraft(sessionId, draftText);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* A rollback removes the message itself, so put its text back into the
|
|
438
|
+
* replacement conversation's composer: the user can then edit and resend
|
|
439
|
+
* without retyping. The Conversation input hub exposes this draft seed
|
|
440
|
+
* (ui-workspace starts new sessions through it too); a failure must never
|
|
441
|
+
* undo the rollback that already happened.
|
|
442
|
+
*/
|
|
443
|
+
function restoreDraft(sessionId, text) {
|
|
444
|
+
if (typeof text !== 'string' || text.trim() === '') return;
|
|
445
|
+
try {
|
|
446
|
+
const binding = ctx.sessions.binding?.(sessionId);
|
|
447
|
+
const conversation = ctx.get?.('conversation');
|
|
448
|
+
if (binding === undefined || conversation === undefined) return;
|
|
449
|
+
conversation.input?.requestDraftInitialization?.(binding, { prompt: text, whenDraftExists: 'replace' });
|
|
450
|
+
} catch (error) {
|
|
451
|
+
console.warn('[message-rewind] could not put the rolled-back message back into the composer:', error instanceof Error ? error.message : String(error));
|
|
452
|
+
}
|
|
433
453
|
}
|
|
434
454
|
|
|
435
455
|
async function execute(rewindFiles) {
|
|
@@ -447,7 +467,7 @@ window.__ModuleLoader__.load({
|
|
|
447
467
|
sessionId: request.sessionId,
|
|
448
468
|
seq: request.seq,
|
|
449
469
|
action: request.kind,
|
|
450
|
-
text: request.text,
|
|
470
|
+
text: request.kind === 'edit' ? request.text : '',
|
|
451
471
|
rewindFiles,
|
|
452
472
|
clientTimeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
453
473
|
});
|
|
@@ -457,7 +477,7 @@ window.__ModuleLoader__.load({
|
|
|
457
477
|
// Navigate first so the source's client reference is released, then let
|
|
458
478
|
// the host retire its log: the sidebar keeps exactly one conversation.
|
|
459
479
|
try {
|
|
460
|
-
await openCreated(result.sessionId);
|
|
480
|
+
await openCreated(result.sessionId, request.kind === 'delete' ? request.text : undefined);
|
|
461
481
|
} catch (error) {
|
|
462
482
|
// The rollback happened; never retire the source the UI still shows.
|
|
463
483
|
console.warn('[message-rewind] the new conversation could not be opened:', error instanceof Error ? error.message : String(error));
|
|
@@ -520,9 +540,9 @@ window.__ModuleLoader__.load({
|
|
|
520
540
|
void inspectEdit(dialog);
|
|
521
541
|
}
|
|
522
542
|
|
|
523
|
-
function openDelete(sessionId, seq, anchor) {
|
|
543
|
+
function openDelete(sessionId, seq, text, anchor) {
|
|
524
544
|
if (writing()) return;
|
|
525
|
-
publish({ token: {}, instance: ++opens, kind: 'delete', sessionId, seq, text
|
|
545
|
+
publish({ token: {}, instance: ++opens, kind: 'delete', sessionId, seq, text, anchor: anchor ?? null, phase: 'loading', busy: true, error: null, details: null, abort: new AbortController() });
|
|
526
546
|
void check();
|
|
527
547
|
}
|
|
528
548
|
|
|
@@ -672,7 +692,7 @@ window.__ModuleLoader__.load({
|
|
|
672
692
|
const anchor = event?.currentTarget ?? null;
|
|
673
693
|
if (isOpenFor(kind, sessionId, data.seq)) { close(); return; }
|
|
674
694
|
if (kind === 'edit') openEdit(sessionId, data.seq, parts.text, anchor);
|
|
675
|
-
else openDelete(sessionId, data.seq, anchor);
|
|
695
|
+
else openDelete(sessionId, data.seq, parts.text, anchor);
|
|
676
696
|
};
|
|
677
697
|
return h('div', { className: 'dmr-row' },
|
|
678
698
|
renderFactorySlot('conversation.chat.user.content', { content, loadImage, facts, interactive: true }),
|
package/package.json
CHANGED