@240xu/dsh-message-ops 0.11.4 → 0.11.6
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 +10 -0
- package/package.json +1 -1
- package/src/client.js +20 -5
- package/src/index.js +9 -3
- package/src/ops-core.js +13 -2
package/README.md
CHANGED
|
@@ -89,6 +89,16 @@ dsh plugin --profile web add file:C:/path/to/dsh-message-ops
|
|
|
89
89
|
| POST | `/api/message-ops/session/restore` | `{trashId}` 从回收站恢复目录与投影/工作区元数据 |
|
|
90
90
|
| POST | `/api/message-ops/session/purge` | `{trashId}` 永久删除(唯一 destructive 操作) |
|
|
91
91
|
|
|
92
|
+
### 0.11.5 · restore 进度落盘 + `turnAligned` 可观测
|
|
93
|
+
|
|
94
|
+
- **磁盘 restore 漏写 `restoredSourceSeqs`(数据正确性)**:`buildRestoreNoticeEvent`
|
|
95
|
+
只写 `restoresSeq`,而 `restoreProgress` 靠 `restoredSourceSeqs` 累计已重放项。
|
|
96
|
+
结果每次恢复都被判 `legacy`(`complete:true` 但 `restoredSeqs` 恒空)→ 进度不可见,
|
|
97
|
+
且下一轮 `excludeSeqs` 为空 → **同一区间被反复重放**(实测 008f3759 两轮各 209 条)。
|
|
98
|
+
磁盘路径改为把 `plan.replayable.map(i => i.seq)` 落进 notice;discard 时不写。
|
|
99
|
+
- `/revert` 与 `/restore` 响应新增 `turnAligned`:live 路径应为 `true`,
|
|
100
|
+
disk/store-miss 路径没有内存 agent,`false` 属正常。便于运行时确认游标对齐是否生效。
|
|
101
|
+
|
|
92
102
|
### 0.11.4 · turn 游标对齐真正生效(会话损坏 P0 续)
|
|
93
103
|
|
|
94
104
|
- **`alignLiveTurnCursor` 此前从未执行**:插件 `export const inject = []`
|
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -425,13 +425,25 @@ window.__ModuleLoader__.load({
|
|
|
425
425
|
}
|
|
426
426
|
|
|
427
427
|
// 头部按钮图标:三叉分支(git-branch 风格,16x16)。
|
|
428
|
-
|
|
428
|
+
// ⚠️ 这条 path 是按**描边**(stroke)设计的:圆点用 arc 画、连接线用
|
|
429
|
+
// `v3.44` / `V6.28` / `v.85` 这类**零宽度线段**。若用 fill 渲染,线段没有
|
|
430
|
+
// 面积 → 整条分支线消失,只剩几个孤立色块(0.11.x 实测症状:
|
|
431
|
+
// 「那个 svg 渲染有问题」)。必须 stroke + round cap/join。
|
|
432
|
+
const BRANCH_PATHS = [
|
|
433
|
+
'M5 2.5a2 2 0 1 1-.9 3.78v3.44a2 2 0 1 1-1.2 0V6.28A2 2 0 1 1 5 2.5Zm0 1.2a.8.8 0 1 0 0 1.6.8.8 0 0 0 0-1.6ZM3.5 11.5a.8.8 0 1 0 1.6 0 .8.8 0 0 0-1.6 0ZM12.5 2.5a2 2 0 0 1 .6 3.9v.85c0 1.9-1.54 3.44-3.44 3.44H8.03a2 2 0 1 1 0-1.2h1.63a2.24 2.24 0 0 0 2.24-2.24V6.4a2 2 0 0 1 .6-3.9Zm0 1.2a.8.8 0 1 0 0 1.6.8.8 0 0 0 0-1.6Z',
|
|
434
|
+
]
|
|
429
435
|
|
|
430
436
|
function BranchIcon() {
|
|
431
437
|
return React.createElement('svg', {
|
|
432
438
|
width: 16, height: 16, viewBox: '0 0 16 16', fill: 'none',
|
|
433
439
|
xmlns: 'http://www.w3.org/2000/svg',
|
|
434
|
-
|
|
440
|
+
'aria-hidden': 'true', focusable: 'false',
|
|
441
|
+
}, React.createElement('path', {
|
|
442
|
+
d: BRANCH_PATHS[0],
|
|
443
|
+
stroke: 'currentColor', strokeWidth: 1.4,
|
|
444
|
+
strokeLinecap: 'round', strokeLinejoin: 'round',
|
|
445
|
+
fill: 'none',
|
|
446
|
+
}))
|
|
435
447
|
}
|
|
436
448
|
|
|
437
449
|
// --- 共享对话框 -------------------------------------------------------------
|
|
@@ -758,8 +770,11 @@ window.__ModuleLoader__.load({
|
|
|
758
770
|
const tag = document.createElement('style')
|
|
759
771
|
tag.id = 'dsh-message-ops-panel-style'
|
|
760
772
|
tag.textContent = [
|
|
761
|
-
'.mopsPanelScrim{position:fixed;inset:0;z-index:1200;background:rgba(15,17,21,.
|
|
762
|
-
'
|
|
773
|
+
'.mopsPanelScrim{position:fixed;inset:0;z-index:1200;background:rgba(15,17,21,.28);display:flex;align-items:center;justify-content:center;padding:24px;animation:mopsFade .12s ease-out}',
|
|
774
|
+
'@keyframes mopsFade{from{opacity:0}to{opacity:1}}',
|
|
775
|
+
'@keyframes mopsRise{from{opacity:0;transform:translateY(8px) scale(.985)}to{opacity:1;transform:none}}',
|
|
776
|
+
'.mopsPanel{width:560px;max-width:min(560px,100%);height:min(760px,100%);max-height:100%;display:flex;flex-direction:column;background:var(--dsw-alias-bg-primary,#fff);color:var(--dsw-alias-label-primary,#0f1115);border:1px solid var(--dsw-alias-border-l2,#e6e6e6);box-shadow:0 24px 64px rgba(15,17,21,.24);font-family:inherit;font-size:13px;line-height:1.45;animation:mopsRise .16s cubic-bezier(.2,.8,.3,1)}',
|
|
777
|
+
'@media(prefers-reduced-motion:reduce){.mopsPanelScrim,.mopsPanel{animation:none}}',
|
|
763
778
|
'.mopsPanel *{box-sizing:border-box}',
|
|
764
779
|
'.mopsPanel button{font:inherit;color:inherit;border-radius:0}',
|
|
765
780
|
'.mopsPanelHead{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:16px 18px 12px;border-bottom:1px solid var(--dsw-alias-border-l2,#e6e6e6)}',
|
|
@@ -825,7 +840,7 @@ window.__ModuleLoader__.load({
|
|
|
825
840
|
'.mopsTrashMain{flex:1;min-width:0}',
|
|
826
841
|
'.mopsTrashTitle{font-size:12px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}',
|
|
827
842
|
'.mopsTrashMeta{font-size:10px;color:var(--dsw-alias-label-tertiary,#8a8a8e);margin-top:2px}',
|
|
828
|
-
'@media(max-width:760px){.mopsPanel{width:
|
|
843
|
+
'@media(max-width:760px){.mopsPanelScrim{padding:0}.mopsPanel{width:100%;height:100%;max-width:100%;max-height:100%;border:0}.mopsDetail{max-height:42%}}',
|
|
829
844
|
].join('')
|
|
830
845
|
document.head.appendChild(tag)
|
|
831
846
|
} catch { /* style failure must not break the panel */ }
|
package/src/index.js
CHANGED
|
@@ -667,11 +667,14 @@ async function opsCommit(targetCtx, mode, sessionId, seq) {
|
|
|
667
667
|
const event = applySurfaceReplace(session, plan.startSeq, plan.endSeq, plan.shadowedSeqs, text, turnStep);
|
|
668
668
|
// 必须闭合:否则引擎内存里 turn 永远开着 → isRunning 恒真 → 后续操作全被 409
|
|
669
669
|
closeWindow()
|
|
670
|
-
|
|
670
|
+
const aligned = win.synthetic ? alignLiveTurnCursor(targetCtx, session, win.turn) : false;
|
|
671
671
|
flushSessions(targetCtx, session);
|
|
672
672
|
return {
|
|
673
673
|
ok: true, mode, seq,
|
|
674
674
|
syntheticTurn: win.synthetic === true,
|
|
675
|
+
// 0.11.4:暴露对齐结果。live 路径必须 true;disk 路径(store-miss)没有
|
|
676
|
+
// 内存 agent,false 属正常。若 live 也 false,下一条真实消息就会重号。
|
|
677
|
+
turnAligned: aligned,
|
|
675
678
|
shadowedCount: plan.shadowedSeqs.length,
|
|
676
679
|
eventSeq: event && event.seq != null ? event.seq : null,
|
|
677
680
|
};
|
|
@@ -748,8 +751,8 @@ async function opsRestore(targetCtx, sessionId, restoreSeq, upToSeq, discard) {
|
|
|
748
751
|
flush: () => { flushSessions(targetCtx, acq.session); },
|
|
749
752
|
});
|
|
750
753
|
for (const post of noticeWindowPostamble(win)) acq.session.append(post.kind, post.data);
|
|
751
|
-
|
|
752
|
-
return { ok: true, ...result, discarded: plan.discard === true, upToSeq: plan.upToSeq, restoredSourceSeqs: plan.replayable.map((i) => i.seq), range: { startSeq: plan.startSeq, endSeq: plan.endSeq } };
|
|
754
|
+
const aligned = win.synthetic ? alignLiveTurnCursor(targetCtx, acq.session, win.turn) : false;
|
|
755
|
+
return { ok: true, ...result, turnAligned: aligned, discarded: plan.discard === true, upToSeq: plan.upToSeq, restoredSourceSeqs: plan.replayable.map((i) => i.seq), range: { startSeq: plan.startSeq, endSeq: plan.endSeq } };
|
|
753
756
|
} catch (err) {
|
|
754
757
|
for (const post of noticeWindowPostamble(win)) {
|
|
755
758
|
try { acq.session.append(post.kind, post.data); } catch { /* postamble 被引擎拒:维持原错误上抛 */ }
|
|
@@ -774,6 +777,9 @@ async function opsRestore(targetCtx, sessionId, restoreSeq, upToSeq, discard) {
|
|
|
774
777
|
: restoreNoticeText(plan),
|
|
775
778
|
restoreSeq: plan.restoreSeq,
|
|
776
779
|
discard: plan.discard === true,
|
|
780
|
+
// 0.11.4:把本轮实际重放的源 seq 落进 notice,restoreProgress 才能累计进度、
|
|
781
|
+
// 下一轮 excludeSeqs 才不会重复重放同一批消息(详见 ops-core 该函数注释)。
|
|
782
|
+
restoredSourceSeqs: plan.discard ? [] : plan.replayable.map((i) => i.seq),
|
|
777
783
|
}));
|
|
778
784
|
let offset = 0;
|
|
779
785
|
for (const item of plan.discard ? [] : plan.replayable) {
|
package/src/ops-core.js
CHANGED
|
@@ -947,8 +947,18 @@ export function buildMarkerEvent({ seq, time, turnStep, text, startSeq, endSeq,
|
|
|
947
947
|
};
|
|
948
948
|
}
|
|
949
949
|
|
|
950
|
-
/**
|
|
951
|
-
|
|
950
|
+
/**
|
|
951
|
+
* 磁盘恢复说明事件(restoresSeq → dock 移除该行;surfaceOp 恒 "append")。
|
|
952
|
+
*
|
|
953
|
+
* 0.11.4:必须写入 `restoredSourceSeqs`。`restoreProgress` 靠它累计「已重放哪些
|
|
954
|
+
* 源 seq」来算 pending/complete;旧实现只写 `restoresSeq`,于是每次恢复都被判
|
|
955
|
+
* `legacy`(`complete:true` 但 `restoredSeqs` 恒空)→ 进度不可见,且下一轮
|
|
956
|
+
* `excludeSeqs` 为空 → 同一区间被**反复重放**(实测 008f3759 两轮各 209 条)。
|
|
957
|
+
*/
|
|
958
|
+
export function buildRestoreNoticeEvent({ seq, time, turnStep, text, restoreSeq, discard, restoredSourceSeqs, version = 4 }) {
|
|
959
|
+
const restored = Array.isArray(restoredSourceSeqs)
|
|
960
|
+
? [...new Set(restoredSourceSeqs.filter((q) => Number.isSafeInteger(q)))]
|
|
961
|
+
: [];
|
|
952
962
|
return {
|
|
953
963
|
type: "system/message",
|
|
954
964
|
seq,
|
|
@@ -958,6 +968,7 @@ export function buildRestoreNoticeEvent({ seq, time, turnStep, text, restoreSeq,
|
|
|
958
968
|
step: turnStep.step,
|
|
959
969
|
message: { id: randomUUID(), role: "system", source: messageSource("system", version), content: [{ type: "text", text }] },
|
|
960
970
|
restoresSeq: restoreSeq,
|
|
971
|
+
...(restored.length > 0 ? { restoredSourceSeqs: restored } : {}),
|
|
961
972
|
...(discard ? { discarded: true } : {}),
|
|
962
973
|
},
|
|
963
974
|
surfaceOp: "append",
|