@xsok/dsh-enhanced 0.2.2-7 → 0.2.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/CHANGELOG.md +28 -0
- package/README.md +1 -15
- package/client.js +532 -21
- package/host/engine/archive.js +23 -7
- package/host/engine/index.js +18 -3
- package/host/engine/projcache.js +38 -1
- package/host/engine/sessions.js +35 -3
- package/host/schedule.js +30 -11
- package/host/sync.js +15 -0
- package/index.js +62 -0
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -73,6 +73,10 @@ window.__ModuleLoader__.load({
|
|
|
73
73
|
'restart.desc': 'Restart the desktop app now?',
|
|
74
74
|
'restart.confirm': 'Restart',
|
|
75
75
|
'restart.busy': 'A turn is still running. Stop it, then restart.',
|
|
76
|
+
'restart.auto': '{reason} · restarting in {seconds}s',
|
|
77
|
+
'restart.reason.sync': 'Sync done',
|
|
78
|
+
'restart.reason.move': 'Session moved',
|
|
79
|
+
'restart.reason.restore': 'Cloud applied',
|
|
76
80
|
'overwrite.cloud': 'Overwrite cloud',
|
|
77
81
|
'overwrite.local': 'Overwrite this machine',
|
|
78
82
|
'overwrite.awayCloud': 'Replaces the cloud with this machine\'s data. Nothing is merged.',
|
|
@@ -172,7 +176,9 @@ window.__ModuleLoader__.load({
|
|
|
172
176
|
'sync.attachments': 'Sync attachments',
|
|
173
177
|
'sync.probe': 'Check',
|
|
174
178
|
'sync.run': 'Sync now',
|
|
179
|
+
'sync.run.hint': 'Ctrl+Alt+Shift+T',
|
|
175
180
|
'sync.running': 'Syncing…',
|
|
181
|
+
'sync.done': 'Sessions synced',
|
|
176
182
|
'sync.never': 'Not run yet.',
|
|
177
183
|
'sync.last': 'Last run: {time} · {result} · {ms} ms',
|
|
178
184
|
'sync.result.ok': 'ok',
|
|
@@ -212,6 +218,12 @@ window.__ModuleLoader__.load({
|
|
|
212
218
|
'delete.failed': 'Delete failed: {message}',
|
|
213
219
|
'delete.blocked': 'A running session cannot be deleted.',
|
|
214
220
|
'move.label': 'Move to workspace…',
|
|
221
|
+
'hover.sessionId': 'Session ID: ',
|
|
222
|
+
'hover.copy.title': 'Session name',
|
|
223
|
+
'hover.copy.id': 'Session ID',
|
|
224
|
+
'hover.copy.path': 'Workspace path',
|
|
225
|
+
'hover.copy.done': 'Copied: {label}',
|
|
226
|
+
'hover.copy.failed': 'Copy failed: {label}',
|
|
215
227
|
'move.running': 'Move to workspace (running)',
|
|
216
228
|
'move.title': 'Move to workspace',
|
|
217
229
|
'move.desc': 'Moves the session into the target workspace in place: the session itself is unchanged and only its working directory becomes the target. Later tool calls run there. The new grouping appears after the app restarts.',
|
|
@@ -264,6 +276,10 @@ window.__ModuleLoader__.load({
|
|
|
264
276
|
'restart.desc': '立即重启桌面应用?',
|
|
265
277
|
'restart.confirm': '重启',
|
|
266
278
|
'restart.busy': '有任务正在运行,结束或停止后再重启。',
|
|
279
|
+
'restart.auto': '{reason} · 即将自动重启 {seconds}s',
|
|
280
|
+
'restart.reason.sync': '同步完成',
|
|
281
|
+
'restart.reason.move': '会话已移动',
|
|
282
|
+
'restart.reason.restore': '已应用云端',
|
|
267
283
|
'overwrite.cloud': '覆盖云端',
|
|
268
284
|
'overwrite.local': '覆盖本机',
|
|
269
285
|
'overwrite.awayCloud': '将以本机数据完全替换云端,不做合并。',
|
|
@@ -363,7 +379,9 @@ window.__ModuleLoader__.load({
|
|
|
363
379
|
'sync.attachments': '同步附件',
|
|
364
380
|
'sync.probe': '检查',
|
|
365
381
|
'sync.run': '立即同步',
|
|
382
|
+
'sync.run.hint': 'Ctrl+Alt+Shift+T',
|
|
366
383
|
'sync.running': '正在同步…',
|
|
384
|
+
'sync.done': '会话同步完成',
|
|
367
385
|
'sync.never': '尚未运行。',
|
|
368
386
|
'sync.last': '上次同步:{time} · {result} · {ms} ms',
|
|
369
387
|
'sync.result.ok': '成功',
|
|
@@ -403,6 +421,12 @@ window.__ModuleLoader__.load({
|
|
|
403
421
|
'delete.failed': '删除失败:{message}',
|
|
404
422
|
'delete.blocked': '运行中的会话不可删除。',
|
|
405
423
|
'move.label': '移动到工作区…',
|
|
424
|
+
'hover.sessionId': '会话ID:',
|
|
425
|
+
'hover.copy.title': '会话名称',
|
|
426
|
+
'hover.copy.id': '会话ID',
|
|
427
|
+
'hover.copy.path': '工作区路径',
|
|
428
|
+
'hover.copy.done': '已复制:{label}',
|
|
429
|
+
'hover.copy.failed': '复制失败:{label}',
|
|
406
430
|
'move.running': '移动到工作区(运行中)',
|
|
407
431
|
'move.title': '移动到工作区',
|
|
408
432
|
'move.desc': '将该会话整体移入目标工作区:会话本身不变,只是工作目录改到目标目录,之后的工具调用会在那里执行。分组变化需要重启应用后完全生效。',
|
|
@@ -574,9 +598,14 @@ window.__ModuleLoader__.load({
|
|
|
574
598
|
.dshe-preset-chip{display:inline-flex;align-items:center;gap:4px}
|
|
575
599
|
.dshe-action-active{background:var(--dsw-alias-brand-primary,#3b6ef5);color:#fff;border-color:transparent}
|
|
576
600
|
.dshe-action-danger{color:var(--dsw-alias-state-error-primary,#c0392b);border-color:color-mix(in srgb,var(--dsw-alias-state-error-primary,#c0392b) 45%,transparent)}
|
|
577
|
-
.dshe-toast{position:
|
|
578
|
-
|
|
579
|
-
|
|
601
|
+
.dshe-toast{position:static;pointer-events:auto;z-index:2010;
|
|
602
|
+
background:rgba(24,26,30,.96);color:#fff;border:1px solid rgba(255,255,255,.18);
|
|
603
|
+
border-radius:14px;padding:10px 18px;font-size:13px;line-height:1.5;
|
|
604
|
+
box-shadow:0 18px 40px rgba(0,0,0,.38);max-width:70vw;user-select:none}
|
|
605
|
+
.dshe-toast[data-kind="error"]{color:#ff4600}
|
|
606
|
+
.dshe-toast-spinner{display:inline-block;width:14px;height:14px;margin-left:8px;vertical-align:-2px;
|
|
607
|
+
animation:dshe-toast-spin .8s linear infinite}
|
|
608
|
+
@keyframes dshe-toast-spin{to{transform:rotate(360deg)}}
|
|
580
609
|
`;
|
|
581
610
|
|
|
582
611
|
// ── store ────────────────────────────────────────────────────────────────
|
|
@@ -592,9 +621,12 @@ window.__ModuleLoader__.load({
|
|
|
592
621
|
deleteBusy: false,
|
|
593
622
|
deleteError: null,
|
|
594
623
|
move: { open: false, sessionId: null, title: '', loading: false, current: null, workspaces: [], targetId: null, error: null, busy: false },
|
|
595
|
-
sync: { loading: false, busy: false, target: null, state: null, error: null, showLog: false, webdav: null, webdavBusy: false, history: [], historyOpen: null, historyLimit:
|
|
624
|
+
sync: { loading: false, busy: false, target: null, state: null, error: null, showLog: false, webdav: null, webdavBusy: false, history: [], historyOpen: null, historyLimit: 20, auto: null },
|
|
596
625
|
overwrite: { open: false, direction: 'cloud', busy: false, preview: null, error: null },
|
|
597
626
|
restartConfirm: false,
|
|
627
|
+
syncLive: false,
|
|
628
|
+
syncDone: false,
|
|
629
|
+
restartCountdown: null,
|
|
598
630
|
presetEdit: null,
|
|
599
631
|
presetReplace: null,
|
|
600
632
|
pauseOpen: false,
|
|
@@ -617,6 +649,8 @@ window.__ModuleLoader__.load({
|
|
|
617
649
|
&& trim(item.root) === trim(settings.webdavRoot);
|
|
618
650
|
}
|
|
619
651
|
|
|
652
|
+
let restartCountdownTimer = null;
|
|
653
|
+
|
|
620
654
|
const store = {
|
|
621
655
|
get: () => state,
|
|
622
656
|
subscribe(listener) {
|
|
@@ -638,9 +672,26 @@ window.__ModuleLoader__.load({
|
|
|
638
672
|
},
|
|
639
673
|
toast(kind, text) {
|
|
640
674
|
if (toastTimer !== null) clearTimeout(toastTimer);
|
|
675
|
+
toastTimer = null;
|
|
641
676
|
store.set({ toast: { kind, text, id: Date.now() } });
|
|
642
677
|
toastTimer = setTimeout(() => store.set({ toast: null }), kind === 'error' ? 5000 : 3000);
|
|
643
678
|
},
|
|
679
|
+
/** A notice that stays until the work finishes; the spinner shows progress. */
|
|
680
|
+
toastBusy(text) {
|
|
681
|
+
if (toastTimer !== null) {
|
|
682
|
+
clearTimeout(toastTimer);
|
|
683
|
+
toastTimer = null;
|
|
684
|
+
}
|
|
685
|
+
store.set({ toast: { kind: 'info', text, spinner: true, id: Date.now() } });
|
|
686
|
+
},
|
|
687
|
+
/** Remove the sticky notice once the work has an answer of its own. */
|
|
688
|
+
clearToast() {
|
|
689
|
+
if (toastTimer !== null) {
|
|
690
|
+
clearTimeout(toastTimer);
|
|
691
|
+
toastTimer = null;
|
|
692
|
+
}
|
|
693
|
+
store.set({ toast: null });
|
|
694
|
+
},
|
|
644
695
|
async init() {
|
|
645
696
|
try {
|
|
646
697
|
const data = await runtime.rpc('state');
|
|
@@ -653,6 +704,43 @@ window.__ModuleLoader__.load({
|
|
|
653
704
|
store.set({ ready: true });
|
|
654
705
|
console.warn('[dsh-enhanced] initial state failed:', error);
|
|
655
706
|
}
|
|
707
|
+
// Launch-time catch-up: runs regardless of the automatic sync switch.
|
|
708
|
+
window.setTimeout(() => { void store.startupSync(); }, 2000);
|
|
709
|
+
// Follow the automatic sync only; the manual one has its own notice.
|
|
710
|
+
// The call waits until the run flips, so there is no polling timer.
|
|
711
|
+
void store.watchSyncState();
|
|
712
|
+
},
|
|
713
|
+
/**
|
|
714
|
+
* Sync once shortly after launch, reusing the normal run path.
|
|
715
|
+
*
|
|
716
|
+
* Doing it here (instead of on the host) means a restart that follows can
|
|
717
|
+
* show its countdown in the UI first.
|
|
718
|
+
*/
|
|
719
|
+
async startupSync() {
|
|
720
|
+
// Launch-time catch-up: unconditional on the sync switch, but it must not
|
|
721
|
+
// run while a turn is in progress.
|
|
722
|
+
if (store.get().sync.busy === true) return;
|
|
723
|
+
// The composer status line follows the launch run just like a manual one.
|
|
724
|
+
store.set({ sync: { ...store.get().sync, busy: true, error: null }, syncDone: false });
|
|
725
|
+
try {
|
|
726
|
+
const data = await runtime.rpc('sync.run', { quiet: true });
|
|
727
|
+
if (data?.skipped === 'busy') {
|
|
728
|
+
store.set({ sync: { ...store.get().sync, busy: false } });
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
store.set({
|
|
732
|
+
sync: { ...store.get().sync, busy: false, state: data, error: null },
|
|
733
|
+
syncDone: data?.ok !== false,
|
|
734
|
+
});
|
|
735
|
+
await store.loadSync();
|
|
736
|
+
const pulled = Number(data?.summary?.sessions?.pulled) || Number(data?.summary?.sessions?.created) || 0;
|
|
737
|
+
const repaired = Number(data?.summary?.blankGuard?.repaired) || 0;
|
|
738
|
+
const archiveChanged = Number(data?.summary?.archive?.changed) || 0;
|
|
739
|
+
if (pulled > 0 || repaired > 0 || archiveChanged > 0) store.restartSoon('restart.reason.sync');
|
|
740
|
+
} catch (error) {
|
|
741
|
+
store.set({ sync: { ...store.get().sync, busy: false } });
|
|
742
|
+
console.warn('[dsh-enhanced] startup sync failed:', error);
|
|
743
|
+
}
|
|
656
744
|
},
|
|
657
745
|
async refreshCount() {
|
|
658
746
|
try {
|
|
@@ -894,7 +982,7 @@ window.__ModuleLoader__.load({
|
|
|
894
982
|
const warning = typeof data?.warning === 'string' && data.warning !== '' ? data.warning : null;
|
|
895
983
|
store.toast(warning === null ? 'success' : 'info', warning ?? runtime.t('move.done', { title: target?.title ?? '' }));
|
|
896
984
|
await store.refreshCount();
|
|
897
|
-
if (data?.needsRestart === true) store.
|
|
985
|
+
if (data?.needsRestart === true) store.restartSoon('restart.reason.move');
|
|
898
986
|
} catch (error) {
|
|
899
987
|
store.set({ move: { ...state.move, busy: false, error: String(error?.message ?? error) } });
|
|
900
988
|
}
|
|
@@ -921,6 +1009,41 @@ window.__ModuleLoader__.load({
|
|
|
921
1009
|
store.set({ sync: { ...state.sync, loading: false, error: String(error?.message ?? error) } });
|
|
922
1010
|
}
|
|
923
1011
|
},
|
|
1012
|
+
/**
|
|
1013
|
+
* Wait for the AUTOMATIC sync to start or stop, then wait again.
|
|
1014
|
+
*
|
|
1015
|
+
* The host resolves the call when the run flips (or after 25 s), so the
|
|
1016
|
+
* badge updates at once and the idle cost is one open request.
|
|
1017
|
+
*/
|
|
1018
|
+
async watchSyncState() {
|
|
1019
|
+
let lastUserSeq = null;
|
|
1020
|
+
for (;;) {
|
|
1021
|
+
try {
|
|
1022
|
+
const data = await runtime.rpc('sync.watch');
|
|
1023
|
+
// A new user message (in any session) is the send signal the host sees.
|
|
1024
|
+
if (Number.isFinite(data?.userSeq)) {
|
|
1025
|
+
if (lastUserSeq === null) lastUserSeq = data.userSeq;
|
|
1026
|
+
else if (data.userSeq > lastUserSeq) {
|
|
1027
|
+
lastUserSeq = data.userSeq;
|
|
1028
|
+
if (store.get().syncDone === true) store.set({ syncDone: false });
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
const running = data?.auto?.running === true;
|
|
1032
|
+
const wasRunning = store.get().syncLive === true;
|
|
1033
|
+
if (running) {
|
|
1034
|
+
store.set({ syncLive: true, syncDone: false });
|
|
1035
|
+
} else if (wasRunning) {
|
|
1036
|
+
// The run just finished: keep a short "done" line until a click.
|
|
1037
|
+
store.set({ syncLive: false, syncDone: true });
|
|
1038
|
+
} else {
|
|
1039
|
+
store.set({ syncLive: false });
|
|
1040
|
+
}
|
|
1041
|
+
} catch {
|
|
1042
|
+
// A dropped connection only means a short pause before retrying.
|
|
1043
|
+
await new Promise((resolve) => { window.setTimeout(resolve, 3000); });
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
},
|
|
924
1047
|
async probeSync() {
|
|
925
1048
|
if (state.sync.busy) return;
|
|
926
1049
|
store.set({ sync: { ...state.sync, busy: true, error: null } });
|
|
@@ -935,10 +1058,15 @@ window.__ModuleLoader__.load({
|
|
|
935
1058
|
},
|
|
936
1059
|
async runSyncNow() {
|
|
937
1060
|
if (state.sync.busy) return;
|
|
938
|
-
store.set({ sync: { ...state.sync, busy: true, error: null } });
|
|
1061
|
+
store.set({ sync: { ...state.sync, busy: true, error: null }, syncDone: false });
|
|
1062
|
+
store.toastBusy(runtime.t('sync.running'));
|
|
939
1063
|
try {
|
|
940
1064
|
const data = await runtime.rpc('sync.run');
|
|
941
|
-
store.
|
|
1065
|
+
store.clearToast();
|
|
1066
|
+
store.set({
|
|
1067
|
+
sync: { ...state.sync, busy: false, state: data, error: null },
|
|
1068
|
+
syncDone: data?.ok !== false,
|
|
1069
|
+
});
|
|
942
1070
|
store.toast(
|
|
943
1071
|
data?.ok === false ? 'error' : 'success',
|
|
944
1072
|
data?.ok === false
|
|
@@ -947,16 +1075,40 @@ window.__ModuleLoader__.load({
|
|
|
947
1075
|
);
|
|
948
1076
|
await store.loadSync();
|
|
949
1077
|
const pulled = Number(data?.summary?.sessions?.pulled) || Number(data?.summary?.sessions?.created) || 0;
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
1078
|
+
const repaired = Number(data?.summary?.blankGuard?.repaired) || 0;
|
|
1079
|
+
const archiveChanged = Number(data?.summary?.archive?.changed) || 0;
|
|
1080
|
+
if (pulled > 0 || repaired > 0 || archiveChanged > 0) {
|
|
1081
|
+
store.restartSoon('restart.reason.sync');
|
|
953
1082
|
}
|
|
954
1083
|
} catch (error) {
|
|
1084
|
+
store.clearToast();
|
|
955
1085
|
store.set({ sync: { ...state.sync, busy: false, error: String(error?.message ?? error) } });
|
|
956
1086
|
store.toast('error', String(error?.message ?? error));
|
|
957
1087
|
await store.loadSync();
|
|
958
1088
|
}
|
|
959
1089
|
},
|
|
1090
|
+
/**
|
|
1091
|
+
* Announce an automatic restart, counting down from three, then restart.
|
|
1092
|
+
*/
|
|
1093
|
+
restartSoon(reasonKey) {
|
|
1094
|
+
if (restartCountdownTimer !== null) return;
|
|
1095
|
+
const reason = runtime.t(reasonKey);
|
|
1096
|
+
let left = 3;
|
|
1097
|
+
const tick = () => {
|
|
1098
|
+
store.toast('info', runtime.t('restart.auto', { reason, seconds: String(left) }));
|
|
1099
|
+
if (left === 0) {
|
|
1100
|
+
window.clearInterval(restartCountdownTimer);
|
|
1101
|
+
restartCountdownTimer = null;
|
|
1102
|
+
store.set({ restartCountdown: null });
|
|
1103
|
+
store.restartApp();
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1106
|
+
store.set({ restartCountdown: left });
|
|
1107
|
+
left -= 1;
|
|
1108
|
+
};
|
|
1109
|
+
tick();
|
|
1110
|
+
restartCountdownTimer = window.setInterval(tick, 1000);
|
|
1111
|
+
},
|
|
960
1112
|
/** Restart the app so a structural change becomes visible. */
|
|
961
1113
|
restartApp() {
|
|
962
1114
|
window.setTimeout(() => {
|
|
@@ -1119,7 +1271,7 @@ window.__ModuleLoader__.load({
|
|
|
1119
1271
|
: runtime.t('overwrite.localDone', { n: String(result?.copied ?? 0) }));
|
|
1120
1272
|
await store.loadSync();
|
|
1121
1273
|
// Replacing this machine wholesale only takes effect after a restart.
|
|
1122
|
-
if (direction === 'local') store.
|
|
1274
|
+
if (direction === 'local') store.restartSoon('restart.reason.restore');
|
|
1123
1275
|
} catch (error) {
|
|
1124
1276
|
store.set({ overwrite: { ...state.overwrite, busy: false, error: String(error?.message ?? error) } });
|
|
1125
1277
|
}
|
|
@@ -1183,10 +1335,10 @@ window.__ModuleLoader__.load({
|
|
|
1183
1335
|
},
|
|
1184
1336
|
toggleSyncLog() {
|
|
1185
1337
|
const open = state.sync.showLog !== true;
|
|
1186
|
-
store.set({ sync: { ...state.sync, showLog: open, historyOpen: open ? 0 : null, historyLimit:
|
|
1338
|
+
store.set({ sync: { ...state.sync, showLog: open, historyOpen: open ? 0 : null, historyLimit: 20 } });
|
|
1187
1339
|
},
|
|
1188
1340
|
showMoreHistory() {
|
|
1189
|
-
store.set({ sync: { ...state.sync, historyLimit: (Number(state.sync.historyLimit) ||
|
|
1341
|
+
store.set({ sync: { ...state.sync, historyLimit: (Number(state.sync.historyLimit) || 20) + 50 } });
|
|
1190
1342
|
},
|
|
1191
1343
|
openHistory(index) {
|
|
1192
1344
|
const next = state.sync.historyOpen === index ? null : index;
|
|
@@ -1420,6 +1572,154 @@ function highlightFocus(text, query, focusIndex) {
|
|
|
1420
1572
|
}, running ? runtime.t('delete.running') : runtime.t('delete.label'));
|
|
1421
1573
|
}
|
|
1422
1574
|
|
|
1575
|
+
/**
|
|
1576
|
+
* Dismiss on a double click anywhere in the window.
|
|
1577
|
+
*
|
|
1578
|
+
* A single click stays harmless, so a stray click does not hide a notice the
|
|
1579
|
+
* reader is still reading. The listener lives on the document, so a double
|
|
1580
|
+
* click on the notice, on the chat, or in the sidebar all count.
|
|
1581
|
+
*/
|
|
1582
|
+
function armQuickClose(node, close) {
|
|
1583
|
+
let done = false;
|
|
1584
|
+
const onDouble = () => {
|
|
1585
|
+
if (done) return;
|
|
1586
|
+
done = true;
|
|
1587
|
+
document.removeEventListener('dblclick', onDouble, true);
|
|
1588
|
+
close();
|
|
1589
|
+
};
|
|
1590
|
+
const onSingle = (event) => event.stopPropagation();
|
|
1591
|
+
node.addEventListener('click', onSingle);
|
|
1592
|
+
document.addEventListener('dblclick', onDouble, true);
|
|
1593
|
+
return () => {
|
|
1594
|
+
done = true;
|
|
1595
|
+
document.removeEventListener('dblclick', onDouble, true);
|
|
1596
|
+
node.removeEventListener('click', onSingle);
|
|
1597
|
+
};
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
/**
|
|
1601
|
+
* Put one string on the clipboard, then say what happened.
|
|
1602
|
+
*
|
|
1603
|
+
* The async Clipboard API needs a secure context; the textarea fallback keeps
|
|
1604
|
+
* the action working when the page is served from elsewhere.
|
|
1605
|
+
*/
|
|
1606
|
+
async function copyWithNotice(value, labelKey) {
|
|
1607
|
+
const label = runtime.t(labelKey);
|
|
1608
|
+
const done = () => runtime.store.toast('success', runtime.t('hover.copy.done', { label }));
|
|
1609
|
+
const failed = () => runtime.store.toast('error', runtime.t('hover.copy.failed', { label }));
|
|
1610
|
+
try {
|
|
1611
|
+
await navigator.clipboard.writeText(value);
|
|
1612
|
+
done();
|
|
1613
|
+
return;
|
|
1614
|
+
} catch {
|
|
1615
|
+
// fall through to the legacy path
|
|
1616
|
+
}
|
|
1617
|
+
try {
|
|
1618
|
+
const area = document.createElement('textarea');
|
|
1619
|
+
area.value = value;
|
|
1620
|
+
area.setAttribute('readonly', '');
|
|
1621
|
+
area.style.cssText = 'position:fixed;top:-1000px;opacity:0';
|
|
1622
|
+
document.body.appendChild(area);
|
|
1623
|
+
area.select();
|
|
1624
|
+
const ok = document.execCommand('copy');
|
|
1625
|
+
area.remove();
|
|
1626
|
+
if (ok) done();
|
|
1627
|
+
else failed();
|
|
1628
|
+
} catch {
|
|
1629
|
+
failed();
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
/**
|
|
1634
|
+
* Session id line inside the row's hover card.
|
|
1635
|
+
*
|
|
1636
|
+
* The hover slot sits below the relative time, but the id reads better right
|
|
1637
|
+
* under the title, so the slot only carries the session identity: the line
|
|
1638
|
+
* itself is created imperatively and parked after the title element, which
|
|
1639
|
+
* keeps React's own layout untouched. Any structural surprise means no line.
|
|
1640
|
+
*/
|
|
1641
|
+
function SessionIdRow(props) {
|
|
1642
|
+
const id = typeof props?.sessionId === 'string' ? props.sessionId : '';
|
|
1643
|
+
const markerRef = React.useRef(null);
|
|
1644
|
+
|
|
1645
|
+
React.useEffect(() => {
|
|
1646
|
+
const marker = markerRef.current;
|
|
1647
|
+
if (marker === null || id === '') return undefined;
|
|
1648
|
+
try {
|
|
1649
|
+
const host = marker.closest('[data-slot="sidebar.session.row.hover"]');
|
|
1650
|
+
const content = host === null ? null : host.parentElement;
|
|
1651
|
+
const title = content === null ? null : content.firstElementChild;
|
|
1652
|
+
if (title === null) return undefined;
|
|
1653
|
+
|
|
1654
|
+
const children = Array.from(content.children);
|
|
1655
|
+
const candidatePath = children.length > 1 ? children[1] : null;
|
|
1656
|
+
// The path line is the one carrying a separator; a reshaped card just
|
|
1657
|
+
// leaves this field unbound.
|
|
1658
|
+
const pathText = candidatePath === null ? '' : (candidatePath.textContent ?? '').trim();
|
|
1659
|
+
const pathLine = /[\\/:]/.test(pathText) ? candidatePath : null;
|
|
1660
|
+
|
|
1661
|
+
// The card's own click copies the session id; each field now copies its
|
|
1662
|
+
// own text instead, so a mis-click still produces something useful.
|
|
1663
|
+
const bindings = [];
|
|
1664
|
+
const bind = (element, value, labelKey) => {
|
|
1665
|
+
if (element === null || typeof value !== 'string' || value.trim() === '') return;
|
|
1666
|
+
const handler = (event) => {
|
|
1667
|
+
event.preventDefault();
|
|
1668
|
+
event.stopPropagation();
|
|
1669
|
+
void copyWithNotice(value.trim(), labelKey);
|
|
1670
|
+
};
|
|
1671
|
+
element.addEventListener('click', handler);
|
|
1672
|
+
element.style.cursor = 'pointer';
|
|
1673
|
+
bindings.push({ element, handler });
|
|
1674
|
+
};
|
|
1675
|
+
|
|
1676
|
+
bind(title, title.textContent ?? '', 'hover.copy.title');
|
|
1677
|
+
bind(pathLine, pathLine === null ? '' : pathLine.textContent ?? '', 'hover.copy.path');
|
|
1678
|
+
|
|
1679
|
+
const line = document.createElement('div');
|
|
1680
|
+
line.className = 'dshe-session-id';
|
|
1681
|
+
line.title = id;
|
|
1682
|
+
line.dataset.sessionId = id;
|
|
1683
|
+
line.style.cssText = [
|
|
1684
|
+
'margin-top:2px',
|
|
1685
|
+
'color:var(--dsw-alias-hovercard-label-secondary, currentColor)',
|
|
1686
|
+
'font-size:12px',
|
|
1687
|
+
'line-height:16px',
|
|
1688
|
+
'overflow-wrap:anywhere',
|
|
1689
|
+
'word-break:break-all',
|
|
1690
|
+
'user-select:text',
|
|
1691
|
+
'cursor:pointer',
|
|
1692
|
+
].join(';');
|
|
1693
|
+
line.textContent = runtime.t('hover.sessionId') + id;
|
|
1694
|
+
line.addEventListener('click', (event) => {
|
|
1695
|
+
event.preventDefault();
|
|
1696
|
+
event.stopPropagation();
|
|
1697
|
+
void copyWithNotice(id, 'hover.copy.id');
|
|
1698
|
+
});
|
|
1699
|
+
title.insertAdjacentElement('afterend', line);
|
|
1700
|
+
|
|
1701
|
+
// The slot's own wrapper also forwards clicks to the card; keep it quiet.
|
|
1702
|
+
const markerClick = (event) => event.stopPropagation();
|
|
1703
|
+
marker.addEventListener('click', markerClick);
|
|
1704
|
+
|
|
1705
|
+
return () => {
|
|
1706
|
+
for (const binding of bindings) {
|
|
1707
|
+
binding.element.removeEventListener('click', binding.handler);
|
|
1708
|
+
binding.element.style.cursor = '';
|
|
1709
|
+
}
|
|
1710
|
+
marker.removeEventListener('click', markerClick);
|
|
1711
|
+
line.remove();
|
|
1712
|
+
};
|
|
1713
|
+
} catch {
|
|
1714
|
+
// A layout change without a line is better than a broken card.
|
|
1715
|
+
return undefined;
|
|
1716
|
+
}
|
|
1717
|
+
}, [id]);
|
|
1718
|
+
|
|
1719
|
+
if (id === '') return null;
|
|
1720
|
+
return h('span', { ref: markerRef, style: { display: 'none' } });
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1423
1723
|
// ── delete confirmation ──────────────────────────────────────────────────
|
|
1424
1724
|
|
|
1425
1725
|
const displayName = (value) => {
|
|
@@ -1762,6 +2062,7 @@ const displayName = (value) => {
|
|
|
1762
2062
|
const markRect = mark.getBoundingClientRect();
|
|
1763
2063
|
node.scrollTop += markRect.top - box.top - node.clientHeight / 2 + markRect.height / 2;
|
|
1764
2064
|
}
|
|
2065
|
+
return () => { node.remove(); };
|
|
1765
2066
|
}, [preview, search.query]);
|
|
1766
2067
|
|
|
1767
2068
|
const previewRef = React.useRef(null);
|
|
@@ -1769,6 +2070,7 @@ const displayName = (value) => {
|
|
|
1769
2070
|
const previewGate = React.useRef(true);
|
|
1770
2071
|
const previewHover = React.useRef(null);
|
|
1771
2072
|
const previewPointer = React.useRef({ x: 0, y: 0 });
|
|
2073
|
+
const previewEpoch = React.useRef(0);
|
|
1772
2074
|
|
|
1773
2075
|
React.useEffect(() => {
|
|
1774
2076
|
// Typing hides the preview; it may only reappear after the pointer moves.
|
|
@@ -1836,6 +2138,11 @@ const displayName = (value) => {
|
|
|
1836
2138
|
}, [expanded]);
|
|
1837
2139
|
|
|
1838
2140
|
React.useEffect(() => {
|
|
2141
|
+
previewEpoch.current += 1;
|
|
2142
|
+
if (previewHover.current !== null) {
|
|
2143
|
+
window.clearTimeout(previewHover.current);
|
|
2144
|
+
previewHover.current = null;
|
|
2145
|
+
}
|
|
1839
2146
|
setPreview(null);
|
|
1840
2147
|
}, [search.open, search.groups]);
|
|
1841
2148
|
|
|
@@ -1941,12 +2248,15 @@ const displayName = (value) => {
|
|
|
1941
2248
|
if (previewGate.current === true) return;
|
|
1942
2249
|
const row = event.currentTarget;
|
|
1943
2250
|
if (event.clientX !== undefined) previewPointer.current = { x: event.clientX, y: event.clientY };
|
|
2251
|
+
const epoch = previewEpoch.current;
|
|
1944
2252
|
previewHover.current = window.setTimeout(() => {
|
|
2253
|
+
if (previewEpoch.current !== epoch) return;
|
|
1945
2254
|
previewHover.current = null;
|
|
1946
2255
|
const rect = row.getBoundingClientRect();
|
|
1947
2256
|
const dialog = row.closest('.dshe-search');
|
|
1948
2257
|
const box = dialog === null ? null : dialog.getBoundingClientRect();
|
|
1949
|
-
const
|
|
2258
|
+
const base = box !== null && box.width > 200 ? box.width : window.innerWidth;
|
|
2259
|
+
const width = Math.max(280, Math.min(460, Math.round(base * 0.62)));
|
|
1950
2260
|
const pointer = previewPointer.current;
|
|
1951
2261
|
const left = Math.max(12, Math.min(Math.round(pointer.x + 16), window.innerWidth - width - 12));
|
|
1952
2262
|
const spaceBelow = Math.round(window.innerHeight - rect.bottom - 12);
|
|
@@ -1974,7 +2284,16 @@ const displayName = (value) => {
|
|
|
1974
2284
|
},
|
|
1975
2285
|
key: `${group.sessionId}-${String(match.seq ?? 'title')}-${String(index)}`,
|
|
1976
2286
|
'data-active': index === active ? 'true' : 'false',
|
|
1977
|
-
onClick: () =>
|
|
2287
|
+
onClick: () => {
|
|
2288
|
+
previewEpoch.current += 1;
|
|
2289
|
+
if (previewHover.current !== null) {
|
|
2290
|
+
window.clearTimeout(previewHover.current);
|
|
2291
|
+
previewHover.current = null;
|
|
2292
|
+
}
|
|
2293
|
+
if (previewTimer.current !== null) window.clearTimeout(previewTimer.current);
|
|
2294
|
+
setPreview(null);
|
|
2295
|
+
open(group.sessionId, match);
|
|
2296
|
+
},
|
|
1978
2297
|
},
|
|
1979
2298
|
h('span', { className: 'dshe-match-time', 'data-tier': String(timeTier(formatMatchTime(match.time))) }, formatMatchTime(match.time)),
|
|
1980
2299
|
h('span', { className: 'dshe-role' }, runtime.t(`role.${match.role ?? 'body'}`)),
|
|
@@ -2312,6 +2631,7 @@ const displayName = (value) => {
|
|
|
2312
2631
|
h('button', {
|
|
2313
2632
|
type: 'button',
|
|
2314
2633
|
className: 'dshe-action',
|
|
2634
|
+
title: runtime.t('sync.run.hint'),
|
|
2315
2635
|
disabled: state.sync.busy === true,
|
|
2316
2636
|
onClick: () => runtime.store.runSyncNow(),
|
|
2317
2637
|
}, runtime.t('sync.run')),
|
|
@@ -2367,7 +2687,7 @@ const displayName = (value) => {
|
|
|
2367
2687
|
? h('div', {},
|
|
2368
2688
|
h('div', { className: 'dshe-row-desc' }, runtime.t('sync.historyCount', { n: logEntries(state).length })),
|
|
2369
2689
|
h('div', { className: 'dshe-log-list dshe-log-scroll' },
|
|
2370
|
-
logEntries(state).slice(0, Number(state.sync.historyLimit) ||
|
|
2690
|
+
logEntries(state).slice(0, Number(state.sync.historyLimit) || 20).map((item, index) => {
|
|
2371
2691
|
const open = state.sync.historyOpen === index;
|
|
2372
2692
|
return h('div', { key: item.at ?? String(index), className: 'dshe-log-item' },
|
|
2373
2693
|
h('button', {
|
|
@@ -2380,7 +2700,7 @@ const displayName = (value) => {
|
|
|
2380
2700
|
open ? h('div', { className: 'dshe-sync-log dshe-log-body' }, (item.log ?? []).map((line, lineIndex) => h(LogLine, { key: lineIndex, line, files: item.details?.[lineIndex] ?? [] }))) : null);
|
|
2381
2701
|
}),
|
|
2382
2702
|
),
|
|
2383
|
-
logEntries(state).length > (Number(state.sync.historyLimit) ||
|
|
2703
|
+
logEntries(state).length > (Number(state.sync.historyLimit) || 20)
|
|
2384
2704
|
? h('button', { type: 'button', className: 'dshe-action', onClick: () => runtime.store.showMoreHistory() }, runtime.t('sync.more'))
|
|
2385
2705
|
: null,
|
|
2386
2706
|
)
|
|
@@ -2551,9 +2871,11 @@ const displayName = (value) => {
|
|
|
2551
2871
|
if (host === null) {
|
|
2552
2872
|
host = document.createElement('div');
|
|
2553
2873
|
host.id = 'dshe-toast-host';
|
|
2554
|
-
host.style.cssText = 'position:fixed;left:0;right:0;bottom:28px;display:flex;justify-content:center;pointer-events:none;z-index:2147483000';
|
|
2555
2874
|
document.body.appendChild(host);
|
|
2556
2875
|
}
|
|
2876
|
+
// A full-window flex box keeps every toast dead centre; rewriting it each
|
|
2877
|
+
// time also repairs a host left behind by an older build.
|
|
2878
|
+
host.style.cssText = 'position:fixed;top:33vh;left:0;right:0;display:flex;justify-content:center;pointer-events:none;z-index:2147483000';
|
|
2557
2879
|
host.textContent = '';
|
|
2558
2880
|
if (toast === null || toast === undefined) return;
|
|
2559
2881
|
const node = document.createElement('div');
|
|
@@ -2565,11 +2887,165 @@ const displayName = (value) => {
|
|
|
2565
2887
|
node.style.left = 'auto';
|
|
2566
2888
|
node.style.bottom = 'auto';
|
|
2567
2889
|
node.textContent = String(toast.text ?? '');
|
|
2890
|
+
if (toast.spinner === true) {
|
|
2891
|
+
const spinner = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
2892
|
+
spinner.setAttribute('class', 'dshe-toast-spinner');
|
|
2893
|
+
spinner.setAttribute('viewBox', '0 0 16 16');
|
|
2894
|
+
spinner.setAttribute('aria-hidden', 'true');
|
|
2895
|
+
const track = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
|
2896
|
+
track.setAttribute('cx', '8');
|
|
2897
|
+
track.setAttribute('cy', '8');
|
|
2898
|
+
track.setAttribute('r', '6');
|
|
2899
|
+
track.setAttribute('fill', 'none');
|
|
2900
|
+
track.setAttribute('stroke', 'rgba(255,255,255,.28)');
|
|
2901
|
+
track.setAttribute('stroke-width', '2');
|
|
2902
|
+
const arc = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
|
2903
|
+
arc.setAttribute('cx', '8');
|
|
2904
|
+
arc.setAttribute('cy', '8');
|
|
2905
|
+
arc.setAttribute('r', '6');
|
|
2906
|
+
arc.setAttribute('fill', 'none');
|
|
2907
|
+
arc.setAttribute('stroke', '#fff');
|
|
2908
|
+
arc.setAttribute('stroke-width', '2');
|
|
2909
|
+
arc.setAttribute('stroke-linecap', 'round');
|
|
2910
|
+
arc.setAttribute('stroke-dasharray', '26 12');
|
|
2911
|
+
spinner.appendChild(track);
|
|
2912
|
+
spinner.appendChild(arc);
|
|
2913
|
+
node.appendChild(spinner);
|
|
2914
|
+
}
|
|
2915
|
+
const release = armQuickClose(node, () => { node.remove(); });
|
|
2568
2916
|
host.appendChild(node);
|
|
2917
|
+
return () => {
|
|
2918
|
+
release();
|
|
2919
|
+
node.remove();
|
|
2920
|
+
};
|
|
2569
2921
|
}, [toast]);
|
|
2570
2922
|
return null;
|
|
2571
2923
|
}
|
|
2572
2924
|
|
|
2925
|
+
/**
|
|
2926
|
+
* The automatic-sync hint, parked on the composer status row.
|
|
2927
|
+
*
|
|
2928
|
+
* The dock entry itself renders nothing: it only marks where the row is. The
|
|
2929
|
+
* visible node lives on document.body and is aligned to the row's own measured
|
|
2930
|
+
* rectangle on every layout change, so it keeps that row's baseline and right
|
|
2931
|
+
* edge without hard-coded offsets.
|
|
2932
|
+
*/
|
|
2933
|
+
function SyncRunningBadge() {
|
|
2934
|
+
const state = useStore();
|
|
2935
|
+
// Manual runs own their centred toast, but the status line follows them too.
|
|
2936
|
+
const live = state.syncLive === true || state.sync.busy === true;
|
|
2937
|
+
const done = state.syncDone === true;
|
|
2938
|
+
const show = live || done;
|
|
2939
|
+
const markerRef = React.useRef(null);
|
|
2940
|
+
|
|
2941
|
+
React.useEffect(() => {
|
|
2942
|
+
if (!show) return undefined;
|
|
2943
|
+
const holder = markerRef.current;
|
|
2944
|
+
if (holder === null) return undefined;
|
|
2945
|
+
const ownRow = holder.parentElement;
|
|
2946
|
+
const dock = ownRow === null ? null : ownRow.parentElement;
|
|
2947
|
+
if (dock === null) return undefined;
|
|
2948
|
+
|
|
2949
|
+
const node = document.createElement('div');
|
|
2950
|
+
node.className = 'dshe-sync-inline';
|
|
2951
|
+
node.style.cssText = [
|
|
2952
|
+
'position:fixed',
|
|
2953
|
+
'z-index:2147483001',
|
|
2954
|
+
'pointer-events:none',
|
|
2955
|
+
'display:inline-flex',
|
|
2956
|
+
'align-items:center',
|
|
2957
|
+
'gap:6px',
|
|
2958
|
+
'font-size:12px',
|
|
2959
|
+
'line-height:16px',
|
|
2960
|
+
'color:var(--dsw-alias-label-secondary, currentColor)',
|
|
2961
|
+
'white-space:nowrap',
|
|
2962
|
+
].join(';');
|
|
2963
|
+
const label = document.createElement('span');
|
|
2964
|
+
label.textContent = runtime.t(live ? 'sync.running' : 'sync.done');
|
|
2965
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
2966
|
+
svg.setAttribute('class', live ? 'dshe-toast-spinner' : 'dshe-sync-done');
|
|
2967
|
+
svg.setAttribute('viewBox', '0 0 16 16');
|
|
2968
|
+
svg.setAttribute('width', '12');
|
|
2969
|
+
svg.setAttribute('height', '12');
|
|
2970
|
+
svg.setAttribute('aria-hidden', 'true');
|
|
2971
|
+
svg.style.flex = 'none';
|
|
2972
|
+
if (live) {
|
|
2973
|
+
const track = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
|
2974
|
+
track.setAttribute('cx', '8');
|
|
2975
|
+
track.setAttribute('cy', '8');
|
|
2976
|
+
track.setAttribute('r', '6');
|
|
2977
|
+
track.setAttribute('fill', 'none');
|
|
2978
|
+
track.setAttribute('stroke', 'currentColor');
|
|
2979
|
+
track.setAttribute('stroke-opacity', '0.25');
|
|
2980
|
+
track.setAttribute('stroke-width', '2');
|
|
2981
|
+
const arc = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
|
2982
|
+
arc.setAttribute('cx', '8');
|
|
2983
|
+
arc.setAttribute('cy', '8');
|
|
2984
|
+
arc.setAttribute('r', '6');
|
|
2985
|
+
arc.setAttribute('fill', 'none');
|
|
2986
|
+
arc.setAttribute('stroke', 'currentColor');
|
|
2987
|
+
arc.setAttribute('stroke-width', '2');
|
|
2988
|
+
arc.setAttribute('stroke-linecap', 'round');
|
|
2989
|
+
arc.setAttribute('stroke-dasharray', '26 12');
|
|
2990
|
+
svg.appendChild(track);
|
|
2991
|
+
svg.appendChild(arc);
|
|
2992
|
+
} else {
|
|
2993
|
+
// Finished: a quiet tick instead of the turning ring.
|
|
2994
|
+
const tick = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
2995
|
+
tick.setAttribute('d', 'M3.5 8.5 L6.5 11.5 L12.5 4.5');
|
|
2996
|
+
tick.setAttribute('fill', 'none');
|
|
2997
|
+
tick.setAttribute('stroke', 'currentColor');
|
|
2998
|
+
tick.setAttribute('stroke-width', '1.8');
|
|
2999
|
+
tick.setAttribute('stroke-linecap', 'round');
|
|
3000
|
+
tick.setAttribute('stroke-linejoin', 'round');
|
|
3001
|
+
svg.appendChild(tick);
|
|
3002
|
+
}
|
|
3003
|
+
node.appendChild(label);
|
|
3004
|
+
node.appendChild(svg);
|
|
3005
|
+
document.body.appendChild(node);
|
|
3006
|
+
|
|
3007
|
+
// The last foreign row of the dock is the status line; our own row keeps
|
|
3008
|
+
// its normal place, so the shipped text never moves.
|
|
3009
|
+
const measure = () => {
|
|
3010
|
+
if (!node.isConnected) return;
|
|
3011
|
+
const rows = Array.from(dock.children).filter((child) => child !== ownRow);
|
|
3012
|
+
const anchor = rows.length > 0 ? rows[rows.length - 1] : dock;
|
|
3013
|
+
const rect = anchor.getBoundingClientRect();
|
|
3014
|
+
if (rect.width === 0 || rect.height === 0) return;
|
|
3015
|
+
const width = node.offsetWidth;
|
|
3016
|
+
const height = node.offsetHeight;
|
|
3017
|
+
const right = Math.max(12, window.innerWidth - 16);
|
|
3018
|
+
const left = Math.max(12, right - width);
|
|
3019
|
+
const top = Math.max(0, rect.top + (rect.height - height) / 2);
|
|
3020
|
+
node.style.left = Math.round(left) + 'px';
|
|
3021
|
+
node.style.top = Math.round(top) + 'px';
|
|
3022
|
+
};
|
|
3023
|
+
|
|
3024
|
+
measure();
|
|
3025
|
+
const frame = window.requestAnimationFrame(measure);
|
|
3026
|
+
// One late pass covers fonts and row heights that settle after the frame.
|
|
3027
|
+
const settle = window.setTimeout(measure, 300);
|
|
3028
|
+
window.addEventListener('resize', measure);
|
|
3029
|
+
// The row only moves when its container changes size, so observing the dock
|
|
3030
|
+
// is enough; no timer keeps running while the line just sits there.
|
|
3031
|
+
let observer = null;
|
|
3032
|
+
if (typeof ResizeObserver === 'function') {
|
|
3033
|
+
observer = new ResizeObserver(() => { measure(); });
|
|
3034
|
+
observer.observe(dock);
|
|
3035
|
+
}
|
|
3036
|
+
return () => {
|
|
3037
|
+
window.cancelAnimationFrame(frame);
|
|
3038
|
+
window.clearTimeout(settle);
|
|
3039
|
+
window.removeEventListener('resize', measure);
|
|
3040
|
+
if (observer !== null) observer.disconnect();
|
|
3041
|
+
node.remove();
|
|
3042
|
+
};
|
|
3043
|
+
}, [show, live]);
|
|
3044
|
+
|
|
3045
|
+
if (!show) return null;
|
|
3046
|
+
return h('span', { ref: markerRef, style: { display: 'none' } });
|
|
3047
|
+
}
|
|
3048
|
+
|
|
2573
3049
|
/** Environment check result, including the "export report" path. */
|
|
2574
3050
|
function EnvDialog() {
|
|
2575
3051
|
const state = useStore();
|
|
@@ -2838,7 +3314,7 @@ const displayName = (value) => {
|
|
|
2838
3314
|
node.style.cssText = [
|
|
2839
3315
|
'position:fixed',
|
|
2840
3316
|
'z-index:2147483002',
|
|
2841
|
-
'top:
|
|
3317
|
+
'top:33vh',
|
|
2842
3318
|
'left:50%',
|
|
2843
3319
|
'transform:translateX(-50%)',
|
|
2844
3320
|
'pointer-events:auto',
|
|
@@ -2854,10 +3330,16 @@ const displayName = (value) => {
|
|
|
2854
3330
|
'max-width:70vw',
|
|
2855
3331
|
'text-align:center',
|
|
2856
3332
|
'cursor:pointer',
|
|
3333
|
+
'user-select:none',
|
|
2857
3334
|
].join(';');
|
|
2858
|
-
|
|
3335
|
+
let release = () => {};
|
|
3336
|
+
const closeNotice = () => {
|
|
3337
|
+
release();
|
|
3338
|
+
node.remove();
|
|
3339
|
+
};
|
|
3340
|
+
release = armQuickClose(node, closeNotice);
|
|
2859
3341
|
document.body.appendChild(node);
|
|
2860
|
-
window.setTimeout(
|
|
3342
|
+
window.setTimeout(closeNotice, typeof ms === 'number' ? ms : 5000);
|
|
2861
3343
|
} catch (error) {
|
|
2862
3344
|
console.warn('[dsh-enhanced] notice failed:', error);
|
|
2863
3345
|
}
|
|
@@ -3022,6 +3504,20 @@ const displayName = (value) => {
|
|
|
3022
3504
|
return () => tag.remove();
|
|
3023
3505
|
}, 'dsh-enhanced: styles');
|
|
3024
3506
|
|
|
3507
|
+
// Ctrl+Alt+Shift+T starts one immediate sync while this window has focus.
|
|
3508
|
+
ctx.effect(() => {
|
|
3509
|
+
const onKeyDown = (event) => {
|
|
3510
|
+
if (!event.ctrlKey || !event.altKey || !event.shiftKey) return;
|
|
3511
|
+
if (event.code !== 'KeyT' && (event.key ?? '').toLowerCase() !== 't') return;
|
|
3512
|
+
if (event.repeat) return;
|
|
3513
|
+
event.preventDefault();
|
|
3514
|
+
event.stopPropagation();
|
|
3515
|
+
void runtime.store.runSyncNow();
|
|
3516
|
+
};
|
|
3517
|
+
window.addEventListener('keydown', onKeyDown, true);
|
|
3518
|
+
return () => window.removeEventListener('keydown', onKeyDown, true);
|
|
3519
|
+
}, 'dsh-enhanced: sync hotkey');
|
|
3520
|
+
|
|
3025
3521
|
ctx.effect(() => {
|
|
3026
3522
|
const onKeyDown = (event) => {
|
|
3027
3523
|
if (!(event.ctrlKey || event.metaKey) || event.altKey || event.shiftKey) return;
|
|
@@ -3245,6 +3741,14 @@ const displayName = (value) => {
|
|
|
3245
3741
|
locale: NS,
|
|
3246
3742
|
}, SessionMoveRow));
|
|
3247
3743
|
|
|
3744
|
+
// Session id inside the row's hover card, between time and status.
|
|
3745
|
+
ctx.slots.inject('sidebar.session.row.hover', () => ctx.slots.register({
|
|
3746
|
+
name: 'sidebar.session.row.hover',
|
|
3747
|
+
id: 'dsh-enhanced.session-id',
|
|
3748
|
+
order: 20,
|
|
3749
|
+
locale: NS,
|
|
3750
|
+
}, SessionIdRow));
|
|
3751
|
+
|
|
3248
3752
|
|
|
3249
3753
|
ctx.slots.inject('shell.overlay', () => ctx.slots.register({
|
|
3250
3754
|
name: 'shell.overlay',
|
|
@@ -3260,6 +3764,13 @@ const displayName = (value) => {
|
|
|
3260
3764
|
locale: NS,
|
|
3261
3765
|
}, OverlayStack));
|
|
3262
3766
|
|
|
3767
|
+
ctx.slots.inject('conversation.composer.dock', () => ctx.slots.register({
|
|
3768
|
+
name: 'conversation.composer.dock',
|
|
3769
|
+
id: 'dsh-enhanced.sync-running',
|
|
3770
|
+
order: 40,
|
|
3771
|
+
locale: NS,
|
|
3772
|
+
}, SyncRunningBadge));
|
|
3773
|
+
|
|
3263
3774
|
ctx.slots.inject('conversation.input.left', () => ctx.slots.register({
|
|
3264
3775
|
name: 'conversation.input.left',
|
|
3265
3776
|
id: 'dsh-enhanced.composer-bridge',
|