@restregular/dsh-powerup 0.19.12 → 0.19.14

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 (2) hide show
  1. package/client.js +409 -44
  2. package/package.json +1 -2
package/client.js CHANGED
@@ -98,7 +98,7 @@
98
98
  const requirementCreateDraft = { workspaceId: null, title: '', text: '', scope: 'current' };
99
99
  /** Fallback bucket when the hero cannot resolve an owning workspace yet. */
100
100
  const UNSCOPED_WORKSPACE = '__unscoped__';
101
- const VERSION = '0.19.12';
101
+ const VERSION = '0.19.14';
102
102
  const MENU_GAP = 8;
103
103
  const MENU_WIDTH = 248;
104
104
  /** Reference scheme understood by the Host's `powerup_step_read` tool. */
@@ -116,10 +116,35 @@
116
116
  'page.subtitle': '给 DeepSeek Harness 加一点助推。',
117
117
  'page.featureTitle': '轨迹右键菜单',
118
118
  'page.featureDesc': '在轨迹页面右键任意记录,快速复制、引用、查看详情、复制步骤引用,或从该记录 Fork 出一个新会话。',
119
+ 'page.featureHow1': '打开任意会话,切到顶部的「轨迹」视图。',
120
+ 'page.featureHow2': '在记录行上右键;在空白处右键可执行会话级操作。',
121
+ 'page.featureHow3': '菜单支持 ↑ / ↓ 选择、Enter 执行、Esc 关闭。',
119
122
  'page.enabled': '已启用',
120
123
  'page.disabled': '已停用',
121
124
  'page.details': '详情',
125
+ 'page.more': '更多',
122
126
  'page.collapse': '收起',
127
+ 'page.sectionDesc': '具体描述',
128
+ 'page.sectionHow': '使用教程',
129
+ 'page.featureBrief': '右键轨迹记录,快速复制、引用、查看、Fork。',
130
+ 'page.launcherBrief': '把侧边栏面板按钮变成可拖拽排序的图标网格。',
131
+ 'page.sessionSwitchBrief': '点击会话标题,在运行中的会话间切换。',
132
+ 'page.locateBrief': '一键在工作区列表中定位当前会话。',
133
+ 'page.scrollToTopBrief': '在侧边栏加一个「回到顶部」按钮。',
134
+ 'page.renderingBrief': '按正则把回复中的指定片段替换成占位符。',
135
+ 'page.dualSendBrief': '在输入框加「等待/插话」两个发送按钮。',
136
+ 'page.quickRepliesBrief': '让 Agent 回复后提供可点的快捷选项。',
137
+ 'page.taskProgressBrief': '会话顶部一键生成结构化任务进度。',
138
+ 'page.directAskBrief': '输入区加轻量问答按钮,不启动 Agent。',
139
+ 'page.promptsBrief': '为每个工作区保存可复用的提示词。',
140
+ 'page.jobStopBrief': '停止后台任务时顺手填写停止原因。',
141
+ 'page.updateBrief': '为第三方插件提供安装入口。',
142
+ 'page.themeTitle': '系统亮暗模式切换',
143
+ 'page.themeBrief': '在侧边栏点一下图标,在亮色与暗色之间切换。',
144
+ 'page.themeDesc': '在左侧边栏的品牌行加入一个主题切换按钮:点击即在亮色和暗色之间切换,图标随当前配色显示(暗色显示太阳,亮色显示月亮)。主题偏好交给 DSH 自身的主题服务保存,与系统设置里的「外观」保持一致。',
145
+ 'page.themeHow': '启用本功能后,左侧边栏顶部品牌名旁会出现一个太阳/月亮图标,点击即可切换亮暗模式;关闭本功能后按钮消失,主题设置仍由 DSH 管理。',
146
+ 'theme.toLight': '切换到亮色模式',
147
+ 'theme.toDark': '切换到暗色模式',
123
148
  'page.actions': '可用操作',
124
149
  'page.howTitle': '怎么用',
125
150
  'page.how1': '打开任意会话,切到顶部的「轨迹」视图。',
@@ -527,10 +552,35 @@
527
552
  'page.subtitle': 'A little boost for DeepSeek Harness.',
528
553
  'page.featureTitle': 'Trajectory context menu',
529
554
  'page.featureDesc': 'Right-click any trajectory record to copy it, quote it, open its inspector, copy a step reference, or fork the session at that point.',
555
+ 'page.featureHow1': 'Open a session and switch to the Trajectory view.',
556
+ 'page.featureHow2': 'Right-click a record row; right-click empty space for session actions.',
557
+ 'page.featureHow3': 'Use ↑ / ↓ to move, Enter to run, Esc to close.',
530
558
  'page.enabled': 'Enabled',
531
559
  'page.disabled': 'Disabled',
532
560
  'page.details': 'Details',
561
+ 'page.more': 'More',
533
562
  'page.collapse': 'Hide',
563
+ 'page.sectionDesc': 'Description',
564
+ 'page.sectionHow': 'How to use',
565
+ 'page.featureBrief': 'Right-click a trajectory record to copy, quote, inspect, or fork it.',
566
+ 'page.launcherBrief': 'Turn sidebar panel buttons into a draggable, sortable icon grid.',
567
+ 'page.sessionSwitchBrief': 'Click the session title to switch between running sessions.',
568
+ 'page.locateBrief': 'Locate the current session in the workspace list.',
569
+ 'page.scrollToTopBrief': 'Add a back-to-top button to the sidebar.',
570
+ 'page.renderingBrief': 'Replace matching reply text with a placeholder via regex.',
571
+ 'page.dualSendBrief': 'Add wait/interrupt send buttons to the composer.',
572
+ 'page.quickRepliesBrief': 'Let the Agent offer tappable reply options.',
573
+ 'page.taskProgressBrief': 'Generate a structured progress panel from the header.',
574
+ 'page.directAskBrief': 'Add a quick, Agent-free Q&A button to the composer.',
575
+ 'page.promptsBrief': 'Save reusable prompts per workspace.',
576
+ 'page.jobStopBrief': 'Leave a reason when stopping a background job.',
577
+ 'page.updateBrief': 'Add an install entry to third-party plugins.',
578
+ 'page.themeTitle': 'Light/dark mode switch',
579
+ 'page.themeBrief': 'Toggle light and dark mode from a sidebar button.',
580
+ 'page.themeDesc': 'Adds a theme toggle button to the sidebar brand row: one click flips between light and dark, with the icon following the active palette (sun in dark mode, moon in light mode). The preference is persisted by DSH\'s own theme service, in sync with the Appearance setting.',
581
+ 'page.themeHow': 'Once enabled, a sun/moon icon appears next to the brand name at the top of the left sidebar; click it to switch palettes. Turning the feature off removes the button; theme preferences remain managed by DSH.',
582
+ 'theme.toLight': 'Switch to light mode',
583
+ 'theme.toDark': 'Switch to dark mode',
534
584
  'page.actions': 'What you can do',
535
585
  'page.howTitle': 'How to use it',
536
586
  'page.how1': 'Open a session and switch to the Trajectory view.',
@@ -969,6 +1019,7 @@
969
1019
  update: true,
970
1020
  locateSession: true,
971
1021
  scrollToTop: true,
1022
+ themeToggle: true,
972
1023
  contentRendering: true,
973
1024
  dualSend: false,
974
1025
  workspacePrompts: true,
@@ -996,6 +1047,7 @@
996
1047
  update: parsed.update !== false,
997
1048
  locateSession: parsed.locateSession !== false,
998
1049
  scrollToTop: parsed.scrollToTop !== false,
1050
+ themeToggle: parsed.themeToggle !== false,
999
1051
  contentRendering: parsed.contentRendering !== false,
1000
1052
  dualSend: parsed.dualSend === true,
1001
1053
  workspacePrompts: parsed.workspacePrompts !== false,
@@ -4207,16 +4259,32 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
4207
4259
  .dsh-powerup-card-body{margin-top:12px}
4208
4260
  .dsh-powerup-card-how{margin:0 0 0;padding:10px 12px;border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.55;overflow-wrap:anywhere}
4209
4261
  .dsh-powerup-card-detail{margin-top:12px;padding-top:4px}
4262
+ .dsh-powerup-card-foot{display:flex;align-items:center;gap:8px;margin-top:12px}
4210
4263
  .dsh-powerup-how-card .dsh-powerup-section-title{margin-bottom:10px}
4211
- .dsh-powerup-detail-btn{flex:none;padding:3px 9px;border:.5px solid var(--dsw-alias-border-l2);border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;line-height:18px;cursor:pointer;white-space:nowrap}
4212
- .dsh-powerup-detail-btn:hover{background:var(--dsw-alias-interactive-bg-hover,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-primary)}
4213
- .dsh-powerup-detail-btn.on{color:var(--dsw-alias-brand-primary);border-color:var(--dsw-alias-brand-primary)}
4214
- .dsh-powerup-detail-btn:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
4264
+ .dsh-powerup-fold-btn{flex:none;display:inline-flex;align-items:center;gap:5px;padding:3px 9px 3px 7px;border:.5px solid var(--dsw-alias-border-l2);border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;line-height:18px;cursor:pointer;white-space:nowrap}
4265
+ .dsh-powerup-fold-btn:hover{background:var(--dsw-alias-interactive-bg-hover,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-primary)}
4266
+ .dsh-powerup-fold-btn.on{color:var(--dsw-alias-brand-primary);border-color:var(--dsw-alias-brand-primary)}
4267
+ .dsh-powerup-fold-btn:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
4268
+ .dsh-powerup-fold-chevron{display:inline-block;width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:4.5px solid currentColor;transition:transform .14s ease}
4269
+ .dsh-powerup-fold-btn.on .dsh-powerup-fold-chevron{transform:rotate(180deg)}
4270
+ .dsh-powerup-detail-modal{box-sizing:border-box;display:flex;flex-direction:column;width:min(460px,100%);max-height:min(680px,calc(100dvh - 48px));border-radius:var(--dsw-radius-panel,14px);background:var(--dsw-alias-bg-layer-2);box-shadow:var(--dsw-elevation-prominent);color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px;overflow:hidden;animation:dsh-powerup-prompt-rise .18s cubic-bezier(.2,.8,.3,1)}
4271
+ .dsh-powerup-detail-modal.is-closing{animation:dsh-powerup-prompt-sink .14s ease-in forwards}
4272
+ .dsh-powerup-detail-modal-title{display:flex;align-items:center;gap:10px;font-size:16px;line-height:24px;font-weight:500;min-width:0}
4273
+ .dsh-powerup-detail-modal-icon{flex:none;display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:8px;background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary)}
4274
+ .dsh-powerup-detail-modal-desc{margin:0;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px;overflow-wrap:anywhere}
4215
4275
  .dsh-powerup-card-icon{flex:none;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:9px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary)}
4216
4276
  .dsh-powerup-card-copy{min-width:0;flex:1 1 auto}
4217
4277
  .dsh-powerup-card-copy h2{margin:0;font-size:14px;line-height:1.35;font-weight:650}
4218
4278
  .dsh-powerup-card-copy p{margin:4px 0 0;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:1.55}
4219
- .dsh-powerup-switch{flex:none;display:inline-flex;align-items:center;gap:7px;padding:3px 4px 3px 6px;border:0;border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;line-height:18px;cursor:pointer;white-space:nowrap}
4279
+ .dsh-powerup-card-brief-row{display:flex;align-items:center;gap:10px;min-width:0;flex-wrap:wrap}
4280
+ .dsh-powerup-card-brief-row p{flex:1 1 auto;min-width:0}
4281
+ .dsh-powerup-detail-link{flex:none;padding:0;border:0;background:transparent;color:var(--dsw-alias-brand-primary);font:inherit;font-size:12px;line-height:18px;cursor:pointer;white-space:nowrap;text-decoration:underline;text-underline-offset:2px}
4282
+ .dsh-powerup-detail-link:hover{color:var(--dsw-alias-brand-primary-hover,var(--dsw-alias-brand-primary));text-decoration-thickness:2px}
4283
+ .dsh-powerup-detail-link:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}
4284
+ .dsh-powerup-detail-section{margin-bottom:14px}
4285
+ .dsh-powerup-detail-section:last-child{margin-bottom:0}
4286
+ .dsh-powerup-detail-section-title{margin:0 0 6px;color:var(--dsw-alias-label-tertiary);font-size:11px;font-weight:600;letter-spacing:.04em;text-transform:uppercase}
4287
+ .dsh-powerup-switch{flex:none;display:inline-flex;align-items:center;justify-content:center;padding:3px 4px 3px 6px;border:0;border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:11px;line-height:18px;cursor:pointer;white-space:nowrap}
4220
4288
  .dsh-powerup-switch:hover{background:var(--dsw-alias-interactive-bg-hover,var(--dsw-alias-bg-layer-2))}
4221
4289
  .dsh-powerup-switch:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
4222
4290
  .dsh-powerup-switch-track{position:relative;display:inline-block;flex:none;width:32px;height:17px;border-radius:999px;background:var(--dsw-alias-border-l3);transition:background .14s ease}
@@ -4408,7 +4476,7 @@ nav.dsh-powerup-launcher.dsh-powerup-launcher-wide>[data-powerup-grid]:hover [cl
4408
4476
  .dsh-powerup-update-quick-note-title{display:flex;align-items:center;gap:6px;color:var(--dsw-alias-state-warn-label);font-size:12px;line-height:17px;font-weight:500}
4409
4477
  .dsh-powerup-update-quick-note .dsh-powerup-update-note{color:var(--dsw-alias-label-secondary)}
4410
4478
  .dsh-powerup-update-close:focus-visible,.dsh-powerup-update-toggle:focus-visible,.dsh-powerup-update-version:focus-visible,.dsh-powerup-update-select-trigger:focus-visible,.dsh-powerup-update-option:focus-visible,.dsh-powerup-update-primary:focus-visible,.dsh-powerup-update-ghost:focus-visible,.dsh-powerup-update-quick:focus-visible,.dsh-powerup-update-button:focus-visible,.dsh-powerup-restart-action:focus-visible,.dsh-powerup-update-default:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
4411
- @media (max-width:680px){.dsh-powerup-page{padding:20px 16px 42px}.dsh-powerup-actions{grid-template-columns:minmax(0,1fr)}.dsh-powerup-hero-art{width:54px;height:54px}.dsh-powerup-hero h1{font-size:19px}.dsh-powerup-card-head{flex-wrap:wrap}.dsh-powerup-detail-btn{margin-left:auto}.dsh-powerup-update-mask{padding:12px}.dsh-powerup-update-dialog{max-height:calc(100dvh - 24px)}.dsh-powerup-update-head{padding:18px 12px 10px 18px}.dsh-powerup-update-body{padding:0 18px 4px}.dsh-powerup-update-foot{padding:14px 18px 18px}}
4479
+ @media (max-width:680px){.dsh-powerup-page{padding:20px 16px 42px}.dsh-powerup-actions{grid-template-columns:minmax(0,1fr)}.dsh-powerup-hero-art{width:54px;height:54px}.dsh-powerup-hero h1{font-size:19px}.dsh-powerup-card-head{flex-wrap:wrap}.dsh-powerup-card-brief-row{gap:6px}.dsh-powerup-update-mask{padding:12px}.dsh-powerup-update-dialog{max-height:calc(100dvh - 24px)}.dsh-powerup-update-head{padding:18px 12px 10px 18px}.dsh-powerup-update-body{padding:0 18px 4px}.dsh-powerup-update-foot{padding:14px 18px 18px}}
4412
4480
  `;
4413
4481
 
4414
4482
  const SESSION_SWITCH_CSS = `
@@ -4454,6 +4522,17 @@ default; shown only while the sidebar workspace list is scrolled down. */
4454
4522
  html[data-platform="darwin"] .dsh-powerup-scrolltop{background:var(--dsw-specific-sidebar-glass-fill)}
4455
4523
  html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-specific-sidebar-glass-hover)}
4456
4524
  @media (prefers-reduced-motion:reduce){.dsh-powerup-scrolltop{transition:none}}
4525
+ `;
4526
+
4527
+ const THEME_TOGGLE_CSS = `
4528
+ /* Theme toggle injected into the sidebar brand row (logoRow). Sits after the
4529
+ logo/brand name, before the rail's collapse toggle. */
4530
+ [class*="logoRow"]{position:relative}
4531
+ .dsh-powerup-theme-toggle{flex:none;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;margin-left:auto;border:0;border-radius:var(--dsw-radius-sm,6px);background:transparent;color:var(--dsw-alias-label-secondary);cursor:pointer;transition:background .12s ease,color .12s ease}
4532
+ .dsh-powerup-theme-toggle:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
4533
+ .dsh-powerup-theme-toggle:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
4534
+ .dsh-powerup-theme-toggle svg{width:16px;height:16px}
4535
+ @media (prefers-reduced-motion:reduce){.dsh-powerup-theme-toggle{transition:none}}
4457
4536
  `;
4458
4537
 
4459
4538
  const RENDERING_CSS = `
@@ -5899,6 +5978,168 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
5899
5978
  return core;
5900
5979
  }
5901
5980
 
5981
+ /**
5982
+ * DOM controller for a theme toggle button in the sidebar brand row (the
5983
+ * logoRow that also holds the collapsed-rail toggle). It reads the theme
5984
+ * service through ctx and flips the preference between `light` and `dark`,
5985
+ * showing a sun glyph in dark mode (click to go light) and a moon glyph in
5986
+ * light mode (click to go dark). Falls back to `prefers-color-scheme` via
5987
+ * the active theme's colorScheme when the preference is `system`.
5988
+ * @param {{getTheme?: Function, setTheme?: Function, t?: Function, isEnabled?: Function}} deps
5989
+ */
5990
+ function createThemeToggleCore(deps) {
5991
+ const options = deps ?? {};
5992
+ const getTheme = typeof options.getTheme === 'function' ? options.getTheme : () => undefined;
5993
+ const setTheme = typeof options.setTheme === 'function' ? options.setTheme : () => {};
5994
+ const t = typeof options.t === 'function' ? options.t : (key) => key;
5995
+ const isEnabled = typeof options.isEnabled === 'function' ? options.isEnabled : () => true;
5996
+
5997
+ let button = null;
5998
+ let observer = null;
5999
+ let started = false;
6000
+ let renderedMode = null;
6001
+
6002
+ const SUN_ICON = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="3" stroke="currentColor" stroke-width="1.3"/><path d="M8 1.2v1.6M8 13.2v1.6M1.2 8h1.6M13.2 8h1.6M3.2 3.2l1.1 1.1M11.7 11.7l1.1 1.1M12.8 3.2l-1.1 1.1M4.3 11.7l-1.1 1.1" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/></svg>';
6003
+ const MOON_ICON = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true" focusable="false"><path d="M13.5 9.5A6 6 0 0 1 6.5 2.5a6 6 0 1 0 7 7Z" stroke="currentColor" stroke-width="1.3" stroke-linejoin="round"/></svg>';
6004
+
6005
+ function hasDocument() {
6006
+ return typeof document !== 'undefined' && document !== null
6007
+ && typeof document.querySelector === 'function' && document.body !== null;
6008
+ }
6009
+
6010
+ /** The sidebar brand row that holds the logo and the rail toggle. */
6011
+ function brandRow() {
6012
+ if (!hasDocument()) return null;
6013
+ return document.querySelector('[class*="logoRow"]');
6014
+ }
6015
+
6016
+ function isDark() {
6017
+ const snap = getTheme();
6018
+ const active = snap && typeof snap === 'object' ? snap.active : null;
6019
+ const scheme = active && typeof active === 'object' ? active.colorScheme : null;
6020
+ if (scheme === 'dark') return true;
6021
+ if (scheme === 'light') return false;
6022
+ try {
6023
+ if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {
6024
+ return window.matchMedia('(prefers-color-scheme: dark)').matches;
6025
+ }
6026
+ } catch { /* ignore */ }
6027
+ return false;
6028
+ }
6029
+
6030
+ function refresh() {
6031
+ if (button === null) return;
6032
+ const dark = isDark();
6033
+ const mode = dark ? 'dark' : 'light';
6034
+ const label = dark ? t('theme.toLight') : t('theme.toDark');
6035
+ // The button lives inside the subtree watched by our MutationObserver.
6036
+ // Rewriting innerHTML on every callback would trigger another mutation
6037
+ // and spin the renderer forever, so only write when state actually changed.
6038
+ if (renderedMode === mode && button.getAttribute('aria-label') === label) return;
6039
+ renderedMode = mode;
6040
+ button.innerHTML = dark ? SUN_ICON : MOON_ICON;
6041
+ button.setAttribute('aria-label', label);
6042
+ button.setAttribute('title', label);
6043
+ }
6044
+
6045
+ function ensureButton() {
6046
+ const host = brandRow();
6047
+ if (host === null || !isEnabled()) {
6048
+ if (button !== null) { button.remove(); button = null; renderedMode = null; }
6049
+ return;
6050
+ }
6051
+ if (button !== null && button.isConnected === true) { refresh(); return; }
6052
+ renderedMode = null;
6053
+ button = document.createElement('button');
6054
+ button.type = 'button';
6055
+ button.className = 'dsh-powerup-theme-toggle';
6056
+ button.setAttribute('data-powerup-theme-toggle', '');
6057
+ button.addEventListener('click', (event) => {
6058
+ event.preventDefault();
6059
+ event.stopPropagation();
6060
+ setTheme(isDark() ? 'light' : 'dark');
6061
+ refresh();
6062
+ });
6063
+ refresh();
6064
+ host.appendChild(button);
6065
+ }
6066
+
6067
+ function sync() {
6068
+ if (!started) return;
6069
+ if (!isEnabled()) {
6070
+ if (button !== null) { button.remove(); button = null; renderedMode = null; }
6071
+ return;
6072
+ }
6073
+ ensureButton();
6074
+ }
6075
+
6076
+ function start() {
6077
+ if (started || !hasDocument()) return;
6078
+ started = true;
6079
+ ensureButton();
6080
+ if (typeof MutationObserver === 'function') {
6081
+ observer = new MutationObserver(() => sync());
6082
+ observer.observe(document.body, { childList: true, subtree: true });
6083
+ }
6084
+ }
6085
+
6086
+ function stop() {
6087
+ started = false;
6088
+ if (observer !== null) observer.disconnect();
6089
+ observer = null;
6090
+ if (button !== null) button.remove();
6091
+ button = null;
6092
+ renderedMode = null;
6093
+ }
6094
+
6095
+ return { start, stop, sync, isDark };
6096
+ }
6097
+
6098
+ /**
6099
+ * Install the sidebar theme toggle button.
6100
+ * @param {object} ctx client plugin context
6101
+ */
6102
+ function installThemeToggle(ctx) {
6103
+ const install = (scope) => {
6104
+ const theme = (() => {
6105
+ try { return scope.get('theme'); } catch { return undefined; }
6106
+ })();
6107
+ if (theme === undefined || typeof theme.getTheme !== 'function') return null;
6108
+ const core = createThemeToggleCore({
6109
+ t: (key, params) => translateCurrent(key, params),
6110
+ isEnabled: () => getSettings().themeToggle !== false,
6111
+ getTheme: () => {
6112
+ try { return theme.getTheme(); } catch { return undefined; }
6113
+ },
6114
+ setTheme: (id) => {
6115
+ try { if (typeof theme.setTheme === 'function') theme.setTheme(id); } catch { /* ignore */ }
6116
+ },
6117
+ });
6118
+ scope.effect(() => {
6119
+ core.start();
6120
+ const off = typeof scope.on === 'function' ? scope.on('theme/change', () => core.sync()) : null;
6121
+ const offSettings = subscribeSettings(() => core.sync());
6122
+ return () => {
6123
+ if (typeof off === 'function') off();
6124
+ offSettings();
6125
+ core.stop();
6126
+ };
6127
+ }, 'dsh-powerup: theme toggle');
6128
+ return core;
6129
+ };
6130
+ // The theme service is provided by another UI plugin and may arrive
6131
+ // after ours on a cold start, so wait for it instead of sampling once.
6132
+ if (typeof ctx?.inject === 'function') {
6133
+ try {
6134
+ ctx.inject(['theme'], (scope) => { install(scope); });
6135
+ } catch (error) {
6136
+ console.warn('[dsh-powerup] theme toggle registration failed:', error?.message ?? error);
6137
+ }
6138
+ return null;
6139
+ }
6140
+ return install(ctx);
6141
+ }
6142
+
5902
6143
  /**
5903
6144
  * DOM-based masking for assistant reply prose. We observe the Chat view's
5904
6145
  * assistant reply rows and replace matching text fragments in place. The
@@ -6030,7 +6271,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
6030
6271
  try {
6031
6272
  const style = document.createElement('style');
6032
6273
  style.setAttribute('data-dsh-powerup', '');
6033
- style.textContent = CSS + '\n' + LAUNCHER_CSS + '\n' + SESSION_SWITCH_CSS + '\n' + LOCATE_CSS + '\n' + SCROLL_TOP_CSS + '\n' + RENDERING_CSS + '\n' + QUICK_REPLIES_CSS + '\n' + PROMPTS_CSS + '\n' + PROGRESS_CSS;
6274
+ style.textContent = CSS + '\n' + LAUNCHER_CSS + '\n' + SESSION_SWITCH_CSS + '\n' + LOCATE_CSS + '\n' + SCROLL_TOP_CSS + '\n' + THEME_TOGGLE_CSS + '\n' + RENDERING_CSS + '\n' + QUICK_REPLIES_CSS + '\n' + PROMPTS_CSS + '\n' + PROGRESS_CSS;
6034
6275
  document.head.appendChild(style);
6035
6276
  ctx.effect(() => () => style.remove(), 'dsh-powerup: styles');
6036
6277
  } catch (error) {
@@ -10816,11 +11057,93 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
10816
11057
  // ------------------------------------------------------------------
10817
11058
  // Sidebar page
10818
11059
  // ------------------------------------------------------------------
11060
+ /**
11061
+ * A feature card's full detail modal: icon + title + full description,
11062
+ * the "how to use" tutorial, and any sub-options (settings) the card carries.
11063
+ * Description and tutorial are shown as two titled sections.
11064
+ */
11065
+ function FeatureDetailModal({ card, t, onClose }) {
11066
+ const [closing, setClosing] = useState(false);
11067
+ const requestClose = () => {
11068
+ if (closing) return;
11069
+ setClosing(true);
11070
+ setTimeout(() => {
11071
+ try { onClose(); } catch { /* parent owns unmount */ }
11072
+ }, 140);
11073
+ };
11074
+ useEffect(() => {
11075
+ const onKey = (event) => {
11076
+ if (event.key === 'Escape') {
11077
+ event.preventDefault();
11078
+ requestClose();
11079
+ }
11080
+ };
11081
+ document.addEventListener('keydown', onKey, true);
11082
+ return () => document.removeEventListener('keydown', onKey, true);
11083
+ }, [closing]);
11084
+ const Icon = card.iconComp;
11085
+ const howParts = Array.isArray(card.howParts)
11086
+ ? card.howParts.filter((part) => typeof part === 'string' && part !== '')
11087
+ : [];
11088
+ const howText = card.howKey !== undefined ? t(card.howKey) : '';
11089
+ const steps = howParts.length > 0 ? howParts : (howText !== '' ? [howText] : []);
11090
+ return renderInBody(h('div', {
11091
+ className: 'dsh-powerup-prompt-modal-mask' + (closing ? ' is-closing' : ''),
11092
+ role: 'presentation',
11093
+ onPointerDown: (event) => {
11094
+ if (event.target === event.currentTarget) requestClose();
11095
+ },
11096
+ },
11097
+ h('div', {
11098
+ className: 'dsh-powerup-detail-modal' + (closing ? ' is-closing' : ''),
11099
+ role: 'dialog',
11100
+ 'aria-modal': 'true',
11101
+ 'aria-label': t(card.titleKey),
11102
+ },
11103
+ h('div', { className: 'dsh-powerup-prompt-modal-head' },
11104
+ h('div', { className: 'dsh-powerup-detail-modal-title' },
11105
+ h('span', { className: 'dsh-powerup-detail-modal-icon' }, h(Icon, { size: 18 })),
11106
+ h('span', null, t(card.titleKey)),
11107
+ ),
11108
+ h('button', {
11109
+ type: 'button',
11110
+ className: 'dsh-powerup-prompt-modal-close',
11111
+ 'aria-label': t('prompts.cancel'),
11112
+ onClick: requestClose,
11113
+ }, '\u00d7'),
11114
+ ),
11115
+ h('div', { className: 'dsh-powerup-prompt-modal-body' },
11116
+ card.descKey !== undefined
11117
+ ? h('section', { className: 'dsh-powerup-detail-section' },
11118
+ h('h3', { className: 'dsh-powerup-detail-section-title' }, t('page.sectionDesc')),
11119
+ h('p', { className: 'dsh-powerup-detail-modal-desc' }, t(card.descKey)),
11120
+ )
11121
+ : null,
11122
+ steps.length > 0
11123
+ ? h('section', { className: 'dsh-powerup-detail-section' },
11124
+ h('h3', { className: 'dsh-powerup-detail-section-title' }, t('page.sectionHow')),
11125
+ steps.length === 1
11126
+ ? h('p', { className: 'dsh-powerup-card-how' }, steps[0])
11127
+ : h('ol', { className: 'dsh-powerup-steps' },
11128
+ steps.map((step, index) => h('li', { key: index, className: 'dsh-powerup-step' },
11129
+ h('span', { className: 'dsh-powerup-step-num' }, String(index + 1)),
11130
+ h('span', null, step),
11131
+ )),
11132
+ ),
11133
+ )
11134
+ : null,
11135
+ card.detail ?? null,
11136
+ ),
11137
+ ),
11138
+ ));
11139
+ }
11140
+
10819
11141
  function PowerUpPage({ ctx }) {
10820
11142
  const settings = useSettings();
10821
11143
  const [, forceLocale] = useState(0);
10822
11144
  const [tab, setTab] = useState('features');
10823
11145
  const [expandedCards, setExpandedCards] = useState(() => new Set());
11146
+ const [detailCard, setDetailCard] = useState(null);
10824
11147
  useEffect(() => {
10825
11148
  const locale = ctx.get('locale');
10826
11149
  if (locale === undefined || typeof locale.subscribe !== 'function') return undefined;
@@ -10859,13 +11182,18 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
10859
11182
  h('span', { className: 'dsh-powerup-switch-track' },
10860
11183
  h('span', { className: 'dsh-powerup-switch-thumb' }),
10861
11184
  ),
10862
- h('span', null, checked ? t('page.enabled') : t('page.disabled')),
10863
11185
  );
10864
11186
  };
10865
11187
 
10866
- /** One uniform feature card: icon + title + description, a details button that folds the body, and an enable/disable switch. */
10867
- const featureCard = (key, iconComp, titleKey, descKey, howKey, detail) => {
10868
- const hasDetail = howKey !== undefined || detail !== undefined;
11188
+ /**
11189
+ * One uniform feature card: icon + title + a one-line brief with a
11190
+ * Details link and enable switch on its right (aligned with each other),
11191
+ * and a fold/unfold button on the card-foot row for sub-options.
11192
+ * opts: { descKey, howKey, howParts, detailAsDetails }
11193
+ */
11194
+ const featureCard = (key, iconComp, titleKey, briefKey, opts = {}) => {
11195
+ const { howKey, howParts, detail, descKey, detailAsDetails } = opts;
11196
+ const hasSub = detail !== undefined && detail !== null;
10869
11197
  const expanded = expandedCards.has(key);
10870
11198
  const toggleExpanded = () => {
10871
11199
  const next = new Set(expandedCards);
@@ -10873,6 +11201,8 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
10873
11201
  else next.add(key);
10874
11202
  setExpandedCards(next);
10875
11203
  };
11204
+ const hasDetail = descKey !== undefined || howKey !== undefined || Array.isArray(howParts);
11205
+ const openDetail = () => setDetailCard({ key, iconComp, titleKey, descKey, howKey, howParts, detail });
10876
11206
  return h('section', {
10877
11207
  key,
10878
11208
  className: 'dsh-powerup-card' + (settings[key] === false ? ' is-off' : ''),
@@ -10881,24 +11211,34 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
10881
11211
  h('div', { className: 'dsh-powerup-card-icon' }, h(iconComp, { size: 18 })),
10882
11212
  h('div', { className: 'dsh-powerup-card-copy' },
10883
11213
  h('h2', null, t(titleKey)),
10884
- h('p', null, t(descKey)),
11214
+ h('div', { className: 'dsh-powerup-card-brief-row' },
11215
+ h('p', null, t(briefKey)),
11216
+ hasDetail
11217
+ ? h('button', {
11218
+ type: 'button',
11219
+ className: 'dsh-powerup-detail-link',
11220
+ onClick: openDetail,
11221
+ }, t('page.details'))
11222
+ : null,
11223
+ toggle(key, t(titleKey)),
11224
+ ),
10885
11225
  ),
10886
- hasDetail
10887
- ? h('button', {
11226
+ ),
11227
+ hasSub && !detailAsDetails
11228
+ ? h('div', { className: 'dsh-powerup-card-foot' },
11229
+ h('button', {
10888
11230
  type: 'button',
10889
- className: 'dsh-powerup-detail-btn' + (expanded ? ' on' : ''),
11231
+ className: 'dsh-powerup-fold-btn' + (expanded ? ' on' : ''),
10890
11232
  'aria-expanded': expanded ? 'true' : 'false',
10891
11233
  onClick: toggleExpanded,
10892
- }, t(expanded ? 'page.collapse' : 'page.details'))
10893
- : null,
10894
- toggle(key, t(titleKey)),
10895
- ),
10896
- hasDetail && expanded
10897
- ? h('div', { className: 'dsh-powerup-card-body' },
10898
- howKey !== undefined ? h('p', { className: 'dsh-powerup-card-how' }, t(howKey)) : null,
10899
- detail ?? null,
11234
+ },
11235
+ h('span', { className: 'dsh-powerup-fold-chevron', 'aria-hidden': 'true' }),
11236
+ h('span', null, t(expanded ? 'page.collapse' : 'page.more'))),
10900
11237
  )
10901
11238
  : null,
11239
+ hasSub && !detailAsDetails && expanded
11240
+ ? h('div', { className: 'dsh-powerup-card-body' }, detail)
11241
+ : null,
10902
11242
  );
10903
11243
  };
10904
11244
 
@@ -10987,32 +11327,46 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
10987
11327
  );
10988
11328
 
10989
11329
  const featuresContent = h('div', null,
10990
- featureCard('contextMenu', PowerUpLineIcon, 'page.featureTitle', 'page.featureDesc', undefined, actionsDetail),
10991
- featureCard('launcher', LauncherIcon, 'page.launcherTitle', 'page.launcherDesc', undefined,
10992
- h('div', { className: 'dsh-powerup-card-detail' },
11330
+ featureCard('contextMenu', PowerUpLineIcon, 'page.featureTitle', 'page.featureBrief', {
11331
+ descKey: 'page.featureDesc',
11332
+ howParts: [t('page.featureHow1'), t('page.featureHow2'), t('page.featureHow3')],
11333
+ detail: actionsDetail,
11334
+ detailAsDetails: true,
11335
+ }),
11336
+ featureCard('themeToggle', QuickIcon, 'page.themeTitle', 'page.themeBrief', {
11337
+ descKey: 'page.themeDesc',
11338
+ howKey: 'page.themeHow',
11339
+ }),
11340
+ featureCard('launcher', LauncherIcon, 'page.launcherTitle', 'page.launcherBrief', {
11341
+ descKey: 'page.launcherDesc',
11342
+ detail: h('div', { className: 'dsh-powerup-card-detail' },
10993
11343
  settingRow('launcher', settings.launcher !== false, t('page.launcherToggle'), t('page.launcherToggleHint')),
10994
11344
  ),
10995
- ),
10996
- featureCard('sessionSwitch', QuickIcon, 'page.sessionSwitchTitle', 'page.sessionSwitchDesc', 'page.sessionSwitchHow'),
10997
- featureCard('locateSession', LocateIcon, 'page.locateTitle', 'page.locateDesc', 'page.locateHow'),
10998
- featureCard('scrollToTop', ScrollTopIcon, 'page.scrollToTopTitle', 'page.scrollToTopDesc', 'page.scrollToTopHow'),
10999
- featureCard('contentRendering', PowerUpLineIcon, 'page.renderingTitle', 'page.renderingDesc', 'page.renderingHow'),
11000
- featureCard('dualSend', LauncherIcon, 'page.dualSendTitle', 'page.dualSendDesc', 'page.dualSendHow'),
11001
- featureCard('quickReplies', TagIcon, 'page.quickRepliesTitle', 'page.quickRepliesDesc', 'page.quickRepliesHow'),
11002
- featureCard('taskProgress', ProgressIcon, 'page.taskProgressTitle', 'page.taskProgressDesc', 'page.taskProgressHow',
11003
- h('div', { className: 'dsh-powerup-card-detail' },
11345
+ }),
11346
+ featureCard('sessionSwitch', QuickIcon, 'page.sessionSwitchTitle', 'page.sessionSwitchBrief', { howKey: 'page.sessionSwitchHow', descKey: 'page.sessionSwitchDesc' }),
11347
+ featureCard('locateSession', LocateIcon, 'page.locateTitle', 'page.locateBrief', { howKey: 'page.locateHow', descKey: 'page.locateDesc' }),
11348
+ featureCard('scrollToTop', ScrollTopIcon, 'page.scrollToTopTitle', 'page.scrollToTopBrief', { howKey: 'page.scrollToTopHow', descKey: 'page.scrollToTopDesc' }),
11349
+ featureCard('contentRendering', PowerUpLineIcon, 'page.renderingTitle', 'page.renderingBrief', { howKey: 'page.renderingHow', descKey: 'page.renderingDesc' }),
11350
+ featureCard('dualSend', LauncherIcon, 'page.dualSendTitle', 'page.dualSendBrief', { howKey: 'page.dualSendHow', descKey: 'page.dualSendDesc' }),
11351
+ featureCard('quickReplies', TagIcon, 'page.quickRepliesTitle', 'page.quickRepliesBrief', { howKey: 'page.quickRepliesHow', descKey: 'page.quickRepliesDesc' }),
11352
+ featureCard('taskProgress', ProgressIcon, 'page.taskProgressTitle', 'page.taskProgressBrief', {
11353
+ howKey: 'page.taskProgressHow',
11354
+ descKey: 'page.taskProgressDesc',
11355
+ detail: h('div', { className: 'dsh-powerup-card-detail' },
11004
11356
  numberRow('taskProgressCooldown', settings.taskProgressCooldown, t('page.taskProgressCooldown'), t('page.taskProgressCooldownHint')),
11005
11357
  ),
11006
- ),
11007
- featureCard('directAsk', TagIcon, 'page.directAskTitle', 'page.directAskDesc', 'page.directAskHow',
11008
- h('div', { className: 'dsh-powerup-card-detail' },
11358
+ }),
11359
+ featureCard('directAsk', TagIcon, 'page.directAskTitle', 'page.directAskBrief', {
11360
+ howKey: 'page.directAskHow',
11361
+ descKey: 'page.directAskDesc',
11362
+ detail: h('div', { className: 'dsh-powerup-card-detail' },
11009
11363
  settingRow('directAsk', settings.directAsk !== false, t('page.directAskToggle'), t('page.directAskToggleHint')),
11010
11364
  settingRow('directAskAutoTitle', settings.directAskAutoTitle === true, t('page.directAskAutoTitle'), t('page.directAskAutoTitleHint')),
11011
11365
  ),
11012
- ),
11013
- featureCard('workspacePrompts', TagIcon, 'page.promptsTitle', 'page.promptsDesc', 'page.promptsHow'),
11014
- featureCard('jobStop', StopIcon, 'page.jobStopTitle', 'page.jobStopDesc', 'page.jobStopHow'),
11015
- featureCard('update', UpdateIcon, 'page.updateTitle', 'page.updateDesc', 'page.updateHow', oneClickDetail),
11366
+ }),
11367
+ featureCard('workspacePrompts', TagIcon, 'page.promptsTitle', 'page.promptsBrief', { howKey: 'page.promptsHow', descKey: 'page.promptsDesc' }),
11368
+ featureCard('jobStop', StopIcon, 'page.jobStopTitle', 'page.jobStopBrief', { howKey: 'page.jobStopHow', descKey: 'page.jobStopDesc' }),
11369
+ featureCard('update', UpdateIcon, 'page.updateTitle', 'page.updateBrief', { howKey: 'page.updateHow', descKey: 'page.updateDesc', detail: oneClickDetail }),
11016
11370
  );
11017
11371
 
11018
11372
  return h('div', { className: 'dsh-powerup-page' },
@@ -11038,6 +11392,13 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
11038
11392
  h('span', null, t('page.localOnly')),
11039
11393
  ),
11040
11394
  ),
11395
+ detailCard !== null
11396
+ ? h(FeatureDetailModal, {
11397
+ card: detailCard,
11398
+ t,
11399
+ onClose: () => setDetailCard(null),
11400
+ })
11401
+ : null,
11041
11402
  );
11042
11403
  }
11043
11404
 
@@ -12153,6 +12514,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
12153
12514
  installSessionSwitcher(ctx);
12154
12515
  installLocateSession(ctx);
12155
12516
  installScrollToTop(ctx);
12517
+ installThemeToggle(ctx);
12156
12518
  installReplyMask(ctx);
12157
12519
 
12158
12520
  const slots = ctx.get('slots');
@@ -12319,6 +12681,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
12319
12681
  SESSION_SWITCH_CSS,
12320
12682
  LOCATE_CSS,
12321
12683
  SCROLL_TOP_CSS,
12684
+ THEME_TOGGLE_CSS,
12322
12685
  RENDERING_CSS,
12323
12686
  PROMPTS_CSS,
12324
12687
  PROGRESS_CSS,
@@ -12364,6 +12727,8 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
12364
12727
  createSessionSwitcherCore,
12365
12728
  createLocateSessionCore,
12366
12729
  createScrollToTopCore,
12730
+ createThemeToggleCore,
12731
+ installThemeToggle,
12367
12732
  LocateIcon,
12368
12733
  ScrollTopIcon,
12369
12734
  LAUNCHER_CSS,
@@ -12384,6 +12749,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
12384
12749
  QuickIcon,
12385
12750
  PowerUpBridge,
12386
12751
  PowerUpPage,
12752
+ FeatureDetailModal,
12387
12753
  PowerUpOverlay,
12388
12754
  PluginUpdateOverlay,
12389
12755
  JobStopOverlay,
@@ -12444,4 +12810,3 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
12444
12810
  },
12445
12811
  });
12446
12812
  })();
12447
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restregular/dsh-powerup",
3
- "version": "0.19.12",
3
+ "version": "0.19.14",
4
4
  "description": "为 DeepSeek Harness 提供一组可选的小型增强:轨迹右键菜单与步骤引用、后台任务停止原因、插件一键安装、侧边栏图标网格、会话切换、定位当前会话、工作区提示词、旁路模型生成的结构化任务进度;所有功能均可在 Power-Up 页面独立开关。 · Opt-in upgrades for DeepSeek Harness: Trajectory context menu and step references, job stop reasons, one-click plugin install, an adaptive sidebar launcher, session switching, locating the current session, workspace prompts, and non-blocking model-generated structured task progress — each toggled independently on the Power-Up page.",
5
5
  "icon": "./icon.svg",
6
6
  "type": "module",
@@ -104,4 +104,3 @@
104
104
  "license": "MIT",
105
105
  "author": "RestRegular"
106
106
  }
107
-