dsh-composer-rewind 2.0.1 → 2.0.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/README.md +1 -0
- package/client.js +12 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ Composer Rewind 是 DeepSeek Harness Web UI 的输入框状态历史插件。它
|
|
|
27
27
|
- 停止输入约 **450ms** 后更新“当前草稿”;它始终只有一条,原地覆盖。
|
|
28
28
|
- **发送、清空输入框、切换会话、关闭或刷新页面**时,当前草稿进入历史。
|
|
29
29
|
- 10 分钟内同一草稿的前缀修改、回退会合并为一条,保留更完整的版本。
|
|
30
|
+
- 再次发送正文和附件都相同的记录时,不新增条目,而是把原条目刷新到列表最前面;附件按文件名、类型和字节大小判断是否同一文件。
|
|
30
31
|
- 去空白后少于 3 个字符、且没有附件的内容会被忽略。
|
|
31
32
|
- 最多保留 **300 条**,超出后丢弃最旧的一条。
|
|
32
33
|
|
package/client.js
CHANGED
|
@@ -351,8 +351,18 @@ window.__ModuleLoader__.load({
|
|
|
351
351
|
return clean;
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
+
/**
|
|
355
|
+
* Identity of one attachment for de-duplication. The runtime id changes
|
|
356
|
+
* every time the same file is uploaded again, so it cannot be part of the
|
|
357
|
+
* signature; name + byte size + kind is stable across uploads. The id stays
|
|
358
|
+
* on the record for restore and blob lookup.
|
|
359
|
+
*/
|
|
360
|
+
function attachmentFingerprint(item) {
|
|
361
|
+
return [item.kind || 'file', item.name || 'file', item.size || 0].join('');
|
|
362
|
+
}
|
|
363
|
+
|
|
354
364
|
function attachmentKeys(attachments) {
|
|
355
|
-
return (attachments || []).map(
|
|
365
|
+
return (attachments || []).map(attachmentFingerprint).join('|');
|
|
356
366
|
}
|
|
357
367
|
|
|
358
368
|
function sameAttachmentKeys(left, right) {
|
|
@@ -435,7 +445,6 @@ window.__ModuleLoader__.load({
|
|
|
435
445
|
|
|
436
446
|
let entries = loadEntries();
|
|
437
447
|
let live = loadLive();
|
|
438
|
-
let lastRetiredSignature = '';
|
|
439
448
|
const listeners = new Set();
|
|
440
449
|
|
|
441
450
|
function emit() {
|
|
@@ -499,8 +508,6 @@ window.__ModuleLoader__.load({
|
|
|
499
508
|
if (attachments.length === 0 && isJunk(text)) return false;
|
|
500
509
|
|
|
501
510
|
const signature = entrySignature(text, attachments);
|
|
502
|
-
if (lastRetiredSignature === signature) return false;
|
|
503
|
-
|
|
504
511
|
const now = Date.now();
|
|
505
512
|
const fresh = {
|
|
506
513
|
id: uid(),
|
|
@@ -520,9 +527,9 @@ window.__ModuleLoader__.load({
|
|
|
520
527
|
at: now,
|
|
521
528
|
references: fresh.references,
|
|
522
529
|
command: fresh.command,
|
|
530
|
+
attachments: fresh.attachments,
|
|
523
531
|
settings: fresh.settings || head.settings,
|
|
524
532
|
};
|
|
525
|
-
lastRetiredSignature = signature;
|
|
526
533
|
commitEntries([refreshed, ...entries.slice(1)]);
|
|
527
534
|
return true;
|
|
528
535
|
}
|
|
@@ -532,19 +539,16 @@ window.__ModuleLoader__.load({
|
|
|
532
539
|
// Typing more of the same draft: replace the head so references,
|
|
533
540
|
// attachments and setup all describe the newest revision.
|
|
534
541
|
if (sameAttachments && text.startsWith(head.text)) {
|
|
535
|
-
lastRetiredSignature = signature;
|
|
536
542
|
commitEntries([{ ...fresh, id: head.id }, ...entries.slice(1)]);
|
|
537
543
|
return true;
|
|
538
544
|
}
|
|
539
545
|
// Backspacing inside a draft we already hold: keep the fuller head.
|
|
540
546
|
if (sameAttachments && head.text.startsWith(text)) {
|
|
541
|
-
lastRetiredSignature = signature;
|
|
542
547
|
commitEntries([{ ...head, at: now, settings: fresh.settings || head.settings }, ...entries.slice(1)]);
|
|
543
548
|
return true;
|
|
544
549
|
}
|
|
545
550
|
}
|
|
546
551
|
|
|
547
|
-
lastRetiredSignature = signature;
|
|
548
552
|
commitEntries([
|
|
549
553
|
fresh,
|
|
550
554
|
...entries.filter((item) => entrySignature(item.text, item.attachments) !== signature),
|
|
@@ -582,7 +586,6 @@ window.__ModuleLoader__.load({
|
|
|
582
586
|
}
|
|
583
587
|
|
|
584
588
|
function clearAll() {
|
|
585
|
-
lastRetiredSignature = '';
|
|
586
589
|
commitEntries([]);
|
|
587
590
|
}
|
|
588
591
|
|
|
@@ -2729,7 +2732,6 @@ window.__ModuleLoader__.load({
|
|
|
2729
2732
|
reset: () => {
|
|
2730
2733
|
entries = [];
|
|
2731
2734
|
live = null;
|
|
2732
|
-
lastRetiredSignature = '';
|
|
2733
2735
|
recall.index = -1;
|
|
2734
2736
|
recall.at = 0;
|
|
2735
2737
|
recall.text = '';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-composer-rewind",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Composer input history for the DeepSeek Harness Web UI: records composer contents, attachments, command tokens and the active DSH setup, then restores the whole composer state.",
|
|
6
6
|
"keywords": [
|