dsh-message-actions 0.2.8 → 0.2.9
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 +13 -5
- package/lib/client.js +15 -5
- package/lib/shared.cjs +11 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -2,17 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README-en.md) | **中文**
|
|
4
4
|
|
|
5
|
-

|
|
6
|
+

|
|
7
7
|

|
|
8
|
-

|
|
9
9
|
[](https://github.com/aijacko/dsh-message-actions)
|
|
10
10
|

|
|
11
11
|
|
|
12
|
-
> **兼容性**:已适配最新版 DSH(`0.2.2-rc.
|
|
12
|
+
> **兼容性**:已适配最新版 DSH(`0.2.2-rc.5`),desktop / web profile 均已实测。
|
|
13
13
|
|
|
14
14
|
**功能:撤回、删除、删至末尾、多选分享与导出;删除会话、回收站、恢复、批量操作;用量计费、余额与费用展示;对话完成提示音。** 宿主本身没有撤回、删除与费用视图,这个插件把这几件事补齐:消息操作、分享导出、会话管理、用量计费全部在本机完成,不上传对话内容。
|
|
15
15
|
|
|
16
|
+
## 界面预览
|
|
17
|
+
|
|
18
|
+
| 消息操作与费用卡片 | 设置 · 消息操作 |
|
|
19
|
+
|---|---|
|
|
20
|
+
|  |  |
|
|
21
|
+
| **设置 · 会话管理** | **设置 · 费用统计** |
|
|
22
|
+
|  |  |
|
|
23
|
+
|
|
16
24
|
## 功能一览
|
|
17
25
|
|
|
18
26
|
### 消息操作
|
|
@@ -73,7 +81,7 @@ pnpm add "file:/path/to/dsh-message-actions"
|
|
|
73
81
|
- 把包名加入 profile `package.json` 的 `dsh.profile.bundles`;**不要**在 `cordis.patch.yml` 里再追加 `insert`,否则可能出现设置无法保存。
|
|
74
82
|
- 升级插件后需**完全退出并重启 DSH**(含托盘 / 后台进程);仅刷新页面不会加载新的客户端代码。
|
|
75
83
|
|
|
76
|
-
已发布版本 `0.2.
|
|
84
|
+
已发布版本 `0.2.9`。
|
|
77
85
|
|
|
78
86
|
## 配置项
|
|
79
87
|
|
package/lib/client.js
CHANGED
|
@@ -652,11 +652,21 @@ function turnSpan(events, nodes, turnIndex, turn) {
|
|
|
652
652
|
|
|
653
653
|
/** 由区间组装一个可落地的删除计划。 */
|
|
654
654
|
function buildPlan(events, nodes, startSeq, endSeq, targetType, action, turn) {
|
|
655
|
-
|
|
655
|
+
let startIdx = nodes.indexOf(startSeq);
|
|
656
656
|
const endIdx = nodes.indexOf(endSeq);
|
|
657
657
|
if (startIdx === -1 || endIdx === -1 || endIdx < startIdx) {
|
|
658
658
|
return { ok: false, code: 'TARGET_NOT_FOUND' };
|
|
659
659
|
}
|
|
660
|
+
// DSH 0.2.2-rc.5 起,surface 节点 0 若是 system/message(系统提示),
|
|
661
|
+
// 只允许由 system/message 精确改写;删除/撤回不能把它卷入替换区间。
|
|
662
|
+
// 轮次区间可能恰好从该节点开始(旧版会话或运行时注入),此时保留系统提示,
|
|
663
|
+
// 从下一个节点开始遮蔽。
|
|
664
|
+
const head = events[startSeq];
|
|
665
|
+
if (startIdx === 0 && head && head.type === 'system/message') {
|
|
666
|
+
if (nodes.length <= 1) return { ok: false, code: 'NOT_DELETABLE' };
|
|
667
|
+
startIdx = 1;
|
|
668
|
+
startSeq = nodes[startIdx];
|
|
669
|
+
}
|
|
660
670
|
const removed = nodes.slice(startIdx, endIdx + 1);
|
|
661
671
|
const kinds = removed.map((seq) => (events[seq] ? events[seq].type : 'unknown'));
|
|
662
672
|
const via = targetType === 'user/message' ? 'user' :
|
|
@@ -2927,7 +2937,7 @@ module.exports = {
|
|
|
2927
2937
|
return module.exports;
|
|
2928
2938
|
})();
|
|
2929
2939
|
// 构建时由 build.mjs 用 package.json 的 version 替换,避免设置页显示旧版本。
|
|
2930
|
-
const VERSION = "0.2.
|
|
2940
|
+
const VERSION = "0.2.9";
|
|
2931
2941
|
|
|
2932
2942
|
const {
|
|
2933
2943
|
ICONS,
|
|
@@ -8296,7 +8306,7 @@ return module.exports;
|
|
|
8296
8306
|
.dma-volume-range:disabled{opacity:.45}
|
|
8297
8307
|
.dma-volume-value{min-width:38px;font-size:12px;font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-secondary,#5b6472);text-align:right}
|
|
8298
8308
|
.dma-cost-note{margin:10px 0 0;font-size:11px;line-height:1.6;color:var(--dsw-alias-label-tertiary,#8a919e)}
|
|
8299
|
-
.dma-setting-primary{height:32px;padding:0 16px;border:0;border-radius:8px;background:var(--dsw-alias-button-primary-fill,#4c8dff);color
|
|
8309
|
+
.dma-setting-primary{height:32px;padding:0 16px;border:0;border-radius:8px;background:var(--dsw-alias-button-primary-fill,#4c8dff);color:var(--dsw-alias-bg-layer-1,#fff);font-size:13px;cursor:pointer}
|
|
8300
8310
|
.dma-setting-primary:disabled{background:var(--dsw-alias-bg-layer-2,#f2f3f5);color:var(--dsw-alias-label-dimmed,#a0a6b0);cursor:default}
|
|
8301
8311
|
.dma-cost-item{flex:1 1 auto;min-width:0}
|
|
8302
8312
|
.dma-cost-card{display:flex;flex-direction:column;gap:3px;min-width:0;padding:5px 8px;border:.5px solid var(--dsw-alias-border-l2,rgba(0,0,0,.08));border-radius:8px;background:var(--dsw-alias-bg-layer-2,#f2f3f5);color:var(--dsw-alias-label-primary,#1f2329)}
|
|
@@ -8374,7 +8384,7 @@ return module.exports;
|
|
|
8374
8384
|
.dma-billing-input:focus{outline:2px solid var(--dsw-alias-state-business-primary,#4c8dff);outline-offset:1px}
|
|
8375
8385
|
.dma-billing-json{min-height:120px}
|
|
8376
8386
|
.dma-billing-actions{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
|
|
8377
|
-
.dma-billing-save{height:28px;padding:0 14px;border:0;border-radius:7px;background:var(--dsw-alias-button-primary-fill,#4c8dff);color
|
|
8387
|
+
.dma-billing-save{height:28px;padding:0 14px;border:0;border-radius:7px;background:var(--dsw-alias-button-primary-fill,#4c8dff);color:var(--dsw-alias-bg-layer-1,#fff);font-size:12px;font-weight:500;cursor:pointer}
|
|
8378
8388
|
.dma-billing-save:disabled{opacity:.6;cursor:default}
|
|
8379
8389
|
.dma-billing-ok{font-size:11.5px;color:#137a4e}
|
|
8380
8390
|
.dma-billing-error{font-size:11.5px;color:#c0392b}
|
|
@@ -8432,7 +8442,7 @@ return module.exports;
|
|
|
8432
8442
|
.dma-stats-money-card{container-type:inline-size}
|
|
8433
8443
|
.dma-stats-money-input{display:inline-flex;flex:0 1 92px;align-items:center;gap:3px;box-sizing:border-box;width:92px;min-width:64px;padding:2px 6px;border:.5px solid var(--dsw-alias-border-l3,#c9ced6);border-radius:6px;background:var(--dsw-alias-bg-layer-1,#fff);font-size:13px;color:var(--dsw-alias-label-tertiary,#8a919e);overflow:hidden}
|
|
8434
8444
|
.dma-stats-money-input input{flex:1 1 auto;width:0;min-width:0;border:0;outline:0;background:transparent;color:var(--dsw-alias-label-primary,#1f2329);font:inherit;font-size:13px;font-variant-numeric:tabular-nums;text-align:right}
|
|
8435
|
-
.dma-stats-money-mini{flex:none;height:25px;padding:0 9px;border:0;border-radius:6px;background:var(--dsw-alias-button-primary-fill,#4c8dff);color
|
|
8445
|
+
.dma-stats-money-mini{flex:none;height:25px;padding:0 9px;border:0;border-radius:6px;background:var(--dsw-alias-button-primary-fill,#4c8dff);color:var(--dsw-alias-bg-layer-1,#fff);font-size:11.5px;font-weight:500;line-height:1;cursor:pointer;white-space:nowrap}
|
|
8436
8446
|
.dma-stats-money-mini:hover{filter:brightness(.95)}
|
|
8437
8447
|
.dma-stats-money-mini:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary,#4c8dff);outline-offset:2px}
|
|
8438
8448
|
.dma-stats-money-mini:disabled{background:var(--dsw-alias-bg-layer-1,#fff);color:var(--dsw-alias-label-dimmed,#a0a6b0);cursor:default;filter:none}
|
package/lib/shared.cjs
CHANGED
|
@@ -610,11 +610,21 @@ function turnSpan(events, nodes, turnIndex, turn) {
|
|
|
610
610
|
|
|
611
611
|
/** 由区间组装一个可落地的删除计划。 */
|
|
612
612
|
function buildPlan(events, nodes, startSeq, endSeq, targetType, action, turn) {
|
|
613
|
-
|
|
613
|
+
let startIdx = nodes.indexOf(startSeq);
|
|
614
614
|
const endIdx = nodes.indexOf(endSeq);
|
|
615
615
|
if (startIdx === -1 || endIdx === -1 || endIdx < startIdx) {
|
|
616
616
|
return { ok: false, code: 'TARGET_NOT_FOUND' };
|
|
617
617
|
}
|
|
618
|
+
// DSH 0.2.2-rc.5 起,surface 节点 0 若是 system/message(系统提示),
|
|
619
|
+
// 只允许由 system/message 精确改写;删除/撤回不能把它卷入替换区间。
|
|
620
|
+
// 轮次区间可能恰好从该节点开始(旧版会话或运行时注入),此时保留系统提示,
|
|
621
|
+
// 从下一个节点开始遮蔽。
|
|
622
|
+
const head = events[startSeq];
|
|
623
|
+
if (startIdx === 0 && head && head.type === 'system/message') {
|
|
624
|
+
if (nodes.length <= 1) return { ok: false, code: 'NOT_DELETABLE' };
|
|
625
|
+
startIdx = 1;
|
|
626
|
+
startSeq = nodes[startIdx];
|
|
627
|
+
}
|
|
618
628
|
const removed = nodes.slice(startIdx, endIdx + 1);
|
|
619
629
|
const kinds = removed.map((seq) => (events[seq] ? events[seq].type : 'unknown'));
|
|
620
630
|
const via = targetType === 'user/message' ? 'user' :
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-message-actions",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "功能:撤回、删除、删至末尾、多选分享与导出;删除会话、回收站、恢复、批量操作;用量计费、余额与费用展示;对话完成提示音。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
"deepseek",
|
|
18
18
|
"plugin"
|
|
19
19
|
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"dsh": "^0.2.2-rc.1"
|
|
22
|
+
},
|
|
20
23
|
"publishConfig": {
|
|
21
24
|
"registry": "https://registry.npmjs.org",
|
|
22
25
|
"access": "public"
|