@restregular/dsh-powerup 0.8.9 → 0.8.10

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.
Files changed (3) hide show
  1. package/README.md +18 -9
  2. package/client.js +61 -15
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -98,7 +98,8 @@ entries other plugins add) become an icon grid instead of a one-per-row list:
98
98
  `minmax(58px, 1fr)` cells, so widening the sidebar adds columns and narrowing
99
99
  it removes them — there is no fixed column count to break.
100
100
  - **Icons above labels.** Each tile stacks a 20px icon over an 11px caption, one
101
- line with an ellipsis when the label is long.
101
+ line with an ellipsis when the label is long. The host's per-row unpin button
102
+ is hidden inside the grid, so a tile is one click target.
102
103
  - **Drag to sort.** Press and drag a tile; a ghost follows the pointer and a
103
104
  thin accent line marks the insertion point. Order is stored per browser.
104
105
  - **Drop onto a tile's middle to build a folder.** Dropping on the middle of
@@ -108,11 +109,17 @@ entries other plugins add) become an icon grid instead of a one-per-row list:
108
109
  anchored to the tile, scaling in from its edge. Inside the flyout: click an
109
110
  entry to open that panel, `×` removes it from the folder, click the title to
110
111
  rename the folder, and **Ungroup** returns every member to the grid.
111
- - **The host's "More" entry is a tile too.** The host wraps its extra-panels
112
- menu in a `Menu` root `<span>` around the row button (not a div), so the
113
- launcher resolves any non-button child that owns a direct button as that
114
- entry; it gets the same stacked icon/label tile and can be dragged like any
115
- other panel, including into a folder.
112
+ - **A host row may be a wrapper, not a bare button.** DSH 0.2.2 wraps each
113
+ panel row in a cell element (`div.panelEntry` holding `button.panelRow` plus
114
+ its `panelUnpin` overlay) and the extra-panels menu in a `span.moreAnchor`.
115
+ The launcher treats any direct child that owns a direct button as one tile:
116
+ the wrapper becomes the grid cell and its row button the click target, so the
117
+ unpin overlay can be hidden without losing the row. The host's "More" entry is
118
+ recognised by `aria-haspopup` / `aria-expanded` (or the `moreAnchor` wrapper),
119
+ never by "not a button", so every panel row keeps its own slot id.
120
+ - **The host's "More" entry is a tile too.** It gets the same stacked
121
+ icon/label tile and can be dragged like any other panel, including into a
122
+ folder.
116
123
  - **A synthetic "Back to conversation" tile.** Power-Up adds one extra tile of
117
124
  its own (chat glyph + label) that calls `layout.selectPanel(null)` to return
118
125
  to the Conversation; it highlights when no global panel is selected and can be
@@ -236,9 +243,11 @@ fiber is unloaded. The panel closes; refresh the page when the install finishes.
236
243
  synthetic folder tiles, hides the rows that moved into a folder with an
237
244
  inline `display` (React rewrites `className` when the active panel changes and
238
245
  would drop an added class), and sorts with the grid's `order` property. Host
239
- rows are resolved by shape — a direct `<button>`, or a wrapper (the More
240
- launcher's `Menu` root `<span>`) whose direct child is that button — because
241
- the wrapper element differs between the panel rows and the more menu.
246
+ rows are resolved by shape — a direct `<button>`, or a cell wrapper
247
+ (`div.panelEntry` since 0.2.2, the More `Menu` root `<span>`) whose direct
248
+ child is that button — so one code path covers both the panel rows and the
249
+ more menu, and only `aria-haspopup` / `aria-expanded` / `moreAnchor` marks a
250
+ row as More.
242
251
  - **The DOM launcher borrows the React app-action prompts.** The launcher is
243
252
  plain DOM and cannot render React, so the Plugins overlay publishes
244
253
  `openRestart` and `openClose` in module-level bridges while it is mounted; the
package/client.js CHANGED
@@ -833,7 +833,9 @@
833
833
  if (typeof candidate.children !== 'object' || candidate.children === null) return false;
834
834
  for (const child of [...candidate.children]) {
835
835
  if (child.tagName === 'BUTTON') return true;
836
- if (child.tagName === 'DIV' && typeof child.querySelector === 'function' && child.querySelector(':scope > button') !== null) return true;
836
+ /* 0.2.2+ wraps each row in a cell element (div.panelEntry /
837
+ span.moreAnchor) that holds the row button as its first child. */
838
+ if (typeof child.querySelector === 'function' && child.querySelector(':scope > button') !== null) return true;
837
839
  }
838
840
  return false;
839
841
  }
@@ -878,6 +880,15 @@
878
880
  sync();
879
881
  }
880
882
 
883
+ /** True when a row button is the host's "More" launcher (it opens a menu). */
884
+ function rowOpensMenu(buttonEl, wrapper) {
885
+ if (buttonEl === null || typeof buttonEl.getAttribute !== 'function') return false;
886
+ if (buttonEl.hasAttribute('aria-haspopup') || buttonEl.hasAttribute('aria-expanded')) return true;
887
+ if (wrapper !== undefined && wrapper !== null && typeof wrapper.className === 'string'
888
+ && wrapper.className.includes('moreAnchor')) return true;
889
+ return false;
890
+ }
891
+
881
892
  /** Resolve the host panel rows (and the "more" launcher) into tile records. */
882
893
  function collectHostTiles(container) {
883
894
  const byLabel = new Map();
@@ -902,19 +913,22 @@
902
913
  || child.hasAttribute('data-powerup-restart')
903
914
  || child.hasAttribute('data-powerup-close')) continue;
904
915
  if (typeof child.classList === 'object' && child.classList !== null && child.classList.contains('dsh-powerup-drop-line')) continue;
916
+ /* A host row is either the button itself (older sidebars) or a
917
+ wrapper that carries the row plus its unpin overlay (0.2.2+:
918
+ `div.panelEntry` per panel, `span.moreAnchor` for More). The
919
+ wrapper is the grid cell; its row button is the click target. */
905
920
  let gridEl = child;
906
921
  let buttonEl = null;
907
922
  if (child.tagName === 'BUTTON') buttonEl = child;
908
923
  else if (typeof child.querySelector === 'function') {
909
- /* The host's "more" launcher wraps its row in a Menu root <span>;
910
- other hosts may use a div. Either way the row is the direct
911
- button child of that wrapper. */
912
- buttonEl = child.querySelector(':scope > button');
924
+ buttonEl = child.querySelector(':scope > button[class*="panelRow"]');
925
+ if (buttonEl === null) buttonEl = child.querySelector(':scope > button:not([class*="panelUnpin"])');
926
+ if (buttonEl === null) buttonEl = child.querySelector(':scope > button');
913
927
  if (buttonEl === null) continue;
914
928
  } else continue;
915
929
  const label = buttonEl.getAttribute('aria-label') ?? '';
916
930
  if (label === '') continue;
917
- const isMore = child.tagName !== 'BUTTON';
931
+ const isMore = rowOpensMenu(buttonEl, child);
918
932
  let key = isMore ? LAUNCHER_MORE_KEY : (byLabel.get(label) ?? 'label:' + label);
919
933
  if (key !== LAUNCHER_MORE_KEY && usedKeys.has(key)) {
920
934
  let suffix = 2;
@@ -1215,6 +1229,8 @@
1215
1229
  tile.gridEl.style.display = hidden ? 'none' : '';
1216
1230
  const position = orderIndex.get(tile.key);
1217
1231
  tile.gridEl.style.order = position === undefined ? '' : String(position);
1232
+ if (tile.active) tile.gridEl.setAttribute('data-powerup-active', '');
1233
+ else tile.gridEl.removeAttribute('data-powerup-active');
1218
1234
  }
1219
1235
  const chat = ensureChatButton();
1220
1236
  syncSyntheticTile(chat, LAUNCHER_CHAT_KEY, t('launcher.backToConversation'), undefined, wide, memberOf, orderIndex);
@@ -1759,7 +1775,27 @@
1759
1775
  function describeTile(target) {
1760
1776
  if (target === null || target === undefined || typeof target.closest !== 'function') return null;
1761
1777
  const button = target.closest('button');
1762
- if (button === null || nav === null || !nav.contains(button)) return null;
1778
+ if (button !== null && nav !== null && nav.contains(button)) {
1779
+ const described = describeButton(button);
1780
+ if (described !== null) return described;
1781
+ }
1782
+ /* A press on the cell padding (or the unpin overlay) still belongs to
1783
+ the tile that owns the cell. */
1784
+ const cell = target.closest('[data-powerup-grid]');
1785
+ if (cell === null || nav === null || !nav.contains(cell)) return null;
1786
+ const key = cell.getAttribute('data-powerup-grid');
1787
+ const folderId = cell.getAttribute('data-powerup-folder');
1788
+ if (folderId !== null) {
1789
+ const group = state.groups[folderId];
1790
+ if (group === undefined) return null;
1791
+ return { kind: 'folder', key: launcherGroupEntry(folderId), gridEl: cell, label: group.name };
1792
+ }
1793
+ const tile = hostTiles.find((candidate) => candidate.key === key);
1794
+ if (tile === undefined) return null;
1795
+ return { kind: tile.isMore ? 'more' : 'panel', key: tile.key, gridEl: tile.gridEl, label: tile.label };
1796
+ }
1797
+
1798
+ function describeButton(button) {
1763
1799
  if (button.hasAttribute('data-powerup-chat')) {
1764
1800
  return { kind: 'chat', key: LAUNCHER_CHAT_KEY, gridEl: button, label: t('launcher.backToConversation') };
1765
1801
  }
@@ -2114,6 +2150,9 @@
2114
2150
  state = normalizeLauncherState(next, hostTiles.filter((tile) => !tile.isMore).map((tile) => tile.key));
2115
2151
  },
2116
2152
  getNav: () => nav,
2153
+ collectHostTiles,
2154
+ detectWide,
2155
+ rowOpensMenu,
2117
2156
  },
2118
2157
  };
2119
2158
  }
@@ -2508,15 +2547,20 @@
2508
2547
  */
2509
2548
  const LAUNCHER_CSS = `
2510
2549
  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}
2511
- 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}
2512
- 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)}
2513
- 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)}
2514
- 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)}
2515
- nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-more]{display:flex!important;flex-direction:column;min-width:0;margin:0}
2550
+ /* One grid cell per tile. A host row arrives either as a bare button or as a
2551
+ wrapper that also holds the unpin overlay (0.2.2+: div.panelEntry, and
2552
+ span.moreAnchor for More), so the cell box and the tile face are styled
2553
+ separately: the wrapper is the cell, its row button is the face. */
2554
+ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid],.dsh-powerup-folder,.dsh-powerup-synth{position:relative;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:0;border:0;border-inline: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}
2555
+ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]>button:not([class*="panelUnpin"]),nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button[data-powerup-grid],.dsh-powerup-folder,.dsh-powerup-synth{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;flex:1 1 auto;width:100%;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:inherit;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}
2556
+ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover,.dsh-powerup-folder:hover,.dsh-powerup-synth:hover{background:var(--dsw-alias-interactive-bg-hover)}
2557
+ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:active,.dsh-powerup-folder:active,.dsh-powerup-synth:active{transform:scale(.96)}
2558
+ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid][data-powerup-active],nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid][class*="panelEntryActive"],nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:has(>button[aria-expanded=true]){background:var(--dsw-alias-interactive-bg-hover)}
2559
+ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide [class*="panelUnpin"]{display:none!important}
2516
2560
  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}
2517
2561
  nav.dsh-powerup-launcher.dsh-powerup-launcher-wide [class*="panelGlyph"] svg{width:20px;height:20px}
2518
2562
  nav.dsh-powerup-launcher.dsh-powerup-launcher-wide [class*="panelTitle"]{display:block;width:100%;max-width:100%;color:var(--dsw-alias-label-secondary);font-size:11px;line-height:14px;font-weight:400;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
2519
- nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover [class*="panelTitle"]{color:var(--dsw-alias-label-primary)}
2563
+ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [class*="panelTitle"]{color:var(--dsw-alias-label-primary)}
2520
2564
  .dsh-powerup-folder{position:relative;list-style:none;flex:none}
2521
2565
  .dsh-powerup-folder-stack{display:grid;grid-template-columns:repeat(2,1fr);grid-template-rows:repeat(2,1fr);gap:1px;width:24px;height:24px;padding:2px;box-sizing:border-box;border-radius:6px;background:color-mix(in srgb,var(--dsw-alias-label-primary) 9%,transparent);flex:none}
2522
2566
  .dsh-powerup-folder-mini{display:inline-flex;align-items:center;justify-content:center;min-width:0;min-height:0;overflow:hidden;color:var(--dsw-alias-label-primary);opacity:.85}
@@ -2536,8 +2580,9 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover [class*="panelTi
2536
2580
  .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)}
2537
2581
  .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}
2538
2582
  .dsh-powerup-drag-ghost{position:fixed;z-index:1800;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;padding:6px 2px 5px;border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-layer-2);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-primary);font-size:11px;line-height:14px;pointer-events:none;opacity:.96;transform:scale(1.05);transition:opacity .1s ease}
2539
- .dsh-powerup-drag-ghost>button{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;width:100%;min-height:0;margin:0;padding:6px 2px 5px;border:0;background:transparent;color:inherit;font:inherit;font-size:11px;line-height:14px;text-align:center;cursor:pointer;user-select:none;-webkit-user-select:none}
2583
+ .dsh-powerup-drag-ghost>button:not([class*="panelUnpin"]){box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;width:100%;min-height:0;margin:0;padding:6px 2px 5px;border:0;background:transparent;color:inherit;font:inherit;font-size:11px;line-height:14px;text-align:center;cursor:pointer;user-select:none;-webkit-user-select:none}
2540
2584
  .dsh-powerup-drag-ghost [class*="panelGlyph"]{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;flex:none}
2585
+ .dsh-powerup-drag-ghost [class*="panelUnpin"]{display:none!important}
2541
2586
  .dsh-powerup-drag-ghost [class*="panelGlyph"] svg{width:20px;height:20px}
2542
2587
  .dsh-powerup-drag-ghost [class*="panelTitle"]{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}
2543
2588
  .dsh-powerup-folder-pop{position:fixed;z-index:1800;box-sizing:border-box;display:flex;flex-direction:column;gap:6px;width:max-content;min-width:196px;max-width:min(440px,calc(100vw - 24px));max-height:min(72vh,440px);padding:8px;border:.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-lg,10px);background:var(--dsw-alias-bg-layer-2);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-primary);font-size:12px;line-height:16px;opacity:0;transform:scale(.92);transition:opacity .13s ease,transform .17s cubic-bezier(.22,.9,.3,1.06)}
@@ -2570,7 +2615,7 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover [class*="panelTi
2570
2615
  .dsh-powerup-folder-item-ghost .dsh-powerup-folder-item-glyph svg{width:20px;height:20px}
2571
2616
  .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}
2572
2617
  .dsh-powerup-folder-item-ghost .dsh-powerup-folder-item-remove{display:none}
2573
- @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}}
2618
+ @media (prefers-reduced-motion:reduce){nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid],.dsh-powerup-folder,.dsh-powerup-synth,.dsh-powerup-folder-pop,.dsh-powerup-drag-ghost,.dsh-powerup-drop-line{transition:none}}
2574
2619
  `;
2575
2620
 
2576
2621
  const CSS = `
@@ -5950,6 +5995,7 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>button:hover [class*="panelTi
5950
5995
  LAUNCHER_RESTART_KEY,
5951
5996
  LAUNCHER_RESTART_ICON,
5952
5997
  LAUNCHER_CLOSE_KEY,
5998
+ LAUNCHER_MORE_KEY,
5953
5999
  LAUNCHER_CLOSE_ICON,
5954
6000
  normalizeLauncherState,
5955
6001
  dissolveGroupOrder,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restregular/dsh-powerup",
3
- "version": "0.8.9",
3
+ "version": "0.8.10",
4
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」「关闭 DSH」三个按钮,它们和「更多」一样可以拖进分组,重启/关闭沿用插件安装流程的确认对话框。",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",