@restregular/dsh-powerup 0.8.3 → 0.8.5

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 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 and folders.
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,17 @@ 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 (power glyph +
121
+ `重启` / `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.
128
+ - **Ungroup expands in place.** Dissolving a folder puts its icons back on the
129
+ grid exactly where the folder sat, in the folder's own order — nothing jumps
130
+ to the end of the grid.
119
131
  - **Drag inside a folder.** Tiles in the flyout are drag handles: drag one over
120
132
  another to reorder the folder's contents, or drag it out of the flyout and
121
133
  drop it anywhere else to put it back on the grid right after the folder
@@ -218,13 +230,21 @@ fiber is unloaded. The panel closes; refresh the page when the install finishes.
218
230
  rows are resolved by shape — a direct `<button>`, or a wrapper (the More
219
231
  launcher's `Menu` root `<span>`) whose direct child is that button — because
220
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.
221
240
  - **Every sync write is idempotent.** The launcher observes its own `<nav>`
222
241
  with a `MutationObserver`, so a write that changes a watched subtree on every
223
242
  sync turns into an infinite loop — and a loop rebuilds the folder flyout
224
243
  continuously, which makes normal clicks miss (the node under the pointer is
225
244
  replaced between `pointerdown` and `click`). Setting `textContent` to the same
226
- string still emits a `childList` mutation, so the synthetic chat tile only
227
- writes its label when it actually changed, folder tiles rebuild only when
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
228
248
  their signature changed, and the flyout re-renders only when its roster or
229
249
  name changed. A
230
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.3';
72
+ const VERSION = '0.8.5';
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 power glyph for the synthetic "restart DSH" tile. */
562
+ const LAUNCHER_RESTART_ICON = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" aria-hidden="true" focusable="false"><path d="M12 2.6v9.2" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M18.36 6.64a9 9 0 1 1-12.73 0" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></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
@@ -630,6 +683,30 @@
630
683
  return { order, groups };
631
684
  }
632
685
 
686
+ /**
687
+ * Replace a folder entry with its members, in the folder's own order, at
688
+ * the exact position the folder occupied. Used by "ungroup" so dissolving
689
+ * a folder is a pure expansion and never scatters the icons to the end.
690
+ * @param {string[]} order current top-level order
691
+ * @param {string} folderEntry the `group:<id>` entry being dissolved
692
+ * @param {string[]} items member keys in folder order
693
+ * @returns {string[]} the new top-level order
694
+ */
695
+ function dissolveGroupOrder(order, folderEntry, items) {
696
+ const source = Array.isArray(order) ? order : [];
697
+ const list = source.filter((entry) => entry !== folderEntry);
698
+ const index = source.indexOf(folderEntry);
699
+ const members = [];
700
+ for (const key of Array.isArray(items) ? items : []) {
701
+ if (typeof key !== 'string' || key === '' || key.startsWith('__')) continue;
702
+ if (list.includes(key) || members.includes(key)) continue;
703
+ members.push(key);
704
+ }
705
+ const insertAt = index < 0 ? list.length : Math.min(index, list.length);
706
+ list.splice(insertAt, 0, ...members);
707
+ return list;
708
+ }
709
+
633
710
  /**
634
711
  * DOM-driven controller for the sidebar launcher.
635
712
  *
@@ -655,6 +732,7 @@
655
732
  const writeRaw = typeof options.write === 'function' ? options.write : () => {};
656
733
  const listPanels = typeof options.listPanels === 'function' ? options.listPanels : () => [];
657
734
  const selectConversation = typeof options.selectConversation === 'function' ? options.selectConversation : () => {};
735
+ const openRestart = typeof options.openRestart === 'function' ? options.openRestart : () => false;
658
736
 
659
737
  let nav = null;
660
738
  let docObserver = null;
@@ -668,6 +746,7 @@
668
746
  let hostTiles = [];
669
747
  let folderButtons = new Map();
670
748
  let chatButton = null;
749
+ let restartButton = null;
671
750
  let dropLine = null;
672
751
  let drag = null;
673
752
  let popup = null;
@@ -775,7 +854,9 @@
775
854
  const tiles = [];
776
855
  const usedKeys = new Set();
777
856
  for (const child of [...container.children]) {
778
- if (child.hasAttribute('data-powerup-folder') || child.hasAttribute('data-powerup-chat')) continue;
857
+ if (child.hasAttribute('data-powerup-folder')
858
+ || child.hasAttribute('data-powerup-chat')
859
+ || child.hasAttribute('data-powerup-restart')) continue;
779
860
  if (typeof child.classList === 'object' && child.classList !== null && child.classList.contains('dsh-powerup-drop-line')) continue;
780
861
  let gridEl = child;
781
862
  let buttonEl = null;
@@ -872,14 +953,28 @@
872
953
  return button;
873
954
  }
874
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
+
875
974
  /** The synthetic "back to conversation" tile, created once and re-used. */
876
975
  function ensureChatButton() {
877
976
  if (chatButton !== null && chatButton.isConnected === true) return chatButton;
878
- const button = document.createElement('button');
879
- button.type = 'button';
880
- button.className = 'dsh-powerup-chat';
881
- button.setAttribute('data-powerup-chat', '');
882
- 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);
883
978
  button.addEventListener('click', (event) => {
884
979
  event.preventDefault();
885
980
  event.stopPropagation();
@@ -896,6 +991,30 @@
896
991
  return button;
897
992
  }
898
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
+
899
1018
  function hideDropLine() {
900
1019
  if (dropLine !== null) dropLine.style.display = 'none';
901
1020
  if (nav !== null && typeof nav.querySelectorAll === 'function') {
@@ -910,6 +1029,7 @@
910
1029
  folderButtons.forEach((button) => button.remove());
911
1030
  folderButtons = new Map();
912
1031
  if (chatButton !== null) chatButton.style.display = 'none';
1032
+ if (restartButton !== null) restartButton.style.display = 'none';
913
1033
  if (dropLine !== null) {
914
1034
  dropLine.remove();
915
1035
  dropLine = null;
@@ -956,7 +1076,7 @@
956
1076
  hostTiles = collectHostTiles(nav);
957
1077
  const wide = detectWide(hostTiles);
958
1078
  nav.classList.toggle('dsh-powerup-launcher-wide', wide);
959
- const panelKeys = [LAUNCHER_CHAT_KEY, ...hostTiles.map((tile) => tile.key)];
1079
+ const panelKeys = [LAUNCHER_CHAT_KEY, LAUNCHER_RESTART_KEY, ...hostTiles.map((tile) => tile.key)];
960
1080
  if (pendingLoad) {
961
1081
  pendingLoad = false;
962
1082
  state = normalizeLauncherState(readPersisted(), panelKeys);
@@ -979,15 +1099,16 @@
979
1099
  tile.gridEl.style.order = position === undefined ? '' : String(position);
980
1100
  }
981
1101
  const chat = ensureChatButton();
982
- const chatLabel = t('launcher.backToConversation');
983
- chat.setAttribute('aria-label', chatLabel);
984
- chat.setAttribute('title', chatLabel);
985
- const chatText = typeof chat.querySelector === 'function' ? chat.querySelector('.dsh-powerup-chat-label') : null;
986
- if (chatText !== null && chatText.textContent !== chatLabel) chatText.textContent = chatLabel;
1102
+ setSyntheticLabel(chat, t('launcher.backToConversation'));
987
1103
  chat.style.display = wide ? '' : 'none';
988
1104
  const chatPosition = orderIndex.get(LAUNCHER_CHAT_KEY);
989
1105
  chat.style.order = chatPosition === undefined ? '' : String(chatPosition);
990
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);
991
1112
  const live = new Set();
992
1113
  for (const [groupId, group] of Object.entries(state.groups)) {
993
1114
  live.add(groupId);
@@ -1458,9 +1579,7 @@
1458
1579
  if (group === undefined) return;
1459
1580
  const groups = { ...state.groups };
1460
1581
  delete groups[groupId];
1461
- const order = state.order
1462
- .filter((entry) => entry !== launcherGroupEntry(groupId))
1463
- .concat(group.items.filter((key) => !state.order.includes(key)));
1582
+ const order = dissolveGroupOrder(state.order, launcherGroupEntry(groupId), group.items);
1464
1583
  state = { order, groups };
1465
1584
  save();
1466
1585
  closePopup();
@@ -1474,8 +1593,11 @@
1474
1593
  const candidates = [];
1475
1594
  for (const entry of state.order) {
1476
1595
  if (entry === excludeKey) continue;
1477
- if (entry === LAUNCHER_CHAT_KEY) {
1478
- if (chatButton !== null && chatButton.isConnected === true) candidates.push({ key: entry, el: chatButton, kind: 'chat' });
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
+ }
1479
1601
  continue;
1480
1602
  }
1481
1603
  const groupId = launcherEntryGroupId(entry);
@@ -1499,6 +1621,9 @@
1499
1621
  if (button.hasAttribute('data-powerup-chat')) {
1500
1622
  return { kind: 'chat', key: LAUNCHER_CHAT_KEY, gridEl: button, label: t('launcher.backToConversation') };
1501
1623
  }
1624
+ if (button.hasAttribute('data-powerup-restart')) {
1625
+ return { kind: 'restart', key: LAUNCHER_RESTART_KEY, gridEl: button, label: t('launcher.restart') };
1626
+ }
1502
1627
  const folderId = button.getAttribute('data-powerup-folder');
1503
1628
  if (folderId !== null) {
1504
1629
  const group = state.groups[folderId];
@@ -1600,8 +1725,7 @@
1600
1725
  const centerX = rect.left + rect.width / 2;
1601
1726
  const centerY = rect.top + rect.height / 2;
1602
1727
  const nearCenter = Math.abs(x - centerX) <= rect.width * 0.28 && Math.abs(y - centerY) <= rect.height * 0.32;
1603
- const special = candidate.key === LAUNCHER_CHAT_KEY || candidate.key === LAUNCHER_MORE_KEY
1604
- || drag.descriptor.key === LAUNCHER_CHAT_KEY || drag.descriptor.key === LAUNCHER_MORE_KEY;
1728
+ const special = isLauncherSpecialKey(candidate.key) || isLauncherSpecialKey(drag.descriptor.key);
1605
1729
  if (nearCenter && !special) {
1606
1730
  drop = { kind: 'merge', target: candidate };
1607
1731
  } else {
@@ -1730,8 +1854,7 @@
1730
1854
 
1731
1855
  function performMerge(sourceKey, targetKey) {
1732
1856
  if (sourceKey === targetKey) return;
1733
- if (sourceKey === LAUNCHER_CHAT_KEY || targetKey === LAUNCHER_CHAT_KEY
1734
- || sourceKey === LAUNCHER_MORE_KEY || targetKey === LAUNCHER_MORE_KEY) return;
1857
+ if (isLauncherSpecialKey(sourceKey) || isLauncherSpecialKey(targetKey)) return;
1735
1858
  const sourceGroupId = launcherEntryGroupId(sourceKey);
1736
1859
  const targetGroupId = launcherEntryGroupId(targetKey);
1737
1860
  if (sourceGroupId !== null && sourceGroupId === targetGroupId) return;
@@ -1824,6 +1947,10 @@
1824
1947
  chatButton.remove();
1825
1948
  chatButton = null;
1826
1949
  }
1950
+ if (restartButton !== null) {
1951
+ restartButton.remove();
1952
+ restartButton = null;
1953
+ }
1827
1954
  state = { order: [], groups: {} };
1828
1955
  pendingLoad = true;
1829
1956
  nav = null;
@@ -1895,6 +2022,14 @@
1895
2022
  const layout = ctx.get('layout');
1896
2023
  if (layout !== undefined && layout !== null && typeof layout.selectPanel === 'function') layout.selectPanel(null);
1897
2024
  },
2025
+ openRestart: () => {
2026
+ if (restartPromptBridge.open !== null) {
2027
+ restartPromptBridge.open();
2028
+ return true;
2029
+ }
2030
+ void restartWithoutPrompt();
2031
+ return true;
2032
+ },
1898
2033
  });
1899
2034
  ctx.effect(() => {
1900
2035
  core.start();
@@ -2218,9 +2353,9 @@
2218
2353
  */
2219
2354
  const LAUNCHER_CSS = `
2220
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}
2221
- 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-chat{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}
2222
- 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-chat:hover{background:var(--dsw-alias-interactive-bg-hover)}
2223
- 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-chat:active{transform:scale(.96)}
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)}
2224
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)}
2225
2360
  nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-more]{display:flex!important;flex-direction:column;min-width:0;margin:0}
2226
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}
@@ -2236,12 +2371,12 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover [class*="panelTi
2236
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}
2237
2372
  .dsh-powerup-folder.is-active .dsh-powerup-folder-name{color:var(--dsw-alias-label-primary)}
2238
2373
  .dsh-powerup-folder.is-active .dsh-powerup-folder-stack{background:color-mix(in srgb,var(--dsw-alias-state-business-primary) 22%,transparent)}
2239
- .dsh-powerup-chat-glyph{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex:none;color:var(--dsw-alias-label-secondary)}
2240
- .dsh-powerup-chat-glyph svg{width:20px;height:20px}
2241
- .dsh-powerup-chat-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}
2242
- .dsh-powerup-chat:hover .dsh-powerup-chat-label{color:var(--dsw-alias-label-primary)}
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)}
2243
2378
  .dsh-powerup-chat.is-active{background:var(--dsw-alias-interactive-bg-hover)}
2244
- .dsh-powerup-chat.is-active .dsh-powerup-chat-label,.dsh-powerup-chat.is-active .dsh-powerup-chat-glyph{color:var(--dsw-alias-label-primary)}
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)}
2245
2380
  .dsh-powerup-dragging{opacity:.32}
2246
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)}
2247
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}
@@ -2280,7 +2415,7 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover [class*="panelTi
2280
2415
  .dsh-powerup-folder-item-ghost .dsh-powerup-folder-item-glyph svg{width:20px;height:20px}
2281
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}
2282
2417
  .dsh-powerup-folder-item-ghost .dsh-powerup-folder-item-remove{display:none}
2283
- @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}}
2284
2419
  `;
2285
2420
 
2286
2421
  const CSS = `
@@ -4643,6 +4778,17 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover [class*="panelTi
4643
4778
  };
4644
4779
  openRestartRef.current = openRestart;
4645
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
+
4646
4792
  /** Confirm the list-header restart. */
4647
4793
  const confirmRestart = async () => {
4648
4794
  if (restartBusy) return;
@@ -4733,7 +4879,9 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover [class*="panelTi
4733
4879
  h('div', { className: 'dsh-powerup-update-head' },
4734
4880
  h('div', { className: 'dsh-powerup-update-heading' },
4735
4881
  h('h2', { id: 'dsh-powerup-restart-title' }, t('restart.title')),
4736
- h('p', null, t('restart.pending', { count: pending.length })),
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 })),
4737
4885
  ),
4738
4886
  restartBusy ? null : h('button', { type: 'button', className: 'dsh-powerup-update-close', 'aria-label': t('update.close'), onClick: () => setRestartAsk(false) }, '×'),
4739
4887
  ),
@@ -5627,7 +5775,11 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover [class*="panelTi
5627
5775
  CSS,
5628
5776
  LAUNCHER_CSS,
5629
5777
  LAUNCHER_STORAGE_KEY,
5778
+ LAUNCHER_CHAT_KEY,
5779
+ LAUNCHER_RESTART_KEY,
5780
+ LAUNCHER_RESTART_ICON,
5630
5781
  normalizeLauncherState,
5782
+ dissolveGroupOrder,
5631
5783
  createLauncherCore,
5632
5784
  installLauncher,
5633
5785
  PowerUpLineIcon,
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.3",
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.5",
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",