@restregular/dsh-powerup 0.8.4 → 0.8.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 +20 -3
- package/client.js +160 -31
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -5,7 +5,8 @@ The upgrades include a **right-click action menu in the Trajectory view**, a
|
|
|
5
5
|
**copyable step reference** that an agent can resolve back into the raw session
|
|
6
6
|
data, an optional **stop reason for background jobs**, an in-place
|
|
7
7
|
**plugin installer**, and a **sidebar launcher** that turns the left sidebar's
|
|
8
|
-
panel list into an adaptive icon grid with drag sorting
|
|
8
|
+
panel list into an adaptive icon grid with drag sorting, folders, a
|
|
9
|
+
back-to-conversation tile and a restart-DSH tile.
|
|
9
10
|
|
|
10
11
|
## Install
|
|
11
12
|
|
|
@@ -116,6 +117,14 @@ entries other plugins add) become an icon grid instead of a one-per-row list:
|
|
|
116
117
|
its own (chat glyph + label) that calls `layout.selectPanel(null)` to return
|
|
117
118
|
to the Conversation; it highlights when no global panel is selected, can be
|
|
118
119
|
placed anywhere by dragging, and never joins a folder either.
|
|
120
|
+
- **A synthetic "Restart DSH" tile.** A second Power-Up tile (circular-arrow
|
|
121
|
+
restart glyph + `重启` / `Restart`) opens the same restart confirmation the pending-restart
|
|
122
|
+
bar uses: the tile only calls into that React prompt, so there is one dialog,
|
|
123
|
+
one capability read (`GET /dsh-powerup/api/restart`) and one set of copy. The
|
|
124
|
+
confirmation explains that running tasks are interrupted; only a runtime that
|
|
125
|
+
can relaunch itself (the desktop app) enables the confirm button. The tile
|
|
126
|
+
drags like any other, never joins a folder, and is hidden with the rest of
|
|
127
|
+
the grid in the collapsed rail.
|
|
119
128
|
- **Ungroup expands in place.** Dissolving a folder puts its icons back on the
|
|
120
129
|
grid exactly where the folder sat, in the folder's own order — nothing jumps
|
|
121
130
|
to the end of the grid.
|
|
@@ -221,13 +230,21 @@ fiber is unloaded. The panel closes; refresh the page when the install finishes.
|
|
|
221
230
|
rows are resolved by shape — a direct `<button>`, or a wrapper (the More
|
|
222
231
|
launcher's `Menu` root `<span>`) whose direct child is that button — because
|
|
223
232
|
the wrapper element differs between the panel rows and the more menu.
|
|
233
|
+
- **The DOM launcher borrows the React restart prompt.** The launcher is plain
|
|
234
|
+
DOM and cannot render React, so the Plugins overlay publishes its
|
|
235
|
+
`openRestart` in a module-level bridge while it is mounted; the synthetic
|
|
236
|
+
restart tile calls that, and gets the exact confirmation, capability check and
|
|
237
|
+
localized copy the pending-restart bar uses — nothing is duplicated. If the
|
|
238
|
+
overlay is not mounted at all (a host without `remote.pluginManager`), the
|
|
239
|
+
tile falls back to a browser confirm over the same Host route.
|
|
224
240
|
- **Every sync write is idempotent.** The launcher observes its own `<nav>`
|
|
225
241
|
with a `MutationObserver`, so a write that changes a watched subtree on every
|
|
226
242
|
sync turns into an infinite loop — and a loop rebuilds the folder flyout
|
|
227
243
|
continuously, which makes normal clicks miss (the node under the pointer is
|
|
228
244
|
replaced between `pointerdown` and `click`). Setting `textContent` to the same
|
|
229
|
-
string still emits a `childList` mutation, so the synthetic chat
|
|
230
|
-
|
|
245
|
+
string still emits a `childList` mutation, so the synthetic chat/restart tiles
|
|
246
|
+
only write their labels when they actually changed, folder tiles rebuild only
|
|
247
|
+
when
|
|
231
248
|
their signature changed, and the flyout re-renders only when its roster or
|
|
232
249
|
name changed. A
|
|
233
250
|
`MutationObserver` re-applies that after every host render, and the module
|
package/client.js
CHANGED
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
|
|
70
70
|
const NS = 'dsh-powerup';
|
|
71
71
|
const SETTINGS_KEY = 'dsh-powerup:settings:v1';
|
|
72
|
-
const VERSION = '0.8.
|
|
72
|
+
const VERSION = '0.8.6';
|
|
73
73
|
const MENU_GAP = 8;
|
|
74
74
|
const MENU_WIDTH = 248;
|
|
75
75
|
/** Reference scheme understood by the Host's `powerup_step_read` tool. */
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
'page.jobStopDesc': '在会话顶部的后台任务面板里点停止按钮时,可以顺手填写停止原因;原因会附加在任务结束后注入会话的提示里。',
|
|
108
108
|
'page.jobStopHow': '打开任意会话,点顶部的「后台任务」面板,在运行中的任务右侧点停止,填写原因(可留空)后确认。',
|
|
109
109
|
'page.launcherTitle': '侧边栏启动器',
|
|
110
|
-
'page.launcherDesc': '把左侧边栏的面板按钮变成自适应图标网格:列数跟着侧边栏宽度走,图标在上、文字在下;拖动图标可以排序,把一个图标拖到另一个图标的中间就会合成一个分组(像 Windows
|
|
110
|
+
'page.launcherDesc': '把左侧边栏的面板按钮变成自适应图标网格:列数跟着侧边栏宽度走,图标在上、文字在下;拖动图标可以排序,把一个图标拖到另一个图标的中间就会合成一个分组(像 Windows 开始菜单的文件夹),点分组会以浮层弹出里面的图标。网格里自带「返回会话」和「重启 DSH」两个按钮。',
|
|
111
111
|
'page.launcherToggle': '启用图标网格',
|
|
112
112
|
'page.launcherToggleHint': '关闭后侧边栏恢复宿主原本的列表样式;排序与分组仍会保留。',
|
|
113
113
|
'launcher.groupDefault': '分组',
|
|
@@ -116,6 +116,8 @@
|
|
|
116
116
|
'launcher.dissolve': '解散分组',
|
|
117
117
|
'launcher.removeItem': '移出分组',
|
|
118
118
|
'launcher.backToConversation': '返回会话',
|
|
119
|
+
'launcher.restart': '重启',
|
|
120
|
+
'launcher.restartHint': '重启 DSH(正在运行的任务会中断)',
|
|
119
121
|
'page.footer': 'Power-Up {version} · 设置在浏览器本地保存',
|
|
120
122
|
'page.localOnly': '仅影响当前浏览器',
|
|
121
123
|
'action.copy': '复制内容',
|
|
@@ -294,7 +296,7 @@
|
|
|
294
296
|
'page.jobStopDesc': 'When you stop a running job from the background jobs panel in the session header, you can leave a reason; the reason is appended to the notice injected into the session when the job settles.',
|
|
295
297
|
'page.jobStopHow': 'Open a session, expand the background jobs panel, press stop on a running job, type a reason (optional), then confirm.',
|
|
296
298
|
'page.launcherTitle': 'Sidebar launcher',
|
|
297
|
-
'page.launcherDesc': 'Turns the left sidebar panel buttons into an adaptive icon grid: the column count follows the sidebar width, icons sit above their labels, icons can be dragged to reorder, dropping one icon onto the middle of another forms a folder (like a Windows Start menu folder), and clicking a folder opens its contents in a flyout.',
|
|
299
|
+
'page.launcherDesc': 'Turns the left sidebar panel buttons into an adaptive icon grid: the column count follows the sidebar width, icons sit above their labels, icons can be dragged to reorder, dropping one icon onto the middle of another forms a folder (like a Windows Start menu folder), and clicking a folder opens its contents in a flyout. The grid also carries two built-in buttons: back to conversation and restart DSH.',
|
|
298
300
|
'page.launcherToggle': 'Enable the icon grid',
|
|
299
301
|
'page.launcherToggleHint': 'When off, the sidebar keeps the host list; order and folders are remembered.',
|
|
300
302
|
'launcher.groupDefault': 'Group',
|
|
@@ -303,6 +305,8 @@
|
|
|
303
305
|
'launcher.dissolve': 'Ungroup',
|
|
304
306
|
'launcher.removeItem': 'Remove from group',
|
|
305
307
|
'launcher.backToConversation': 'Back to conversation',
|
|
308
|
+
'launcher.restart': 'Restart',
|
|
309
|
+
'launcher.restartHint': 'Restart DSH (running tasks are interrupted)',
|
|
306
310
|
'page.footer': 'Power-Up {version} · Settings are stored in this browser',
|
|
307
311
|
'page.localOnly': 'This browser only',
|
|
308
312
|
'action.copy': 'Copy content',
|
|
@@ -550,8 +554,47 @@
|
|
|
550
554
|
const LAUNCHER_MORE_KEY = '__more';
|
|
551
555
|
/** Tile key of the Power-Up "back to conversation" tile. */
|
|
552
556
|
const LAUNCHER_CHAT_KEY = '__chat';
|
|
557
|
+
/** Tile key of the Power-Up "restart DSH" tile. */
|
|
558
|
+
const LAUNCHER_RESTART_KEY = '__restart';
|
|
553
559
|
/** 16-grid chat glyph for the synthetic "back to conversation" tile. */
|
|
554
560
|
const LAUNCHER_CHAT_ICON = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path d="M2.8 3.4h10.4v6.8H7.4L4.4 12.8v-2.6H2.8V3.4Z" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/></svg>';
|
|
561
|
+
/** 16-grid restart glyph (Material restart_alt) for the "restart DSH" tile. */
|
|
562
|
+
const LAUNCHER_RESTART_ICON = '<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true" focusable="false"><path d="M12 5V2L7 7l5 5V9c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"/></svg>';
|
|
563
|
+
/**
|
|
564
|
+
* Bridge to the Plugins overlay's React restart prompt. The launcher is
|
|
565
|
+
* plain DOM and cannot render React, so the overlay publishes its opener
|
|
566
|
+
* here while it is mounted; the synthetic restart tile calls it and gets
|
|
567
|
+
* the same confirmation, capability check and locale-aware copy.
|
|
568
|
+
*/
|
|
569
|
+
const restartPromptBridge = { open: null };
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Last resort for a host where the Plugins overlay (and with it the
|
|
573
|
+
* React restart prompt) is not mounted: confirm with the browser and ask
|
|
574
|
+
* the Host restart route directly. Unreachable on a normal desktop/web
|
|
575
|
+
* host, where `remote.pluginManager` mounts the overlay.
|
|
576
|
+
*/
|
|
577
|
+
async function restartWithoutPrompt() {
|
|
578
|
+
const t = (key, params) => translateCurrent(key, params);
|
|
579
|
+
try {
|
|
580
|
+
const capability = await fetch('/dsh-powerup/api/restart', { headers: { accept: 'application/json' } })
|
|
581
|
+
.then((response) => response.json());
|
|
582
|
+
if (capability?.supported !== true) {
|
|
583
|
+
window.alert(t('update.restartUnsupported', { reason: capability?.reason ?? '' }));
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
if (window.confirm(t('restart.title') + ' ' + t('restart.desc')) !== true) return;
|
|
587
|
+
const response = await fetch('/dsh-powerup/api/restart', {
|
|
588
|
+
method: 'POST',
|
|
589
|
+
headers: { 'content-type': 'application/json' },
|
|
590
|
+
body: JSON.stringify({ action: 'restart' }),
|
|
591
|
+
});
|
|
592
|
+
const data = await response.json().catch(() => null);
|
|
593
|
+
if (!response.ok || data?.ok !== true) throw new Error(data?.error ?? 'HTTP ' + response.status);
|
|
594
|
+
} catch (error) {
|
|
595
|
+
window.alert(t('update.restartFailed', { message: error?.message ?? String(error) }));
|
|
596
|
+
}
|
|
597
|
+
}
|
|
555
598
|
|
|
556
599
|
function launcherGroupEntry(groupId) {
|
|
557
600
|
return LAUNCHER_GROUP_PREFIX + groupId;
|
|
@@ -567,6 +610,16 @@
|
|
|
567
610
|
return 'g' + Date.now().toString(36) + Math.random().toString(36).slice(2, 6);
|
|
568
611
|
}
|
|
569
612
|
|
|
613
|
+
/**
|
|
614
|
+
* Synthetic tiles (back to conversation, restart DSH, the host's "more"
|
|
615
|
+
* launcher) always live directly on the grid and can never join a folder.
|
|
616
|
+
* @param {string} key tile key
|
|
617
|
+
* @returns {boolean}
|
|
618
|
+
*/
|
|
619
|
+
function isLauncherSpecialKey(key) {
|
|
620
|
+
return key === LAUNCHER_CHAT_KEY || key === LAUNCHER_RESTART_KEY || key === LAUNCHER_MORE_KEY;
|
|
621
|
+
}
|
|
622
|
+
|
|
570
623
|
/**
|
|
571
624
|
* Reconcile the saved launcher state with the panels that exist right now.
|
|
572
625
|
* Unknown panel keys (unregistered, unpinned) are dropped; panels without
|
|
@@ -679,6 +732,7 @@
|
|
|
679
732
|
const writeRaw = typeof options.write === 'function' ? options.write : () => {};
|
|
680
733
|
const listPanels = typeof options.listPanels === 'function' ? options.listPanels : () => [];
|
|
681
734
|
const selectConversation = typeof options.selectConversation === 'function' ? options.selectConversation : () => {};
|
|
735
|
+
const openRestart = typeof options.openRestart === 'function' ? options.openRestart : () => false;
|
|
682
736
|
|
|
683
737
|
let nav = null;
|
|
684
738
|
let docObserver = null;
|
|
@@ -692,6 +746,7 @@
|
|
|
692
746
|
let hostTiles = [];
|
|
693
747
|
let folderButtons = new Map();
|
|
694
748
|
let chatButton = null;
|
|
749
|
+
let restartButton = null;
|
|
695
750
|
let dropLine = null;
|
|
696
751
|
let drag = null;
|
|
697
752
|
let popup = null;
|
|
@@ -799,7 +854,9 @@
|
|
|
799
854
|
const tiles = [];
|
|
800
855
|
const usedKeys = new Set();
|
|
801
856
|
for (const child of [...container.children]) {
|
|
802
|
-
if (child.hasAttribute('data-powerup-folder')
|
|
857
|
+
if (child.hasAttribute('data-powerup-folder')
|
|
858
|
+
|| child.hasAttribute('data-powerup-chat')
|
|
859
|
+
|| child.hasAttribute('data-powerup-restart')) continue;
|
|
803
860
|
if (typeof child.classList === 'object' && child.classList !== null && child.classList.contains('dsh-powerup-drop-line')) continue;
|
|
804
861
|
let gridEl = child;
|
|
805
862
|
let buttonEl = null;
|
|
@@ -896,14 +953,28 @@
|
|
|
896
953
|
return button;
|
|
897
954
|
}
|
|
898
955
|
|
|
956
|
+
/** Refresh a synthetic tile's label and tooltip without churning text. */
|
|
957
|
+
function setSyntheticLabel(button, label, hint) {
|
|
958
|
+
button.setAttribute('aria-label', label);
|
|
959
|
+
button.setAttribute('title', hint === undefined ? label : hint);
|
|
960
|
+
const text = typeof button.querySelector === 'function' ? button.querySelector('.dsh-powerup-synth-label') : null;
|
|
961
|
+
if (text !== null && text.textContent !== label) text.textContent = label;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/** Build a synthetic tile: shared grid styling, one glyph, one label. */
|
|
965
|
+
function createSyntheticTile(className, attribute, icon) {
|
|
966
|
+
const button = document.createElement('button');
|
|
967
|
+
button.type = 'button';
|
|
968
|
+
button.className = 'dsh-powerup-synth ' + className;
|
|
969
|
+
button.setAttribute(attribute, '');
|
|
970
|
+
button.innerHTML = '<span class="dsh-powerup-synth-glyph" aria-hidden="true">' + icon + '</span><span class="dsh-powerup-synth-label"></span>';
|
|
971
|
+
return button;
|
|
972
|
+
}
|
|
973
|
+
|
|
899
974
|
/** The synthetic "back to conversation" tile, created once and re-used. */
|
|
900
975
|
function ensureChatButton() {
|
|
901
976
|
if (chatButton !== null && chatButton.isConnected === true) return chatButton;
|
|
902
|
-
const button =
|
|
903
|
-
button.type = 'button';
|
|
904
|
-
button.className = 'dsh-powerup-chat';
|
|
905
|
-
button.setAttribute('data-powerup-chat', '');
|
|
906
|
-
button.innerHTML = '<span class="dsh-powerup-chat-glyph" aria-hidden="true">' + LAUNCHER_CHAT_ICON + '</span><span class="dsh-powerup-chat-label"></span>';
|
|
977
|
+
const button = createSyntheticTile('dsh-powerup-chat', 'data-powerup-chat', LAUNCHER_CHAT_ICON);
|
|
907
978
|
button.addEventListener('click', (event) => {
|
|
908
979
|
event.preventDefault();
|
|
909
980
|
event.stopPropagation();
|
|
@@ -920,6 +991,30 @@
|
|
|
920
991
|
return button;
|
|
921
992
|
}
|
|
922
993
|
|
|
994
|
+
/**
|
|
995
|
+
* The synthetic "restart DSH" tile, created once and re-used. It hands
|
|
996
|
+
* the click to the React restart prompt owned by the Plugins overlay,
|
|
997
|
+
* so the sidebar and the pending-restart bar share one confirmation.
|
|
998
|
+
*/
|
|
999
|
+
function ensureRestartButton() {
|
|
1000
|
+
if (restartButton !== null && restartButton.isConnected === true) return restartButton;
|
|
1001
|
+
const button = createSyntheticTile('dsh-powerup-restart', 'data-powerup-restart', LAUNCHER_RESTART_ICON);
|
|
1002
|
+
button.addEventListener('click', (event) => {
|
|
1003
|
+
event.preventDefault();
|
|
1004
|
+
event.stopPropagation();
|
|
1005
|
+
if (drag !== null && drag.active) return;
|
|
1006
|
+
closePopup();
|
|
1007
|
+
try {
|
|
1008
|
+
if (openRestart() === false) warn('the restart prompt is not available in this host');
|
|
1009
|
+
} catch (error) {
|
|
1010
|
+
warn('restart prompt could not be opened:', error);
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
1013
|
+
nav.appendChild(button);
|
|
1014
|
+
restartButton = button;
|
|
1015
|
+
return button;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
923
1018
|
function hideDropLine() {
|
|
924
1019
|
if (dropLine !== null) dropLine.style.display = 'none';
|
|
925
1020
|
if (nav !== null && typeof nav.querySelectorAll === 'function') {
|
|
@@ -934,6 +1029,7 @@
|
|
|
934
1029
|
folderButtons.forEach((button) => button.remove());
|
|
935
1030
|
folderButtons = new Map();
|
|
936
1031
|
if (chatButton !== null) chatButton.style.display = 'none';
|
|
1032
|
+
if (restartButton !== null) restartButton.style.display = 'none';
|
|
937
1033
|
if (dropLine !== null) {
|
|
938
1034
|
dropLine.remove();
|
|
939
1035
|
dropLine = null;
|
|
@@ -980,7 +1076,7 @@
|
|
|
980
1076
|
hostTiles = collectHostTiles(nav);
|
|
981
1077
|
const wide = detectWide(hostTiles);
|
|
982
1078
|
nav.classList.toggle('dsh-powerup-launcher-wide', wide);
|
|
983
|
-
const panelKeys = [LAUNCHER_CHAT_KEY, ...hostTiles.map((tile) => tile.key)];
|
|
1079
|
+
const panelKeys = [LAUNCHER_CHAT_KEY, LAUNCHER_RESTART_KEY, ...hostTiles.map((tile) => tile.key)];
|
|
984
1080
|
if (pendingLoad) {
|
|
985
1081
|
pendingLoad = false;
|
|
986
1082
|
state = normalizeLauncherState(readPersisted(), panelKeys);
|
|
@@ -1003,15 +1099,16 @@
|
|
|
1003
1099
|
tile.gridEl.style.order = position === undefined ? '' : String(position);
|
|
1004
1100
|
}
|
|
1005
1101
|
const chat = ensureChatButton();
|
|
1006
|
-
|
|
1007
|
-
chat.setAttribute('aria-label', chatLabel);
|
|
1008
|
-
chat.setAttribute('title', chatLabel);
|
|
1009
|
-
const chatText = typeof chat.querySelector === 'function' ? chat.querySelector('.dsh-powerup-chat-label') : null;
|
|
1010
|
-
if (chatText !== null && chatText.textContent !== chatLabel) chatText.textContent = chatLabel;
|
|
1102
|
+
setSyntheticLabel(chat, t('launcher.backToConversation'));
|
|
1011
1103
|
chat.style.display = wide ? '' : 'none';
|
|
1012
1104
|
const chatPosition = orderIndex.get(LAUNCHER_CHAT_KEY);
|
|
1013
1105
|
chat.style.order = chatPosition === undefined ? '' : String(chatPosition);
|
|
1014
1106
|
chat.classList.toggle('is-active', hostTiles.every((tile) => tile.active !== true));
|
|
1107
|
+
const restart = ensureRestartButton();
|
|
1108
|
+
setSyntheticLabel(restart, t('launcher.restart'), t('launcher.restartHint'));
|
|
1109
|
+
restart.style.display = wide ? '' : 'none';
|
|
1110
|
+
const restartPosition = orderIndex.get(LAUNCHER_RESTART_KEY);
|
|
1111
|
+
restart.style.order = restartPosition === undefined ? '' : String(restartPosition);
|
|
1015
1112
|
const live = new Set();
|
|
1016
1113
|
for (const [groupId, group] of Object.entries(state.groups)) {
|
|
1017
1114
|
live.add(groupId);
|
|
@@ -1496,8 +1593,11 @@
|
|
|
1496
1593
|
const candidates = [];
|
|
1497
1594
|
for (const entry of state.order) {
|
|
1498
1595
|
if (entry === excludeKey) continue;
|
|
1499
|
-
if (entry === LAUNCHER_CHAT_KEY) {
|
|
1500
|
-
|
|
1596
|
+
if (entry === LAUNCHER_CHAT_KEY || entry === LAUNCHER_RESTART_KEY) {
|
|
1597
|
+
const button = entry === LAUNCHER_CHAT_KEY ? chatButton : restartButton;
|
|
1598
|
+
if (button !== null && button.isConnected === true) {
|
|
1599
|
+
candidates.push({ key: entry, el: button, kind: entry === LAUNCHER_CHAT_KEY ? 'chat' : 'restart' });
|
|
1600
|
+
}
|
|
1501
1601
|
continue;
|
|
1502
1602
|
}
|
|
1503
1603
|
const groupId = launcherEntryGroupId(entry);
|
|
@@ -1521,6 +1621,9 @@
|
|
|
1521
1621
|
if (button.hasAttribute('data-powerup-chat')) {
|
|
1522
1622
|
return { kind: 'chat', key: LAUNCHER_CHAT_KEY, gridEl: button, label: t('launcher.backToConversation') };
|
|
1523
1623
|
}
|
|
1624
|
+
if (button.hasAttribute('data-powerup-restart')) {
|
|
1625
|
+
return { kind: 'restart', key: LAUNCHER_RESTART_KEY, gridEl: button, label: t('launcher.restart') };
|
|
1626
|
+
}
|
|
1524
1627
|
const folderId = button.getAttribute('data-powerup-folder');
|
|
1525
1628
|
if (folderId !== null) {
|
|
1526
1629
|
const group = state.groups[folderId];
|
|
@@ -1622,8 +1725,7 @@
|
|
|
1622
1725
|
const centerX = rect.left + rect.width / 2;
|
|
1623
1726
|
const centerY = rect.top + rect.height / 2;
|
|
1624
1727
|
const nearCenter = Math.abs(x - centerX) <= rect.width * 0.28 && Math.abs(y - centerY) <= rect.height * 0.32;
|
|
1625
|
-
const special = candidate.key
|
|
1626
|
-
|| drag.descriptor.key === LAUNCHER_CHAT_KEY || drag.descriptor.key === LAUNCHER_MORE_KEY;
|
|
1728
|
+
const special = isLauncherSpecialKey(candidate.key) || isLauncherSpecialKey(drag.descriptor.key);
|
|
1627
1729
|
if (nearCenter && !special) {
|
|
1628
1730
|
drop = { kind: 'merge', target: candidate };
|
|
1629
1731
|
} else {
|
|
@@ -1752,8 +1854,7 @@
|
|
|
1752
1854
|
|
|
1753
1855
|
function performMerge(sourceKey, targetKey) {
|
|
1754
1856
|
if (sourceKey === targetKey) return;
|
|
1755
|
-
if (sourceKey
|
|
1756
|
-
|| sourceKey === LAUNCHER_MORE_KEY || targetKey === LAUNCHER_MORE_KEY) return;
|
|
1857
|
+
if (isLauncherSpecialKey(sourceKey) || isLauncherSpecialKey(targetKey)) return;
|
|
1757
1858
|
const sourceGroupId = launcherEntryGroupId(sourceKey);
|
|
1758
1859
|
const targetGroupId = launcherEntryGroupId(targetKey);
|
|
1759
1860
|
if (sourceGroupId !== null && sourceGroupId === targetGroupId) return;
|
|
@@ -1846,6 +1947,10 @@
|
|
|
1846
1947
|
chatButton.remove();
|
|
1847
1948
|
chatButton = null;
|
|
1848
1949
|
}
|
|
1950
|
+
if (restartButton !== null) {
|
|
1951
|
+
restartButton.remove();
|
|
1952
|
+
restartButton = null;
|
|
1953
|
+
}
|
|
1849
1954
|
state = { order: [], groups: {} };
|
|
1850
1955
|
pendingLoad = true;
|
|
1851
1956
|
nav = null;
|
|
@@ -1917,6 +2022,14 @@
|
|
|
1917
2022
|
const layout = ctx.get('layout');
|
|
1918
2023
|
if (layout !== undefined && layout !== null && typeof layout.selectPanel === 'function') layout.selectPanel(null);
|
|
1919
2024
|
},
|
|
2025
|
+
openRestart: () => {
|
|
2026
|
+
if (restartPromptBridge.open !== null) {
|
|
2027
|
+
restartPromptBridge.open();
|
|
2028
|
+
return true;
|
|
2029
|
+
}
|
|
2030
|
+
void restartWithoutPrompt();
|
|
2031
|
+
return true;
|
|
2032
|
+
},
|
|
1920
2033
|
});
|
|
1921
2034
|
ctx.effect(() => {
|
|
1922
2035
|
core.start();
|
|
@@ -2240,9 +2353,9 @@
|
|
|
2240
2353
|
*/
|
|
2241
2354
|
const LAUNCHER_CSS = `
|
|
2242
2355
|
nav.dsh-powerup-launcher.dsh-powerup-launcher-wide{position:relative;display:grid!important;grid-template-columns:repeat(auto-fill,minmax(58px,1fr));grid-auto-rows:min-content;gap:2px;align-content:start;align-items:stretch;margin:0 0 10px;padding:2px 0}
|
|
2243
|
-
nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button,nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-more]>button,.dsh-powerup-folder,.dsh-powerup-
|
|
2244
|
-
nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover,nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-more]>button:hover,.dsh-powerup-folder:hover,.dsh-powerup-
|
|
2245
|
-
nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:active,nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-more]>button:active,.dsh-powerup-folder:active,.dsh-powerup-
|
|
2356
|
+
nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button,nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-more]>button,.dsh-powerup-folder,.dsh-powerup-synth{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;width:auto;min-width:0;height:auto;min-height:52px;margin:0;padding:6px 2px 5px;border:0;border-radius:var(--dsw-radius-md,8px);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:11px;line-height:14px;text-align:center;cursor:pointer;user-select:none;-webkit-user-select:none;transition:background .12s ease,color .12s ease,transform .12s ease}
|
|
2357
|
+
nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover,nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-more]>button:hover,.dsh-powerup-folder:hover,.dsh-powerup-synth:hover{background:var(--dsw-alias-interactive-bg-hover)}
|
|
2358
|
+
nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:active,nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-more]>button:active,.dsh-powerup-folder:active,.dsh-powerup-synth:active{transform:scale(.96)}
|
|
2246
2359
|
nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button[class*="panelActive"],nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-more]>button[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover)}
|
|
2247
2360
|
nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-more]{display:flex!important;flex-direction:column;min-width:0;margin:0}
|
|
2248
2361
|
nav.dsh-powerup-launcher.dsh-powerup-launcher-wide [class*="panelGlyph"]{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex:none}
|
|
@@ -2258,12 +2371,12 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover [class*="panelTi
|
|
|
2258
2371
|
.dsh-powerup-folder-name{display:block;width:100%;max-width:100%;color:var(--dsw-alias-label-secondary);font-size:11px;line-height:14px;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
2259
2372
|
.dsh-powerup-folder.is-active .dsh-powerup-folder-name{color:var(--dsw-alias-label-primary)}
|
|
2260
2373
|
.dsh-powerup-folder.is-active .dsh-powerup-folder-stack{background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 22%,transparent)}
|
|
2261
|
-
.dsh-powerup-
|
|
2262
|
-
.dsh-powerup-
|
|
2263
|
-
.dsh-powerup-
|
|
2264
|
-
.dsh-powerup-
|
|
2374
|
+
.dsh-powerup-synth-glyph{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex:none;color:var(--dsw-alias-label-secondary)}
|
|
2375
|
+
.dsh-powerup-synth-glyph svg{width:20px;height:20px}
|
|
2376
|
+
.dsh-powerup-synth-label{display:block;width:100%;max-width:100%;color:var(--dsw-alias-label-secondary);font-size:11px;line-height:14px;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
2377
|
+
.dsh-powerup-synth:hover .dsh-powerup-synth-label{color:var(--dsw-alias-label-primary)}
|
|
2265
2378
|
.dsh-powerup-chat.is-active{background:var(--dsw-alias-interactive-bg-hover)}
|
|
2266
|
-
.dsh-powerup-chat.is-active .dsh-powerup-
|
|
2379
|
+
.dsh-powerup-chat.is-active .dsh-powerup-synth-label,.dsh-powerup-chat.is-active .dsh-powerup-synth-glyph{color:var(--dsw-alias-label-primary)}
|
|
2267
2380
|
.dsh-powerup-dragging{opacity:.32}
|
|
2268
2381
|
.dsh-powerup-merge-target{background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 17%,transparent)!important;box-shadow:inset 0 0 0 1px var(--dsw-alias-state-business-primary)}
|
|
2269
2382
|
.dsh-powerup-drop-line{position:absolute;z-index:6;display:none;width:2px;border-radius:999px;background:var(--dsw-alias-state-business-primary);box-shadow:0 0 0 1px color-mix(in srgb,var(--dsw-alias-state-business-primary) 26%,transparent);pointer-events:none}
|
|
@@ -2302,7 +2415,7 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover [class*="panelTi
|
|
|
2302
2415
|
.dsh-powerup-folder-item-ghost .dsh-powerup-folder-item-glyph svg{width:20px;height:20px}
|
|
2303
2416
|
.dsh-powerup-folder-item-ghost .dsh-powerup-folder-item-label{display:block;width:100%;max-width:100%;color:var(--dsw-alias-label-secondary);text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
2304
2417
|
.dsh-powerup-folder-item-ghost .dsh-powerup-folder-item-remove{display:none}
|
|
2305
|
-
@media (prefers-reduced-motion:reduce){nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button,nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-more]>button,.dsh-powerup-folder,.dsh-powerup-folder-pop,.dsh-powerup-drag-ghost,.dsh-powerup-drop-line{transition:none}}
|
|
2418
|
+
@media (prefers-reduced-motion:reduce){nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button,nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-more]>button,.dsh-powerup-folder,.dsh-powerup-synth,.dsh-powerup-folder-pop,.dsh-powerup-drag-ghost,.dsh-powerup-drop-line{transition:none}}
|
|
2306
2419
|
`;
|
|
2307
2420
|
|
|
2308
2421
|
const CSS = `
|
|
@@ -4665,6 +4778,17 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover [class*="panelTi
|
|
|
4665
4778
|
};
|
|
4666
4779
|
openRestartRef.current = openRestart;
|
|
4667
4780
|
|
|
4781
|
+
// The sidebar launcher is plain DOM and cannot render React, so it
|
|
4782
|
+
// calls this opener for its synthetic "restart DSH" tile. Keeping the
|
|
4783
|
+
// opener here means the sidebar and the pending-restart bar share one
|
|
4784
|
+
// confirmation dialog, one capability read and one set of copy.
|
|
4785
|
+
useEffect(() => {
|
|
4786
|
+
restartPromptBridge.open = () => openRestartRef.current();
|
|
4787
|
+
return () => {
|
|
4788
|
+
if (restartPromptBridge.open !== null) restartPromptBridge.open = null;
|
|
4789
|
+
};
|
|
4790
|
+
}, []);
|
|
4791
|
+
|
|
4668
4792
|
/** Confirm the list-header restart. */
|
|
4669
4793
|
const confirmRestart = async () => {
|
|
4670
4794
|
if (restartBusy) return;
|
|
@@ -4755,7 +4879,9 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover [class*="panelTi
|
|
|
4755
4879
|
h('div', { className: 'dsh-powerup-update-head' },
|
|
4756
4880
|
h('div', { className: 'dsh-powerup-update-heading' },
|
|
4757
4881
|
h('h2', { id: 'dsh-powerup-restart-title' }, t('restart.title')),
|
|
4758
|
-
|
|
4882
|
+
/* A sidebar-initiated restart usually has no pending plugins, so the
|
|
4883
|
+
subtitle only appears when there is something to report. */
|
|
4884
|
+
pending.length === 0 ? null : h('p', null, t('restart.pending', { count: pending.length })),
|
|
4759
4885
|
),
|
|
4760
4886
|
restartBusy ? null : h('button', { type: 'button', className: 'dsh-powerup-update-close', 'aria-label': t('update.close'), onClick: () => setRestartAsk(false) }, '×'),
|
|
4761
4887
|
),
|
|
@@ -5649,6 +5775,9 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover [class*="panelTi
|
|
|
5649
5775
|
CSS,
|
|
5650
5776
|
LAUNCHER_CSS,
|
|
5651
5777
|
LAUNCHER_STORAGE_KEY,
|
|
5778
|
+
LAUNCHER_CHAT_KEY,
|
|
5779
|
+
LAUNCHER_RESTART_KEY,
|
|
5780
|
+
LAUNCHER_RESTART_ICON,
|
|
5652
5781
|
normalizeLauncherState,
|
|
5653
5782
|
dissolveGroupOrder,
|
|
5654
5783
|
createLauncherCore,
|
package/locale/en.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Power-Up",
|
|
4
|
-
"description": "Adds a right-click action menu to the Trajectory ledger: copy a record, copy a Markdown quote, quote it into the composer, open the record inspector, fork the session at that record, copy a step reference (session id + step id) that the read-only powerup_step_read tool resolves back into the raw session data, export the trajectory snapshot, and copy the session ID. The session header background jobs panel gains an optional stop reason when a job is stopped by hand; the reason is appended to the completion notice injected into the session. The Plugins page gains an install control on every third-party installed plugin: read versions from the registry, install the version in the input through the Add plugin path (removing the old copy first), then enable and optionally restart DSH. The install panel also offers a one-click install that installs the input version without the enable and restart questions, enabling and restarting automatically by default; both defaults are configurable on the Power-Up page. A sidebar launcher turns the left sidebar panel buttons into an adaptive icon grid (icon above label) with drag sorting and folders: drop an icon onto the middle of another to fold them into a folder like a Windows Start menu folder, click a folder to open its icons in a flyout, and switch the whole grid off on the Power-Up page."
|
|
4
|
+
"description": "Adds a right-click action menu to the Trajectory ledger: copy a record, copy a Markdown quote, quote it into the composer, open the record inspector, fork the session at that record, copy a step reference (session id + step id) that the read-only powerup_step_read tool resolves back into the raw session data, export the trajectory snapshot, and copy the session ID. The session header background jobs panel gains an optional stop reason when a job is stopped by hand; the reason is appended to the completion notice injected into the session. The Plugins page gains an install control on every third-party installed plugin: read versions from the registry, install the version in the input through the Add plugin path (removing the old copy first), then enable and optionally restart DSH. The install panel also offers a one-click install that installs the input version without the enable and restart questions, enabling and restarting automatically by default; both defaults are configurable on the Power-Up page. A sidebar launcher turns the left sidebar panel buttons into an adaptive icon grid (icon above label) with drag sorting and folders: drop an icon onto the middle of another to fold them into a folder like a Windows Start menu folder, click a folder to open its icons in a flyout, and switch the whole grid off on the Power-Up page. The grid also carries two built-in buttons: back to conversation, and restart DSH (which reuses the install flow's restart confirmation)."
|
|
5
5
|
}
|
|
6
6
|
}
|
package/locale/zh.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"meta": {
|
|
3
3
|
"title": "Power-Up",
|
|
4
|
-
"description": "在轨迹页面为记录增加右键操作菜单:复制内容、复制 Markdown 引用、引用到输入框、查看记录详情、从该记录 Fork 会话、复制「会话 ID + 步骤 ID」的步骤引用(Agent 用只读工具 powerup_step_read 取回该步骤完整数据)、导出轨迹快照、复制会话 ID。在会话顶部的后台任务面板手动停止任务时可以填写停止原因,原因会附加在任务结束后注入会话的提示里。插件页为每个第三方已安装插件增加安装按钮:从安装源读取版本,按输入框中的版本先卸载旧版再按「添加插件」流程安装,完成后可立即启用并选择是否重启 DSH。安装面板还提供「一键安装」:按输入框版本安装并跳过启用与重启的询问,默认自动启用并重启,可在 Power-Up 页面调整默认行为。侧边栏启动器把左侧边栏的面板按钮变成随宽度自适应的图标网格(图标在上、文字在下),支持拖拽排序与分组:把一个图标拖到另一个图标的中间即可合并成分组(像 Windows 开始菜单的文件夹),点击分组会以浮层弹出其中的图标;可在 Power-Up
|
|
4
|
+
"description": "在轨迹页面为记录增加右键操作菜单:复制内容、复制 Markdown 引用、引用到输入框、查看记录详情、从该记录 Fork 会话、复制「会话 ID + 步骤 ID」的步骤引用(Agent 用只读工具 powerup_step_read 取回该步骤完整数据)、导出轨迹快照、复制会话 ID。在会话顶部的后台任务面板手动停止任务时可以填写停止原因,原因会附加在任务结束后注入会话的提示里。插件页为每个第三方已安装插件增加安装按钮:从安装源读取版本,按输入框中的版本先卸载旧版再按「添加插件」流程安装,完成后可立即启用并选择是否重启 DSH。安装面板还提供「一键安装」:按输入框版本安装并跳过启用与重启的询问,默认自动启用并重启,可在 Power-Up 页面调整默认行为。侧边栏启动器把左侧边栏的面板按钮变成随宽度自适应的图标网格(图标在上、文字在下),支持拖拽排序与分组:把一个图标拖到另一个图标的中间即可合并成分组(像 Windows 开始菜单的文件夹),点击分组会以浮层弹出其中的图标;可在 Power-Up 页面整体关闭。网格里自带「返回会话」与「重启 DSH」两个按钮,重启沿用插件安装流程的确认对话框。"
|
|
5
5
|
}
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@restregular/dsh-powerup",
|
|
3
|
-
"version": "0.8.
|
|
4
|
-
"description": "Power-Up — small, opt-in upgrades for DeepSeek Harness. Adds a right-click action menu to the Trajectory ledger, an optional stop reason in the session header's background jobs panel (appended to the injected completion notice), and an install control for third-party plugins from the Plugins page: read versions from the configured registries, install the version in the input through the Add plugin path (removing the old copy first), mark restart-needed installs, hand Power-Up's own install to the background, and optionally restart DSH. One-click install skips the enable and restart questions and can apply those actions automatically with configurable defaults. The ledger menu also copies a step reference (session id + step id) that the read-only powerup_step_read tool resolves back into the raw session data. · 为 DeepSeek Harness 提供小型增强:在轨迹页面右键记录即可复制、引用、查看详情或从该记录 Fork;右键「复制步骤引用」得到「会话 ID + 步骤 ID」,Agent 用只读工具 powerup_step_read 即可取回该步骤的完整原始数据;在会话顶部的后台任务面板手动停止任务时可填写停止原因,原因会附加到任务结束后的会话提示;并在插件页为第三方已安装插件提供安装按钮,从安装源读取版本,按输入框中的版本沿用「添加插件」流程安装(先卸载旧版),支持待重启标记、Power-Up 自身后台安装与可选重启;安装面板提供「一键安装」,按输入框版本安装并跳过启用/重启询问,默认自动启用并重启,可在 Power-Up 页面调整默认行为。 ·
|
|
3
|
+
"version": "0.8.6",
|
|
4
|
+
"description": "Power-Up — small, opt-in upgrades for DeepSeek Harness. Adds a right-click action menu to the Trajectory ledger, an optional stop reason in the session header's background jobs panel (appended to the injected completion notice), and an install control for third-party plugins from the Plugins page: read versions from the configured registries, install the version in the input through the Add plugin path (removing the old copy first), mark restart-needed installs, hand Power-Up's own install to the background, and optionally restart DSH. One-click install skips the enable and restart questions and can apply those actions automatically with configurable defaults. The ledger menu also copies a step reference (session id + step id) that the read-only powerup_step_read tool resolves back into the raw session data. · 为 DeepSeek Harness 提供小型增强:在轨迹页面右键记录即可复制、引用、查看详情或从该记录 Fork;右键「复制步骤引用」得到「会话 ID + 步骤 ID」,Agent 用只读工具 powerup_step_read 即可取回该步骤的完整原始数据;在会话顶部的后台任务面板手动停止任务时可填写停止原因,原因会附加到任务结束后的会话提示;并在插件页为第三方已安装插件提供安装按钮,从安装源读取版本,按输入框中的版本沿用「添加插件」流程安装(先卸载旧版),支持待重启标记、Power-Up 自身后台安装与可选重启;安装面板提供「一键安装」,按输入框版本安装并跳过启用/重启询问,默认自动启用并重启,可在 Power-Up 页面调整默认行为。 · 侧边栏启动器:把左侧边栏的面板按钮变成随宽度自适应的图标网格(图标在上、文字在下),支持拖拽排序与分组(拖到另一个图标中间即合并为分组,点击分组弹出浮层展示内部图标),可随时整体关闭;网格里自带「返回会话」与「重启 DSH」两个按钮,重启沿用插件安装流程的确认对话框。",
|
|
5
5
|
"icon": "./icon.svg",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "index.js",
|
|
@@ -76,7 +76,8 @@
|
|
|
76
76
|
"sidebar",
|
|
77
77
|
"launcher",
|
|
78
78
|
"drag-sort",
|
|
79
|
-
"folder"
|
|
79
|
+
"folder",
|
|
80
|
+
"restart"
|
|
80
81
|
],
|
|
81
82
|
"publishConfig": {
|
|
82
83
|
"access": "public",
|